import React, { useState } from 'react'; import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'; import { Head, usePage, useForm, router } from '@inertiajs/react'; import { PageProps } from '@/types'; import swal from '@/lib/swal'; // FilePond import { FilePond, registerPlugin } from 'react-filepond'; import 'filepond/dist/filepond.min.css'; import FilePondPluginImagePreview from 'filepond-plugin-image-preview'; import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css'; import FilePondPluginFileValidateType from 'filepond-plugin-file-validate-type'; registerPlugin(FilePondPluginImagePreview, FilePondPluginFileValidateType); interface ProfileEditProps extends PageProps { mustVerifyEmail: boolean; status?: string; } function SectionCard({ title, description, children, delay = '0s' }: { title: string; description: string; children: React.ReactNode; delay?: string }) { return (

{title}

{description}

{children}
); } function InputField({ label, id, type = 'text', value, onChange, error, placeholder, required = false, ...props }: any) { return (
{error &&

{error}

}
); } export default function ProfileEdit({ mustVerifyEmail, status }: ProfileEditProps) { const { auth } = usePage().props; const { user } = auth; const [files, setFiles] = useState([]); const profileForm = useForm({ first_name: user.first_name || '', last_name: user.last_name || '', email: user.email || '', phone: user.phone || '', bio: user.bio || '', avatar_file: null as File | null, _method: 'PATCH' }); const passwordForm = useForm({ current_password: '', password: '', password_confirmation: '', }); const handleProfileSubmit = (e: React.FormEvent) => { e.preventDefault(); profileForm.post(route('profile.update'), { preserveScroll: true, onSuccess: () => swal.success('Success', 'Profile identity synchronized.'), }); }; const handlePasswordSubmit = (e: React.FormEvent) => { e.preventDefault(); passwordForm.put(route('password.update'), { preserveScroll: true, onSuccess: () => { passwordForm.reset(); swal.success('Success', 'Security token updated.'); }, }); }; const initials = `${user.first_name?.charAt(0) || ''}${user.last_name?.charAt(0) || ''}`.toUpperCase(); return (

Account Settings

Personal Identity & Security Governance

{/* Grid 6 6 Layout for Precision - Enforcing full-width grid-cols-2 */}
{/* Column 1: Identity Configuration */}
{user.avatar_url ? ( ) : initials}
{ setFiles(items); profileForm.setData('avatar_file', items[0]?.file as File || null); }} allowMultiple={false} maxFiles={1} labelIdle='Portrait update' />
profileForm.setData('first_name', e.target.value)} error={profileForm.errors.first_name} required placeholder="e.g. Alex" /> profileForm.setData('last_name', e.target.value)} error={profileForm.errors.last_name} required placeholder="e.g. Johnson" />
profileForm.setData('email', e.target.value)} error={profileForm.errors.email} required placeholder="alex@company.com" /> profileForm.setData('phone', e.target.value)} error={profileForm.errors.phone} placeholder="+62..." />