From 154226b48dfe24ec2f6cf6d948602e67cd3957d3 Mon Sep 17 00:00:00 2001 From: i701 Date: Sun, 6 Jul 2025 19:48:24 +0500 Subject: [PATCH] =?UTF-8?q?feat:=20add=20radio=20filter=20for=20topup=20ex?= =?UTF-8?q?piry=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(dashboard)/top-ups/page.tsx | 19 +++++++++++++++++++ components/generic-filter.tsx | 19 +++++++++++++++++++ components/ui/app-sidebar.tsx | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/app/(dashboard)/top-ups/page.tsx b/app/(dashboard)/top-ups/page.tsx index ad41ebc..6aaf80d 100644 --- a/app/(dashboard)/top-ups/page.tsx +++ b/app/(dashboard)/top-ups/page.tsx @@ -48,6 +48,25 @@ export default async function Topups({ }, ], }, + { + label: "Topup Expiry", + name: "is_expired", + type: "radio-group", + options: [ + { + label: "All", + value: "", + }, + { + label: "Expired", + value: "true", + }, + { + label: "Not Expired", + value: "false", + }, + ], + }, { label: "Topup Amount", name: "amount", diff --git a/components/generic-filter.tsx b/components/generic-filter.tsx index 5ef3c53..f290848 100644 --- a/components/generic-filter.tsx +++ b/components/generic-filter.tsx @@ -388,6 +388,25 @@ export default function DynamicFilter<

); } + if (config.type === "radio-group") { + const stringValue = value as string; + // For true/false values, display the label instead of the value + if (stringValue === "true" || stringValue === "false") { + const option = config.options.find((opt) => opt.value === stringValue); + const displayValue = option?.label || stringValue; + return ( +

+ {config.label}: {displayValue} +

+ ); + } + // For other values, display as normal + return ( +

+ {config.label}: {stringValue} +

+ ); + } return (

{config.label}: {value} diff --git a/components/ui/app-sidebar.tsx b/components/ui/app-sidebar.tsx index a156e9d..5dc6431 100644 --- a/components/ui/app-sidebar.tsx +++ b/components/ui/app-sidebar.tsx @@ -82,7 +82,7 @@ export async function AppSidebar({ }, { title: "Parental Control", - link: "/parental-control", + link: "/parental-control?page=1", icon: , perm_identifier: "device", },