siakad-itm/resources/js/components/date-picker.tsx
Yoga Pangestu b0e16a6cd5 feat: add assignment and submission management features
- Created SubmissionService to handle submission logic for assignments.
- Added migrations for assignments and submissions tables.
- Implemented AssignmentSeeder and SubmissionSeeder for initial data.
- Updated DatabaseSeeder to include new seeders.
- Enhanced app sidebar to include assignments navigation.
- Developed datetime field component for better date and time input.
- Created assignment management pages with data tables for assignments and submissions.
- Implemented forms for creating and editing assignments and submissions.
- Added routes for assignment and submission management in admin panel.
- Defined types for assignments and submissions to improve type safety.
2026-08-24 18:15:44 +07:00

56 lines
1.6 KiB
TypeScript

import { format } from 'date-fns';
import { CalendarIcon } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Calendar } from '@/components/ui/calendar';
import {
Popover,
PopoverContent,
PopoverTrigger,
} from '@/components/ui/popover';
import { cn } from '@/lib/utils';
type DatePickerProps = {
value?: Date | null;
onChange?: (date: Date | undefined) => void;
placeholder?: string;
className?: string;
disabled?: boolean;
};
export function DatePicker({
value,
onChange,
placeholder = 'Pilih tanggal',
className,
disabled,
}: DatePickerProps) {
return (
<Popover>
<PopoverTrigger asChild>
<Button
variant="outline"
className={cn(
'w-full justify-start text-left font-normal',
!value && 'text-muted-foreground',
className,
)}
disabled={disabled}
>
<CalendarIcon className="mr-2 h-4 w-4" />
{value ? format(value, 'dd MMM yyyy') : placeholder}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={value ?? undefined}
defaultMonth={value ?? undefined}
captionLayout="dropdown"
onSelect={onChange}
/>
</PopoverContent>
</Popover>
);
}