Merge pull request #288 from shariquerik/bulk-convert

feat: Bulk convert lead
This commit is contained in:
Shariq Ansari 2024-08-05 13:12:23 +05:30 committed by GitHub
commit 2b5fd93922
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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