@php use App\Models\EmploymentStatus; @endphp

Employment Status

Assign Contract
{{-- Search + Filters --}}
Filter Employment Status
{{-- Passport Number --}}
{{-- Optional: different icon --}}
{{-- Visa Number --}}
{{-- Status --}}
{{-- Payment Status --}}
{{-- Submit & Clear --}}
Clear
{{-- Status Tabs --}} @php $currentStatus = request('status', 'All'); // Default status is 'All' if no status is selected $queryParams = request()->except('status', 'page'); // Get all current query parameters, except 'status' and 'page' @endphp {{-- Employment Status List --}}
Employment Status List
@foreach ($EmploymentStatus as $status)
{{-- Status + Optional Icon --}}
@php $cleanStatus = trim($status->status); $badgeColor = match ($cleanStatus) { 'Pending' => 'secondary', 'Sent NEA' => 'secondary', 'NEA Approved' => 'primary', 'Medical Fit' => 'warning text-dark', 'Ready for Submission' => 'dark', 'Submitted Embassy' => 'info', 'Visa Issued', 'Travelled' => 'success', default => 'secondary', }; @endphp
{{ strtoupper($cleanStatus ?? 'N/A') }}
{{-- Optional Avatar --}} Photo of {{ $status->worker->full_name ?? 'N/A' }}
{{-- Info --}}
Contract #
{{ $status->contract_number }}
Visa
{{ $status->visa_number ?? 'N/A' }}
Candidate
@if ($status->worker) {{ $status->worker->surname }} {{ $status->worker->given_names }} @else N/A @endif
Passport No
{{ $status->worker->passport_number ?? 'N/A' }} {{-- Assuming 'passport_number' is the field --}}
Occupation
{{ $status->worker->occupation ?? 'N/A' }}
e_Agency
{{ $status->externalAgency->company_name ?? 'N/A' }}
Nationality
{{ $status->worker->country ?? 'N/A' }}
Payment
{{ $status->payment_status }}
Created on
{{ \Carbon\Carbon::parse($status->created_at)->format('d M Y') }}
{{-- Actions --}}
@php // Normalize status values $normalize = [ 'pending' => EmploymentStatus::STATUS_PENDING, 'sent nea' => EmploymentStatus::STATUS_SENT_NEA, 'nea approved' => EmploymentStatus::STATUS_NEA_APPROVED, 'medical fit' => EmploymentStatus::STATUS_MEDICAL_FIT, 'ready for submission' => EmploymentStatus::STATUS_READY_FOR_SUBMISSION, 'submitted embassy' => EmploymentStatus::STATUS_SUBMITTED_EMBASSY, 'visa issued' => EmploymentStatus::STATUS_VISA_ISSUED, 'travelled' => EmploymentStatus::STATUS_TRAVELLED, 'canceled' => EmploymentStatus::STATUS_CANCELED, ]; $statusRaw = trim($status->status); $statusKey = $normalize[strtolower($statusRaw)] ?? $statusRaw; $statusMap = [ EmploymentStatus::STATUS_PENDING => 'Send NEA', EmploymentStatus::STATUS_SENT_NEA => 'Mark as NEA Approved', EmploymentStatus::STATUS_NEA_APPROVED => 'Mark as Medical Fit', EmploymentStatus::STATUS_MEDICAL_FIT => 'Mark as Ready for Submission', EmploymentStatus::STATUS_READY_FOR_SUBMISSION => 'Mark as Submitted to Embassy', EmploymentStatus::STATUS_SUBMITTED_EMBASSY => 'Mark as Visa Issued', EmploymentStatus::STATUS_VISA_ISSUED => 'Mark as Travelled', EmploymentStatus::STATUS_TRAVELLED => 'Travel Complete', ]; $isFinal = $statusKey === EmploymentStatus::STATUS_TRAVELLED; $isCanceled = $statusKey === EmploymentStatus::STATUS_CANCELED; $buttonText = $statusMap[$statusKey] ?? 'Update Status'; @endphp @if ($isFinal) @elseif ($isCanceled) @else
@csrf
@endif @if ($status->status !== \App\Models\EmploymentStatus::STATUS_CANCELED) Edit @endif @php $isCancelled = strtolower(trim($status->status)) === strtolower(\App\Models\EmploymentStatus::STATUS_CANCELED); @endphp @if ($isCancelled) @else @endif
@endforeach {{-- No Results --}} @if ($EmploymentStatus->isEmpty())

No employment status records found.

@endif
{{-- Pagination --}}
{{ $EmploymentStatus->appends(request()->query())->links('pagination::bootstrap-4') }}