| @@ -29,9 +29,9 @@ | ||
| 29 | 29 | CardTitle, |
| 30 | 30 | } from "../components/ui/card"; |
| 31 | 31 | import { ConditionalRender } from "../components/ui/conditional-render"; |
| 32 | 32 | import { Skeleton } from "../components/ui/skeleton"; |
| 33 | -import { getCurrencySymbol, getCurrency } from "../data/currencies"; | |
| 33 | +import { formatYatraMoney } from "../lib/currency-display"; | |
| 34 | 34 | |
| 35 | 35 | function paymentStr(v: unknown, fallback = ""): string { |
| 36 | 36 | if (v == null || v === "") return fallback; |
| 37 | 37 | return String(v); |
| @@ -54,8 +54,9 @@ | ||
| 54 | 54 | trip_id: number; |
| 55 | 55 | trip_title: string; |
| 56 | 56 | amount: number; |
| 57 | 57 | payment_method: string; |
| 58 | + payment_method_label?: string; | |
| 58 | 59 | payment_status: string; |
| 59 | 60 | transaction_id: string; |
| 60 | 61 | payment_date: string; |
| 61 | 62 | notes: string; |
| @@ -130,19 +131,13 @@ | ||
| 130 | 131 | day: "numeric", |
| 131 | 132 | }); |
| 132 | 133 | }; |
| 133 | 134 | |
| 134 | - const formatPrice = (price: number, currencyCode: string = "USD") => { | |
| 135 | - const symbol = getCurrencySymbol(currencyCode); | |
| 136 | - const currencyData = getCurrency(currencyCode); | |
| 137 | - const decimals = currencyData?.decimalDigits ?? 2; | |
| 135 | + const formatPrice = (price: number, currencyCode: string = "USD") => | |
| 136 | + formatYatraMoney(Number(price) || 0, currencyCode, { | |
| 137 | + zeroAsUnknown: false, | |
| 138 | + }); | |
| 138 | 139 | |
| 139 | - return `${symbol}${new Intl.NumberFormat(undefined, { | |
| 140 | - minimumFractionDigits: decimals, | |
| 141 | - maximumFractionDigits: decimals, | |
| 142 | - }).format(price)}`; | |
| 143 | - }; | |
| 144 | - | |
| 145 | 140 | const getPaymentStatusBadge = (status: string) => { |
| 146 | 141 | const statusMap: Record<string, { className: string; label: string }> = { |
| 147 | 142 | completed: { |
| 148 | 143 | className: |
| @@ -385,9 +380,9 @@ | ||
| 385 | 380 | </label> |
| 386 | 381 | <div className="mt-1 flex items-center gap-2"> |
| 387 | 382 | <CreditCard className="w-4 h-4 text-gray-400" /> |
| 388 | 383 | <p className="text-sm font-medium text-gray-900 dark:text-white"> |
| 389 | - {payment.payment_method} | |
| 384 | + {payment.payment_method_label || payment.payment_method} | |
| 390 | 385 | </p> |
| 391 | 386 | </div> |
| 392 | 387 | </div> |
| 393 | 388 | <div> |