feat(auth): referrer code at signup and agent code in profile

Optional referrer agent code in registration with field validation UX. Show read-only agent referral code in profile edit and desktop overview.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-04 10:38:16 +03:30
co-authored by Cursor
parent 9c35450b31
commit f252749d18
7 changed files with 132 additions and 7 deletions
@@ -54,7 +54,9 @@ const checksCount = computed(() => {
const customerCode = computed(() => {
const u = auth.user
if (!u) return toPersianDigits('—')
if (auth.isAgent && u.agentCode) return toPersianDigits(u.agentCode)
if (auth.isAgent) {
return u.agentCode ? toPersianDigits(u.agentCode) : toPersianDigits('—')
}
if (u.nationalId) return toPersianDigits(u.nationalId.slice(-6).padStart(6, '0'))
return toPersianDigits(u.id?.slice(-6) ?? '—')
})
@@ -73,7 +75,8 @@ const joinDate = computed(() =>
const creditBalance = computed(() => 0)
const companyRows = computed(() => [
const companyRows = computed(() => {
const rows: Array<{ label: string; value: string; badge?: boolean }> = [
{ label: 'نام شرکت', value: auth.fullName || '—' },
{ label: 'شناسه ملی', value: auth.user?.nationalId ? toPersianDigits(auth.user.nationalId) : '—' },
{
@@ -87,7 +90,17 @@ const companyRows = computed(() => [
badge: true,
},
{ label: 'وضعیت حساب', value: 'فعال', badge: true },
])
]
if (auth.isAgent) {
rows.splice(1, 0, {
label: 'کد واسطه',
value: auth.user?.agentCode
? toPersianDigits(auth.user.agentCode)
: '—',
})
}
return rows
})
const quickAccess = [
{ label: 'حساب‌های بانکی', icon: IconCashSettlement },