fix: delete event from lead/deal

This commit is contained in:
Shariq Ansari 2025-08-14 17:27:36 +05:30
parent ea644c22f1
commit 9cd6b142d7
2 changed files with 47 additions and 31 deletions

View File

@ -51,7 +51,7 @@
<div <div
class="flex h-8 w-7 items-center justify-center bg-surface-white text-ink-gray-8" class="flex h-8 w-7 items-center justify-center bg-surface-white text-ink-gray-8"
> >
<EventIcon class="h-4 w-4" /> <CalendarIcon class="h-4 w-4" />
</div> </div>
</div> </div>
<EventArea <EventArea

View File

@ -1,10 +1,24 @@
<template> <template>
<Dialog v-model="show" :options="{ size: 'xl' }"> <Dialog v-model="show" :options="{ size: 'xl' }">
<template #body-title> <template #body-header>
<div class="flex items-center gap-3"> <div class="mb-6 flex items-center justify-between">
<h3 class="text-2xl font-semibold leading-6 text-ink-gray-9"> <div class="flex items-center space-x-2">
{{ editMode ? __('Edit an event') : __('Create an event') }} <h3 class="text-2xl font-semibold leading-6 text-ink-gray-9">
</h3> {{ editMode ? __('Edit an event') : __('Create an event') }}
</h3>
</div>
<div class="flex gap-1">
<Button variant="ghost" @click="deleteEvent">
<template #icon>
<LucideTrash2 class="h-4 w-4 text-ink-gray-9" />
</template>
</Button>
<Button variant="ghost" @click="show = false">
<template #icon>
<LucideX class="h-4 w-4 text-ink-gray-9" />
</template>
</Button>
</div>
</div> </div>
</template> </template>
<template #body-content> <template #body-content>
@ -36,7 +50,7 @@
</div> </div>
<div class="flex gap-2 w-9/12"> <div class="flex gap-2 w-9/12">
<DatePicker <DatePicker
:class="[_event.isFullDay ? 'w-full' : 'w-[160px]']" :class="[_event.isFullDay ? 'w-full' : 'w-[158px]']"
variant="outline" variant="outline"
:value="_event.fromDate" :value="_event.fromDate"
:formatter="(date) => getFormat(date, 'MMM D, YYYY')" :formatter="(date) => getFormat(date, 'MMM D, YYYY')"
@ -122,6 +136,7 @@ import {
DatePicker, DatePicker,
dayjs, dayjs,
} from 'frappe-ui' } from 'frappe-ui'
import { globalStore } from '@/stores/global'
import { getFormat } from '@/utils' import { getFormat } from '@/utils'
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
@ -140,6 +155,8 @@ const props = defineProps({
}, },
}) })
const { $dialog } = globalStore()
const show = defineModel() const show = defineModel()
const events = defineModel('events') const events = defineModel('events')
@ -283,29 +300,28 @@ function updateEvent() {
) )
} }
// function deleteEvent(eventID) { function deleteEvent() {
// if (!eventID) return if (!_event.value.id) return
// $dialog({ $dialog({
// title: __('Delete'), title: __('Delete'),
// message: __('Are you sure you want to delete this event?'), message: __('Are you sure you want to delete this event?'),
// actions: [ actions: [
// { {
// label: __('Delete'), label: __('Delete'),
// variant: 'solid', variant: 'solid',
// theme: 'red', theme: 'red',
// onClick: (close) => { onClick: (close) => {
// events.delete.submit(eventID, { events.value.delete.submit(_event.value.id, {
// onSuccess: () => events.reload(), onSuccess: async () => {
// }) await events.value.reload()
// showEventPanel.value = false show.value = false
// event.value = {} close()
// activeEvent.value = '' },
// mode.value = '' })
// close() },
// }, },
// }, ],
// ], })
// }) }
// }
</script> </script>