@extends('layouts.app')

@section('title', 'Account Dashboard')

@section('content')
<div class="page-head">
    <div>
        <h1 class="page-title">Driver Payout Account</h1>
        <p class="page-subtitle">This dashboard is for Account users to prepare driver settlement rows, apply additions/deficits, export bank-ready CSV files, and bulk import payout schedules.</p>
    </div>
    <a class="btn" href="{{ route('driver-payouts.index') }}">Open Driver Pay Out</a>
</div>

<div class="grid grid-2">
    <div class="metric"><span>Payout Rows</span><strong>{{ number_format($payoutCount) }}</strong></div>
    <div class="metric"><span>Total Amount</span><strong>₦{{ number_format((float) $totalPayout, 2) }}</strong></div>
</div>

<div class="card">
    <h2 style="margin-top:0;">Recent Payouts</h2>
    <div class="table-wrap">
        <table>
            <thead>
                <tr>
                    <th>Driver Name</th>
                    <th>Bank</th>
                    <th>Account No</th>
                    <th>Total Amount</th>
                </tr>
            </thead>
            <tbody>
                @forelse($recentPayouts as $payout)
                    <tr>
                        <td>{{ $payout->driver_name }}</td>
                        <td>{{ $payout->driver_bank }}</td>
                        <td>{{ $payout->driver_account_no }}</td>
                        <td><strong>₦{{ number_format((float) $payout->total_amount, 2) }}</strong></td>
                    </tr>
                @empty
                    <tr><td colspan="4">No driver payout rows yet.</td></tr>
                @endforelse
            </tbody>
        </table>
    </div>
</div>
@endsection
