<{{ $titleSize ?? 'h5' }} class="card-title"> Holiday Allowance {{ $year }}
@php // Set defaults for optional parameters $totalAvailable = $totalAvailable ?? 0; $currentTaken = $currentTaken ?? 0; $currentCarryover = $currentCarryover ?? 0; $currentCOR = $currentCOR ?? 0; $showDetails = $showDetails ?? false; $remainingWorkingFromHomeDays = $remainingWorkingFromHomeDays ?? null; $maxWorkingFromHomeDays = $maxWorkingFromHomeDays ?? null; $nextTotal = $nextTotal ?? null; $duvetNextYear = $duvetNextYear ?? null; $cardClass = $cardClass ?? 'shadow-sm h-100'; $titleSize = $titleSize ?? 'h5'; $totalEntitlement = $currentTotal + $currentCarryover; $percentageRemaining = $totalEntitlement > 0 ? ($totalAvailable / $totalEntitlement) * 100 : 0; $bgClass = 'bg-success'; $txtClass = 'text-success'; if ($percentageRemaining < 70 && $percentageRemaining >= 30) { $bgClass = 'bg-warning'; $txtClass = 'text-warning'; } elseif ($percentageRemaining < 30) { $bgClass = 'bg-danger'; $txtClass = 'text-danger'; } $formatValue = function($value) { return fmod((float)$value, 1) == 0 ? number_format($value, 0) : number_format($value, 1); }; @endphp

{{ $formatValue($totalAvailable) }}

Available

{{ $formatValue($currentTaken) }}

Taken

{{ $formatValue($totalEntitlement) }}

Total
{{ round($percentageRemaining) }}% {{ $percentageRemaining > 30 ? 'Remaining' : '' }}
@if ($showDetails)
@if ($year == date('Y'))

Annual Allowance: {{ $formatValue($currentTotal) }} days

Carry Over Given: {{ $formatValue($currentCarryover) }} days

Carry Over Remain: {{ $formatValue($currentCOR) }} days

Duvet Day: {{ !!$duvetThisYear ? 'Used' : 'Available' }}
Working From Home: {{ $formatValue($remainingWorkingFromHomeDays) }} / {{ $formatValue($maxWorkingFromHomeDays) }} days
@if ($remainingWorkingFromHomeDays > 0)
Remaining: {{ $remainingWorkingFromHomeDays }} day(s) this month
@else
No Working From Home days left this month.
@endif
@if ($currentCOR > 0) @endif @else @if($nextTotal !== null)

Annual Allowance: {{ $formatValue($nextTotal) }} days


Duvet Day: {{ !!$duvetNextYear ? 'Used' : 'Available' }}
@endif @endif @endif