diff --git a/frontend/src/pages/Lead.vue b/frontend/src/pages/Lead.vue index 7de430aa..3f02832e 100644 --- a/frontend/src/pages/Lead.vue +++ b/frontend/src/pages/Lead.vue @@ -245,6 +245,15 @@ {{ __("New contact will be created based on the person's details") }} + +
+ + { + let statuses = statusOptions('deal') + if (!deal.status) { + deal.status = statuses[0].value + } + return statuses +}) + +const dealTabs = createResource({ + url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_fields_layout', + cache: ['RequiredFields', 'CRM Deal'], + params: { doctype: 'CRM Deal', type: 'Required Fields' }, + auto: true, + transform: (_tabs) => { + let hasFields = false + let parsedTabs = _tabs.forEach((tab) => { + tab.sections.forEach((section) => { + section.columns.forEach((column) => { + column.fields.forEach((field) => { + hasFields = true + if (field.fieldname == 'status') { + field.fieldtype = 'Select' + field.options = dealStatuses.value + field.prefix = getDealStatus(deal.status).color + } + + if (field.fieldtype === 'Table') { + deal[field.fieldname] = [] + } + }) + }) + }) + }) + return hasFields ? parsedTabs : [] + }, +})