stash
This commit is contained in:
parent
da075d162f
commit
473b80d171
5 changed files with 53 additions and 4 deletions
|
@ -13,8 +13,8 @@ from core.settings import MAIL_DOMAIN
|
|||
from mail.models import Email
|
||||
from mail.protocol import send_smtp, make_reply, collect_references
|
||||
from notify_sessions.models import SystemEvent
|
||||
from tickets.models import IssueThread, Comment, STATE_CHOICES
|
||||
from tickets.serializers import IssueSerializer, CommentSerializer
|
||||
from tickets.models import IssueThread, Comment, STATE_CHOICES, ShippingCode
|
||||
from tickets.serializers import IssueSerializer, CommentSerializer, ShippingCodeSerializer
|
||||
|
||||
|
||||
class IssueViewSet(viewsets.ModelViewSet):
|
||||
|
@ -22,6 +22,11 @@ class IssueViewSet(viewsets.ModelViewSet):
|
|||
queryset = IssueThread.objects.all()
|
||||
|
||||
|
||||
class ShippingCodeViewSet(viewsets.ModelViewSet):
|
||||
serializer_class = ShippingCodeSerializer
|
||||
queryset = ShippingCode.objects.all()
|
||||
|
||||
|
||||
@api_view(['POST'])
|
||||
@permission_classes([IsAuthenticated])
|
||||
@permission_required('tickets.add_issuethread', raise_exception=True)
|
||||
|
@ -113,6 +118,7 @@ def add_comment(request, pk):
|
|||
|
||||
router = routers.SimpleRouter()
|
||||
router.register(r'tickets', IssueViewSet, basename='issues')
|
||||
router.register(r'shipping_codes', ShippingCodeViewSet, basename='shipping_codes')
|
||||
|
||||
urlpatterns = ([
|
||||
re_path(r'^tickets/(?P<pk>\d+)/reply/$', reply, name='reply'),
|
||||
|
|
|
@ -136,3 +136,14 @@ class ItemRelation(models.Model):
|
|||
|
||||
def __str__(self):
|
||||
return str(self.issue_thread) + ' related to ' + str(self.item)
|
||||
|
||||
|
||||
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)
|
||||
timestamp = models.DateTimeField(auto_now_add=True)
|
||||
used_at = models.DateTimeField(null=True)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.issue_thread) + ' shipping code ' + self.code
|
|
@ -2,7 +2,7 @@ from rest_framework import serializers
|
|||
|
||||
from authentication.models import ExtendedUser
|
||||
from mail.api_v2 import AttachmentSerializer
|
||||
from tickets.models import IssueThread, Comment, STATE_CHOICES
|
||||
from tickets.models import IssueThread, Comment, STATE_CHOICES, ShippingCode
|
||||
from inventory.serializers import ItemSerializer
|
||||
|
||||
|
||||
|
@ -29,6 +29,13 @@ class StateSerializer(serializers.Serializer):
|
|||
return obj['value']
|
||||
|
||||
|
||||
class ShippingCodeSerializer(serializers.Serializer):
|
||||
class Meta:
|
||||
model = ShippingCode
|
||||
fields = ('id', 'code', 'timestamp', 'issue_thread', 'used_at')
|
||||
read_only_fields = ('id', 'timestamp', 'used_at')
|
||||
|
||||
|
||||
class IssueSerializer(serializers.ModelSerializer):
|
||||
timeline = serializers.SerializerMethodField()
|
||||
last_activity = serializers.SerializerMethodField()
|
||||
|
|
|
@ -1,6 +1,31 @@
|
|||
<template>
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-xl-2">
|
||||
<!--div class="card bg-dark text-light mb-2" id="filters">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-info">Sort & Filter</h5>
|
||||
<div class="form-group" v-for="(column, index) in columns" :key="index">
|
||||
<label>{{ column }}</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<button
|
||||
:class="[ 'btn', column === sortBy ? 'btn-outline-info' : 'btn-outline-secondary' ]"
|
||||
type="button"
|
||||
@click="toggleSort(column)">
|
||||
<font-awesome-icon :icon="getSortIcon(column)"/>
|
||||
</button>
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="filter"
|
||||
:value="filters[column]"
|
||||
@input="changeFilter(column, $event.target.value)"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div-->
|
||||
</div>
|
||||
<div class="col-lg-9 col-xl-8">
|
||||
<div class="w-100"
|
||||
|
|
|
@ -21,7 +21,7 @@ const store = createStore({
|
|||
state_options: [],
|
||||
messageTemplates: [],
|
||||
messageTemplateVariables: [],
|
||||
shippingCodes: null,
|
||||
shippingCodes: [],
|
||||
|
||||
lastEvent: '37C3',
|
||||
lastUsed: {},
|
||||
|
|
Loading…
Reference in a new issue