[agendaview] Edit events as dialog

This commit is contained in:
Ferdinand Thiessen 2021-11-25 15:32:58 +01:00
parent 512e68f1ed
commit 4c92fb0ff7
1 changed files with 7 additions and 2 deletions

View File

@ -64,7 +64,7 @@
{{ timestamp.day }} {{ timestamp.day }}
<q-menu> <q-menu>
<q-list style="min-width: 100px"> <q-list style="min-width: 100px">
<q-item exact :to="{ name: 'new-event', query: { date: timestamp.date } }"> <q-item exact clickable @click="create(timestamp.date)">
<q-item-section>Neue Veranstaltung</q-item-section> <q-item-section>Neue Veranstaltung</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@ -95,6 +95,7 @@ import { date, QDate, QPopupProxy, useQuasar } from 'quasar';
import { startOfWeek } from '@flaschengeist/api'; import { startOfWeek } from '@flaschengeist/api';
import EditEvent from '../management/EditEvent.vue'; import EditEvent from '../management/EditEvent.vue';
import { QCalendarAgenda } from '@quasar/quasar-ui-qcalendar'; import { QCalendarAgenda } from '@quasar/quasar-ui-qcalendar';
import { EditableEvent, emptyEvent } from '../../store/models';
export default defineComponent({ export default defineComponent({
name: 'AgendaView', name: 'AgendaView',
@ -115,7 +116,7 @@ export default defineComponent({
calendarView.value == 'day' || quasar.screen.xs ? 1 : quasar.screen.sm ? 3 : 7 calendarView.value == 'day' || quasar.screen.xs ? 1 : quasar.screen.sm ? 3 : 7
); );
const events = ref<Agendas>({}); const events = ref<Agendas>({});
const editor = ref<FG.Event | undefined>(undefined); const editor = ref<EditableEvent>();
interface Agendas { interface Agendas {
[index: number]: FG.Event[]; [index: number]: FG.Event[];
@ -125,6 +126,9 @@ export default defineComponent({
await loadAgendas(); await loadAgendas();
}); });
function create(ds: string) {
editor.value = emptyEvent(date.extractDate(ds, 'YYYY-MM-DD'));
}
async function edit(id: number) { async function edit(id: number) {
editor.value = await store.getEvent(id); editor.value = await store.getEvent(id);
} }
@ -221,6 +225,7 @@ export default defineComponent({
calendarPrev, calendarPrev,
calendarRealView, calendarRealView,
calendarView, calendarView,
create,
edit, edit,
editor, editor,
editDone, editDone,