import React, { useState } from 'react'; import { Head, Link, router } from '@inertiajs/react'; import EmployerLayout from '../../../Layouts/EmployerLayout'; import { CheckCircle2, Globe2, Briefcase, DollarSign, Calendar, HeartHandshake, Languages, MessageSquare, Bookmark, ArrowLeft, Sparkles, FileText, ShieldCheck, Search, Star, Share2, Flag, X, UserCheck, AlertTriangle, User } from 'lucide-react'; import { toast } from 'sonner'; const getLanguageFlag = (lang) => { const flags = { 'English': '🇬🇧', 'Arabic': '🇦🇪', 'Tagalog': '🇵🇭', 'Hindi': '🇮🇳', 'Swahili': '🇰🇪', 'French': '🇫🇷', 'Indonesian': '🇮🇩' }; return flags[lang] || '🌐'; }; export default function Show({ worker }) { const [showReportModal, setShowReportModal] = useState(false); const [reportReason, setReportReason] = useState(''); const [reportDetails, setReportDetails] = useState(''); const [isShortlisted, setIsShortlisted] = useState(false); // Hiring flow states const [availabilityStatus, setAvailabilityStatus] = useState(worker.availability_status); const [showHiredModal, setShowHiredModal] = useState(false); // Reviews state const [showReviewModal, setShowReviewModal] = useState(false); const [newRating, setNewRating] = useState(5); const [newComment, setNewComment] = useState(''); const [workerReviews, setWorkerReviews] = useState(worker.reviews || []); const handleShare = () => { navigator.clipboard.writeText(window.location.href); toast.success("📋 Profile link copied to clipboard!", { description: "You can now share this URL with your family or sponsor contacts." }); }; const handleReportSubmit = (e) => { e.preventDefault(); if (!reportReason) { toast.error("Please select a reason for reporting."); return; } toast.success("🛡️ Worker report submitted successfully", { description: "Our admin compliance team will investigate this worker's credentials within 24 hours." }); setShowReportModal(false); setReportReason(''); setReportDetails(''); }; const handleReviewSubmit = (e) => { e.preventDefault(); if (!newComment.trim()) { toast.error("Please add a comment."); return; } const newReview = { id: Date.now(), employer_name: "You (Verified Sponsor)", rating: newRating, date: "Today", comment: newComment, }; setWorkerReviews([newReview, ...workerReviews]); toast.success("⭐ Review posted successfully!", { description: "Your trust feedback is live and helps other sponsors hire securely." }); setShowReviewModal(false); setNewComment(''); }; const handleToggleShortlist = () => { setIsShortlisted(!isShortlisted); router.post('/employer/shortlist/toggle', { worker_id: worker.id }, { preserveScroll: true, onSuccess: () => { toast.success(isShortlisted ? "Removed from Shortlist" : "Added to Shortlist"); } }); }; const handleMarkHired = () => { setAvailabilityStatus('Hired'); setShowHiredModal(true); toast.success("🎉 Worker successfully marked as Hired!", { description: "Sponsorship direct match finalized. Please leave an anonymous trust review!" }); }; return (
{/* Back Link */}
BACK TO FIND WORKERS {/* Quick Profile Actions */}
{/* Header Card with Clean Premium White BG */}
{worker.photo ? ( {worker.name} ) : ( )}

{worker.name}

{worker.verified && ( Verified )} {/* Availability Status Badge */} {availabilityStatus}
{/* Emirates ID verification status bar & Visa Status */}
{worker.emirates_id_status}
{worker.visa_status && (worker.visa_status.toLowerCase().includes('tourist') || worker.visa_status.toLowerCase().includes('visit')) ? (
{worker.visa_status} (Warning: Visit Visa)
) : worker.visa_status && worker.visa_status.toLowerCase().includes('cancelled') ? (
{worker.visa_status} (Warning: Cancelled)
) : (
{worker.visa_status}
)}
{worker.nationality} {worker.age} Years Old {worker.category}
{worker.rating} / 5.0 ({workerReviews.length} reviews)
{/* Sponsor Actions Block */}
{/* Stage 3 Connect: Start In-App Chat */} Start Direct Chat {/* Stage 4 Hire: Mark Hired (Finalize Hiring Direct Flow) */}
{/* Main Details Grid */}
{/* Left Column: Quick Stats */}

Sponsorship Details

Salary Expectations
{worker.salary} AED / mo
Availability Status
{availabilityStatus}
Work Experience
{worker.experience}
Preferred Job Type
{worker.preferred_job_type}
Emirates ID Vetting
{worker.emirates_id_status}
Visa Status
{worker.visa_status}
Medical Health Test
PASSED CERTIFIED
{/* Languages Spoken with visual flags */}
Languages Spoken
{worker.languages?.map(lang => ( {getLanguageFlag(lang)} {lang} ))}
{/* Right Column: Bio & Skills */}
{/* Professional Summary */}

Professional Summary

"{worker.bio}"

{/* Verified Skills & Competencies */}

Verified Skills & Competencies

{worker.skills?.map(skill => (
{skill}
))}
{/* Verified Documents Section */}

Verified Legal Documents (UAE MOHRE Vetted)

{/* Document Card: Passport */}
Passport (Verified)
Click zoom
Document ID
L82739102-UAE
Issue
12 Jan 2021
Expiry
11 Jan 2031
OCR Match
95%
{/* Document Card: Emirates ID */}
Emirates ID (PDPL Compliant)
Scan Purged UAE PDPL compliant
Verification Type
Emirates ID OCR
Status
{worker.emirates_id_status}
Physical Scan Storage
Permanently Purged
{/* Document Card: Visa */}
Entry Visa (Verified) {worker.visa_status && (worker.visa_status.toLowerCase().includes('tourist') || worker.visa_status.toLowerCase().includes('visit') || worker.visa_status.toLowerCase().includes('cancelled')) ? ( ) : ( )}
Click zoom
Visa Category
{worker.visa_status}
Vetting status
{worker.visa_status && (worker.visa_status.toLowerCase().includes('tourist') || worker.visa_status.toLowerCase().includes('visit')) ? ( Transfer Required ) : worker.visa_status && worker.visa_status.toLowerCase().includes('cancelled') ? ( Needs Regularization ) : ( <> Clear Records )}
{/* Star Ratings & Trust Review logs */}

Sponsor Reviews & Star Ratings

Ratings can only be posted by verified sponsors who completed verified direct hiring.

{/* Reviews List */}
{workerReviews.map((review) => (
{review.employer_name} {review.date}
{[...Array(5)].map((_, i) => ( ))}

"{review.comment}"

))}
{/* Similar Recommendations Slider */}

Similar Recommended Workers

{worker.similar_workers?.map((sim) => (

{sim.name}

{sim.nationality} • {sim.category}

{sim.availability_status}
{sim.salary} AED/mo View Profile
))}
{/* Stage 4/5 Hired Flow Success Modal Overlay */} {showHiredModal && (

Direct Sponsoring Finalized!

{worker.name} is successfully marked as Hired under your sponsorship! This direct matching conforms exactly with Stage 4 of our UAE MOHRE zero-middlemen flow.

Next Step: Stage 5 Post-Hire Review

Help the UAE community hire safely by posting an anonymous review describing {worker.name}'s childcare, cooking, driving, or domestic skills.

Back to Worker Directory
)} {/* Report Abuse Modal Overlay */} {showReportModal && (

Report Vetting Abuse / Terms Violation

We maintain zero-tolerance for fake documentation, independent recruiters trading cash, or incorrect contact details.