Files
ilycats/resources/views/components/status-badge.blade.php
T

17 lines
599 B
PHP
Raw Normal View History

2026-02-08 15:16:35 +07:00
@props(['status'])
@php
$cleanStatus = strtolower(trim($status ?? ''));
$safeWords = ['sehat', 'normal', 'aktif', 'ok', 'good', 'sembuh', '-', ''];
2026-09-23 12:45:02 +07:00
$isSehat = in_array($cleanStatus, $safeWords);
2026-02-08 15:16:35 +07:00
2026-09-23 12:45:02 +07:00
$classes = $isSehat
2026-02-08 15:16:35 +07:00
? 'bg-green-100 text-green-700 border-green-200'
: 'bg-red-100 text-red-700 border-red-200';
@endphp
<span {{ $attributes->merge(['class' => "px-3 py-1 rounded-full text-xs font-bold border $classes"]) }}>
2026-09-23 12:45:02 +07:00
<i class="fas {{ $isSehat ? 'fa-check-circle' : 'fa-pills' }} mr-1"></i>
{{ $isSehat ? 'Sehat / Normal' : $status }}
2026-02-08 15:16:35 +07:00
</span>