fix(dashboard): show price unit (toman) inside the amount-in-letters bracket
This commit is contained in:
@@ -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})`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user