Files
hats-app/app/admin/report/leave-permit-sick/component/Detail.tsx
T
Ichsan Kurniawan 93a9b489d0 Improve task views mobile responsiveness
This commit updates the task dashboard and assignment views for smaller screens by tightening spacing, improving text wrapping, and making filter/search controls responsive. It also refreshes the assignment detail layout with clearer date spans, team summaries, and switchable grid/list member views, while polishing client and assignment cards for better readability on mobile.
2026-10-06 11:24:30 +07:00

88 lines
5.3 KiB
TypeScript

import ViewAvatar from '@/components/ViewAvatar';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { getVariantWorkingStatus } from '@/lib/helper';
import dayjs from 'dayjs';
import { Dispatch, FC, MouseEvent, SetStateAction } from 'react';
type Props = {
open: boolean
onOpenChange: Dispatch<SetStateAction<boolean>>
data: any
onClose: (e: MouseEvent<HTMLButtonElement>) => any
};
const DetailModalComponent: FC<Props> = ({ data, open, onOpenChange, onClose }) => {
return (
<>
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className='max-w-full md:max-w-[760px] py-6 md:px-10 overflow-y-auto max-h-[95vh]'>
<DialogHeader className='flex flex-row justify-between'>
<div>
<DialogTitle>Detail Application Form</DialogTitle>
<DialogDescription>
This is detail of application that has been submited.
</DialogDescription>
</div>
</DialogHeader>
<div className='grid grid-cols-1 md:grid-cols-5 text-center md:text-left text-sm md:text-base md:my-3'>
<div className='col-span-2 flex flex-col items-center md:items-start'>
<ViewAvatar avatar={data.avatar} className='w-52 h-52 sm:w-52 sm:h-52 rounded-xl shadow' />
<span className='text-base font-semibold mt-2'>{data.fullname}</span>
<span className='text-muted-foreground'>{data?.position_name || data?.nickname}</span>
</div>
<div className='col-span-3 space-y-3 mt-5 md:mt-0'>
<div>
<p className='text-muted-foreground text-xs md:text-sm font-medium'>Category</p>
<Badge variant={getVariantWorkingStatus(data.category_name)}>{data.category_name}</Badge>
</div>
<div>
<p className='text-muted-foreground text-xs md:text-sm font-medium'>Address</p>
<p>{data.contact_street}, {data.contact_city}</p>
</div>
<div className='flex flex-col'>
<p className='text-muted-foreground text-xs md:text-sm font-medium'>Period</p>
<p>{dayjs(data.start_date).format('dddd, DD MMM YYYY')} <span className='text-muted-foreground'>to</span> {dayjs(data.end_date).format('dddd, DD MMM YYYY')}</p>
</div>
<div>
<p className='text-muted-foreground text-xs md:text-sm font-medium'>Return to work</p>
<p>{dayjs(data.return_to_work_date).format('dddd, DD MMMM YYYY')}</p>
</div>
<div>
<p className='text-muted-foreground text-xs md:text-sm font-medium'>Note</p>
<p className='wrap-wrap-break-word'>{data.note || '-'}</p>
{data.tag?.length > 0 && data.tag?.map((item: string) =>
<Badge variant='secondary' className='mr-1' key={item}>{item}</Badge>
)}
</div>
<div>
<p className='text-muted-foreground text-xs md:text-sm font-medium'>Send to</p>
<p>{data.sent_to || '-'}</p>
</div>
<div>
<p className='text-muted-foreground text-xs md:text-sm font-medium'>Mentions to</p>
<p>{data.cc?.length > 0 ? data.cc?.join(', ') : '-'}</p>
</div>
<div>
<p className='text-muted-foreground text-xs md:text-sm font-medium'>Approval :</p>
{data.approved_at ? <Badge variant='secondary'>approved</Badge> : data.rejected_at ? <Badge variant='destructive'>rejected</Badge> : <Badge>need to be approve</Badge>}
{(data.approved_by || data.rejected_by) &&
<div className='flex flex-col'>
<p className='font-semibold'>by {data.approved_by || data.rejected_by}</p>
<p>at {data.approved_by ? dayjs(data.approved_at).format('dddd, DD MMM YYYY HH:mm A') : dayjs(data.rejected_at).format('ddd, DD MMM YYYY HH:mm A')}</p>
</div>
}
</div>
</div>
</div>
<DialogFooter>
<Button onClick={onClose}>Close</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</>
);
}
export default DetailModalComponent;