import React, { useState } from 'react';
import { Head, useForm } from '@inertiajs/react';
import EmployerLayout from '../../Layouts/EmployerLayout';
import { useTranslation } from '../../lib/LanguageContext';
import {
User,
CheckCircle2,
Save,
Building2,
Lock,
Bell,
ShieldCheck,
Mail,
Phone,
Globe,
CreditCard,
ChevronRight,
Camera,
Home,
Users,
MapPin,
History,
Sparkles
} from 'lucide-react';
import { toast } from 'sonner';
export default function Profile({ employerProfile }) {
const { t } = useTranslation();
const { data: profile, setData, post, processing, errors } = useForm({
name: employerProfile?.name || '',
company_name: employerProfile?.company_name || '',
email: employerProfile?.email || '',
phone: employerProfile?.phone || '',
language: employerProfile?.language || 'English',
nationality: employerProfile?.nationality || '',
family_size: employerProfile?.family_size || '',
accommodation: employerProfile?.accommodation || '',
district: employerProfile?.district || '',
notifications: employerProfile?.notifications ?? true,
emirates_id_front: null,
emirates_id_back: null,
current_password: '',
new_password: '',
new_password_confirmation: '',
});
const [activeTab, setActiveTab] = useState('personal');
const [saved, setSaved] = useState(false);
const handleSave = (e) => {
e.preventDefault();
post('/employer/profile/update', {
preserveScroll: true,
onSuccess: () => {
setSaved(true);
toast.success(`🛡️ ${t('profile_updated_successfully', 'Profile updated successfully')}`, {
description: t('profile_updated_successfully_desc', 'Household sponsor preferences and vetted credentials synchronized successfully.')
});
setTimeout(() => setSaved(false), 3000);
},
onError: (errs) => {
toast.error(t('profile_update_failed', 'Failed to update profile'), {
description: Object.values(errs)[0] || t('check_form_fields', 'Please check the form fields.')
});
}
});
};
const tabs = [
{ id: 'personal', label: t('tab_personal', 'Personal'), icon: User },
{ id: 'security', label: t('tab_security', 'Security & Password'), icon: Lock },
{ id: 'billing', label: t('tab_billing', 'Billing & Receipts'), icon: CreditCard },
{ id: 'notifications', label: t('tab_notifications', 'Notifications Hub'), icon: Bell },
];
return (
{profile.company_name}