{{-- Resource Gauge Component - AdminLTE style Shows a circular or linear gauge for resource usage Usage: --}} @props([ 'value' => 0, 'max' => 100, 'label', 'sublabel' => null, 'suffix' => '%', 'prefix' => null, 'icon' => null, 'gradient' => null, 'color' => 'auto', ]) @php $percent = $max > 0 ? min(100, ($value / $max) * 100) : 0; // Auto-color based on usage if ($color === 'auto') { if ($percent >= 90) { $color = 'danger'; } elseif ($percent >= 70) { $color = 'warning'; } else { $color = 'success'; } } $bgColors = [ 'primary' => 'var(--lte-primary, #0d6efd)', 'success' => 'var(--lte-success, #198754)', 'warning' => 'var(--lte-warning, #ffc107)', 'danger' => 'var(--lte-danger, #dc3545)', 'info' => 'var(--lte-info, #0dcaf0)', ]; $barColor = $bgColors[$color] ?? $bgColors['primary']; $badgeLabel = match(true) { $percent >= 100 => 'Over entitlement', $percent >= 85 => 'Watchlist', default => 'Healthy', }; $badgeStyle = match(true) { $percent >= 100 => 'background-color: rgba(220, 53, 69, 0.1); color: var(--lte-danger, #dc3545);', $percent >= 85 => 'background-color: rgba(255, 193, 7, 0.15); color: #997404;', default => 'background-color: rgba(25, 135, 84, 0.1); color: var(--lte-success, #198754);', }; @endphp
class(['resource-gauge-lte']) }}>

{{ $label }}

@if($prefix){{ $prefix }}@endif{{ is_numeric($value) ? number_format($value, 1) : $value }}@if($suffix){{ $suffix }}@endif

@if($sublabel)

{{ $sublabel }}

@endif
{{ $badgeLabel }}
Usage {{ number_format($percent, 1) }}%