feat: Bulk convert lead
This commit is contained in:
parent
994ff2db51
commit
2d3db4e63d
@ -56,6 +56,39 @@ function editValues(selections, unselectAll) {
|
|||||||
unselectAllAction.value = 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) {
|
function deleteValues(selections, unselectAll) {
|
||||||
$dialog({
|
$dialog({
|
||||||
title: __('Delete'),
|
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) => {
|
customBulkActions.value.forEach((action) => {
|
||||||
actions.push({
|
actions.push({
|
||||||
label: __(action.label),
|
label: __(action.label),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user