Skip to content

Commit

Permalink
Merge pull request #288 from shariquerik/bulk-convert
Browse files Browse the repository at this point in the history
feat: Bulk convert lead
  • Loading branch information
shariquerik authored Aug 5, 2024
2 parents 994ff2d + 2d3db4e commit 2b5fd93
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions frontend/src/components/ListBulkActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 2b5fd93

Please sign in to comment.