From c40d32433bd3ecd0ef7f599572fbd3220b1c203f Mon Sep 17 00:00:00 2001
From: Michael Bauer <michael-bauer@posteo.de>
Date: Fri, 22 Sep 2023 21:56:27 +0200
Subject: [PATCH] Remove amendEvent namespace in now standalone AmendEvent
 component

---
 .../frontend/components/AmendLesson.vue       | 80 +++++++++----------
 1 file changed, 39 insertions(+), 41 deletions(-)

diff --git a/aleksis/apps/chronos/frontend/components/AmendLesson.vue b/aleksis/apps/chronos/frontend/components/AmendLesson.vue
index aae3630e..f43faa3a 100644
--- a/aleksis/apps/chronos/frontend/components/AmendLesson.vue
+++ b/aleksis/apps/chronos/frontend/components/AmendLesson.vue
@@ -2,26 +2,26 @@
   <v-card-actions v-if="checkPermission('chronos.edit_substitution_rule')">
     <edit-button
       i18n-key="chronos.event.amend.edit_button"
-      @click="amendEvent.open = true"
+      @click="edit = true"
       />
     <delete-button
       v-if="selectedEvent.meta.amended"
       i18n-key="chronos.event.amend.delete_button"
-      @click="amendEvent.delete = true"
+      @click="delete = true"
       />
     <dialog-object-form
-      v-model="amendEvent.open"
-      :fields="amendEvent.fields"
+      v-model="edit"
+      :fields="fields"
       :is-create="!selectedEvent.meta.amended"
       createItemI18nKey="chronos.event.amend.title"
-      :gql-create-mutation="amendEvent.gqlCreateMutation"
+      :gql-create-mutation="gqlCreateMutation"
       :get-create-data="transformCreateData"
-      :default-item="amendEvent.default"
+      :default-item="default"
       editItemI18nKey="chronos.event.amend.title"
-      :gql-patch-mutation="amendEvent.gqlPatchMutation"
+      :gql-patch-mutation="gqlPatchMutation"
       :get-patch-data="transformPatchData"
       :edit-item="initPatchData"
-      @cancel="amendEvent.open = false"
+      @cancel="open = false"
       @save="updateOnSave()"
       >
       <template #subject.field="{ attrs, on, item }">
@@ -69,8 +69,8 @@
     </dialog-object-form>
     <delete-dialog
       deleteSuccessMessageI18nKey="chronos.event.amend.delete_success"
-      :gql-mutation="amendEvent.gqlDeleteMutation"
-      v-model="amendEvent.delete"
+      :gql-mutation="gqlDeleteMutation"
+      v-model="delete"
       :item="selectedEvent.meta"
       @success="updateOnSave()"
       >
@@ -107,39 +107,37 @@ export default {
   mixins: [permissionsMixin],
   data() {
     return {
-      amendEvent: {
-        open: false,
-        fields: [
-          {
-            text: this.$t("chronos.event.amend.subject"),
-            value: "subject",
-          },
-          {
-            text: this.$t("chronos.event.amend.teachers"),
-            value: "teachers",
-          },
-          {
-            text: this.$t("chronos.event.amend.rooms"),
-            value: "rooms",
-          },
-          {
-            text: this.$t("chronos.event.amend.cancelled"),
-            value: "cancelled",
-          },
-          {
-            text: this.$t("chronos.event.amend.comment"),
-            value: "comment",
-          },
-        ],
-        default: {
-          cancelled: this.selectedEvent.meta.cancelled,
-          comment: this.selectedEvent.meta.comment,
+      edit: false,
+      fields: [
+        {
+          text: this.$t("chronos.event.amend.subject"),
+          value: "subject",
         },
-        gqlCreateMutation: createAmendLesson,
-        gqlPatchMutation: patchAmendLesson,
-        delete: false,
-        gqlDeleteMutation: deleteAmendLesson,
+        {
+          text: this.$t("chronos.event.amend.teachers"),
+          value: "teachers",
+        },
+        {
+          text: this.$t("chronos.event.amend.rooms"),
+          value: "rooms",
+        },
+        {
+          text: this.$t("chronos.event.amend.cancelled"),
+          value: "cancelled",
+        },
+        {
+          text: this.$t("chronos.event.amend.comment"),
+          value: "comment",
+        },
+      ],
+      default: {
+        cancelled: this.selectedEvent.meta.cancelled,
+        comment: this.selectedEvent.meta.comment,
       },
+      gqlCreateMutation: createAmendLesson,
+      gqlPatchMutation: patchAmendLesson,
+      delete: false,
+      gqlDeleteMutation: deleteAmendLesson,
     };
   },
   methods: {
-- 
GitLab