Merge pull request #10 from i701/feat/wallet-topups
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 19m58s

refactor: update topup status handling in DynamicFilter and TopupsTable components 
This commit is contained in:
Abdulla Aidhaan
2025-07-05 19:45:45 +05:00
committed by GitHub
2 changed files with 20 additions and 13 deletions

View File

@ -26,8 +26,8 @@ export default async function Topups({
<DynamicFilter <DynamicFilter
inputs={[ inputs={[
{ {
label: "Paid", label: "Status",
name: "paid", name: "status",
type: "radio-group", type: "radio-group",
options: [ options: [
{ {
@ -35,12 +35,16 @@ export default async function Topups({
value: "", value: "",
}, },
{ {
label: "Paid", label: "Pending",
value: "true", value: "PENDING",
}, },
{ {
label: "Pending", label: "Cancelled",
value: "false", value: "CANCELLED",
},
{
label: "Paid",
value: "PAID",
}, },
], ],
}, },

View File

@ -122,7 +122,13 @@ export async function TopupsTable({
<TableCell> <TableCell>
<span className="font-semibold pr-2"> <span className="font-semibold pr-2">
{topup.is_expired ? <Badge>Expired</Badge> : <Badge variant="outline">{topup.status}</Badge>} {topup.paid ? (
<Badge className="bg-green-100 dark:bg-green-700" variant="outline">{topup.status}</Badge>
) : topup.is_expired ? (
<Badge className="text-black dark:text-white bg-yellow-100 dark:bg-yellow-700">Expired</Badge>
) : (
<Badge variant="outline">{topup.status}</Badge>
)}
</span> </span>
</TableCell> </TableCell>
<TableCell> <TableCell>
@ -150,10 +156,7 @@ export async function TopupsTable({
</TableRow> </TableRow>
</TableFooter> </TableFooter>
</Table> </Table>
<Pagination
totalPages={meta.total / meta.per_page}
currentPage={meta.current_page}
/>
</div> </div>
<div className="sm:hidden block"> <div className="sm:hidden block">
{data.map((topup) => ( {data.map((topup) => (
@ -161,8 +164,8 @@ export async function TopupsTable({
))} ))}
</div> </div>
<Pagination <Pagination
totalPages={meta?.last_page} totalPages={meta.total / meta.per_page}
currentPage={meta?.current_page} currentPage={meta.current_page}
/> />
</> </>
)} )}