diff --git a/components/payments-table.tsx b/components/payments-table.tsx index 014593a..4b79ec5 100644 --- a/components/payments-table.tsx +++ b/components/payments-table.tsx @@ -59,7 +59,7 @@ export async function PaymentsTable({ Details Duration - + Status Amount @@ -84,6 +84,8 @@ export async function PaymentsTable({ month: "short", day: "2-digit", year: "numeric", + minute: "2-digit", + hour: "2-digit", }, )} @@ -98,16 +100,6 @@ export async function PaymentsTable({ View Details - - {payment.paid ? "Paid" : "Unpaid"} -

Devices

@@ -124,9 +116,30 @@ export async function PaymentsTable({
+ {payment.number_of_months} Months + + + {payment.paid ? ( + + {payment.status} + + ) : payment.is_expired ? ( + Expired + ) : ( + {payment.status} + )} + + {payment.amount.toFixed(2)} @@ -185,6 +198,8 @@ function MobilePaymentDetails({ payment }: { payment: Payment }) { month: "short", day: "2-digit", year: "numeric", + minute: "2-digit", + hour: "2-digit", })} @@ -198,16 +213,6 @@ function MobilePaymentDetails({ payment }: { payment: Payment }) { View Details - - {payment.paid ? "Paid" : "Unpaid"} -

Devices

@@ -226,9 +231,29 @@ function MobilePaymentDetails({ payment }: { payment: Payment }) {

Amount

- - {payment.amount.toFixed(2)} MVR - +
+ + {payment.amount.toFixed(2)} MVR + + + {payment.paid ? ( + + {payment.status} + + ) : payment.is_expired ? ( + Expired + ) : ( + {payment.status} + )} + +
diff --git a/components/topups-table.tsx b/components/topups-table.tsx index f7fb0ab..f85e3eb 100644 --- a/components/topups-table.tsx +++ b/components/topups-table.tsx @@ -103,19 +103,6 @@ export async function TopupsTable({ View Details - {!topup.is_expired && - topup.status !== "CANCELLED" && ( - - {topup.paid ? "Paid" : "Unpaid"} - - )}
@@ -203,18 +190,6 @@ function MobileTopupDetails({ topup }: { topup: Topup }) { View Details - {!topup.is_expired && topup.status !== "CANCELLED" && ( - - {topup.paid ? "Paid" : "Unpaid"} - - )}
diff --git a/lib/backend-types.ts b/lib/backend-types.ts index a42e8f8..1cdfcd5 100644 --- a/lib/backend-types.ts +++ b/lib/backend-types.ts @@ -81,9 +81,12 @@ export interface Payment { paid: boolean; paid_at: string | null; method: string; - expires_at: string | null; + expires_at: string; + is_expired: boolean; created_at: string; updated_at: string; + status: "CANCELLED" | "PENDING" | "PAID"; + mib_reference: string | null; user: number; }