@extends('layouts.admin')

@section('title', 'Payment Mode Summary')

@section('content')
<x-admin.report-page
    title="Payment Mode Summary"
    subtitle="Date: {{ $date }} | Order Type: {{ strtoupper($orderType) }}"
>
    <x-slot:actions>
        <a href="{{ route('admin.reports.day-ledger', ['date' => $date, 'order_type' => $orderType]) }}" class="ci-btn ci-btn--ghost">
            <i class="bi bi-arrow-left"></i> Back to Day Ledger
        </a>
    </x-slot:actions>

    <div class="ci-table-card">
        <div class="ci-table-wrap">
            <table class="ci-table">
                <thead>
                    <tr>
                        <th>Payment Mode</th>
                        <th class="ci-end">Collection</th>
                        <th class="ci-end">Expense</th>
                        <th class="ci-end">Refund</th>
                        <th class="ci-end">Cash to Bank</th>
                        <th class="ci-end">Net</th>
                    </tr>
                </thead>
                <tbody>
                    @forelse($rows as $row)
                        <tr>
                            <td>{{ $paymentModeLabels[$row['payment_mode']] ?? $row['payment_mode'] }}</td>
                            <td class="ci-end"><span class="ci-money">Rs {{ number_format($row['collection'], 2) }}</span></td>
                            <td class="ci-end"><span class="ci-money">Rs {{ number_format($row['expense'], 2) }}</span></td>
                            <td class="ci-end"><span class="ci-money">Rs {{ number_format($row['refund'], 2) }}</span></td>
                            <td class="ci-end"><span class="ci-money">Rs {{ number_format($row['transfer'], 2) }}</span></td>
                            <td class="ci-end"><span class="ci-money">Rs {{ number_format($row['net'], 2) }}</span></td>
                        </tr>
                    @empty
                        <tr>
                            <td colspan="6">
                                <div class="ci-empty">
                                    <i class="bi bi-credit-card"></i>
                                    <h3>No Data Found</h3>
                                    <p>No payment mode rows for this date.</p>
                                </div>
                            </td>
                        </tr>
                    @endforelse
                </tbody>
            </table>
        </div>
    </div>
</x-admin.report-page>
@endsection
