feat(tahesab): sync full customer profile fields into CRM people
Pull national id, address, city, and rasteh on import/refresh so person records match Tahesab, and surface them on the person form and profile. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -183,6 +183,18 @@ const externalCode = computed(() => {
|
||||
}
|
||||
return '';
|
||||
});
|
||||
function customFieldText(...keys: string[]) {
|
||||
const fields = person.value?.customFields ?? {};
|
||||
for (const key of keys) {
|
||||
const raw = fields[key];
|
||||
if (typeof raw === 'string' && raw.trim()) return raw.trim();
|
||||
if (typeof raw === 'number' && Number.isFinite(raw)) return String(raw);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
const nationalIdLabel = computed(() => customFieldText('nationalId', 'CodeMelli', 'codeMeli'));
|
||||
const cityLabel = computed(() => customFieldText('city', 'City'));
|
||||
const rastehLabel = computed(() => customFieldText('rasteh', 'Rasteh'));
|
||||
const SOURCE_LABELS: Record<string, string> = {
|
||||
manual: 'دستی',
|
||||
tahesab: 'تهحساب',
|
||||
@@ -444,6 +456,9 @@ const infoEmpty = computed(() => {
|
||||
!p.instagram &&
|
||||
!p.birthDate &&
|
||||
!p.referrer &&
|
||||
!nationalIdLabel.value &&
|
||||
!cityLabel.value &&
|
||||
!rastehLabel.value &&
|
||||
!(p.addresses?.length) &&
|
||||
!p.company &&
|
||||
!externalCode.value &&
|
||||
@@ -794,6 +809,18 @@ watch(() => route.query.tab, readTab, { immediate: true });
|
||||
<dt>معرف</dt>
|
||||
<dd>{{ person.referrer }}</dd>
|
||||
</div>
|
||||
<div v-if="nationalIdLabel" class="fact">
|
||||
<dt>کد ملی</dt>
|
||||
<dd dir="ltr">{{ toFaDigits(nationalIdLabel) }}</dd>
|
||||
</div>
|
||||
<div v-if="cityLabel" class="fact">
|
||||
<dt>شهر</dt>
|
||||
<dd>{{ cityLabel }}</dd>
|
||||
</div>
|
||||
<div v-if="rastehLabel" class="fact">
|
||||
<dt>رسته</dt>
|
||||
<dd dir="ltr">{{ toFaDigits(rastehLabel) }}</dd>
|
||||
</div>
|
||||
<div v-if="person.website" class="fact">
|
||||
<dt>وبسایت</dt>
|
||||
<dd dir="ltr">{{ person.website }}</dd>
|
||||
@@ -1119,6 +1146,15 @@ watch(() => route.query.tab, readTab, { immediate: true });
|
||||
<div><dt>وبسایت</dt><dd>{{ person.website || '—' }}</dd></div>
|
||||
<div><dt>اینستاگرام</dt><dd dir="ltr">{{ person.instagram || '—' }}</dd></div>
|
||||
<div><dt>معرف</dt><dd>{{ person.referrer || '—' }}</dd></div>
|
||||
<div>
|
||||
<dt>کد ملی</dt>
|
||||
<dd dir="ltr">{{ nationalIdLabel ? toFaDigits(nationalIdLabel) : '—' }}</dd>
|
||||
</div>
|
||||
<div><dt>شهر</dt><dd>{{ cityLabel || '—' }}</dd></div>
|
||||
<div>
|
||||
<dt>رسته</dt>
|
||||
<dd dir="ltr">{{ rastehLabel ? toFaDigits(rastehLabel) : '—' }}</dd>
|
||||
</div>
|
||||
<div class="wide">
|
||||
<dt>آدرسها</dt>
|
||||
<dd>
|
||||
|
||||
Reference in New Issue
Block a user