fix: disable create button when event data is not modified

This commit is contained in:
Shariq Ansari 2025-09-04 22:44:32 +05:30
parent 5eaf828758
commit 1d249b8fff

View File

@ -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)
}
})