@php // Expects: $staff, $type, $label, $col, $canManage $current = $staff->$col; $history = $staff->renewals->where('type', $type); $chipCls = !$current ? 'secondary' : ((int) now()->startOfDay()->diffInDays(\Illuminate\Support\Carbon::parse($current)->startOfDay(), false) < 30 ? 'danger' : 'success'); @endphp
Current {{ $label }} Expiry
{{ optional($current)->format('d M Y') ?? 'Not set' }}
@if($current) @php $d = (int) now()->startOfDay()->diffInDays($current->startOfDay(), false); @endphp {{ $d < 0 ? 'Expired '.abs($d).'d ago' : 'in '.$d.' days' }} @endif
@if($canManage)
Record {{ $label }} Renewal
@csrf
@endif
{{ $label }} History
@forelse($history as $r) @empty @endforelse
Renewed OnPreviousNew ExpiryCostRefByDoc
{{ optional($r->renewed_on)->format('d/m/Y') ?? '—' }} {{ optional($r->previous_expiry)->format('d/m/Y') ?? '—' }} {{ optional($r->new_expiry)->format('d/m/Y') }} {{ $r->cost ? 'RM '.number_format($r->cost,2) : '—' }} {{ $r->reference_no ?? '—' }} {{ $r->creator?->name ?? '—' }} @if($r->document_path)@else—@endif
No {{ strtolower($label) }} renewals recorded yet.