From 6a91d32cd50aed28a7933940c598a2f2219ad8e9 Mon Sep 17 00:00:00 2001 From: ali_mohaghegh Date: Thu, 27 Aug 2026 15:04:25 +0330 Subject: [PATCH] fix(dashboard): show price unit (toman) inside the amount-in-letters bracket --- frontend/src/lib/numutil.ts | 7 +++---- frontend/src/pages/Dashboard/QuoteCard.tsx | 2 +- frontend/src/pages/Dashboard/QuoteRow.tsx | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/src/lib/numutil.ts b/frontend/src/lib/numutil.ts index 4650279..9b94052 100644 --- a/frontend/src/lib/numutil.ts +++ b/frontend/src/lib/numutil.ts @@ -91,13 +91,12 @@ export function toWords(v: unknown): string { return numToWordsFa(n); } -// full price label: comma number + words in parentheses -// "52800" -> "۵۲٬۸۰۰ (پنجاه و دو هزار و هشتصد)" +// full price label: comma number + words with the unit INSIDE the brackets +// "52800" -> "۵۲٬۸۰۰ (پنجاه و دو هزار و هشتصد تومان)" export function priceLabel(v: unknown, unit?: string): string { const n = parseNum(v); if (n == null) return ""; const num = groupCommas(n, true); const words = toWords(n); - const suffix = unit ? ` ${unit}` : ""; - return `${num}${suffix} (${words})`; + return unit ? `${num} (${words} ${unit})` : `${num} (${words})`; } diff --git a/frontend/src/pages/Dashboard/QuoteCard.tsx b/frontend/src/pages/Dashboard/QuoteCard.tsx index 7a3b275..c8587fc 100644 --- a/frontend/src/pages/Dashboard/QuoteCard.tsx +++ b/frontend/src/pages/Dashboard/QuoteCard.tsx @@ -176,7 +176,7 @@ export function QuoteCard({ store, q, expanded, onToggleExpand, onAccept, onEdit {pc ? ( - {pc.num} تومان ({pc.words}) + {pc.num} ({pc.words} تومان) ) : ( "—" diff --git a/frontend/src/pages/Dashboard/QuoteRow.tsx b/frontend/src/pages/Dashboard/QuoteRow.tsx index 71838a6..5694f99 100644 --- a/frontend/src/pages/Dashboard/QuoteRow.tsx +++ b/frontend/src/pages/Dashboard/QuoteRow.tsx @@ -129,7 +129,7 @@ export function QuoteRow({ store, q, expanded, onToggleExpand, onAccept, onEdit {pc ? ( <> - {pc.num} ({pc.words}) + {pc.num} ({pc.words} تومان) ) : ( "—"