i701 0f17800a00 Refactor UI components for improved consistency and functionality
- Removed unnecessary border styles from various dashboard components including Devices, DeviceDetails, Parental Control, Payments, and Users pages to enhance visual consistency.
- Updated DevicesTable to utilize a new ClickableRow component for better device interaction and management.
- Refactored AddDevicesToCartButton to use a checkbox for selecting devices, improving user experience.
- Enhanced DeviceCard component to streamline device information display and interaction.
- Overall improvements to the layout and responsiveness of the dashboard components.

These changes enhance the user interface and improve the maintainability of the codebase.
2024-12-26 00:43:39 +05:00

52 lines
1.5 KiB
TypeScript

import DevicesToPay from "@/components/devices-to-pay";
import { auth } from "@/lib/auth";
import prisma from "@/lib/db";
import { cn } from "@/lib/utils";
import { headers } from "next/headers";
import React from "react";
export default async function PaymentPage({
params,
}: {
params: Promise<{ paymentId: string }>;
}) {
const session = await auth.api.getSession({
headers: await headers()
})
const user = await prisma.user.findUnique({
where: {
id: session?.session.userId
}
})
const paymentId = (await params).paymentId;
const payment = await prisma.payment.findUnique({
where: {
id: paymentId,
},
include: {
devices: true,
},
});
const formula = await prisma.billFormula.findFirst();
return (
<div>
<div className="flex justify-between items-center text-gray-500 text-2xl font-bold title-bg py-4 px-2 mb-4">
<h3>Payment</h3>
<span className={cn("text-sm border px-4 py-2 rounded-md uppercase font-semibold", payment?.paid ? "text-green-500 bg-green-500/20" : "text-yellow-500 bg-yellow-500/20")}>
{payment?.paid ? "Paid" : "Pending"}
</span>
</div>
<div
id="user-filters"
className="pb-4 gap-4 flex sm:flex-row flex-col items-start justify-start"
>
<DevicesToPay
user={user || undefined}
billFormula={formula ?? undefined}
payment={payment || undefined}
/>
</div>
</div>
);
}