if the user clicks the Cancel button or cross button (╳)
it shows an empty card
When the user clicks the cancel button, this card should be hidden.
We open a modal for both adding and editing tasks.
taskEdit: {
editorConfig: {
title: 'Edit Opportunity',
autoUpdateRecord: false,
defaults: {
labelWidth: '30%',
},
width: '35em',
},
items: {
name: {
disabled: true,
label: 'Organization',
},
opportunityService: {
type: 'combo',
items: [],
name: 'opportunityService',
label: 'Service',
weight: 200,
required: true,
},
resources: {
label: 'Team Member',
weight: 400,
multiSelect: false,
},
estmargin: {
type: 'text',
label: 'EST Margin (per month)',
name: 'estimatedMargin',
disabled: true,
weight: 500,
},
color: null,
description: {
weight: 600,
label: 'Subtitle'
},
},
processItems({ feature, items, taskRecord }) {
const customerName = feature.owner.customerName;
feature._editorConfig.title = 'Edit Opportunity';
if (taskRecord.originalData.name == 'New task') {
feature._editorConfig.title = 'Add Opportunity';
delete items.estmargin;
}
taskRecord.set('name', customerName);
items.opportunityService.items =
feature.owner.initialConfig.features.taskEdit.items.opportunityService.items;
},
},