@extends('layouts.app') @section('title', 'Matching') @section('content') @php $sections = [ ['received', 'Receipts on account', 'Money clients paid that isn\'t tied to an order yet', $receipts, $openOrders, 'client', 'client_id', 'success'], ['paid', 'Vendor payments on account', 'Money you paid that isn\'t tied to a bill or an assignment yet', $payments, $openBills, 'vendor', 'vendor_id', 'danger'], ]; @endphp Ledger check @foreach ($sections as [$dir, $title, $sub, $list, $open, $rel, $col, $tone])
{{ $title }}
{{ $sub }}
{{ $list->isEmpty() ? 'All matched' : $list->count().' to match' }}
@forelse ($list as $p) @php($targets = $open[$p->{$col}] ?? collect()) @empty @endforelse
Date{{ ucfirst($rel) }}Method / refAmountMatch to {{ $dir === 'received' ? 'order' : 'bill / assignment' }}
{{ $p->paid_on->format('d M Y') }} {{ $p->partyName() }} {{ \App\Models\Payment::METHODS[$p->method] ?? $p->method }}@if ($p->reference){{ $p->reference }}@endif {{ money($p->amount) }} @if ($targets->isEmpty()) No open {{ $dir === 'received' ? 'orders' : 'bills' }} for this {{ $rel }}. @else
@csrf
{{ config('erp.currency') }}
@endif
@if ($list->isNotEmpty())@endif
@endforeach @endsection