@extends('layouts.admin')

@section('title', 'Payment Mode Summary')

@section('content')
<div class="admin-page-header d-flex justify-content-between align-items-center mb-4">
    <div>
        <h1>Payment Mode Summary</h1>
        <p class="admin-page-subtitle mb-0">Date: {{ $date }} | Order Type: {{ strtoupper($orderType) }}</p>
    </div>
    <a href="{{ route('admin.reports.day-ledger', ['date' => $date, 'order_type' => $orderType]) }}" class="btn btn-outline-secondary">
        Back to Day Ledger
    </a>
</div>

<div class="admin-card">
    <div class="card-body">
        <div class="table-responsive">
            <table class="admin-table table table-hover">
                <thead>
                    <tr>
                        <th>Payment Mode</th>
                        <th class="text-end">Collection</th>
                        <th class="text-end">Expense</th>
                        <th class="text-end">Refund</th>
                        <th class="text-end">Cash to Bank</th>
                        <th class="text-end">Net</th>
                    </tr>
                </thead>
                <tbody>
                    @forelse($rows as $row)
                        <tr>
                            <td>{{ $paymentModeLabels[$row['payment_mode']] ?? $row['payment_mode'] }}</td>
                            <td class="text-end">Rs {{ number_format($row['collection'], 2) }}</td>
                            <td class="text-end">Rs {{ number_format($row['expense'], 2) }}</td>
                            <td class="text-end">Rs {{ number_format($row['refund'], 2) }}</td>
                            <td class="text-end">Rs {{ number_format($row['transfer'], 2) }}</td>
                            <td class="text-end fw-semibold">Rs {{ number_format($row['net'], 2) }}</td>
                        </tr>
                    @empty
                        <tr><td colspan="6" class="text-center text-muted py-3">No data found</td></tr>
                    @endforelse
                </tbody>
            </table>
        </div>
    </div>
</div>
@endsection
