Add optional activity experience on leads and people with form mapping and filters.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -46,7 +46,13 @@ import {
|
||||
UserAddOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
import { api } from '@/lib/api';
|
||||
import { isBirthDateAnswer, leadNoteFileIsImage, parseLeadFormNotes } from '@/lib/lead-form-notes';
|
||||
import {
|
||||
isActivityExperienceAnswer,
|
||||
isBirthDateAnswer,
|
||||
leadNoteFileIsImage,
|
||||
parseLeadFormNotes,
|
||||
} from '@/lib/lead-form-notes';
|
||||
import { ACTIVITY_EXPERIENCE_OPTIONS } from '@mento/shared';
|
||||
import {
|
||||
formatClockFa,
|
||||
formatJalaliNumeric,
|
||||
@@ -140,9 +146,15 @@ const editForm = ref({
|
||||
instagram: '',
|
||||
birthDate: '',
|
||||
trade: '',
|
||||
activityExperience: '' as string,
|
||||
notes: '',
|
||||
});
|
||||
|
||||
const activityExperienceOptions = [
|
||||
{ value: '', label: '—' },
|
||||
...ACTIVITY_EXPERIENCE_OPTIONS.map((value) => ({ value, label: value })),
|
||||
];
|
||||
|
||||
function formatDate(value: string | null | undefined) {
|
||||
if (!value) return '—';
|
||||
try {
|
||||
@@ -160,8 +172,18 @@ const shownBirthDate = computed(() => {
|
||||
if (lead.value?.birthDate) return formatDate(lead.value.birthDate);
|
||||
return formBirthDate.value || '—';
|
||||
});
|
||||
const formActivityExperience = computed(
|
||||
() =>
|
||||
noteView.value.rows.find((row) => isActivityExperienceAnswer(row.label) && !row.file)?.text ??
|
||||
'',
|
||||
);
|
||||
const shownActivityExperience = computed(
|
||||
() => lead.value?.activityExperience || formActivityExperience.value || '—',
|
||||
);
|
||||
const answerRows = computed(() =>
|
||||
noteView.value.rows.filter((row) => !isBirthDateAnswer(row.label)),
|
||||
noteView.value.rows.filter(
|
||||
(row) => !isBirthDateAnswer(row.label) && !isActivityExperienceAnswer(row.label),
|
||||
),
|
||||
);
|
||||
|
||||
const genderOptions = PERSON_GENDERS.map((key) => ({
|
||||
@@ -246,6 +268,7 @@ function startEdit() {
|
||||
? formatLocalDateInput(new Date(lead.value.birthDate))
|
||||
: '',
|
||||
trade: lead.value.trade ?? '',
|
||||
activityExperience: lead.value.activityExperience ?? '',
|
||||
notes: lead.value.notes ?? '',
|
||||
};
|
||||
}
|
||||
@@ -272,6 +295,7 @@ async function saveEdit() {
|
||||
instagram: editForm.value.instagram.trim() || null,
|
||||
birthDate: editForm.value.birthDate || null,
|
||||
trade: editForm.value.trade.trim() || null,
|
||||
activityExperience: editForm.value.activityExperience.trim() || null,
|
||||
notes: editForm.value.notes.trim() || null,
|
||||
});
|
||||
okMsg.value = 'لید ویرایش شد.';
|
||||
@@ -710,6 +734,17 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
||||
<a-input v-model:value="editForm.trade" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="سابقه فعالیت">
|
||||
<a-select
|
||||
v-model:value="editForm.activityExperience"
|
||||
allow-clear
|
||||
placeholder="اختیاری"
|
||||
style="width: 100%"
|
||||
:options="activityExperienceOptions"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="یادداشت">
|
||||
<a-textarea
|
||||
@@ -782,6 +817,9 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
||||
<span dir="ltr">{{ lead.instagram || '—' }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="صنف">{{ lead.trade || '—' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="سابقه فعالیت">
|
||||
{{ shownActivityExperience }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="منبع">
|
||||
{{ lead.source || '—' }}
|
||||
</a-descriptions-item>
|
||||
|
||||
Reference in New Issue
Block a user