fix: get sidebar field for lead/deal using api
This commit is contained in:
parent
7aacbb4c77
commit
afeac24b36
@ -108,15 +108,15 @@
|
|||||||
@updateField="updateField"
|
@updateField="updateField"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="detailSections.length"
|
v-if="fieldsLayout.data"
|
||||||
class="flex flex-1 flex-col justify-between overflow-hidden"
|
class="flex flex-1 flex-col justify-between overflow-hidden"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col overflow-y-auto">
|
<div class="flex flex-col overflow-y-auto">
|
||||||
<div
|
<div
|
||||||
v-for="(section, i) in detailSections"
|
v-for="(section, i) in fieldsLayout.data"
|
||||||
:key="section.label"
|
:key="section.label"
|
||||||
class="flex flex-col p-3"
|
class="flex flex-col p-3"
|
||||||
:class="{ 'border-b': i !== detailSections.length - 1 }"
|
:class="{ 'border-b': i !== fieldsLayout.data.length - 1 }"
|
||||||
>
|
>
|
||||||
<Section :is-opened="section.opened" :label="section.label">
|
<Section :is-opened="section.opened" :label="section.label">
|
||||||
<template #actions>
|
<template #actions>
|
||||||
@ -480,10 +480,12 @@ const tabs = computed(() => {
|
|||||||
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
||||||
})
|
})
|
||||||
|
|
||||||
const detailSections = computed(() => {
|
const fieldsLayout = createResource({
|
||||||
let data = deal.data
|
url: 'crm.api.doc.get_sidebar_fields',
|
||||||
if (!data) return []
|
cache: ['fieldsLayout', props.dealId],
|
||||||
return getParsedFields(data.doctype_fields, deal_contacts.data)
|
params: { doctype: 'CRM Deal', name: props.dealId },
|
||||||
|
auto: true,
|
||||||
|
transform: (data) => getParsedFields(data, deal_contacts.data),
|
||||||
})
|
})
|
||||||
|
|
||||||
function getParsedFields(sections, contacts) {
|
function getParsedFields(sections, contacts) {
|
||||||
|
|||||||
@ -162,15 +162,15 @@
|
|||||||
@updateField="updateField"
|
@updateField="updateField"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="detailSections.length"
|
v-if="fieldsLayout.data"
|
||||||
class="flex flex-1 flex-col justify-between overflow-hidden"
|
class="flex flex-1 flex-col justify-between overflow-hidden"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col overflow-y-auto">
|
<div class="flex flex-col overflow-y-auto">
|
||||||
<div
|
<div
|
||||||
v-for="(section, i) in detailSections"
|
v-for="(section, i) in fieldsLayout.data"
|
||||||
:key="section.label"
|
:key="section.label"
|
||||||
class="flex flex-col p-3"
|
class="flex flex-col p-3"
|
||||||
:class="{ 'border-b': i !== detailSections.length - 1 }"
|
:class="{ 'border-b': i !== fieldsLayout.data.length - 1 }"
|
||||||
>
|
>
|
||||||
<Section :is-opened="section.opened" :label="section.label">
|
<Section :is-opened="section.opened" :label="section.label">
|
||||||
<SectionFields
|
<SectionFields
|
||||||
@ -469,10 +469,11 @@ function validateFile(file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const detailSections = computed(() => {
|
const fieldsLayout = createResource({
|
||||||
let data = lead.data
|
url: 'crm.api.doc.get_sidebar_fields',
|
||||||
if (!data) return []
|
cache: ['fieldsLayout', props.leadId],
|
||||||
return data.doctype_fields
|
params: { doctype: 'CRM Lead', name: props.leadId },
|
||||||
|
auto: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
function updateField(name, value, callback) {
|
function updateField(name, value, callback) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user