mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-23 14:02:01 +00:00
- Added new PaymentPage component for processing payments and displaying devices to pay. - Introduced DeviceDetails component for viewing individual device information. - Implemented PriceCalculator component for calculating costs based on user input. - Integrated Jotai for state management across components, including device cart functionality. - Updated layout to include Jotai Provider for state management. - Enhanced DevicesTable with AddDevicesToCartButton for adding devices to the cart. - Refactored sidebar to include a link to the new Price Calculator page. - Updated Prisma schema to include Payment and BillFormula models for better data handling. - Added new UI components for device cart management and drawer functionality. - Improved overall user experience with responsive design adjustments and new UI elements.
61 lines
1.4 KiB
TypeScript
61 lines
1.4 KiB
TypeScript
import { DevicesTable } from "@/components/devices-table";
|
|
import Filter from "@/components/filter";
|
|
import Search from "@/components/search";
|
|
import AddDeviceDialogForm from "@/components/user/add-device-dialog";
|
|
import { getCurrentUser } from "@/lib/auth-utils";
|
|
import { AArrowDown, AArrowUp } from "lucide-react";
|
|
import React, { Suspense } from "react";
|
|
|
|
const sortfilterOptions = [
|
|
{
|
|
value: 'asc',
|
|
label: 'Ascending',
|
|
icon: <AArrowUp size={16} />,
|
|
},
|
|
{
|
|
value: 'desc',
|
|
label: 'Descending',
|
|
icon: <AArrowDown size={16} />,
|
|
},
|
|
]
|
|
|
|
|
|
export default async function Devices({
|
|
searchParams,
|
|
}: {
|
|
searchParams: Promise<{
|
|
query: string;
|
|
page: number;
|
|
sortBy: string;
|
|
status: string;
|
|
}>;
|
|
}) {
|
|
const query = (await searchParams)?.query || "";
|
|
const user = await getCurrentUser()
|
|
return (
|
|
<div>
|
|
<div className="flex justify-between items-center border-b-2 text-gray-500 text-2xl font-bold title-bg py-4 px-2 mb-4">
|
|
<h3>
|
|
My Devices
|
|
</h3>
|
|
<AddDeviceDialogForm user_id={user?.id} />
|
|
</div>
|
|
|
|
<div
|
|
id="user-filters"
|
|
className=" border-b-2 pb-4 gap-4 flex sm:flex-row flex-col items-start justify-start"
|
|
>
|
|
<Search />
|
|
<Filter
|
|
options={sortfilterOptions}
|
|
defaultOption="asc"
|
|
queryParamKey="sortBy"
|
|
/>
|
|
</div>
|
|
<Suspense key={query} fallback={"loading...."}>
|
|
<DevicesTable searchParams={searchParams} />
|
|
</Suspense>
|
|
</div>
|
|
);
|
|
}
|