feat(portal-ui): enhance user and device information display in admin and user devices tables

This commit is contained in:
2025-06-30 22:58:44 +05:00
parent 01b064aee7
commit 3cd3bbad16
5 changed files with 29 additions and 14 deletions

View File

@ -16,7 +16,6 @@ import {
import { cn } from "@/lib/utils";
import { getDevices } from "@/queries/devices";
import { tryCatch } from "@/utils/tryCatch";
import AddDevicesToCartButton from "../add-devices-to-cart-button";
import BlockDeviceDialog from "../block-device-dialog";
import ClientErrorMessage from "../client-error-message";
import DeviceCard from "../device-card";
@ -130,15 +129,23 @@ export async function AdminDevicesTable({
)}
</div>
</TableCell>
<TableCell className="font-medium">{device.user}</TableCell>
<TableCell className="font-medium">
<div className="flex flex-col items-start">
{device?.user?.name}
<span className="text-muted-foreground">{device?.user?.id_card}</span>
</div>
</TableCell>
<TableCell className="font-medium">{device.mac}</TableCell>
<TableCell className="font-medium">{device?.vendor}</TableCell>
<TableCell>
<BlockDeviceDialog
admin={isAdmin}
type={device.blocked ? "unblock" : "block"}
device={device}
/>
{!device.has_a_pending_payment && (
<BlockDeviceDialog
admin={isAdmin}
type={device.blocked ? "unblock" : "block"}
device={device}
/>
)}
</TableCell>
</TableRow>
))}

View File

@ -1,3 +1,5 @@
import { redirect } from "next/navigation";
import { getServerSession } from "next-auth";
import { authOptions } from "@/app/auth";
import {
Table,
@ -11,8 +13,6 @@ import {
} from "@/components/ui/table";
import { getDevices } from "@/queries/devices";
import { tryCatch } from "@/utils/tryCatch";
import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";
import ClickableRow from "./clickable-row";
import ClientErrorMessage from "./client-error-message";
import DeviceCard from "./device-card";