1
0
forked from test/crm

fix: lead/deal details tab breaking in mobile view

This commit is contained in:
Shariq Ansari 2025-01-03 17:02:46 +05:30
parent 3627f48cf4
commit 693c6a1eaf
2 changed files with 111 additions and 163 deletions

View File

@ -58,58 +58,23 @@
@updateField="updateField" @updateField="updateField"
/> />
<div <div
v-if="fieldsLayout.data" v-if="sections.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
v-for="(section, i) in fieldsLayout.data"
:key="section.name"
class="flex flex-col px-2 py-3 sm:p-3"
:class="{ 'border-b': i !== fieldsLayout.data.length - 1 }"
>
<Section :label="section.label" :opened="section.opened">
<template #actions>
<div v-if="section.contacts" class="pr-2">
<Link
value=""
doctype="Contact"
@change="(e) => addContact(e)"
:onCreate="
(value, close) => {
_contact = {
first_name: value,
company_name: deal.data.organization,
}
showContactModal = true
close()
}
"
>
<template #target="{ togglePopover }">
<Button
class="h-7 px-3"
variant="ghost"
icon="plus"
@click="togglePopover()"
/>
</template>
</Link>
</div>
</template>
<SidePanelLayout <SidePanelLayout
v-if="section.columns?.[0].fields"
:fields="section.columns[0].fields"
:isLastSection="i == fieldsLayout.data.length - 1"
doctype="CRM Deal"
v-model="deal.data" v-model="deal.data"
:sections="sections.data"
doctype="CRM Deal"
v-slot="{ section }"
@update="updateField" @update="updateField"
/> @reload="sections.reload"
<div v-else> >
<div <div
v-if=" v-if="section.name == 'contacts_section'"
dealContacts?.loading && dealContacts?.data?.length == 0 class="contacts-area"
" >
<div
v-if="dealContacts?.loading && dealContacts?.data?.length == 0"
class="flex min-h-20 flex-1 items-center justify-center gap-3 text-base text-ink-gray-4" class="flex min-h-20 flex-1 items-center justify-center gap-3 text-base text-ink-gray-4"
> >
<LoadingIndicator class="h-4 w-4" /> <LoadingIndicator class="h-4 w-4" />
@ -120,10 +85,7 @@
v-for="(contact, i) in section.contacts" v-for="(contact, i) in section.contacts"
:key="contact.name" :key="contact.name"
> >
<div <div class="px-2 pb-2.5" :class="[i == 0 ? 'pt-5' : 'pt-2.5']">
class="px-2 pb-2.5"
:class="[i == 0 ? 'pt-5' : 'pt-2.5']"
>
<Section :opened="contact.opened"> <Section :opened="contact.opened">
<template #header="{ opened, toggle }"> <template #header="{ opened, toggle }">
<div <div
@ -204,9 +166,7 @@
{{ __('No contacts added') }} {{ __('No contacts added') }}
</div> </div>
</div> </div>
</Section> </SidePanelLayout>
</div>
</div>
</div> </div>
</div> </div>
<Activities <Activities
@ -257,7 +217,6 @@ import Activities from '@/components/Activities/Activities.vue'
import OrganizationModal from '@/components/Modals/OrganizationModal.vue' import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
import AssignTo from '@/components/AssignTo.vue' import AssignTo from '@/components/AssignTo.vue'
import ContactModal from '@/components/Modals/ContactModal.vue' import ContactModal from '@/components/Modals/ContactModal.vue'
import Link from '@/components/Controls/Link.vue'
import Section from '@/components/Section.vue' import Section from '@/components/Section.vue'
import SidePanelLayout from '@/components/SidePanelLayout.vue' import SidePanelLayout from '@/components/SidePanelLayout.vue'
import SLASection from '@/components/SLASection.vue' import SLASection from '@/components/SLASection.vue'
@ -324,7 +283,7 @@ const deal = createResource({
resource: { resource: {
deal, deal,
dealContacts, dealContacts,
fieldsLayout, sections,
}, },
call, call,
} }
@ -490,7 +449,7 @@ const tabs = computed(() => {
}) })
const { tabIndex } = useActiveTabManager(tabs, 'lastDealTab') const { tabIndex } = useActiveTabManager(tabs, 'lastDealTab')
const fieldsLayout = createResource({ 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' },
@ -593,7 +552,7 @@ const dealContacts = createResource({
cache: ['deal_contacts', props.dealId], cache: ['deal_contacts', props.dealId],
auto: true, auto: true,
onSuccess: (data) => { onSuccess: (data) => {
let contactSection = fieldsLayout.data?.find( let contactSection = sections.data?.find(
(section) => section.name == 'contacts_section', (section) => section.name == 'contacts_section',
) )
if (!contactSection) return if (!contactSection) return

View File

@ -63,26 +63,16 @@
@updateField="updateField" @updateField="updateField"
/> />
<div <div
v-if="fieldsLayout.data" v-if="sections.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
v-for="(section, i) in fieldsLayout.data"
:key="section.name"
class="flex flex-col px-2 py-3 sm:p-3"
:class="{ 'border-b': i !== fieldsLayout.data.length - 1 }"
>
<Section :label="section.label" :opened="section.opened">
<SidePanelLayout <SidePanelLayout
:fields="section.columns[0].fields"
:isLastSection="i == fieldsLayout.data.length - 1"
v-model="lead.data" v-model="lead.data"
:sections="sections.data"
doctype="CRM Lead"
@update="updateField" @update="updateField"
@reload="sections.reload"
/> />
</Section>
</div>
</div>
</div> </div>
</div> </div>
<Activities <Activities
@ -180,7 +170,6 @@ import LayoutHeader from '@/components/LayoutHeader.vue'
import Activities from '@/components/Activities/Activities.vue' import Activities from '@/components/Activities/Activities.vue'
import AssignTo from '@/components/AssignTo.vue' import AssignTo from '@/components/AssignTo.vue'
import Link from '@/components/Controls/Link.vue' import Link from '@/components/Controls/Link.vue'
import Section from '@/components/Section.vue'
import SidePanelLayout from '@/components/SidePanelLayout.vue' import SidePanelLayout from '@/components/SidePanelLayout.vue'
import SLASection from '@/components/SLASection.vue' import SLASection from '@/components/SLASection.vue'
import CustomActions from '@/components/CustomActions.vue' import CustomActions from '@/components/CustomActions.vue'
@ -240,7 +229,7 @@ const lead = createResource({
deleteDoc: deleteLead, deleteDoc: deleteLead,
resource: { resource: {
lead, lead,
fieldsLayout, sections,
}, },
call, call,
} }
@ -410,7 +399,7 @@ watch(tabs, (value) => {
} }
}) })
const fieldsLayout = createResource({ 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 Lead'], cache: ['sidePanelSections', 'CRM Lead'],
params: { doctype: 'CRM Lead' }, params: { doctype: 'CRM Lead' },