feat: add template checkpoint edit dialog and vendor management components
- Implemented TemplateCheckpointEditDialog for creating and editing inspection checkpoints. - Added VendorActions component for managing vendor actions including edit, activate/deactivate, and delete. - Created VendorContext for managing vendor state across components. - Developed VendorGeneralInfo component to display detailed vendor information. - Introduced AedSymbol and Money components for consistent currency representation. - Added PromptDialog for user input prompts throughout the application. - Implemented RelationLink component for unified related-data display in CRUD tables. - Created InspectionTemplatesClient for API interactions related to inspection templates.
This commit is contained in:
@@ -87,17 +87,23 @@ export function formatNumber(value?: number | string | null): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a numeric value as currency: "$1,500.00"
|
||||
* Plain-string currency formatter. For JSX use the <Money/> component which
|
||||
* renders the new AED dirham SVG. This string variant falls back to the "AED"
|
||||
* prefix so toasts, exports, and other non-JSX contexts stay readable.
|
||||
*/
|
||||
export function formatCurrency(
|
||||
value?: number | string | null,
|
||||
currency = "AED",
|
||||
locale?: string,
|
||||
fractionDigits = 2,
|
||||
): string {
|
||||
if (value == null || value === "") return "—"
|
||||
const num = typeof value === "string" ? Number(value) : value
|
||||
if (isNaN(num)) return "—"
|
||||
return new Intl.NumberFormat(locale, { style: "currency", currency }).format(num)
|
||||
const formatted = new Intl.NumberFormat(locale, {
|
||||
minimumFractionDigits: fractionDigits,
|
||||
maximumFractionDigits: fractionDigits,
|
||||
}).format(num)
|
||||
return `AED ${formatted}`
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user