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