fix: delete lead/deal from lead/deal page

This commit is contained in:
Shariq Ansari 2023-12-13 21:12:14 +05:30
parent dd93342601
commit d887c27d1d
2 changed files with 70 additions and 0 deletions

View File

@ -4,6 +4,33 @@
<Breadcrumbs :items="breadcrumbs" />
</template>
<template #right-header>
<Dropdown
:options="[
{
icon: 'trash-2',
label: 'Delete',
onClick: () =>
$dialog({
title: 'Delete Deal',
message: 'Are you sure you want to delete this deal?',
actions: [
{
label: 'Delete',
theme: 'red',
variant: 'solid',
onClick(close) {
deleteDeal(deal.data.name)
close()
},
},
],
}),
},
]"
@click.stop
>
<Button icon="more-horizontal" />
</Dropdown>
<Link
class="form-control"
:value="getUser(deal.data.deal_owner).full_name"
@ -524,4 +551,12 @@ function updateField(name, value, callback) {
callback?.()
})
}
async function deleteDeal(name) {
await call('frappe.client.delete', {
doctype: 'CRM Deal',
name,
})
router.push({ name: 'Deals' })
}
</script>

View File

@ -4,6 +4,33 @@
<Breadcrumbs :items="breadcrumbs" />
</template>
<template #right-header>
<Dropdown
:options="[
{
icon: 'trash-2',
label: 'Delete',
onClick: () =>
$dialog({
title: 'Delete Lead',
message: 'Are you sure you want to delete this lead?',
actions: [
{
label: 'Delete',
theme: 'red',
variant: 'solid',
onClick(close) {
deleteLead(lead.data.name)
close()
},
},
],
}),
},
]"
@click.stop
>
<Button icon="more-horizontal" />
</Dropdown>
<Link
class="form-control"
:value="getUser(lead.data.lead_owner).full_name"
@ -365,4 +392,12 @@ function updateField(name, value, callback) {
callback?.()
})
}
async function deleteLead(name) {
await call('frappe.client.delete', {
doctype: 'CRM Lead',
name,
})
router.push({ name: 'Leads' })
}
</script>