@extends('layouts.app', ['pageTitle' => 'Admin Finance Dashboard', 'pageSubtitle' => 'Summary of cash, receivables, payables, income, expenses and approvals'])
@section('content')
<div class="grid grid-4">
    <div class="card stat"><div class="label">Cash / Bank</div><div class="value">₦{{ number_format($summary['cash'], 2) }}</div></div>
    <div class="card stat"><div class="label">Receivables</div><div class="value">₦{{ number_format($summary['receivables'], 2) }}</div></div>
    <div class="card stat"><div class="label">Payables</div><div class="value">₦{{ number_format($summary['payables'], 2) }}</div></div>
    <div class="card stat"><div class="label">Profit / Loss</div><div class="value">₦{{ number_format($summary['income'] - $summary['expenses'], 2) }}</div></div>
</div>
<div class="grid grid-4">
    <div class="card stat"><div class="label">Income</div><div class="value">₦{{ number_format($summary['income'], 2) }}</div></div>
    <div class="card stat"><div class="label">Expenses</div><div class="value">₦{{ number_format($summary['expenses'], 2) }}</div></div>
    <div class="card stat"><div class="label">Pending Claims</div><div class="value">{{ $summary['pending_claims'] }}</div></div>
    <div class="card stat"><div class="label">Unpaid Invoices / Bills</div><div class="value">{{ $summary['unpaid_invoices'] }} / {{ $summary['unpaid_bills'] }}</div></div>
</div>
<div class="grid grid-2">
    <div class="card"><h3 class="section-title">Recent Payments</h3><div class="table-wrap"><table><thead><tr><th>No</th><th>Type</th><th>Amount</th><th>Date</th></tr></thead><tbody>@forelse($recentPayments as $p)<tr><td>{{ $p->payment_number }}</td><td><span class="badge blue">{{ $p->payment_type }}</span></td><td>₦{{ number_format($p->amount,2) }}</td><td>{{ $p->payment_date }}</td></tr>@empty<tr><td colspan="4">No payment recorded.</td></tr>@endforelse</tbody></table></div></div>
    <div class="card"><h3 class="section-title">Recent Claims</h3><div class="table-wrap"><table><thead><tr><th>Claim</th><th>User</th><th>Amount</th><th>Status</th></tr></thead><tbody>@forelse($recentClaims as $c)<tr><td>{{ $c->claim_number }}</td><td>{{ $c->user_name }}</td><td>₦{{ number_format($c->amount + $c->tax_amount,2) }}</td><td><span class="badge warn">{{ $c->status }}</span></td></tr>@empty<tr><td colspan="4">No claim submitted.</td></tr>@endforelse</tbody></table></div></div>
</div>
@endsection
