fix: preview of side panel modal

This commit is contained in:
Shariq Ansari 2025-01-02 15:03:42 +05:30
parent 3cdd594da9
commit e4c8e2727f
2 changed files with 19 additions and 22 deletions

View File

@ -37,26 +37,20 @@
:doctype="_doctype" :doctype="_doctype"
/> />
<div v-if="preview" class="flex flex-1 flex-col border rounded"> <div v-if="preview" class="flex flex-1 flex-col border rounded">
<div <SidePanelLayout
v-for="(section, i) in tabs.data[0].sections" :sections="{ data: tabs.data[0].sections }"
:key="section.name" :doctype="_doctype"
class="flex flex-col py-1.5 px-1" v-model="data"
:class="{ :preview="true"
'border-b': i !== tabs.data[0].sections?.length - 1, v-slot="{ section }"
}"
> >
<Section <div
labelClass="p-2" v-if="section.name == 'contacts_section'"
:label="section.label" class="flex h-16 items-center justify-center text-base text-ink-gray-5"
:opened="section.opened"
> >
<SidePanelLayout {{ __('No contacts added') }}
:fields="section.columns?.[0].fields || []" </div>
:isLastSection="i == tabs.data[0].sections?.length - 1" </SidePanelLayout>
v-model="data"
/>
</Section>
</div>
</div> </div>
<div <div
v-else v-else
@ -70,7 +64,6 @@
</Dialog> </Dialog>
</template> </template>
<script setup> <script setup>
import Section from '@/components/Section.vue'
import SidePanelLayout from '@/components/SidePanelLayout.vue' import SidePanelLayout from '@/components/SidePanelLayout.vue'
import SidePanelLayoutEditor from '@/components/SidePanelLayoutEditor.vue' import SidePanelLayoutEditor from '@/components/SidePanelLayoutEditor.vue'
import { useDebounceFn } from '@vueuse/core' import { useDebounceFn } from '@vueuse/core'

View File

@ -12,7 +12,7 @@
:label="section.label" :label="section.label"
:opened="section.opened" :opened="section.opened"
> >
<template #actions> <template v-if="!preview" #actions>
<div v-if="section.contacts" class="pr-2"> <div v-if="section.contacts" class="pr-2">
<Link <Link
value="" value=""
@ -371,6 +371,10 @@ const props = defineProps({
type: String, type: String,
default: 'CRM Lead', default: 'CRM Lead',
}, },
preview: {
type: Boolean,
default: false,
},
}) })
const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } = const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =
@ -408,8 +412,8 @@ const _sections = computed(() => {
}) })
} }
section.visible = section.visible =
section.isContactsSection || section.name == 'contacts_section' ||
section.columns[0].fields.filter((f) => f.visible).length section.columns?.[0].fields.filter((f) => f.visible).length
return section return section
}) })
}) })