Add dialog showing diff of changes to save

Add a save dialog at the bottom of the screen that is present whenever
there are unsaved changes.  This dialog provides a diff between the
client and server state so that the user can easily confirm the changes
they are about to make are the correct changes before applying them to
the server.
This commit is contained in:
Hornwitser 2025-06-30 15:43:15 +02:00
parent 60f898e986
commit 1d2edf7535
12 changed files with 630 additions and 7 deletions

View file

@ -0,0 +1,64 @@
<template>
<div>
<h2>Changes</h2>
<section v-if="locations.length">
<h3>Locations</h3>
<DiffScheduleLocation
v-for="location in locations"
:key="location.id"
:location
/>
</section>
<section v-if="events.length">
<h3>Events</h3>
<DiffScheduleEvent
v-for="event in events"
:key="event.id"
:event
:schedule
/>
</section>
<section v-if="roles.length">
<h3>Roles</h3>
<DiffScheduleRole
v-for="role in roles"
:key="role.id"
:role
/>
</section>
<section v-if="shifts.length">
<h3>Shifts</h3>
<DiffScheduleShift
v-for="shift in shifts"
:key="shift.id"
:shift
:schedule
/>
</section>
</div>
</template>
<script lang="ts" setup>
const props = defineProps<{
schedule: ClientSchedule
}>();
const locations = computed(() => {
return [...props.schedule.locations.values()].filter(location => location.isModified());
});
const events = computed(() => {
return [...props.schedule.events.values()].filter(event => event.isModified());
});
const roles = computed(() => {
return [...props.schedule.roles.values()].filter(role => role.isModified());
});
const shifts = computed(() => {
return [...props.schedule.shifts.values()].filter(shift => shift.isModified());
});
</script>
<style>
h2 {
margin-block-start: 0.2rem;
}
</style>