diff --git a/src/flaschengeist.d.ts b/src/flaschengeist.d.ts index afd25e1..28f38ba 100644 --- a/src/flaschengeist.d.ts +++ b/src/flaschengeist.d.ts @@ -28,11 +28,11 @@ declare namespace FG { id: number; time: Date; amount: number; - reversal_id: number; - sender_id?: string; - receiver_id?: string; + reversal_id?: number; author_id?: string; + sender_id?: string; original_id?: number; + receiver_id?: string; } interface Drink { id: number; @@ -91,7 +91,7 @@ declare namespace FG { start: Date; end?: Date; description?: string; - type: EventType; + type: EventType | number; jobs: Array; } interface EventType { @@ -102,8 +102,8 @@ declare namespace FG { id: number; start: Date; end?: Date; - comment: string; - type: JobType; + type: JobType | number; + comment?: string; services: Array; required_services: number; } diff --git a/src/plugins/schedule/components/management/CreateEvent.vue b/src/plugins/schedule/components/management/CreateEvent.vue index 99ac748..7c5aca2 100644 --- a/src/plugins/schedule/components/management/CreateEvent.vue +++ b/src/plugins/schedule/components/management/CreateEvent.vue @@ -43,13 +43,8 @@ @@ -78,59 +73,31 @@ export default defineComponent({ const eventtypes = computed(() => store.eventTypes); const jobDeleteDisabled = computed(() => event.value.jobs.length < 2); - const newJob = ref(({ + const newJob = ref({ id: NaN, - start: undefined, - end: undefined, - comment: '', + start: new Date(), + end: date.addToDate(new Date(), { hours: 1 }), services: [], required_services: 2, - } as unknown) as FG.Job); + type: store.jobTypes[0], + }); const event = ref({ id: NaN, start: new Date(), - description: '', jobs: [Object.assign({}, newJob.value)], - } as FG.Event); + type: store.eventTypes[0], + }); onBeforeMount(() => { void store.getEventTypes(); void store.getJobTypes(); }); - function setStart(data: { job: FG.Job; value: Date }) { - data.job.start = data.value; - } - - function setEnd(data: { job: FG.Job; value: Date }) { - data.job.end = data.value; - } - - function setComment(data: { job: FG.Job; value: string }) { - data.job.comment = data.value; - } - - function setJobType(job: FG.Job, value: FG.JobType) { - job.type = value; - } - - function setRequired(data: { job: FG.Job; value: number }) { - data.job.required_services = data.value; - } - function addJob() { - const addJob = Object.assign({}, newJob.value); - event.value.jobs.unshift(addJob); + event.value.jobs.push(Object.assign({}, newJob.value)); } - //function removeJob(id: number) { - // let jobtoremove = event.value.jobs.findIndex(job => job.id == id); - // if (jobtoremove != undefined) { - // event.value.jobs.splice(jobtoremove, 1); - // } - //} - function removeJob(index: number) { event.value.jobs.splice(index, 1); } @@ -174,11 +141,6 @@ export default defineComponent({ reset, event, isAfterDate, - setStart, - setEnd, - setComment, - setJobType, - setRequired, }; }, }); diff --git a/src/plugins/schedule/components/management/Job.vue b/src/plugins/schedule/components/management/Job.vue index 462d5d0..89a1a10 100644 --- a/src/plugins/schedule/components/management/Job.vue +++ b/src/plugins/schedule/components/management/Job.vue @@ -2,59 +2,52 @@ @@ -63,7 +56,7 @@