mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 21:16:29 +00:00
Add CreateAttendance and update UI/hooks
Add a new CreateAttendance component to allow admins to create manual attendance (Alpha) with confirmation dialog and server API call. Lazy-load the CreateAttendance component in EmployeeAlpha and wrap usages with Suspense plus a loading fallback to reduce initial bundle size. Update Performance page to use a centered Suspense fallback. Improve ImportExcel UX by showing a full-loading state, tweaking button/icon styles, and fixing modal sizing/scroll behavior. Enhance useFetchWithAxios to accept nullable URLs and SWR options, adjust the fetcher signature, and return the nested data payload. Add a "use server" directive and imports in lib/server-api, and apply small type/formatting tweaks (table size cast and minor UI/text refinements).
This commit is contained in:
@@ -37,6 +37,7 @@ export default function ImportExcel() {
|
||||
|
||||
const onDrop = useCallback((acceptedFiles: any[]) => {
|
||||
acceptedFiles.forEach(async (file: any) => {
|
||||
setFullLoading(true);
|
||||
const reader = new FileReader();
|
||||
const workbook = new ExcelJS.Workbook();
|
||||
|
||||
@@ -93,18 +94,18 @@ export default function ImportExcel() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button variant='outline' onClick={() => setShowModal(true)}><FileSpreadsheet />Import Excel</Button>
|
||||
<Button variant='outline' onClick={() => setShowModal(true)}><FileSpreadsheet className='text-muted-foreground' />Import Excel</Button>
|
||||
|
||||
{showModal ?
|
||||
<AlertDialog open={true}>
|
||||
<AlertDialogContent className={`max-h-[90vh] duration-300 min-w-full ${rowData && rowData.length > 0 ? 'min-w-[90vw]' : 'sm:min-w-[600px]'} overflow-y-auto`}>
|
||||
<AlertDialogContent className={`max-h-[95vh] overflow-y-hidden duration-300 min-w-full ${rowData && rowData.length > 0 ? 'min-w-[90vw]' : 'sm:min-w-[600px]'}`}>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>{rowData && rowData.length > 0 ? "Review Your Data" : "Upload Excel File"}</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
{rowData && rowData.length > 0 ? "Please review attendance data first before saving!" : "Please attach your excel file for batching import"}
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex flex-col gap-2 max-h-[65vh] md:max-h-[70vh] 2xl:max-h-[75vh] overflow-y-auto">
|
||||
{/* Drop area */}
|
||||
<Dropzone ref={dropzoneRef} onDrop={onDrop} multiple={false} noClick noKeyboard
|
||||
accept={{
|
||||
|
||||
@@ -111,7 +111,7 @@ const ComponentPage: FC<Props> = ({ data }) => {
|
||||
defaultPageSize: 15,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
size: 'middle'
|
||||
size: 'middle' as any
|
||||
},
|
||||
scroll: { x: 'max-content' },
|
||||
tableLayout: 'auto',
|
||||
|
||||
Reference in New Issue
Block a user