import React from 'react'; import { Head, Link } from '@inertiajs/react'; import EmployerLayout from '../../Layouts/EmployerLayout'; import { useTranslation } from '../../lib/LanguageContext'; import { Bookmark, MessageSquare, CalendarDays, CreditCard, Search, ArrowRight, Heart, CheckCircle2, Info, Clock, ChevronRight, UserCircle2, Sparkles, Plus, Activity, TrendingUp, ShieldCheck, AlertTriangle, Star, Send, HelpCircle, UserCheck, Lock } from 'lucide-react'; export default function Dashboard({ employer, stats, shortlisted_workers, recent_messages, announcements, recommended_workers = [], saved_searches = [] }) { const isSubActive = employer.subscription_status === 'active'; const isExpiringSoon = stats.days_remaining <= 7; const { t } = useTranslation(); return (
{/* 1. Alerts & Warning Banners */} {!isSubActive && (

{t('expired_pass_title', 'Your Sponsor Subscription Pass Has Expired!')}

{t('expired_pass_desc', 'Direct communication, candidate dossiers, and messaging are locked. Renew your annual sponsor subscription now to resume hiring.')}

{t('renew_sub', 'Renew Subscription')}
)} {isExpiringSoon && isSubActive && (

{t('expiring_pass_title', 'Your Premium Sponsor Pass is expiring soon!')}

{t('expiring_pass_desc', 'Only {days} days left. Renew now to avoid losing contact access to 500+ verified candidates.').replace('{days}', stats.days_remaining)}

{t('renew_now', 'Renew Now')}
)} {/* Welcome Banner */}
{t('sub_status', 'Subscription Status')}: {employer.subscription_status} | {stats.days_remaining} {t('days_left', 'Days Left')}

{t('welcome_back', 'Welcome Back')}, {employer.name}

{t('welcome_desc_dash', 'Hire direct, MOHRE-compliant domestic workers with zero middleman commissions. Browse our updated database of candidates with OCR passport checks.')}

{t('browse_workers', 'Browse 500+ Verified Workers')}
{/* 2. Top-level Stats & Analytics Grid */}
{/* Subscription Pass status card */}
ACTIVE BILLING
{t('sponsor_pass_tier', 'Sponsor Pass Tier')}
{employer.plan_name}
{t('renews', 'Renews')}: {employer.subscription_expires_at}
{t('manage_billing', 'Manage billing & invoices')}
{/* Contacted Workers Stat Card */}
ENGAGED
{t('contacted_workers_title', 'Contacted Workers')}
{stats.contacted_workers_count}
{t('active_conversations_sub', 'Active candidate chat channels')}
{t('view_messages', 'Open message center')}
{/* Hired Count Stat Card */}
HIRED SECURELY
{t('total_hired_workers', 'Total Hired Workers')}
{stats.hired_count}
{t('direct_contracts', 'Direct contracts initiated')}
{t('track_active_staff', 'Track active staff')}
{/* Shortlist Counter */}
SAVED LIST
{t('shortlisted_candidates', 'Shortlisted Candidates')}
{stats.shortlisted_count}
{t('bookmark_list', 'Bookmark list for interviews')}
{t('open_shortlist', 'Open shortlist book')}
{/* 3. Analytics & Quick Action Section */}
{/* Worker Activity Analytics Module (Col 8) */}

{t('discover_insights', 'Discover Insights & Market Stats')}

{/* Dubai General Market Stats */}
{t('dubai_insights', 'Dubai General Market Insights')}
1,284
{t('hired_dubai', 'Hired using app in Dubai')}
{t('cooking_care', 'Cooking, Care, Driving')}
{t('top_skills', 'Top Skills Hired')}
1.4%
{t('turnover_rate', 'Turnover rate')}
{/* Your own activity */}
{t('sponsor_activity', 'Your Sponsor Activity Stats')}
14
{t('workers_contacted', 'Workers Contacted')}
{stats.shortlisted_count}
{t('shortlist', 'Shortlist')}
{stats.hired_count}
{t('secure_hires', 'Secure Hires')}
{/* Quick Actions Panel (Col 4) */}

{t('quick_actions', 'Quick Actions')}

{t('speed_up', 'Speed up your sponsorship process.')}

{t('find_nannies', 'Find Baby Care & Nannies')}
{t('browse_nannies', 'Browse premium verified nannies')}
{t('whatsapp_support', 'Direct WhatsApp Support')}
{t('chat_manager', 'Chat with a recruitment manager')}
{t('legal_platform', '100% Legal UAE Agency-Free Platform')}
{/* 4. Detailed Workspace Rows (Col 12 Grid) */}
{/* Left Column: Recommended Workers, Shortlist, Chats */}
{/* Recommended Workers Module */}

{t('recommended_for_you', 'Recommended for You')}

{t('browse_all', 'Browse all')}
{recommended_workers.length > 0 ? ( recommended_workers.map((worker) => (
{/* Top info */}
{worker.name.charAt(0)}
{worker.verified && ( VERIFIED )}
{worker.name}
{worker.nationality} • {worker.category}
{worker.rating} ({Math.floor(Math.random() * 15) + 3} reviews)
{/* Action buttons */}
{worker.salary} AED/mo
{t('view_profile', 'View Profile')}
)) ) : (
{t('no_recommended', 'No workers currently recommended. Update profile details.')}
)}
{/* My Shortlist Module */}

{t('active_shortlist', 'Active Shortlist')} ({shortlisted_workers.length})

{t('view_book', 'View book')}
{shortlisted_workers?.length > 0 ? (
{shortlisted_workers.map((worker) => (
{worker.name.charAt(0)}
{worker.name} {worker.verified && }
{worker.nationality}
{t('category', 'Category')}:
{worker.category || 'General Helper'}
{t('availability', 'Availability')}: {worker.availability}
{t('open_profile', 'Open Profile')}
))}
) : (
{t('shortlist_candidates_desc', 'Shortlist candidates to compare their documents side-by-side')}
)}
{/* Recent Chats / Message Center */}

{t('recent_chats', 'Recent Chats')}

{t('all_channels', 'All channels')}
{recent_messages?.length > 0 ? ( recent_messages.map((msg) => (
{msg.worker_name.charAt(0)}
{msg.worker_name}
{msg.sent_at} {msg.unread && ( )}

{msg.last_message}

)) ) : (
{t('no_chats', 'No recent chat logs found. Find workers to start conversing.')}
)}
{/* Right Column: Saved Searches, Announcements, Regulatory details */}
{/* Charity Events Module */}

{t('charity_drives', 'Community Charity Drives')}

{t('live_events', 'Live Events')}
{announcements?.map((ann) => (
❤️ {t('charity_drive', 'Charity Drive')} {ann.created_at}

{ann.title}

{ann.body}

{/* Metas */}
🎁 {t('provided_items', 'Provided Items')}: {ann.provided_items}
📅 {t('event_date', 'Event Date')}: {ann.event_date}
{ann.location_pin && ( 📍 {t('open_maps', 'Open Google Maps Location Pin')} )}
))}
{/* Direct Sponsorship Compliance card */}

{t('mohre_compliant', 'UAE Tadbeer & MOHRE Compliant')}

{t('mohre_desc', 'Our direct contract system aligns automatically with the Ministry of Human Resources and Emiratisation guidelines. Fully legal, zero agent fees, complete transparency.')}

); }