mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:46:29 +00:00
7f8e6637e4
Extract NextAuth configuration into a shared library, load admin sidebar items from role permissions, and update related RBAC types and UI.
67 lines
2.5 KiB
TypeScript
67 lines
2.5 KiB
TypeScript
import { type Metadata } from "next";
|
|
|
|
import DateRangePicker from "./components/DateRangePicker";
|
|
import { Card, CardContent } from "@/components/ui/card";
|
|
import { Suspense, lazy } from "react";
|
|
import SkeletonTable from "@/components/skeleton/SkeletonTable";
|
|
import TabsComponent from "./components/Tabs";
|
|
import { getServerSession } from "next-auth";
|
|
import { authOptions } from "@/lib/auth";
|
|
|
|
const AttendanceHistory = lazy(() => import("./attendance"));
|
|
const LeavePermitHistory = lazy(() => import("./leave-permit"));
|
|
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const session = await getServerSession(authOptions)
|
|
|
|
return {
|
|
title: `${session?.user?.detail.fullname || 'User'}'s History - HIS Attendance Task System (H.A.T.s)`,
|
|
}
|
|
}
|
|
|
|
type Props = {
|
|
searchParams: Promise<{ [key: string]: string | string[] | undefined }>
|
|
};
|
|
|
|
export default async function HistoryPage({ searchParams }: Props) {
|
|
const tab = (await searchParams)!.tab
|
|
|
|
return (
|
|
<>
|
|
<div className="flex-1 space-y-8 p-6 sm:p-8 pt-6 pb-8">
|
|
<div className="flex flex-col sm:flex-row items-start justify-between space-y-2 sm:space-y-0">
|
|
<div>
|
|
<h1 className="text-lg sm:text-3xl font-medium tracking-tight capitalize">Attendance History</h1>
|
|
<p className="text-xs md:text-base text-muted-foreground sm:mt-1">Here is list of your attendance history</p>
|
|
</div>
|
|
<div className="flex items-center space-x-2">
|
|
<DateRangePicker />
|
|
{/* <ExportComponent data={all.history} /> */}
|
|
</div>
|
|
</div>
|
|
|
|
<TabsComponent />
|
|
<Card>
|
|
<CardContent>
|
|
<Suspense fallback={<SkeletonTable />} key={tab as string}>
|
|
{tab === 'leave-permit' ?
|
|
<LeavePermitHistory searchParams={searchParams} />
|
|
:
|
|
<AttendanceHistory searchParams={searchParams} />
|
|
}
|
|
</Suspense>
|
|
</CardContent>
|
|
</Card>
|
|
|
|
{/* <Card>
|
|
<CardContent>
|
|
<Suspense fallback={<LazyLoading />}>
|
|
<DataTable data={getFilterData()} />
|
|
</Suspense>
|
|
</CardContent>
|
|
</Card> */}
|
|
</div>
|
|
</>
|
|
)
|
|
} |