Compare commits
2 Commits
8f8eef1784
...
4d3654f08a
Author | SHA1 | Date |
---|---|---|
Ferdinand Thiessen | 4d3654f08a | |
Ferdinand Thiessen | 661685c57a |
|
@ -1,3 +1,4 @@
|
||||||
|
node_modules
|
||||||
node_modules/
|
node_modules/
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
# No need, this is done by user
|
# No need, this is done by user
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, PropType, ref, onBeforeMount } from 'vue';
|
import { computed, defineComponent, PropType, ref, onBeforeMount } from 'vue';
|
||||||
import { date, ModifyDateOptions } from 'quasar';
|
import { date, ModifyDateOptions } from 'quasar';
|
||||||
import { useScheduleStore } from '../../store';
|
import { useEventStore } from '../../store';
|
||||||
import { notEmpty } from '@flaschengeist/api';
|
import { notEmpty } from '@flaschengeist/api';
|
||||||
import { IsoDateInput } from '@flaschengeist/api/components';
|
import { IsoDateInput } from '@flaschengeist/api/components';
|
||||||
import EditJobSlot from './EditJobSlot.vue';
|
import EditJobSlot from './EditJobSlot.vue';
|
||||||
|
@ -127,7 +127,7 @@ export default defineComponent({
|
||||||
done: (val: boolean) => typeof val === 'boolean',
|
done: (val: boolean) => typeof val === 'boolean',
|
||||||
},
|
},
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const store = useScheduleStore();
|
const store = useEventStore();
|
||||||
const startDate = computed(() => {
|
const startDate = computed(() => {
|
||||||
const d = date.buildDate({milliseconds: 0, seconds: 0, minutes: 0, hours: 0})
|
const d = date.buildDate({milliseconds: 0, seconds: 0, minutes: 0, hours: 0})
|
||||||
if (!props.date || !date.isValid(props.date)) return d
|
if (!props.date || !date.isValid(props.date)) return d
|
||||||
|
@ -180,9 +180,15 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
async function save(template = false) {
|
async function save(template = false) {
|
||||||
|
if (!event.value.is_template && template) event.value.id = NaN;
|
||||||
|
|
||||||
event.value.is_template = template;
|
event.value.is_template = template;
|
||||||
try {
|
try {
|
||||||
|
if (!isNaN(event.value.id)) {
|
||||||
|
//fix
|
||||||
|
}
|
||||||
await store.addEvent(event.value);
|
await store.addEvent(event.value);
|
||||||
|
|
||||||
if (props.modelValue === undefined && recurrent.value && !event.value.is_template) {
|
if (props.modelValue === undefined && recurrent.value && !event.value.is_template) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const options: ModifyDateOptions = {};
|
const options: ModifyDateOptions = {};
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
import { defineComponent, computed, onBeforeMount, PropType } from 'vue';
|
import { defineComponent, computed, onBeforeMount, PropType } from 'vue';
|
||||||
import { IsoDateInput } from '@flaschengeist/api/components';
|
import { IsoDateInput } from '@flaschengeist/api/components';
|
||||||
import { notEmpty } from '@flaschengeist/api';
|
import { notEmpty } from '@flaschengeist/api';
|
||||||
import { useScheduleStore } from '../../store';
|
import { useEventStore } from '../../store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'JobSlot',
|
name: 'JobSlot',
|
||||||
|
@ -73,7 +73,7 @@ export default defineComponent({
|
||||||
'update:modelValue': (job: FG.Job) => !!job,
|
'update:modelValue': (job: FG.Job) => !!job,
|
||||||
},
|
},
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const store = useScheduleStore();
|
const store = useEventStore();
|
||||||
|
|
||||||
onBeforeMount(() => store.getJobTypes());
|
onBeforeMount(() => store.getJobTypes());
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { isAxiosError } from '@flaschengeist/api';
|
import { isAxiosError } from '@flaschengeist/api';
|
||||||
import { defineComponent, ref, computed, PropType, onBeforeMount } from 'vue';
|
import { defineComponent, ref, computed, PropType, onBeforeMount } from 'vue';
|
||||||
import { useScheduleStore } from '../../store';
|
import { useEventStore } from '../../store';
|
||||||
import { Notify, QInput } from 'quasar';
|
import { useQuasar, QInput } from 'quasar';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ManageTypes',
|
name: 'ManageTypes',
|
||||||
|
@ -61,7 +61,9 @@ export default defineComponent({
|
||||||
title: {type: String, required: true}
|
title: {type: String, required: true}
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const store = useScheduleStore();
|
const store = useEventStore();
|
||||||
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const dialogOpen = ref(false);
|
const dialogOpen = ref(false);
|
||||||
const emptyType = { id: -1, name: '' };
|
const emptyType = { id: -1, name: '' };
|
||||||
const actualType = ref(emptyType);
|
const actualType = ref(emptyType);
|
||||||
|
@ -105,12 +107,12 @@ export default defineComponent({
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
if (isAxiosError(e, 409))
|
if (isAxiosError(e, 409))
|
||||||
Notify.create({
|
quasar.notify({
|
||||||
type: 'negative',
|
type: 'negative',
|
||||||
message: 'Der Name wird bereits verwendet',
|
message: 'Der Name wird bereits verwendet',
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
Notify.create({
|
quasar.notify({
|
||||||
type: 'negative',
|
type: 'negative',
|
||||||
message: 'Unbekannter Fehler beim speichern.',
|
message: 'Unbekannter Fehler beim speichern.',
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<q-card>
|
<q-card>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="col" align="right" style="position: sticky; top: 0; z-index: 999">
|
<div class="col" align="right" style="position: sticky; top: 0; z-index: 999">
|
||||||
<q-btn round color="negative" icon="close" dense rounded @click="editDone(false)" />
|
<q-btn round color="negative" icon="mdi-close" dense rounded @click="editDone(false)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col" style="margin: 0; padding: 0; margin-top: -2.4em">
|
<div class="col" style="margin: 0; padding: 0; margin-top: -2.4em">
|
||||||
<edit-event v-model="editor" @done="editDone" />
|
<edit-event v-model="editor" @done="editDone" />
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ComponentPublicInstance, computed, defineComponent, onBeforeMount, ref } from 'vue';
|
import { ComponentPublicInstance, computed, defineComponent, onBeforeMount, ref } from 'vue';
|
||||||
import { useScheduleStore } from '../../store';
|
import { useEventStore } from '../../store';
|
||||||
import EventSlot from './slots/EventSlot.vue';
|
import EventSlot from './slots/EventSlot.vue';
|
||||||
import { date, useQuasar } from 'quasar';
|
import { date, useQuasar } from 'quasar';
|
||||||
import { startOfWeek } from '@flaschengeist/api';
|
import { startOfWeek } from '@flaschengeist/api';
|
||||||
|
@ -111,7 +111,7 @@ export default defineComponent({
|
||||||
components: { EventSlot, EditEvent, QCalendarAgenda: <ComponentPublicInstance>QCalendarAgenda },
|
components: { EventSlot, EditEvent, QCalendarAgenda: <ComponentPublicInstance>QCalendarAgenda },
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const store = useScheduleStore();
|
const store = useEventStore();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const selectedDate = ref(date.formatDate(new Date(), 'YYYY-MM-DD'));
|
const selectedDate = ref(date.formatDate(new Date(), 'YYYY-MM-DD'));
|
||||||
|
@ -158,7 +158,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadAgendas() {
|
async function loadAgendas() {
|
||||||
const selected = date.adjustDate(new Date(selectedDate.value), {milliseconds: 0, seconds: 0, minutes: 0, hours: 0});
|
const selected = date.adjustDate(selectedDate.value, {milliseconds: 0, seconds: 0, minutes: 0, hours: 0});
|
||||||
const start = calendarRealView.value === 'day' ? selected : startOfWeek(selected);
|
const start = calendarRealView.value === 'day' ? selected : startOfWeek(selected);
|
||||||
const end = date.addToDate(start, { days: calendarDays.value });
|
const end = date.addToDate(start, { days: calendarDays.value });
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
import { defineComponent, computed, PropType } from 'vue';
|
import { defineComponent, computed, PropType } from 'vue';
|
||||||
import { hasPermission } from '@flaschengeist/api';
|
import { hasPermission } from '@flaschengeist/api';
|
||||||
import { PERMISSIONS } from '../../../permissions';
|
import { PERMISSIONS } from '../../../permissions';
|
||||||
|
import { date } from 'quasar';
|
||||||
import JobSlot from './JobSlot.vue';
|
import JobSlot from './JobSlot.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -72,8 +73,10 @@ export default defineComponent({
|
||||||
const canEdit = computed(
|
const canEdit = computed(
|
||||||
() =>
|
() =>
|
||||||
hasPermission(PERMISSIONS.EDIT) &&
|
hasPermission(PERMISSIONS.EDIT) &&
|
||||||
(props.modelValue?.end || props.modelValue.start) > new Date()
|
(props.modelValue?.end || props.modelValue.start) >=
|
||||||
|
date.buildDate({ hours: 0, minutes: 0, seconds: 0, milliseconds: 0 })
|
||||||
);
|
);
|
||||||
|
|
||||||
const event = computed({
|
const event = computed({
|
||||||
get: () => props.modelValue,
|
get: () => props.modelValue,
|
||||||
set: (v) => emit('update:modelValue', v),
|
set: (v) => emit('update:modelValue', v),
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, onBeforeMount, computed, PropType } from 'vue';
|
import { defineComponent, onBeforeMount, computed, PropType } from 'vue';
|
||||||
import { Notify } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { asHour, useMainStore, useUserStore } from '@flaschengeist/api';
|
import { asHour, useMainStore, useUserStore } from '@flaschengeist/api';
|
||||||
import { useScheduleStore } from '../../../store';
|
import { useEventStore } from '../../../store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'JobSlot',
|
name: 'JobSlot',
|
||||||
|
@ -54,10 +54,10 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
emits: { 'update:modelValue': (v: FG.Job) => !!v },
|
emits: { 'update:modelValue': (v: FG.Job) => !!v },
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const store = useScheduleStore();
|
const store = useEventStore();
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const availableUsers = null;
|
const quasar = useQuasar();
|
||||||
|
|
||||||
onBeforeMount(async () => userStore.getUsers());
|
onBeforeMount(async () => userStore.getUsers());
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ export default defineComponent({
|
||||||
emit('update:modelValue', job);
|
emit('update:modelValue', job);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn(error);
|
console.warn(error);
|
||||||
Notify.create({
|
quasar.notify({
|
||||||
group: false,
|
group: false,
|
||||||
type: 'negative',
|
type: 'negative',
|
||||||
message: 'Fehler beim Eintragen als Dienst',
|
message: 'Fehler beim Eintragen als Dienst',
|
||||||
|
@ -113,7 +113,7 @@ export default defineComponent({
|
||||||
emit('update:modelValue', job);
|
emit('update:modelValue', job);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn(error);
|
console.warn(error);
|
||||||
Notify.create({
|
quasar.notify({
|
||||||
group: false,
|
group: false,
|
||||||
type: 'negative',
|
type: 'negative',
|
||||||
message: 'Fehler beim Austragen als Dienst',
|
message: 'Fehler beim Austragen als Dienst',
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onBeforeMount, defineComponent, ref } from 'vue';
|
import { onBeforeMount, defineComponent, ref } from 'vue';
|
||||||
import EditEvent from '../components/management/EditEvent.vue';
|
import EditEvent from '../components/management/EditEvent.vue';
|
||||||
import { useScheduleStore } from '../store';
|
import { useEventStore } from '../store';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { EditEvent },
|
components: { EditEvent },
|
||||||
setup() {
|
setup() {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = useScheduleStore();
|
const store = useEventStore();
|
||||||
const event = ref<FG.Event | undefined>(undefined);
|
const event = ref<FG.Event | undefined>(undefined);
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
if ('id' in route.params && typeof route.params.id === 'string')
|
if ('id' in route.params && typeof route.params.id === 'string')
|
||||||
|
|
14
src/store.ts
14
src/store.ts
|
@ -151,9 +151,17 @@ export const useScheduleStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
async addEvent(event: FG.Event) {
|
async addEvent(event: FG.Event) {
|
||||||
const { data } = await api.post<FG.Event>('/events', event);
|
if (isNaN(event.id)) {
|
||||||
if (data.is_template) this.templates.push(data);
|
const { data } = await api.post<FG.Event>('/events', event);
|
||||||
return data;
|
if (data.is_template) this.templates.push(data);
|
||||||
|
return data;
|
||||||
|
} else {
|
||||||
|
if (typeof event.type === 'object') event.type = event.type.id;
|
||||||
|
|
||||||
|
const { data } = await api.put<FG.Event>(`/events/${event.id}`, Object.assign(event, {jobs: undefined}));
|
||||||
|
if (data.is_template) this.templates.push(data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue