@extends('layouts.app') @section('title', $locum->full_name . ' | ' . (($locum->worker_type ?? 'locum') === 'volunteer' ? 'Volunteer Profile' : 'Locum Profile')) @section('content') @php $isVolunteer = ($locum->worker_type ?? 'locum') === 'volunteer'; @endphp @include('locum.partials.payroll-tabs', ['active' => $isVolunteer ? 'volunteers' : 'register']) {{-- Profile Header --}}
{{ collect(explode(' ', $locum->full_name))->map(fn($n) => $n[0] ?? '')->take(2)->implode('') }}

{{ $locum->full_name }} @if($isVolunteer)VOLUNTEER@endif

@if($locum->staff_number){{ $locum->staff_number }} ยท @endif {{ $locum->role_designation ?? '' }} ยท {{ $locum->department->name ?? '' }}

@if($locum->id_passport_no)ID: {{ $locum->id_passport_no }}@endif @if($locum->phone)๐Ÿ“ž {{ $locum->phone }}@endif @if($locum->email)โœ‰ {{ $locum->email }}@endif @unless($isVolunteer) @if($locum->kra_pin)KRA: {{ $locum->kra_pin }}@endif @endunless
{{ ucfirst($locum->status) }} @if($locum->is_license_expired)License Expired@elseif($locum->is_license_expiring_soon)License Expiring@endif Edit @if($locum->status === 'active') {{-- Promote-to-permanent is rare in normal operations, so we keep it as a small secondary action in the header next to Edit. Clicking opens a modal that collects the employment terms โ€” everything else (personal info, statutory numbers, license, emergency contact, documents) carries straight from the locum row, no re-typing. --}} @endif
{{-- โ”€โ”€โ”€ Promote to Permanent Staff modal โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Triggered by the "Promote to Staff" button in the header. Hidden by default. PersonOnboardingService copies everything the locum row already has across to a new StaffRecord and links them via the same User row. The original locum row is kept (status=converted) so payroll/shift history isn't orphaned. --}} @if($locum->status === 'active') @endif {{-- Stats โ€” only for paid locums (volunteers have no shifts/earnings) --}} @unless($isVolunteer)

Total Shifts

{{ $shiftStats['total'] }}

This Month

{{ $shiftStats['this_month'] }}

Pending Approval

{{ $shiftStats['pending_approval'] }}

Total Earned

KES {{ number_format($shiftStats['total_earned']) }}

@endunless {{-- Personal + License + (Statutory|Payment) panels --}}
{{-- Personal --}}

Personal

Date of Birth{{ $locum->date_of_birth ? $locum->date_of_birth->format('d M Y') : 'โ€”' }}
Gender{{ $locum->gender ? str_replace('_', ' ', $locum->gender) : 'โ€”' }}
Emergency Contact{{ $locum->emergency_contact_name ?? 'โ€”' }}
@if($locum->emergency_contact_phone)
๐Ÿ“ž {{ $locum->emergency_contact_phone }}
@endif
{{-- License --}}

License

Number{{ $locum->license_no ?? 'โ€”' }}
Expiry{{ $locum->license_expiry ? $locum->license_expiry->format('d M Y') : 'โ€”' }}
{{-- Statutory + Payment (paid locums) OR Quick Actions (volunteers) --}} @if($isVolunteer)

Notes

Volunteer โ€” no payment is recorded for shifts. Schedule them on the duty roster like any other staff.

@else @if(Auth::user()->activeRoleName() !== 'Receptionist')

Statutory & Payment

SHA{{ $locum->sha_number ?? 'โ€”' }}
NSSF{{ $locum->nssf_number ?? 'โ€”' }}
Mode{{ $locum->payment_mode ?? 'โ€”' }}
Rate@if($locum->rate_type==='percentage'){{ $locum->default_rate }}%@else KES {{ number_format($locum->default_rate ?? 0) }}/shift @endif
@if($locum->payment_mode === 'mpesa')
M-Pesa{{ $locum->mpesa_no ?? 'โ€”' }}
@endif @if($locum->payment_mode === 'bank')
Bank{{ $locum->bank_name ?? 'โ€”' }} ยท {{ $locum->bank_account ?? 'โ€”' }}
@endif
@endif @endif
{{-- Documents --}} @if($locum->documents)

Documents

@foreach($locum->documents as $doc)
{{ $doc['name'] ?? 'file' }} ยท uploaded {{ \Carbon\Carbon::parse($doc['uploaded_at'] ?? now())->format('d M Y') }}
@endforeach
@endif {{-- Recent Shifts (paid locums only) --}} @unless($isVolunteer)

Recent Shifts

+ Record Shift
@forelse($locum->shifts as $s) @php $sc = ['draft'=>'badge-gray','submitted'=>'badge-info','verified'=>'badge-info','approved'=>'badge-success','rejected'=>'badge-danger']; @endphp @empty @endforelse
DateShiftDeptRateGross PayStatus
{{ $s->work_date->format('d M Y') }} {{ $s->shift_type }} {{ $s->department->name ?? '-' }} @if($s->rate_type==='percentage'){{ $s->rate_applied }}%@else KES {{ number_format($s->rate_applied) }}@endif KES {{ number_format($s->gross_amount) }} {{ ucfirst($s->approval_status) }}
No shifts recorded yet.
@endunless @endsection