From 1d249b8fffaf6d15df1ee377f25daf3843d8c560 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 4 Sep 2025 22:44:32 +0530 Subject: [PATCH] fix: disable create button when event data is not modified --- frontend/src/components/Modals/EventModal.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/components/Modals/EventModal.vue b/frontend/src/components/Modals/EventModal.vue index f01a24d0..4e1ea574 100644 --- a/frontend/src/components/Modals/EventModal.vue +++ b/frontend/src/components/Modals/EventModal.vue @@ -158,6 +158,7 @@ ? __('Duplicate') : __('Create') " + :disabled="!dirty" :loading=" mode === 'edit' ? eventsResource.setValue.loading @@ -224,6 +225,7 @@ const mode = computed(() => { : 'create' }) +const oldEvent = ref({}) const _event = ref({ title: '', description: '', @@ -239,6 +241,10 @@ const _event = ref({ event_participants: [], }) +const dirty = computed(() => { + return JSON.stringify(_event.value) !== JSON.stringify(oldEvent.value) +}) + const peoples = computed({ get() { return _event.value.event_participants || [] @@ -274,6 +280,8 @@ onMounted(() => { event_participants: props.event.event_participants || [], } + oldEvent.value = JSON.parse(JSON.stringify(_event.value)) + setTimeout(() => title.value?.el?.focus(), 100) } })