@props([ 'prescriptionItem', 'showStatus' => true, 'showDosage' => true, 'showFrequency' => true ]) @php $colorClasses = 'bg-gray-100 text-gray-800'; $statusDot = 'bg-gray-500'; $isCustom = $prescriptionItem && !$prescriptionItem->medication_id; if ($prescriptionItem) { if ($isCustom) { $colorClasses = 'bg-purple-100 text-purple-800'; // Custom color for custom medications } elseif ($prescriptionItem->medication) { $colorClasses = match ($prescriptionItem->medication->type ?? 'default') { 'antibiotic' => 'bg-blue-100 text-blue-800', 'painkiller' => 'bg-red-100 text-red-800', 'antidepressant' => 'bg-purple-100 text-purple-800', 'antihistamine' => 'bg-yellow-100 text-yellow-800', 'vitamin' => 'bg-green-100 text-green-800', 'antidiabetic' => 'bg-orange-100 text-orange-800', 'cardiovascular' => 'bg-pink-100 text-pink-800', 'antiviral' => 'bg-teal-100 text-teal-800', 'anticoagulant' => 'bg-indigo-100 text-indigo-800', 'antihypertensive' => 'bg-sky-100 text-sky-800', 'antipsychotic' => 'bg-fuchsia-100 text-fuchsia-800', 'hormone' => 'bg-lime-100 text-lime-800', 'gastrointestinal' => 'bg-amber-100 text-amber-800', 'respiratory' => 'bg-cyan-100 text-cyan-800', 'immunosuppressant' => 'bg-rose-100 text-rose-800', 'antifungal' => 'bg-emerald-100 text-emerald-800', 'anticonvulsant' => 'bg-violet-100 text-violet-800', 'dermatological' => 'bg-stone-100 text-stone-800', 'ophthalmic' => 'bg-slate-100 text-slate-800', default => 'bg-gray-100 text-gray-800', }; } $statusDot = match ($prescriptionItem->status ?? 'default') { 'active' => 'bg-green-500', 'discontinued' => 'bg-red-500', 'as-needed' => 'bg-yellow-500', 'temporary' => 'bg-blue-500', 'tapering' => 'bg-purple-500', 'on-hold' => 'bg-orange-500', 'scheduled' => 'bg-indigo-500', 'long-term' => 'bg-teal-500', default => 'bg-gray-500', }; } @endphp merge(['class' => "inline-flex items-center px-2.5 py-1 rounded-full text-xs font-medium $colorClasses transition duration-300 ease-in-out hover:opacity-80"]) }}> @if($showStatus && $prescriptionItem) @endif @if($isCustom) {{ $prescriptionItem->custom_medication_name ?? 'Custom Medication' }} @if($showDosage && $prescriptionItem) ({{ $prescriptionItem->dosage ?? 'Unknown' }}) @endif @else {{ $prescriptionItem->medication->name ?? 'Unknown Medication' }} @if($showDosage && $prescriptionItem && $prescriptionItem->medication) ({{ $prescriptionItem->dosage ?? 'Unknown' }} {{ $prescriptionItem->medication->dosage_form ?? 'form' }}) @endif @endif @if($showFrequency && $prescriptionItem) {{ $prescriptionItem->frequency ?? 'Unknown frequency' }} @endif