diff --git a/frontend/src/app/[lang]/dashboard/admin/invoices/page.tsx b/frontend/src/app/[lang]/dashboard/admin/invoices/page.tsx index bffd9f1..f35ba7b 100644 --- a/frontend/src/app/[lang]/dashboard/admin/invoices/page.tsx +++ b/frontend/src/app/[lang]/dashboard/admin/invoices/page.tsx @@ -65,6 +65,8 @@ export default function AdminInvoicesPage() { const lineLabel = (label?: string) => (isFa ? translateInvoiceLabel(label) : (label ?? '-')); const lineDesc = (desc?: string) => (isFa ? translateInvoiceDescription(desc) : (desc ?? '')); const reasonLabel = (reason?: string) => (isFa ? translateInvoiceReason(reason) : (reason ?? '-')); + const methodLabel = (m?: string) => + m ? ({ wallet: inv.methodWallet, gateway: inv.methodGateway, mixed: inv.methodMixed } as Record)[m] ?? m : '-'; const downloadPdfMutation = useMutation({ mutationFn: (invoice: Invoice) => @@ -168,7 +170,7 @@ export default function AdminInvoicesPage() { {statusLabel(invoice.status)} - {invoice.paymentMethod || '-'} + {methodLabel(invoice.paymentMethod)}

{formatPrice(invoice.dueAmount)} {t.common.currencyShort}

{inv.total} {formatPrice(invoice.total)} {t.common.currencyShort}

@@ -229,7 +231,7 @@ export default function AdminInvoicesPage() {
- {inv.method}: {selectedInvoice.paymentMethod || '-'} + {inv.method}: {methodLabel(selectedInvoice.paymentMethod)}
diff --git a/frontend/src/app/[lang]/dashboard/invoices/page.tsx b/frontend/src/app/[lang]/dashboard/invoices/page.tsx index c6d2ea1..3f4729e 100644 --- a/frontend/src/app/[lang]/dashboard/invoices/page.tsx +++ b/frontend/src/app/[lang]/dashboard/invoices/page.tsx @@ -30,6 +30,8 @@ export default function InvoicesPage() { const lineLabel = (label?: string) => (isFa ? translateInvoiceLabel(label) : (label ?? '-')); const lineDesc = (desc?: string) => (isFa ? translateInvoiceDescription(desc) : (desc ?? '')); const reasonLabel = (reason?: string) => (isFa ? translateInvoiceReason(reason) : (reason ?? '-')); + const methodLabel = (m?: string) => + m ? ({ wallet: inv.methodWallet, gateway: inv.methodGateway, mixed: inv.methodMixed } as Record)[m] ?? m : '-'; const authUser = useAuthStore((s) => s.user); const queryClient = useQueryClient(); const searchParams = useSearchParams(); @@ -234,7 +236,7 @@ export default function InvoicesPage() {
{inv.total}{formatPrice(selectedInvoice.total)} {inv.toman}
{inv.paidLabel}{formatPrice(selectedInvoice.paidAmount)} {inv.toman}
{inv.due}{formatPrice(selectedInvoice.dueAmount)} {inv.toman}
-
{inv.method}{selectedInvoice.paymentMethod || '-'}
+
{inv.method}{methodLabel(selectedInvoice.paymentMethod)}
diff --git a/frontend/src/lib/invoice-pdf.ts b/frontend/src/lib/invoice-pdf.ts index 622caf2..eb8f3db 100644 --- a/frontend/src/lib/invoice-pdf.ts +++ b/frontend/src/lib/invoice-pdf.ts @@ -39,6 +39,15 @@ export function buildInvoicePdfData( const trDesc = (desc?: string) => (isFa ? translateInvoiceDescription(desc) : desc ?? ''); const trReason = (reason?: string) => (isFa ? translateInvoiceReason(reason) : reason ?? '-'); + const methodLabel = (m?: string) => { + const map: Record = { + wallet: inv.methodWallet, + gateway: inv.methodGateway, + mixed: inv.methodMixed, + }; + return m ? map[m] ?? m : '-'; + }; + const cust = customer ?? invoice.user ?? undefined; const fullName = [cust?.firstName, cust?.lastName].filter(Boolean).join(' ').trim(); const phone = cust?.phone || undefined; @@ -50,7 +59,7 @@ export function buildInvoicePdfData( meta.push( { label: pdf.application, value: invoice.application?.name || trReason(invoice.reason) }, { label: pdf.createdAt, value: formatDate(invoice.createdAt) }, - { label: inv.method, value: invoice.paymentMethod || '-' }, + { label: inv.method, value: methodLabel(invoice.paymentMethod) }, ); if (invoice.paidAt) meta.push({ label: pdf.paidAt, value: formatDate(invoice.paidAt) }); if (invoice.gatewayTrackingCode) meta.push({ label: inv.tracking, value: invoice.gatewayTrackingCode });