import { Form, Head, Link, usePage } from '@inertiajs/react'; import { format } from 'date-fns'; import { Save } from 'lucide-react'; import { useState } from 'react'; import ProfileController from '@/actions/App/Http/Controllers/Admin/Settings/ProfileController'; import { DatePicker } from '@/components/date-picker'; import Heading from '@/components/heading'; import InputError from '@/components/input-error'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { PhoneInput } from '@/components/ui/phone-input'; import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'; import { Textarea } from '@/components/ui/textarea'; import { edit } from '@/routes/admin/settings/profile'; import { send } from '@/routes/verification'; import type { Auth } from '@/types'; const roleLabels: Record = { mahasiswa: 'Mahasiswa', dosen: 'Dosen', 'staff-admin': 'Staf Admin', 'staff-keuangan': 'Staf Keuangan', }; type Profile = { full_name: string | null; phone_number: string | null; address: string | null; gender: 'male' | 'female' | null; birth_date: string | null; birth_place: string | null; } | null; type StudentRoleData = { student_number: string; department: string | null; enrollment_year: number; academic_advisor: string | null; }; type LecturerRoleData = { lecturer_number: string; department: string | null; }; type AdminRoleData = { roles: string[]; }; type PageProps = { auth: Auth; }; type Props = { mustVerifyEmail: boolean; status?: string; profile: Profile; role: 'mahasiswa' | 'dosen' | 'admin'; roleData: StudentRoleData | LecturerRoleData | AdminRoleData | null; }; export default function Profile({ mustVerifyEmail, status, profile, role, roleData, }: Props) { const { auth } = usePage().props; const [gender, setGender] = useState(profile?.gender ?? ''); const [birthDate, setBirthDate] = useState( profile?.birth_date ? new Date(profile.birth_date) : undefined, ); return ( <>

Pengaturan Profil

{({ processing, errors }) => ( <>
{mustVerifyEmail && auth.user.email_verified_at === null && (

Alamat email Anda belum diverifikasi.{' '} Klik di sini untuk mengirim ulang email verifikasi.

{status === 'verification-link-sent' && (
Tautan verifikasi baru telah dikirim ke alamat email Anda.
)}
)}