diff --git a/quasar.extensions.json b/quasar.extensions.json new file mode 100644 index 0000000..e239c30 --- /dev/null +++ b/quasar.extensions.json @@ -0,0 +1,3 @@ +{ + "@quasar/qcalendar": {} +} \ No newline at end of file diff --git a/src/plugins/schedule/components/management/CreateEvent.vue b/src/plugins/schedule/components/management/CreateEvent.vue index 9080ed7..13e66ab 100644 --- a/src/plugins/schedule/components/management/CreateEvent.vue +++ b/src/plugins/schedule/components/management/CreateEvent.vue @@ -71,7 +71,7 @@ import { Store } from 'vuex'; import { StateInterface } from 'src/store'; import { ScheduleInterface } from '../../store/schedule'; import { date } from 'quasar'; -// import { emit } from 'process'; + export default defineComponent({ name: 'CreateEvent', components: { IsoDateInput, Job }, @@ -140,16 +140,21 @@ export default defineComponent({ function save() { console.log('Event:', event); - store.dispatch('schedule/addEvent', event.value).catch(error => { - console.warn(error); - }); + void store + .dispatch('schedule/addEvent', event.value) + .catch(error => { + console.warn(error); + }) + .then(() => { + reset(); + }); } function reset() { event.value.id = NaN; event.value.start = new Date(); event.value.description = ''; - event.value.type = {id: -1, name: ''}; + event.value.type = { id: -1, name: '' }; event.value.jobs = [Object.assign({}, newJob.value)]; } function notEmpty(val: string) { @@ -183,4 +188,4 @@ export default defineComponent({ }); - + diff --git a/src/plugins/schedule/components/management/Job.vue b/src/plugins/schedule/components/management/Job.vue index f10a377..d41f96d 100644 --- a/src/plugins/schedule/components/management/Job.vue +++ b/src/plugins/schedule/components/management/Job.vue @@ -21,6 +21,7 @@ + + diff --git a/src/plugins/schedule/components/overview/slots/EventSlot.vue b/src/plugins/schedule/components/overview/slots/EventSlot.vue new file mode 100644 index 0000000..6750049 --- /dev/null +++ b/src/plugins/schedule/components/overview/slots/EventSlot.vue @@ -0,0 +1,82 @@ + + + {{ event.type.name }} + + + Info + {{ event.description }} + + + + + {{ job.start | formatToHour }} - {{ job.end | formatToHour }} + + {{ job.type.name }} + + + {{ job.comment }} + + + + + + + + + + + + diff --git a/src/plugins/schedule/pages/Overview.vue b/src/plugins/schedule/pages/Overview.vue index b64ab3f..8dd8ad1 100644 --- a/src/plugins/schedule/pages/Overview.vue +++ b/src/plugins/schedule/pages/Overview.vue @@ -1,8 +1,100 @@ - - - - - - + + + + + + + + + + + {{ tabindex.label }} + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/schedule/store/schedule.ts b/src/plugins/schedule/store/schedule.ts index 015545a..47f1d4f 100644 --- a/src/plugins/schedule/store/schedule.ts +++ b/src/plugins/schedule/store/schedule.ts @@ -78,6 +78,9 @@ const mutations: MutationTree = { }, addEvent(state, event: FG.Event) { state.events.unshift(event); + }, + setEvents(state, events: FG.Event[]) { + state.events = events; } }; @@ -174,13 +177,27 @@ const actions: ActionTree = { addEvent({ commit }, event: Event) { axios .post('/schedule/events', event) - .then((response: AxiosResponse) => { + .then((response: AxiosResponse) => { commit('addEvent', response.data); }) .catch(err => { console.warn(err); }); console.log('Events: ', state.events); + }, + getEvents({ commit }) { + axios + .get('/schedule/events') + .then((response: AxiosResponse) => { + console.log('action:', response.data); + response.data.forEach(event => { + event.start = new Date(event.start); + }); + commit('setEvents', response.data); + }) + .catch(err => { + console.warn(err); + }); } }; const getters: GetterTree = {