mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-27 14:43:19 +00:00
feat(user-topups): add user topups page with dynamic filtering and admin table integration ✨
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Has been cancelled
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Has been cancelled
feat(admin-devices-table): update admin check to use is_admin and clean up device display logic ✨ feat(admin-topup-table): create admin topups table with pagination and detail view links ✨ fix(user-payments-table): correct user data access and display payment amount with currency ✨ feat(app-sidebar): add link for user topups in the admin sidebar ✨ fix(backend-types): enhance Payment interface to include user details for better data handling ✨
This commit is contained in:
@ -18,21 +18,18 @@ import { getDevices } from "@/queries/devices";
|
||||
import { tryCatch } from "@/utils/tryCatch";
|
||||
import BlockDeviceDialog from "../block-device-dialog";
|
||||
import ClientErrorMessage from "../client-error-message";
|
||||
import DeviceCard from "../device-card";
|
||||
import Pagination from "../pagination";
|
||||
|
||||
export async function AdminDevicesTable({
|
||||
searchParams,
|
||||
parentalControl,
|
||||
}: {
|
||||
searchParams: Promise<{
|
||||
[key: string]: unknown;
|
||||
}>;
|
||||
parentalControl?: boolean;
|
||||
}) {
|
||||
const resolvedParams = await searchParams;
|
||||
const session = await getServerSession(authOptions);
|
||||
const isAdmin = session?.user?.is_superuser;
|
||||
const isAdmin = session?.user?.is_admin;
|
||||
|
||||
const page = Number.parseInt(resolvedParams.page as string) || 1;
|
||||
const limit = 10;
|
||||
@ -67,7 +64,7 @@ export async function AdminDevicesTable({
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="hidden sm:block">
|
||||
<div>
|
||||
<Table className="overflow-scroll">
|
||||
<TableCaption>Table of all devices.</TableCaption>
|
||||
<TableHeader>
|
||||
@ -167,15 +164,7 @@ export async function AdminDevicesTable({
|
||||
</TableFooter>
|
||||
</Table>
|
||||
</div>
|
||||
<div className="sm:hidden my-4">
|
||||
{data?.map((device) => (
|
||||
<DeviceCard
|
||||
parentalControl={parentalControl}
|
||||
key={device.id}
|
||||
device={device}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<Pagination
|
||||
totalPages={meta?.last_page}
|
||||
currentPage={meta?.current_page}
|
||||
|
Reference in New Issue
Block a user