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),