@extends('master.app') @section('title', 'Customer Advances') @section('body')
{{-- Header --}}

Customer Advances

Filter, review and manage customer prepayments
{{-- KPI Cards --}} @php $selectedCurrencyId = request('currency_id', 'all'); $isAllCurrency = $selectedCurrencyId === 'all' || $selectedCurrencyId === null; $renderTotals = function ($arr) use ($isAllCurrency, $selectedCurrencyId, $currencyTitles) { if ($isAllCurrency) { $hasAny = false; $html = ''; foreach ($currencyTitles as $cid => $title) { $v = (float) ($arr[$cid] ?? 0); if ($v != 0) { $hasAny = true; $html .= '
' . number_format($v, 2) . ' ' . $title . '
'; } } return $hasAny ? $html : '
0
'; } $v = (float) ($arr[$selectedCurrencyId] ?? 0); $t = $currencyTitles[$selectedCurrencyId] ?? ''; return '
' . number_format($v, 2) . ' ' . $t . '
'; }; @endphp
Total Sale
{!! $renderTotals($totals['sale']) !!}
Total Received
{!! $renderTotals($totals['received']) !!}
Total Advance
{!! $renderTotals($totals['advance']) !!}
Balance
{!! $renderTotals($totals['balance']) !!}
{{-- Filters (GET to index) --}}
Reset
{{-- Table --}}
@forelse($data as $row) @empty @endforelse
# Number Customer Title Date Advance Action
{{ $loop->iteration }} {{ $row->invoice_number }} {{ optional($row->customer)->name }} {{ $row->title }} {{ $row->date }} {{ $row->amount }} {{ optional($row->currency)->title_en }}
No data found.
{{-- Pagination --}}
{{ $data->links('pagination::bootstrap-4') }}
@endsection @section('pageJs') @endsection