@php $unitId = $getState() ?? null; $totalAmount = (float) str_replace(',', '', (string) ($this->data['total_amount'] ?? 0)); $record = $getRecord(); // Payment type if ($record && $record->payment_type) { $isRefund = $record->payment_type === \App\Enums\PaymentType::Refund; } else { $isRefund = $totalAmount < 0; } // Credit $unit = $unitId ? \App\Models\Unit::find($this->data['unit_id'] ?? null) : null; $credit = $unit ? (int) $unit->credit : 0; $showCredit = !$isRefund && ($totalAmount > 0 || ($record && $record->payment_type === \App\Enums\PaymentType::Collect)); @endphp
{{-- Payment Type Badge --}} @if($totalAmount != 0 || $record) @if($isRefund) ↩ ຄືນເງິນໃຫ້ໜ່ວຍ @else ↓ ເກັບເງິນຈາກໜ່ວຍ @endif @else — ເລືອກງວດກ່ອນ @endif {{-- Credit Badge --}} @if($showCredit && $unit) 🎫 ສິດຕິດໜີ້: {{ $credit }} ຄັ້ງ @endif