@extends('layouts.app') @section('content')

{{ $viewType === 'statement' ? 'Agent Statement' : 'Agent Payment History' }}

@if($viewType === 'statement')
@endif
@if($agentId !== null || $showAllAgents)

{{ $viewType === 'statement' ? 'Statement' : 'Payment History' }} for {{ $selectedAgent ? $selectedAgent->name : 'All Agents' }}

@if($viewType === 'statement') @if(count($items) > 0)
@forelse($items as $item) @empty @endforelse
Type Date Customer Name Customer Identity Service Name Voucher ID Branch Payment Method Transaction ID Payable Paid Due
{{ $item['type'] }} {{ $item['delivery_date'] }} {{ $item['customer_name'] }} {{ $item['identity_no'] }} {{ $item['service_name'] }} {{ $item['voucher_id'] ? Str::of($item['voucher_id'])->replace('-', '') : '' }} {{ $item['branch'] }} {{ $item['payment_method'] }} {{ $item['trx_id'] }} {{ $item['payable'] }} {{ $item['paid'] }} {{ $item['due'] }}
No completed orders or payments found.
Totals: {{ $totalPayable }} {{ $totalPaid }} {{ $totalDue }}
@else

No completed orders or payments found for the selected criteria.

@endif @elseif($viewType === 'payment') @if($payments->isNotEmpty())
@if(auth()->user()->isSuperAdmin()) @endif @foreach($payments as $payment) @endforeach
Voucher ID Payment Date Branch PaidAction
{{ Str::of($payment->voucher_id ?? 'N/A')->replace('-', '') }} {{ $payment->created_at->format('Y-m-d H:i:s') }} {{ $payment->payment->branch->name ?? 'N/A' }} {{ number_format($payment->amount, 0) }} View @if(auth()->user()->isSuperAdmin()) Edit @endif
Total Paid: {{ number_format($payments->sum('amount'), 0) }}
@else

No payment history found for the selected criteria.

@endif @endif @else

Please select an agent to view the {{ $viewType === 'statement' ? 'statement' : 'payment history' }}.

@endif
@endsection