@extends('layouts.app')
@section('title','Receipts')
@section('page_title','Receipt Vouchers')
@section('content')
<div class="page-head"><div><h1>Receipt Vouchers</h1><p>Customer receipts, vendor refunds and other incoming payments.</p></div>@if(auth()->user()->hasPermission('receipts.create'))<a class="btn btn-primary" href="{{ route('receipts.create') }}">+ New Receipt</a>@endif</div>
<div class="card"><div class="toolbar"><form class="search"><input class="control" name="search" value="{{ request('search') }}" placeholder="Receipt, party or reference"><select class="control" name="status"><option value="">All statuses</option>@foreach(\App\Enums\DocumentStatus::cases() as $s)<option value="{{ $s->value }}" @selected(request('status')===$s->value)>{{ ucwords(str_replace('_',' ',$s->value)) }}</option>@endforeach</select><button class="btn btn-secondary">Filter</button></form><span class="muted">{{ $receipts->total() }} receipts</span></div><div class="table-wrap"><table class="table"><thead><tr><th>Receipt</th><th>Date</th><th>Type</th><th>Party</th><th>Method</th><th>Amount</th><th>Allocated</th><th>Status</th><th></th></tr></thead><tbody>@forelse($receipts as $r)@php($s=$r->status instanceof \App\Enums\DocumentStatus?$r->status->value:$r->status)<tr><td><strong>{{ $r->receipt_number }}</strong><div class="muted">{{ $r->reference_number }}</div></td><td>{{ $r->receipt_date->format('d M Y') }}</td><td>{{ ucwords(str_replace('_',' ',$r->receipt_type)) }}</td><td>{{ $r->party?->legal_name }}</td><td>{{ ucwords(str_replace('_',' ',$r->payment_method)) }}</td><td>{{ $r->currency_code }} {{ number_format((float)$r->amount,2) }}</td><td>{{ number_format((float)$r->allocated_total,2) }}</td><td><span class="badge status-{{ $s }}">{{ ucwords(str_replace('_',' ',$s)) }}</span></td><td><a class="btn btn-secondary btn-sm" href="{{ route('receipts.show',$r) }}">Open</a></td></tr>@empty<tr><td colspan="9" class="empty">No receipts found.</td></tr>@endforelse</tbody></table></div>{{ $receipts->links() }}</div>
@endsection
