Adjusting the lead note and dashboard header height
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
Image as AImage,
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
List as AList,
|
||||
@@ -44,6 +45,7 @@ import {
|
||||
UserAddOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
import { api } from '@/lib/api';
|
||||
import { isBirthDateAnswer, leadNoteFileIsImage, parseLeadFormNotes } from '@/lib/lead-form-notes';
|
||||
import {
|
||||
formatClockFa,
|
||||
formatJalaliNumeric,
|
||||
@@ -131,6 +133,18 @@ function formatDate(value: string | null | undefined) {
|
||||
}
|
||||
}
|
||||
|
||||
const noteView = computed(() => parseLeadFormNotes(lead.value?.notes));
|
||||
const formBirthDate = computed(
|
||||
() => noteView.value.rows.find((row) => isBirthDateAnswer(row.label) && !row.file)?.text ?? '',
|
||||
);
|
||||
const shownBirthDate = computed(() => {
|
||||
if (lead.value?.birthDate) return formatDate(lead.value.birthDate);
|
||||
return formBirthDate.value || '—';
|
||||
});
|
||||
const answerRows = computed(() =>
|
||||
noteView.value.rows.filter((row) => !isBirthDateAnswer(row.label)),
|
||||
);
|
||||
|
||||
function apiError(e: unknown, fallback: string) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
||||
@@ -674,7 +688,7 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
||||
{{ lead.assigneeName || '—' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="تاریخ تولد">
|
||||
{{ formatDate(lead.birthDate) }}
|
||||
{{ shownBirthDate }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="تاریخ ثبت">
|
||||
{{ formatDate(lead.createdAt) }}
|
||||
@@ -695,7 +709,44 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
||||
>
|
||||
<div v-for="(addr, i) in lead.addresses" :key="i">{{ addr }}</div>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item v-if="lead.notes" label="یادداشت" :span="2">
|
||||
<template v-if="noteView.mode === 'answers'">
|
||||
<a-descriptions-item
|
||||
v-for="(row, index) in answerRows"
|
||||
:key="`${row.label}-${index}`"
|
||||
:label="row.label"
|
||||
:span="2"
|
||||
:label-style="{ whiteSpace: 'normal' }"
|
||||
:content-style="{ whiteSpace: 'normal' }"
|
||||
>
|
||||
<a-space v-if="row.file" direction="vertical" :size="4">
|
||||
<a-image
|
||||
v-if="row.file.dataUrl && leadNoteFileIsImage(row.file)"
|
||||
:src="row.file.dataUrl"
|
||||
:alt="row.file.name"
|
||||
:width="160"
|
||||
/>
|
||||
<a-typography-text>{{ row.file.name }}</a-typography-text>
|
||||
</a-space>
|
||||
<a-typography-paragraph
|
||||
v-else
|
||||
:ellipsis="{ rows: 4, expandable: true, symbol: 'بیشتر' }"
|
||||
:content="row.text"
|
||||
style="margin-bottom: 0"
|
||||
/>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
v-if="noteView.prose"
|
||||
label="یادداشت"
|
||||
:span="2"
|
||||
>
|
||||
<a-typography-paragraph
|
||||
:ellipsis="{ rows: 4, expandable: true, symbol: 'بیشتر' }"
|
||||
:content="noteView.prose"
|
||||
style="margin-bottom: 0"
|
||||
/>
|
||||
</a-descriptions-item>
|
||||
</template>
|
||||
<a-descriptions-item v-else-if="lead.notes" label="یادداشت" :span="2">
|
||||
<a-typography-paragraph
|
||||
:ellipsis="{ rows: 4, expandable: true, symbol: 'بیشتر' }"
|
||||
:content="lead.notes"
|
||||
|
||||
Reference in New Issue
Block a user