@extends('layouts.app') @section('title', 'Edit Shift Entry') @section('content') @php // Receptionist must NOT see locum pay information — they record // shifts but the rate and earnings are confidential to HR/Admin. $canSeePay = Auth::user()->activeRoleName() !== 'Receptionist'; $canOverridePay = in_array(Auth::user()->actualRoleName(), ['Hospital Admin', 'Super Admin'], true); $shiftRole = strtolower((string) $shift->locum->role_designation); $shiftIsSono = str_contains($shiftRole, 'sonograph') || str_contains($shiftRole, 'ultrasound'); @endphp

Edit Shift Entry

{{ $shift->locum->full_name }} — {{ $shift->work_date->format('d M Y') }}  ·  @php $sc = ['draft'=>'badge-gray','submitted'=>'badge-info','verified'=>'badge-info','approved'=>'badge-success','rejected'=>'badge-danger']; @endphp {{ ucfirst($shift->approval_status) }}

@if($shift->approval_status === 'draft') This entry is still a draft. Make your changes here, then submit it for approval from the shift list. @elseif($shift->approval_status === 'rejected') This entry was rejected. Fix the details below and save — it will return to the approval queue automatically. @else This entry is awaiting approval. Saving your corrections will send the updated version back to the approval queue for review. @endif
@if($shiftIsSono && $canOverridePay)
Admin tools available. Expand any session row below to apply a discount or waiver. New overrides require a reason. Existing overrides persist across receptionist submits — they can't be wiped accidentally.
@elseif($shiftIsSono && !$canOverridePay)
Sonographer shifts are populated automatically from verified reports. Amounts shown reflect what was invoiced, plus any admin discounts already applied. You can review and submit, but not change patients, procedures, or amounts. To request a discount or waiver, ask the hospital admin.
@endif
@csrf @method('PUT')

Shift Details

{{-- Locum is LOCKED — cannot be changed on edit --}}

{{ $shift->locum->full_name }}

{{ $shift->locum->role_designation }} @if($canSeePay)  ·  @if($shift->rate_type === 'percentage'){{ $shift->rate_applied }}% per procedure @else KES {{ number_format($shift->rate_applied) }} per shift @endif @endif

Locked
@php $editLocumRole = strtolower((string) $shift->locum->role_designation); $editIsSonographer = str_contains($editLocumRole, 'sonograph') || str_contains($editLocumRole, 'ultrasound'); @endphp @if($shift->rate_type === 'percentage' && $editIsSonographer) {{-- Multi-session panel (sonographer picker) --}}

Procedure Sessions

Pick from billed scans below. Already-attached scans are hidden automatically. @if($canSeePay)Rate: {{ $shift->rate_applied }}% per procedure @endif

@php $canOverride = in_array(Auth::user()->actualRoleName(), ['Hospital Admin', 'Super Admin'], true); @endphp @if($canOverride)

Available billed scans

Loading…

@else
Sessions are added automatically when the sonographer verifies and releases a report. To apply a discount or waiver, ask the hospital admin.
@endif
0 session(s) @if($canSeePay)

Total billed

KES 0

Locum earns

KES 0

@else @endif
@elseif($shift->rate_type === 'percentage' && !$editIsSonographer) {{-- Free-text panel (dentist & other percentage non-sonographer roles) --}}

Procedure Sessions

Type each procedure performed and the amount charged at the till. Date and Patient (from the visit log) are required for every row.@if($canSeePay) Rate: {{ $shift->rate_applied }}% per procedure @endif

0 procedure(s) @if($canSeePay)

Total billed

KES 0

Locum earns

KES 0

@else @endif
@else {{-- Flat rate --}} @if($canSeePay)

Flat shift rate

KES {{ number_format($shift->rate_applied) }} per shift

KES {{ number_format($shift->gross_amount) }}

@endif @endif
Cancel
@endsection @section('scripts') @php $editLocumRole = strtolower((string) $shift->locum->role_designation); $editIsSonographer = str_contains($editLocumRole, 'sonograph') || str_contains($editLocumRole, 'ultrasound'); @endphp @if($shift->rate_type === 'percentage' && $editIsSonographer) @php // Override authority — only the user's REAL role grants this, not an // impersonated one. Mirrors LocumController::updateShift. $canOverride = in_array(Auth::user()->actualRoleName(), ['Hospital Admin', 'Super Admin'], true); @endphp @elseif($shift->rate_type === 'percentage' && !$editIsSonographer) @endif @endsection