fix: fetch side panel sections & deal contacts if not already fetched
This commit is contained in:
parent
46776b4a4b
commit
5c5b2cdce1
@ -564,10 +564,11 @@ const sections = createResource({
|
|||||||
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
||||||
cache: ['sidePanelSections', 'CRM Deal'],
|
cache: ['sidePanelSections', 'CRM Deal'],
|
||||||
params: { doctype: 'CRM Deal' },
|
params: { doctype: 'CRM Deal' },
|
||||||
auto: true,
|
|
||||||
transform: (data) => getParsedSections(data),
|
transform: (data) => getParsedSections(data),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!sections.data) sections.fetch()
|
||||||
|
|
||||||
function getParsedSections(_sections) {
|
function getParsedSections(_sections) {
|
||||||
_sections.forEach((section) => {
|
_sections.forEach((section) => {
|
||||||
if (section.name == 'contacts_section') return
|
if (section.name == 'contacts_section') return
|
||||||
@ -670,7 +671,6 @@ const dealContacts = createResource({
|
|||||||
url: 'crm.fcrm.doctype.crm_deal.api.get_deal_contacts',
|
url: 'crm.fcrm.doctype.crm_deal.api.get_deal_contacts',
|
||||||
params: { name: props.dealId },
|
params: { name: props.dealId },
|
||||||
cache: ['deal_contacts', props.dealId],
|
cache: ['deal_contacts', props.dealId],
|
||||||
auto: true,
|
|
||||||
transform: (data) => {
|
transform: (data) => {
|
||||||
data.forEach((contact) => {
|
data.forEach((contact) => {
|
||||||
contact.opened = false
|
contact.opened = false
|
||||||
@ -679,6 +679,8 @@ const dealContacts = createResource({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!dealContacts.data) dealContacts.fetch()
|
||||||
|
|
||||||
function triggerCall() {
|
function triggerCall() {
|
||||||
let primaryContact = dealContacts.data?.find((c) => c.is_primary)
|
let primaryContact = dealContacts.data?.find((c) => c.is_primary)
|
||||||
let mobile_no = primaryContact.mobile_no || null
|
let mobile_no = primaryContact.mobile_no || null
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user