From 1d2edf753530c8f2766a2862c6c846cec1c8d7e2 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Mon, 30 Jun 2025 15:43:15 +0200 Subject: [PATCH] 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. --- components/DiffEntry.vue | 48 ++++++++++++++ components/DiffFieldEntityId.vue | 43 +++++++++++++ components/DiffFieldSetEntityId.vue | 56 ++++++++++++++++ components/DiffFieldString.vue | 36 +++++++++++ components/DiffSchedule.vue | 64 +++++++++++++++++++ components/DiffScheduleEvent.vue | 95 +++++++++++++++++++++++++++ components/DiffScheduleEventSlot.vue | 41 ++++++++++++ components/DiffScheduleLocation.vue | 28 ++++++++ components/DiffScheduleRole.vue | 28 ++++++++ components/DiffScheduleShift.vue | 96 ++++++++++++++++++++++++++++ components/DiffScheduleShiftSlot.vue | 34 ++++++++++ pages/edit.vue | 68 ++++++++++++++++++-- 12 files changed, 630 insertions(+), 7 deletions(-) create mode 100644 components/DiffEntry.vue create mode 100644 components/DiffFieldEntityId.vue create mode 100644 components/DiffFieldSetEntityId.vue create mode 100644 components/DiffFieldString.vue create mode 100644 components/DiffSchedule.vue create mode 100644 components/DiffScheduleEvent.vue create mode 100644 components/DiffScheduleEventSlot.vue create mode 100644 components/DiffScheduleLocation.vue create mode 100644 components/DiffScheduleRole.vue create mode 100644 components/DiffScheduleShift.vue create mode 100644 components/DiffScheduleShiftSlot.vue diff --git a/components/DiffEntry.vue b/components/DiffEntry.vue new file mode 100644 index 0000000..42f1b3f --- /dev/null +++ b/components/DiffEntry.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/components/DiffFieldEntityId.vue b/components/DiffFieldEntityId.vue new file mode 100644 index 0000000..2034e45 --- /dev/null +++ b/components/DiffFieldEntityId.vue @@ -0,0 +1,43 @@ + + + diff --git a/components/DiffFieldSetEntityId.vue b/components/DiffFieldSetEntityId.vue new file mode 100644 index 0000000..3ad166d --- /dev/null +++ b/components/DiffFieldSetEntityId.vue @@ -0,0 +1,56 @@ + + + diff --git a/components/DiffFieldString.vue b/components/DiffFieldString.vue new file mode 100644 index 0000000..ea31207 --- /dev/null +++ b/components/DiffFieldString.vue @@ -0,0 +1,36 @@ + + + diff --git a/components/DiffSchedule.vue b/components/DiffSchedule.vue new file mode 100644 index 0000000..28ecfb6 --- /dev/null +++ b/components/DiffSchedule.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/components/DiffScheduleEvent.vue b/components/DiffScheduleEvent.vue new file mode 100644 index 0000000..305ef3f --- /dev/null +++ b/components/DiffScheduleEvent.vue @@ -0,0 +1,95 @@ + + + diff --git a/components/DiffScheduleEventSlot.vue b/components/DiffScheduleEventSlot.vue new file mode 100644 index 0000000..77dfe63 --- /dev/null +++ b/components/DiffScheduleEventSlot.vue @@ -0,0 +1,41 @@ + + + diff --git a/components/DiffScheduleLocation.vue b/components/DiffScheduleLocation.vue new file mode 100644 index 0000000..274d511 --- /dev/null +++ b/components/DiffScheduleLocation.vue @@ -0,0 +1,28 @@ + + + diff --git a/components/DiffScheduleRole.vue b/components/DiffScheduleRole.vue new file mode 100644 index 0000000..35452d7 --- /dev/null +++ b/components/DiffScheduleRole.vue @@ -0,0 +1,28 @@ + + + diff --git a/components/DiffScheduleShift.vue b/components/DiffScheduleShift.vue new file mode 100644 index 0000000..c04b310 --- /dev/null +++ b/components/DiffScheduleShift.vue @@ -0,0 +1,96 @@ + + + diff --git a/components/DiffScheduleShiftSlot.vue b/components/DiffScheduleShiftSlot.vue new file mode 100644 index 0000000..0049761 --- /dev/null +++ b/components/DiffScheduleShiftSlot.vue @@ -0,0 +1,34 @@ + + + diff --git a/pages/edit.vue b/pages/edit.vue index fd758e7..64e55df 100644 --- a/pages/edit.vue +++ b/pages/edit.vue @@ -78,13 +78,31 @@ -

- Changes are not saved yet. - -

+
+ +
+
+ Changes are not saved yet. + + +
+
@@ -156,6 +174,8 @@ const roleFilter = computed({ }), }); +const reviewOpen = ref(false); + async function saveChanges() { try { await $fetch("/api/schedule", { @@ -168,3 +188,37 @@ async function saveChanges() { } } + +