From 55a4b9b3e3be1721ace3ef80086c0a2f50d805ab Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 21 Feb 2025 14:43:37 +0530 Subject: [PATCH] feat: show required deal fields in convert to deal modal --- frontend/src/pages/Lead.vue | 53 +++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) 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 : [] + }, +})