@foreach ($dateRange as $date) @php $dayName = \Carbon\Carbon::parse($date)->format('l'); @endphp

@foreach ($shiftTypes as $shiftKey => $shiftName) @php $shiftSlug = $shiftKey; $shiftKey = $shiftTypes[$shiftKey]; $shiftRow = $rosterShifts->where('date', $date)->firstWhere('shift', $shiftKey); $allocation = $shiftRow?->allocations ?? collect(); @endphp

@php $allocCount = ($shiftRow && $shiftRow->allocations) ? $shiftRow->allocations->count() : 0; @endphp

@if($has_permission_to_add_open_shift ?? false) @endif
@if ($shiftRow && $shiftRow->allocations->count()) @foreach ($shiftRow->allocations as $allocation) @if($allocation->shift_type == 'open_shift_with_approval') @php $allocStart = $allocation->start_time ? \Carbon\Carbon::parse($allocation->start_time)->format('H:i') : ''; $allocEnd = $allocation->end_time ? \Carbon\Carbon::parse($allocation->end_time)->format('H:i') : ''; $openusers = $allocation->openUsers->pluck('user_id')->toArray(); @endphp
Allocation ID: #{{ $allocation->id }}
@if(!empty($allocation['cancelled']) && $allocation['cancelled']) Cancelled @endif
:
@if(isset($allocation->staff_id))
@endif
@if (!empty($shared_clients)) @php $scHours = collect( $allocation->sharedClients ?? [], ) ->pluck('client_hours', 'client_id') ->toArray(); @endphp
Shared Client Hours ({{ array_sum($scHours) }})
@foreach ($shared_clients as $scId => $scName)
@endforeach
@endif

Note: Please select below Open Shift Users


@else @php $allocStart = $allocation->start_time ? \Carbon\Carbon::parse($allocation->start_time)->format('H:i') : ''; $allocEnd = $allocation->end_time ? \Carbon\Carbon::parse($allocation->end_time)->format('H:i') : ''; @endphp
Allocation ID: #{{ $allocation->id }}
@if(!empty($allocation['cancelled']) && $allocation['cancelled']) Cancelled @endif
@if($is_core_shift_permitted ?? false)
@endif
:
@if (!empty($shared_clients)) @php $scHours = collect( $allocation->sharedClients ?? [], ) ->pluck('client_hours', 'client_id') ->toArray(); @endphp
Shared Client Hours ({{ array_sum($scHours) }})
@foreach ($shared_clients as $scId => $scName)
@endforeach
@endif
@endif @endforeach @else
No staff assigned yet
@endif
@endforeach
@endforeach

Notes