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);
|
return numToWordsFa(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
// full price label: comma number + words in parentheses
|
// full price label: comma number + words with the unit INSIDE the brackets
|
||||||
// "52800" -> "۵۲٬۸۰۰ (پنجاه و دو هزار و هشتصد)"
|
// "52800" -> "۵۲٬۸۰۰ (پنجاه و دو هزار و هشتصد تومان)"
|
||||||
export function priceLabel(v: unknown, unit?: string): string {
|
export function priceLabel(v: unknown, unit?: string): string {
|
||||||
const n = parseNum(v);
|
const n = parseNum(v);
|
||||||
if (n == null) return "";
|
if (n == null) return "";
|
||||||
const num = groupCommas(n, true);
|
const num = groupCommas(n, true);
|
||||||
const words = toWords(n);
|
const words = toWords(n);
|
||||||
const suffix = unit ? ` ${unit}` : "";
|
return unit ? `${num} (${words} ${unit})` : `${num} (${words})`;
|
||||||
return `${num}${suffix} (${words})`;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ export function QuoteCard({ store, q, expanded, onToggleExpand, onAccept, onEdit
|
|||||||
<InfoCell label="مجموع">
|
<InfoCell label="مجموع">
|
||||||
{pc ? (
|
{pc ? (
|
||||||
<span className="font-bold tabular-nums">
|
<span className="font-bold tabular-nums">
|
||||||
{pc.num} <span className="num-words">تومان</span> <span className="num-words">({pc.words})</span>
|
{pc.num} <span className="num-words">({pc.words} تومان)</span>
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
"—"
|
"—"
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ export function QuoteRow({ store, q, expanded, onToggleExpand, onAccept, onEdit
|
|||||||
<td className="text-[13px] font-semibold tabular-nums whitespace-nowrap">
|
<td className="text-[13px] font-semibold tabular-nums whitespace-nowrap">
|
||||||
{pc ? (
|
{pc ? (
|
||||||
<>
|
<>
|
||||||
{pc.num} <span className="num-words">({pc.words})</span>
|
{pc.num} <span className="num-words">({pc.words} تومان)</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
"—"
|
"—"
|
||||||
|
|||||||
Reference in New Issue
Block a user