@php /** * Reusable badge helpers for deviation views. * Use as: @include('deviations.partials._badge-helpers') */ $badgeForStatus = fn($s) => match($s) { 'DRAFT' => 'secondary', 'SUBMITTED' => 'primary', 'UNDER_REVIEW' => 'warning', 'UNDER_INVESTIGATION' => 'info', 'AWAITING_CAPA' => 'warning', 'AWAITING_CLOSURE' => 'primary', 'CLOSED' => 'success', 'REJECTED' => 'danger', default => 'secondary', }; $badgeForPriority = fn($p) => match(strtoupper($p ?? '')) { 'CRITICAL' => 'danger', 'HIGH' => 'warning', 'MEDIUM' => 'info', 'LOW' => 'success', default => 'secondary', }; $badgeForSeverity = fn($s) => match(strtoupper($s ?? '')) { 'CRITICAL' => 'danger', 'HIGH' => 'warning', 'MEDIUM' => 'info', 'LOW' => 'success', default => 'secondary', }; @endphp