{{-- Data Field Component — label:value row untuk detail/read-only pages Usage: Simple value: Custom content (badge, link, dll): Currency: Empty fallback: Props: label string required value mixed optional — dipakai jika slot kosong currency bool default false — format sebagai Rp empty string default '—' — teks jika value null/kosong --}} @props([ 'label', 'value' => null, 'currency' => false, 'empty' => '—', ]) @php $hasSlot = isset($slot) && $slot->isNotEmpty(); if (! $hasSlot) { if ($value === null || $value === '') { $displayValue = $empty; $isEmpty = true; } elseif ($currency) { $displayValue = 'Rp ' . number_format((float) $value, 0, ',', '.'); $isEmpty = false; } else { $displayValue = $value; $isEmpty = false; } } @endphp
{{ $label }}
@if($hasSlot) {{ $slot }} @else {{ $displayValue }} @endif