@props([ 'status' => null, 'size' => 'sm', 'showIcon' => true, ]) @php use App\Enums\LeadOrderStatus; $status = $status instanceof LeadOrderStatus ? $status : ($status ? LeadOrderStatus::tryFrom($status) : null); $colorMap = [ 'active' => 'success', 'paused' => 'warning', 'completed' => 'info', 'cancelled' => 'danger', ]; $iconMap = [ 'active' => 'play-circle', 'paused' => 'pause-circle', 'completed' => 'check-circle', 'cancelled' => 'cross-circle', ]; $color = $status ? ($colorMap[$status->value] ?? 'secondary') : 'light'; $icon = $status ? ($iconMap[$status->value] ?? 'help') : 'help'; $label = $status?->label() ?? __('Inconnu'); $sizeClass = match($size) { 'xs' => 'badge-xs', 'sm' => 'badge-sm', 'md' => '', 'lg' => 'badge-lg', default => 'badge-sm', }; @endphp merge(['class' => "badge bg-{$color}-dim bg-outline-{$color} rounded-pill {$sizeClass}"]) }}> @if($showIcon) @endif {{ $label }}