Files
hats-app/app/admin/report/history/page.tsx
T
Ichsan Kurniawan 60648f312d update
2026-02-25 13:39:59 +07:00

40 lines
1.3 KiB
TypeScript

import { type Metadata } from 'next';
import { FC, Suspense, lazy } from 'react';
import { Card } from '@/components/ui/card';
import LazyLoading from '@/components/loader/LazyLoading';
import dayjs from 'dayjs';
import { fetchDataWithPost } from '@/lib/fetchData';
const ComponentPage = lazy(() => import('./component'));
export const metadata: Metadata = {
title: "Admin | Attendance History",
}
type Props = {
searchParams: Promise<{ [key: string]: string | string[] | undefined }>
};
const MonthlyPresencePage: FC<Props> = async ({ searchParams }) => {
const start_date = (await searchParams)!.start_date
const end_date = (await searchParams)!.end_date
const data = await fetchDataWithPost('/presence/history', { start_date: start_date || dayjs().subtract(1, 'month'), end_date: end_date || dayjs().format('YYYY-MM-DD') })
return (
<>
<div className="flex flex-col">
<Card>
<Suspense fallback={<div className='flex justify-center items-center w-full h-[40vh]'><LazyLoading /></div>}>
<ComponentPage
data={data.history}
/>
</Suspense>
</Card>
</div>
</>
);
}
export default MonthlyPresencePage;