From af79a30497c151d84aee6a6cfb14c26c524b7e49 Mon Sep 17 00:00:00 2001 From: Dominik Date: Sun, 7 Feb 2021 20:16:21 +0100 Subject: [PATCH] Minor Styling Changes to Eventslots and enrollment functionality --- src/flaschengeist.d.ts | 2 +- .../components/overview/AgendaView.vue | 28 +++- .../components/overview/slots/EventSlot.vue | 130 +++++++++++++++--- src/plugins/schedule/pages/Management.vue | 2 +- src/plugins/schedule/pages/Overview.vue | 2 +- src/plugins/schedule/store/schedule.ts | 25 +++- 6 files changed, 161 insertions(+), 28 deletions(-) diff --git a/src/flaschengeist.d.ts b/src/flaschengeist.d.ts index 4ac035a..dc3bc42 100644 --- a/src/flaschengeist.d.ts +++ b/src/flaschengeist.d.ts @@ -15,7 +15,7 @@ declare namespace FG { mail: string; birthday?: Date; roles: Array; - permissions?: list; + permissions?: Array; avatar_url?: string; } type Permission = string; diff --git a/src/plugins/schedule/components/overview/AgendaView.vue b/src/plugins/schedule/components/overview/AgendaView.vue index 9fb81e5..f883c48 100644 --- a/src/plugins/schedule/components/overview/AgendaView.vue +++ b/src/plugins/schedule/components/overview/AgendaView.vue @@ -31,10 +31,23 @@ + + + >root.$store; - const state = store.state.schedule; + const state = computed(() => store.state.schedule); const selectedDate = ref(date.formatDate(new Date(), 'YYYY-MM-DD')); const proxyDate = ref(''); + const calendarView = 'week-agenda'; const events2 = computed(() => { - console.log(state.events); let agenda: Agendas = {}; - state.events + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + console.log('Hier Passiert was'); + state.value.events .filter(event => { const thisWeek = date.formatDate(new Date(selectedDate.value), 'w'); console.log(thisWeek, date.formatDate(event.start, 'w')); @@ -124,7 +140,6 @@ export default defineComponent({ onBeforeMount(() => { void store.dispatch('schedule/getEvents'); - // void store.dispatch('schedule/getJobTypes'); }); function getAgenda(this: any, day: { weekday: string }) { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access @@ -156,7 +171,8 @@ export default defineComponent({ calendarPrev, updateProxy, saveNewSelectedDate, - proxyDate + proxyDate, + calendarView }; } }); diff --git a/src/plugins/schedule/components/overview/slots/EventSlot.vue b/src/plugins/schedule/components/overview/slots/EventSlot.vue index 6750049..52c4e55 100644 --- a/src/plugins/schedule/components/overview/slots/EventSlot.vue +++ b/src/plugins/schedule/components/overview/slots/EventSlot.vue @@ -1,49 +1,76 @@ - + diff --git a/src/plugins/schedule/pages/Management.vue b/src/plugins/schedule/pages/Management.vue index 05b65d1..05f0c4f 100644 --- a/src/plugins/schedule/pages/Management.vue +++ b/src/plugins/schedule/pages/Management.vue @@ -70,7 +70,7 @@ export default defineComponent({ } const tabs: Tab[] = [ - { name: 'create', label: 'Veranstantungen' }, + { name: 'create', label: 'Veranstaltungen' }, { name: 'eventtypes', label: 'Veranstaltungsarten' }, { name: 'jobtypes', label: 'Dienstarten' } ]; diff --git a/src/plugins/schedule/pages/Overview.vue b/src/plugins/schedule/pages/Overview.vue index 8dd8ad1..6dc86cc 100644 --- a/src/plugins/schedule/pages/Overview.vue +++ b/src/plugins/schedule/pages/Overview.vue @@ -71,7 +71,7 @@ export default defineComponent({ } const tabs: Tab[] = [ - { name: 'agendaView', label: 'Wochenkalendar' } + { name: 'agendaView', label: 'Kalendar' } // { name: 'eventtypes', label: 'Veranstaltungsarten' }, // { name: 'jobtypes', label: 'Dienstarten' } ]; diff --git a/src/plugins/schedule/store/schedule.ts b/src/plugins/schedule/store/schedule.ts index 47f1d4f..db47c1d 100644 --- a/src/plugins/schedule/store/schedule.ts +++ b/src/plugins/schedule/store/schedule.ts @@ -81,6 +81,10 @@ const mutations: MutationTree = { }, setEvents(state, events: FG.Event[]) { state.events = events; + }, + updateEvent(state, event: FG.Event) { + let eventToChange = state.events.find(ev => ev.id == event.id); + eventToChange = event; } }; @@ -165,7 +169,7 @@ const actions: ActionTree = { }, changeEventTypeName({ commit }, eventtype: { id: number; name: string; oldname: string }) { axios - .put(`/schedule/event-types/${eventtype.oldname}`, eventtype) + .put(`/schedule/event-types/${eventtype.id}`, eventtype) .then(() => { commit('setEventType', eventtype); }) @@ -185,6 +189,22 @@ const actions: ActionTree = { }); console.log('Events: ', state.events); }, + updateEvent( + { commit }, + updateInformation: { eventId: number; JobId: number; service: FG.Service } + ) { + axios + .put( + `/schedule/events/${updateInformation.eventId}/jobs/${updateInformation.JobId}`, + updateInformation.service + ) + .then((response: AxiosResponse) => { + commit('updateEvent', response.data); + }) + .catch(err => { + console.warn(err); + }); + }, getEvents({ commit }) { axios .get('/schedule/events') @@ -203,6 +223,9 @@ const actions: ActionTree = { const getters: GetterTree = { jobTypes(state) { return state.jobTypes; + }, + events(state) { + return state.events; } };