import React, { useState } from 'react'; import { Head, Link, router } from '@inertiajs/react'; import axios from 'axios'; import { toast } from 'sonner'; import { Loader2, ShieldAlert, ShieldCheck, UploadCloud, FileText, Users, DollarSign, MessageSquare, ArrowLeft } from 'lucide-react'; export default function UploadEmiratesId({ email }) { const [file, setFile] = useState(null); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleFileChange = (e) => { const selectedFile = e.target.files[0]; if (selectedFile) { if (selectedFile.size > 10240 * 1024) { setError('The document must not exceed 10MB.'); toast.error('The document must not exceed 10MB.'); return; } setFile(selectedFile); setError(null); } }; const handleSubmit = async (e) => { e.preventDefault(); if (!file) { setError('Please upload a clear scan or image of your Emirates ID.'); toast.error('Please upload your Emirates ID document.'); return; } setLoading(true); setError(null); const formData = new FormData(); formData.append('emirates_id_file', file); try { await axios.post('/employer/upload-emirates-id', formData, { headers: { 'Content-Type': 'multipart/form-data' } }); toast.success('Emirates ID scanned successfully. Data extracted and document deleted.'); router.visit('/employer/register-payment'); } catch (err) { if (err.response && err.response.data && err.response.data.errors) { setError(err.response.data.errors.emirates_id_file || 'Validation failed.'); toast.error('Validation failed. Please verify the document.'); } else { toast.error('Scan extraction failed. Please try again.'); } } finally { setLoading(false); } }; const renderStepIndicator = () => (
Unlock direct access to top domestic candidates with a Migrant premium subscription. Find, interview, and hire directly without middlemen.
Upload your identity document for quick OCR scanning
We do not store your physical Emirates ID document. Your card is temporarily scanned only to securely extract the ID number and expiry date via automated OCR, and the file is permanently deleted immediately after extraction.