From 1316c477066406dea939a9a86946857c589b3cdb Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 19 Mar 2021 18:33:57 +0100 Subject: [PATCH] [schedule][quasar2] Fixed overview and eventslot --- .../schedule/components/overview/AgendaView.vue | 2 +- .../components/overview/slots/EventSlot.vue | 15 ++++----------- src/plugins/schedule/store.ts | 7 ++++++- src/utils/datetime.ts | 4 ++-- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/plugins/schedule/components/overview/AgendaView.vue b/src/plugins/schedule/components/overview/AgendaView.vue index 4dc8469..022ab2e 100644 --- a/src/plugins/schedule/components/overview/AgendaView.vue +++ b/src/plugins/schedule/components/overview/AgendaView.vue @@ -93,7 +93,7 @@ export default defineComponent({ if (list) list.forEach((event) => { let day = event.start.getDay(); - console.log('event', event, day, !agenda[day]); + if (!agenda[day]) { agenda[day] = []; } diff --git a/src/plugins/schedule/components/overview/slots/EventSlot.vue b/src/plugins/schedule/components/overview/slots/EventSlot.vue index c42c59c..82d2d51 100644 --- a/src/plugins/schedule/components/overview/slots/EventSlot.vue +++ b/src/plugins/schedule/components/overview/slots/EventSlot.vue @@ -16,7 +16,9 @@
-
{{ asHour(job.start) }} - {{ asHour(job.end) }}
+
+ {{ asHour(job.start) }} +
{{ job.type.name }}
@@ -68,7 +70,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { defineComponent, ref, onBeforeMount, PropType } from 'vue'; import { useRouter } from 'vue-router'; -import { date, Notify } from 'quasar'; +import { Notify } from 'quasar'; import { asHour } from 'src/utils/datetime'; import { useUserStore } from 'src/plugins/user/store'; import { useMainStore } from 'src/store'; @@ -77,13 +79,6 @@ import { useScheduleStore } from 'src/plugins/schedule/store'; export default defineComponent({ name: 'Eventslot', components: {}, - filters: { - formatToHour: function (value: Date) { - if (value) { - return date.formatDate(value, 'HH:mm'); - } - }, - }, props: { event: { required: true, @@ -113,7 +108,6 @@ export default defineComponent({ } function jobFull(job: FG.Job) { - console.log('jobFull', job.services.length >= job.required_services); return job.services.length >= job.required_services; } @@ -146,7 +140,6 @@ export default defineComponent({ userid: mainStore.currentUser.userid, value: -1, }; - try { await store.updateEvent(props.event.id, job.id, { user: newService }); } catch (error) { diff --git a/src/plugins/schedule/store.ts b/src/plugins/schedule/store.ts index f56bcd4..b6a4586 100644 --- a/src/plugins/schedule/store.ts +++ b/src/plugins/schedule/store.ts @@ -8,7 +8,12 @@ interface UserService { function fixEvent(event: FG.Event) { event.start = new Date(event.start); - event.end = new Date(event.end); + if (event.end) event.end = new Date(event.end); + + event.jobs.forEach((job) => { + job.start = new Date(job.start); + if (job.end) job.end = new Date(job.end); + }); } export const useScheduleStore = defineStore({ diff --git a/src/utils/datetime.ts b/src/utils/datetime.ts index 4af05cd..48e2599 100644 --- a/src/utils/datetime.ts +++ b/src/utils/datetime.ts @@ -17,6 +17,6 @@ export function formatDateTime( return dateTimeFormat.format(date); } -export function asHour(date: Date) { - return formatDateTime(date, false, true); +export function asHour(date?: Date) { + if (date) return formatDateTime(date, false, true); }