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:
@@ -97,6 +97,9 @@ const website = ref('');
|
||||
const instagram = ref('');
|
||||
const birthDate = ref('');
|
||||
const referrer = ref('');
|
||||
const nationalId = ref('');
|
||||
const city = ref('');
|
||||
const rasteh = ref('');
|
||||
const addresses = ref<string[]>(['']);
|
||||
const notes = ref('');
|
||||
const tagsRaw = ref('');
|
||||
@@ -283,6 +286,16 @@ function fill(p: PersonDto) {
|
||||
mood.value = p.mood || 'newcomer';
|
||||
groupIds.value = (p.groups ?? []).map((g) => g.id);
|
||||
customFields.value = { ...(p.customFields ?? {}) };
|
||||
const cf = customFields.value;
|
||||
nationalId.value =
|
||||
typeof cf.nationalId === 'string'
|
||||
? cf.nationalId
|
||||
: typeof cf.nationalId === 'number'
|
||||
? String(cf.nationalId)
|
||||
: '';
|
||||
city.value = typeof cf.city === 'string' ? cf.city : '';
|
||||
rasteh.value =
|
||||
typeof cf.rasteh === 'string' || typeof cf.rasteh === 'number' ? String(cf.rasteh) : '';
|
||||
loyaltyPoints.value = p.loyaltyPoints ?? 0;
|
||||
loyaltyTierName.value = p.loyaltyTier?.name ?? '';
|
||||
}
|
||||
@@ -344,6 +357,18 @@ function parseTags(raw: string): string[] {
|
||||
}
|
||||
|
||||
function payload(): CreatePersonRequest {
|
||||
const fields: Record<string, unknown> = { ...customFields.value };
|
||||
const nid = nationalId.value.trim();
|
||||
if (nid) fields.nationalId = nid;
|
||||
else delete fields.nationalId;
|
||||
const cityVal = city.value.trim();
|
||||
if (cityVal) fields.city = cityVal;
|
||||
else delete fields.city;
|
||||
const rastehRaw = rasteh.value.trim();
|
||||
if (rastehRaw) {
|
||||
const n = Number(rastehRaw);
|
||||
fields.rasteh = Number.isFinite(n) && String(n) === rastehRaw ? n : rastehRaw;
|
||||
} else delete fields.rasteh;
|
||||
return {
|
||||
firstName: firstName.value,
|
||||
lastName: lastName.value,
|
||||
@@ -363,7 +388,7 @@ function payload(): CreatePersonRequest {
|
||||
companyId: companyId.value || null,
|
||||
mood: mood.value,
|
||||
groupIds: groupIds.value,
|
||||
customFields: customFields.value,
|
||||
customFields: fields,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -545,6 +570,21 @@ onMounted(load);
|
||||
<a-input v-model:value="referrer" placeholder="نام معرف" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="کد ملی">
|
||||
<a-input v-model:value="nationalId" dir="ltr" placeholder="کد ملی (تهحساب)" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="شهر">
|
||||
<a-input v-model:value="city" placeholder="شهر" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="رسته">
|
||||
<a-input v-model:value="rasteh" dir="ltr" placeholder="رسته حساب تهحساب" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-divider orientation="right">آدرسها</a-divider>
|
||||
|
||||
Reference in New Issue
Block a user