@extends('hms.layout') @section('title','Staff leave management') @section('content')

Staff leave management

Requests, approvals, annual allowances and shift cover. All durations use inclusive calendar days, including weekends.

Shift schedule
@if($manager)Download leave report@endif

My {{ $year }} allowances

@forelse($allowances as $a)

{{ $types->firstWhere('id',$a->leave_type_id)?->name }}: {{ max(0,$a->days-$a->reserved) }} available · {{ $a->days }} granted · {{ $a->reserved }} approved or pending calendar days

@empty

No yearly allowance has been set. Ask a manager before requesting an allowance-based leave type.

@endforelse
@if($canRequest)

Request leave

@csrf

PDF or image, up to 5 MB. Available only to you and authorised leave reviewers.

@endif @if($manager)
Set staff allowance
@csrf
Add leave type
@csrf
@endif

{{ $manager ? 'Requests and approvals' : 'My requests' }}

@forelse($rows as $r)
{{ $people[$r->user_id] ?? 'Staff' }} · {{ $types->firstWhere('id',$r->leave_type_id)?->name }}{{ ucfirst($r->status) }}

{{ $r->starts_on }} – {{ $r->ends_on }} · {{ (int)\Illuminate\Support\Carbon::parse($r->starts_on)->diffInDays(\Illuminate\Support\Carbon::parse($r->ends_on))+1 }} calendar days

@if($r->note)

{{ $r->note }}

@endif @if($r->document_path)Download supporting document@endif @if($r->reviewed_at)

{{ $people[$r->reviewed_by] ?? 'Manager' }} · {{ $r->reviewed_at }} · {{ $r->review_note }}

@endif @if($r->status==='pending' && (int)$r->user_id===auth()->id())
@csrf
@endif @if($manager && $r->status==='pending' && (int)$r->user_id!==auth()->id())
@csrf
@endif @foreach($covers->get($r->id,collect()) as $cover)
Shift cover: {{ $cover->title }}

{{ $cover->starts_at }} – {{ $cover->ends_at }} · {{ $cover->status==='covered' ? 'Covered by '.($staff->firstWhere('id',$cover->replacement_user_id)?->name ?? 'assigned colleague') : 'Cover needed' }}

@if($manager && $cover->status==='needed' && \Illuminate\Support\Carbon::parse($cover->ends_at)->isFuture())
@csrf
@endif
@endforeach
@empty

No leave requests overlap the selected dates.

@endforelse @endsection