This commit is contained in:
j3d1 2024-06-15 19:38:20 +02:00
parent 9c3fedc5c3
commit 13430c0f04
4 changed files with 11 additions and 4 deletions

View file

@ -1,4 +1,4 @@
# Generated by Django 4.2.7 on 2024-06-15 15:59
# Generated by Django 4.2.7 on 2024-06-15 17:37
from django.db import migrations, models
import django.db.models.deletion
@ -16,6 +16,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('code', models.CharField(max_length=255)),
('type', models.CharField(max_length=255)),
('timestamp', models.DateTimeField(auto_now_add=True)),
('used_at', models.DateTimeField(null=True)),
('issue_thread', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='shipping_codes', to='tickets.issuethread')),

View file

@ -142,6 +142,7 @@ class ShippingCode(models.Model):
id = models.AutoField(primary_key=True)
issue_thread = models.ForeignKey(IssueThread, on_delete=models.CASCADE, related_name='shipping_codes', null=True)
code = models.CharField(max_length=255)
type = models.CharField(max_length=255)
timestamp = models.DateTimeField(auto_now_add=True)
used_at = models.DateTimeField(null=True)

View file

@ -462,7 +462,7 @@ const store = createStore({
}
},
async createShippingCode({commit, state}, code) {
const {data, success} = await http.post('/2/shipping_codes/', {code}, state.user.token);
const {data, success} = await http.post('/2/shipping_codes/', code, state.user.token);
if (data && success) {
commit('setShippingCodes', data);
}

View file

@ -1,7 +1,12 @@
<template>
<div>
<h3>Shipping Codes</h3>
<Table
<ul>
<li v-for="code in shippingCodes" :key="code.code">
{{ code.type }} - {{ code.code }}
</li>
</ul>
<!--Table
:columns="['type', 'code']"
:items="shippingCodes"
:keyName="'code'"
@ -18,7 +23,7 @@
</button>
</div>
</template>
</Table>
</Table-->
<div class="mt-3">
<textarea class="form-control mb-3" rows="5" placeholder="Shipping Code List" v-model="bulk_codes" v-if="bulk"></textarea>
<div class="input-group">