This commit is contained in:
j3d1 2024-06-23 02:31:21 +02:00
parent fb01b49bed
commit 5a4f588942
7 changed files with 68 additions and 5 deletions

View file

@ -22,6 +22,11 @@ class IssueViewSet(viewsets.ModelViewSet):
queryset = IssueThread.objects.all() queryset = IssueThread.objects.all()
class CommentViewSet(viewsets.ModelViewSet):
serializer_class = CommentSerializer
queryset = Comment.objects.all()
class ShippingVoucherViewSet(viewsets.ModelViewSet): class ShippingVoucherViewSet(viewsets.ModelViewSet):
serializer_class = ShippingVoucherSerializer serializer_class = ShippingVoucherSerializer
queryset = ShippingVoucher.objects.all() queryset = ShippingVoucher.objects.all()
@ -118,6 +123,7 @@ def add_comment(request, pk):
router = routers.SimpleRouter() router = routers.SimpleRouter()
router.register(r'tickets', IssueViewSet, basename='issues') router.register(r'tickets', IssueViewSet, basename='issues')
#router.register(r'comments', CommentViewSet, basename='comments')
router.register(r'shipping_vouchers', ShippingVoucherViewSet, basename='shipping_vouchers') router.register(r'shipping_vouchers', ShippingVoucherViewSet, basename='shipping_vouchers')
urlpatterns = ([ urlpatterns = ([

View file

@ -1,5 +1,5 @@
from django.db import models
from django.utils import timezone from django.utils import timezone
from django.db import models
from django_softdelete.models import SoftDeleteModel from django_softdelete.models import SoftDeleteModel
from authentication.models import ExtendedUser from authentication.models import ExtendedUser

View file

@ -83,6 +83,13 @@ export default {
} else { } else {
this.collapsed = this.sections.map(() => true); this.collapsed = this.sections.map(() => true);
} }
//this.$router.push({...this.$router.currentRoute, query: {...this.$router.currentRoute.query, layout}});
//this.collapsed = this.sections.map(() => true);
/*this.columns.map(e => ({
k: e,
v: this.$store.getters.getFilters[e]
})).filter(e => e.v).forEach(e => this.setFilter(e.k, e.v));*/
}, },
computed: { computed: {
grouped_items() { grouped_items() {

View file

@ -0,0 +1,48 @@
<template>
<div class="toast" :class="color && ('border-' + color)" role="alert" ref="toast" data-autohide="false">
<div class="toast-header" :class="[color && ('bg-' + color), color && 'text-light']">
<strong class="mr-auto pr-3">{{ title }}</strong>
<small>{{ displayTime }}</small>
<button type="button" class="ml-2 mb-1 close" @click="close()">
<span aria-hidden="true">&times;</span>
</button>
</div>
<!--div class="toast-body" v-html="message">{{ message }}</div-->
</div>
</template>
<script>
import $ from 'jquery';
import 'bootstrap/js/dist/toast';
import {DateTime} from 'luxon';
export default {
name: 'Toast',
props: ['title', 'message', 'color'],
data: () => ({
creationTime: DateTime.local(),
displayTime: 'just now',
timer: undefined
}),
mounted() {
const {toast} = this.$refs;
$(toast).toast('show');
this.timer = setInterval(this.updateDisplayTime, 1000);
},
methods: {
close() {
const {toast} = this.$refs;
$(toast).toast('hide');
window.setTimeout(() => {
this.$emit('close');
}, 500);
},
updateDisplayTime() {
this.displayTime = this.creationTime.toRelative();
}
},
beforeDestroy() {
clearInterval(this.timer);
}
};
</script>

View file

@ -4,6 +4,7 @@ import store from '@/store';
import Items from './views/Items'; import Items from './views/Items';
import Boxes from './views/Boxes'; import Boxes from './views/Boxes';
import Files from './views/Files'; import Files from './views/Files';
import Error from './views/Error';
import HowTo from './views/HowTo'; import HowTo from './views/HowTo';
import Login from '@/views/Login.vue'; import Login from '@/views/Login.vue';
import Register from '@/views/Register.vue'; import Register from '@/views/Register.vue';

View file

@ -88,7 +88,6 @@ export default (config) => {
} }
/** may only be called from worker */ /** may only be called from worker */
const worker_fun = function (self, ctx) { const worker_fun = function (self, ctx) {
/* globals WebSocket, SharedWorker, onconnect, onmessage, postMessage, close, location */ /* globals WebSocket, SharedWorker, onconnect, onmessage, postMessage, close, location */

View file

@ -51,6 +51,7 @@ const store = createStore({
afterInitHandlers: [], afterInitHandlers: [],
showAddBoxModal: false, showAddBoxModal: false,
test: ['foo', 'bar', 'baz'],
shippingVoucherTypes: { shippingVoucherTypes: {
'2kg-de': '2kg Paket (DE)', '2kg-de': '2kg Paket (DE)',
@ -59,8 +60,7 @@ const store = createStore({
'2kg-eu': '2kg Paket (EU)', '2kg-eu': '2kg Paket (EU)',
'5kg-eu': '5kg Paket (EU)', '5kg-eu': '5kg Paket (EU)',
'10kg-eu': '10kg Paket (EU)', '10kg-eu': '10kg Paket (EU)',
}, }
test: ['foo', 'bar', 'baz'],
}, },
getters: { getters: {
route: state => router.currentRoute.value, route: state => router.currentRoute.value,
@ -215,6 +215,9 @@ const store = createStore({
user.permissions = null; user.permissions = null;
state.user = user; state.user = user;
}, },
setTest(state, test) {
state.test = test;
},
setThumbnail(state, {url, data}) { setThumbnail(state, {url, data}) {
state.thumbnailCache[url] = data; state.thumbnailCache[url] = data;
}, },
@ -477,7 +480,6 @@ const store = createStore({
dispatch('fetchMessageTemplates'); dispatch('fetchMessageTemplates');
} }
}, },
async fetchShippingVouchers({commit, state}) { async fetchShippingVouchers({commit, state}) {
if (!state.user.token) return; if (!state.user.token) return;
if (state.fetchedData.shippingVouchers > Date.now() - 1000 * 60 * 60 * 24) return; if (state.fetchedData.shippingVouchers > Date.now() - 1000 * 60 * 60 * 24) return;