{{-- Reference --}}
{{ $sale->reference_no }}
@if($sale->client)
{{ $sale->client->full_name }}
@endif
{{ $sale->sale_date->format('d M Y H:i') }}
{{-- Services --}}
@if($services->isNotEmpty())
Services
@foreach($services as $svc)
{{ $svc['name'] }}
@if(!empty($svc['staff_name']))
by {{ $svc['staff_name'] }}
@endif
KSh {{ number_format($svc['amount'], 2) }}
@endforeach
@endif
{{-- Totals --}}
SubtotalKSh {{ number_format($sale->subtotal, 2) }}
@if($sale->discount_total > 0)
Discount- KSh {{ number_format($sale->discount_total, 2) }}
@endif
Grand TotalKSh {{ number_format($sale->total, 2) }}
@if($sale->total_paid > 0)
PaidKSh {{ number_format($sale->total_paid, 2) }}
@endif
@if($sale->remaining_balance > 0)
Balance Due
KSh {{ number_format($sale->remaining_balance, 2) }}
@php
$balance = $sale->remaining_balance;
$methods = $paymentMethods ?? [];
// If no methods configured, show defaults
if (empty($methods)) {
$methods = [
['key' => 'mpesa', 'label' => 'M-Pesa', 'type' => 'mpesa', 'enabled' => true],
['key' => 'cash', 'label' => 'Cash', 'type' => 'cash', 'enabled' => true],
];
}
$payheroOn = $payheroConfigured ?? false;
@endphp
{{-- Method tabs --}}
@if(count($methods) > 1)
@foreach($methods as $i => $method)
@php
$type = strtolower($method['type'] ?? $method['key'] ?? '');
$icon = match(true) {
str_contains($type, 'mpesa') || str_contains($type, 'm-pesa') => '📱',
str_contains($type, 'cash') => '💵',
str_contains($type, 'card') => '💳',
default => '💰',
};
@endphp
{{ $icon }}
{{ $method['label'] }}
@endforeach
@endif
{{-- Method panels --}}
@foreach($methods as $i => $method)
@php
$type = strtolower($method['type'] ?? $method['key'] ?? '');
$isMpesa = str_contains($type, 'mpesa') || str_contains($type, 'm-pesa');
$isCash = str_contains($type, 'cash');
$isCard = str_contains($type, 'card');
$key = $method['key'];
@endphp
@endforeach
@else
Fully Paid — Thank you!
@endif