feat: update Topup interface with status and paid_at fields; modify table display for topup details

This commit is contained in:
2025-07-05 17:53:32 +05:00
parent a41be97cdf
commit ef7121f247
3 changed files with 18 additions and 25 deletions

View File

@ -93,7 +93,7 @@ export default function TopupToPay({ topup, disabled }: { topup?: Topup, disable
</TableCaption> </TableCaption>
<TableBody className=""> <TableBody className="">
<TableRow> <TableRow>
<TableCell>Topup created at</TableCell> <TableCell>Topup created</TableCell>
<TableCell className="text-right text-muted-foreground"> <TableCell className="text-right text-muted-foreground">
{new Date(topup?.created_at ?? "").toLocaleDateString("en-US", { {new Date(topup?.created_at ?? "").toLocaleDateString("en-US", {
month: "short", month: "short",
@ -106,22 +106,24 @@ export default function TopupToPay({ topup, disabled }: { topup?: Topup, disable
</TableCell> </TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell>Topup expires at</TableCell> <TableCell>Payment received</TableCell>
<TableCell className="text-right text-sarLinkOrange"> <TableCell className="text-right text-sarLinkOrange">
{new Date(topup?.expires_at ?? "").toLocaleDateString("en-US", { {topup?.paid_at
? new Date(topup.paid_at).toLocaleDateString("en-US", {
month: "short", month: "short",
day: "2-digit", day: "2-digit",
year: "numeric", year: "numeric",
minute: "2-digit", minute: "2-digit",
hour: "2-digit", hour: "2-digit",
second: "2-digit", second: "2-digit",
})} })
: "-"}
</TableCell> </TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell>MIB Reference</TableCell> <TableCell>MIB Reference</TableCell>
<TableCell className="text-right"> <TableCell className="text-right">
{topup?.mib_reference ? topup.mib_reference : "N/A"} {topup?.mib_reference ? topup.mib_reference : "-"}
</TableCell> </TableCell>
</TableRow> </TableRow>
</TableBody> </TableBody>

View File

@ -60,8 +60,7 @@ export async function TopupsTable({
<TableHeader> <TableHeader>
<TableRow> <TableRow>
<TableHead>Details</TableHead> <TableHead>Details</TableHead>
<TableHead>Expires at</TableHead> <TableHead>Status</TableHead>
<TableHead>Expired</TableHead>
<TableHead>Amount</TableHead> <TableHead>Amount</TableHead>
</TableRow> </TableRow>
</TableHeader> </TableHeader>
@ -120,20 +119,10 @@ export async function TopupsTable({
</div> </div>
</div> </div>
</TableCell> </TableCell>
<TableCell>
<span>
{new Date(topup.expires_at).toLocaleDateString("en-US", {
month: "short",
day: "2-digit",
year: "numeric",
minute: "2-digit",
hour: "2-digit",
})}
</span>
</TableCell>
<TableCell> <TableCell>
<span className="font-semibold pr-2"> <span className="font-semibold pr-2">
{topup.is_expired ? <Badge>Yes</Badge> : <Badge variant="secondary">No</Badge>} {topup.is_expired ? <Badge>Expired</Badge> : <Badge variant="outline">{topup.status}</Badge>}
</span> </span>
</TableCell> </TableCell>
<TableCell> <TableCell>

View File

@ -64,6 +64,8 @@ export interface Topup {
name: string; name: string;
}; };
paid: boolean; paid: boolean;
status: "CANCELLED" | "PENDING" | "VERIFIED";
paid_at: string | null;
mib_reference: string | null; mib_reference: string | null;
expires_at: string; expires_at: string;
is_expired: boolean; is_expired: boolean;