fix: disable create button when event data is not modified
This commit is contained in:
parent
5eaf828758
commit
1d249b8fff
@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user