From 2d3db4e63d03b2717bde43119695cc20bcd4acec Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 5 Aug 2024 13:11:28 +0530 Subject: [PATCH] feat: Bulk convert lead --- frontend/src/components/ListBulkActions.vue | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/frontend/src/components/ListBulkActions.vue b/frontend/src/components/ListBulkActions.vue index 5b5bfdaa5..84af5b2ff 100644 --- a/frontend/src/components/ListBulkActions.vue +++ b/frontend/src/components/ListBulkActions.vue @@ -56,6 +56,39 @@ function editValues(selections, unselectAll) { unselectAllAction.value = unselectAll } +function convertToDeal(selections, unselectAll) { + $dialog({ + title: __('Convert to Deal'), + message: __('Are you sure you want to convert {0} Lead(s) to Deal(s)?', [ + selections.size, + ]), + variant: 'solid', + theme: 'blue', + actions: [ + { + label: __('Convert'), + variant: 'solid', + onClick: (close) => { + Array.from(selections).forEach((name) => { + call('crm.fcrm.doctype.crm_lead.crm_lead.convert_to_deal', { + lead: name, + }).then(() => { + createToast({ + title: __('Converted successfully'), + icon: 'check', + iconClasses: 'text-green-600', + }) + list.value.reload() + unselectAll() + close() + }) + }) + }, + }, + ], + }) +} + function deleteValues(selections, unselectAll) { $dialog({ title: __('Delete'), @@ -162,6 +195,13 @@ function bulkActions(selections, unselectAll) { }) } + if (!props.options.hideDelete) { + actions.push({ + label: __('Convert to Deal'), + onClick: () => convertToDeal(selections, unselectAll), + }) + } + customBulkActions.value.forEach((action) => { actions.push({ label: __(action.label),