Initial Mento CRM: portal OTP, reports, SMS, and deploy for crm.montzar.ir.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
export const CURRENCY_OPTIONS = [
|
||||
{ code: 'IRR', labelFa: 'ریال ایران', suffix: 'ریال' },
|
||||
{ code: 'USD', labelFa: 'دلار آمریکا', suffix: 'دلار' },
|
||||
{ code: 'EUR', labelFa: 'یورو', suffix: 'یورو' },
|
||||
{ code: 'AED', labelFa: 'درهم امارات', suffix: 'درهم' },
|
||||
{ code: 'TRY', labelFa: 'لیر ترکیه', suffix: 'لیر' },
|
||||
{ code: 'GBP', labelFa: 'پوند انگلیس', suffix: 'پوند' },
|
||||
] as const;
|
||||
|
||||
export function currencySuffix(code: string): string {
|
||||
return CURRENCY_OPTIONS.find((c) => c.code === code)?.suffix ?? code;
|
||||
}
|
||||
|
||||
export function formatMoney(amount: number, currency = 'IRR'): string {
|
||||
try {
|
||||
return (
|
||||
new Intl.NumberFormat('fa-IR').format(amount) +
|
||||
' ' +
|
||||
currencySuffix(currency)
|
||||
);
|
||||
} catch {
|
||||
return `${amount} ${currency}`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user