@props([ 'classification' => null, 'size' => 'sm', 'animated' => true, ]) @php use App\Enums\LeadClassification; $classification = $classification instanceof LeadClassification ? $classification : ($classification ? LeadClassification::tryFrom($classification) : null); $colorMap = [ 'billable' => 'success', 'out_of_criteria' => 'danger', 'wrong_number' => 'danger', 'unreachable' => 'warning', 'duplicate' => 'secondary', 'incomplete_data' => 'warning', 'existing_client' => 'secondary', ]; $iconMap = [ 'billable' => 'check-circle', 'out_of_criteria' => 'cross-circle', 'wrong_number' => 'call-alt', 'unreachable' => 'user-cross', 'duplicate' => 'copy', 'incomplete_data' => 'alert-circle', 'existing_client' => 'users', ]; $color = $classification ? ($colorMap[$classification->value] ?? 'secondary') : 'light'; $icon = $classification ? ($iconMap[$classification->value] ?? 'help') : 'help'; $label = $classification?->label() ?? __('Non classifié'); $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($animated) x-data="{ show: false }" x-init="setTimeout(() => show = true, 100)" x-show="show" x-transition:enter="tw-transition tw-ease-out tw-duration-300" x-transition:enter-start="tw-opacity-0 tw-scale-90" x-transition:enter-end="tw-opacity-100 tw-scale-100" @endif > {{ $label }}