[events] Structural and minor optical cleanup

This commit is contained in:
Ferdinand Thiessen 2021-03-28 03:26:11 +02:00
parent 6f053d849a
commit f712bfd4f9
4 changed files with 51 additions and 24 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<q-card-section class="fit row justify-start content-center items-center"> <q-card class="fit row justify-start content-center items-center">
<q-card-section class="fit row justify-start content-center items-center"> <q-card-section class="fit row justify-start content-center items-center">
<IsoDateInput <IsoDateInput
v-model="job.start" v-model="job.start"
@ -45,8 +45,10 @@
filled filled
/> />
</q-card-section> </q-card-section>
<q-btn label="Schicht löschen" color="negative" :disabled="jobCanDelete" @click="removeJob" /> <q-card-actions>
</q-card-section> <q-btn label="Schicht löschen" color="negative" :disabled="canDelete" @click="removeJob" />
</q-card-actions>
</q-card>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -63,7 +65,7 @@ export default defineComponent({
required: true, required: true,
type: Object as PropType<FG.Job>, type: Object as PropType<FG.Job>,
}, },
jobCanDelete: Boolean, canDelete: Boolean,
}, },
emits: { emits: {
'remove-job': () => true, 'remove-job': () => true,

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <q-page padding class="fit row justify-center content-start items-start q-gutter-sm">
<q-tabs v-if="$q.screen.gt.sm" v-model="tab"> <q-tabs v-if="$q.screen.gt.sm" v-model="tab">
<q-tab <q-tab
v-for="(tabindex, index) in tabs" v-for="(tabindex, index) in tabs"
@ -24,7 +24,6 @@
</q-item> </q-item>
</q-list> </q-list>
</q-drawer> </q-drawer>
<q-page padding class="fit row justify-center content-start items-start q-gutter-sm">
<q-tab-panels <q-tab-panels
v-model="tab" v-model="tab"
style="background-color: transparent" style="background-color: transparent"
@ -42,7 +41,6 @@
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
</q-page> </q-page>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">

View File

@ -0,0 +1,27 @@
import { date } from 'quasar';
/** An new event does not contain an id and the type might be unset */
export type EditableEvent = Omit<Omit<Omit<FG.Event, 'jobs'>, 'type'>, 'id'> & {
type?: FG.EventType | number;
id?: number;
jobs: EditableJob[];
};
/** A new job does not have an id or type assigned */
export type EditableJob = Omit<Omit<FG.Job, 'type'>, 'id'> & {
type?: FG.EventType | number;
id?: number;
};
export const emptyJob: EditableJob = {
start: new Date(),
end: date.addToDate(new Date(), { hours: 1 }),
services: [],
required_services: 2,
};
export const emptyEvent: EditableEvent = {
start: new Date(),
jobs: [Object.assign({}, emptyJob)],
is_template: false,
};