<div class="hub-table-wrap">
    <div class="table-responsive">
    <table class="table table-hover align-middle mb-0">
        <thead>
            <tr>
                <th>Date</th>
                <th>Description</th>
                <th>Account</th>
                <th>Number</th>
                <th class="text-end">Credit</th>
                <th class="text-end">Debit</th>
                <th class="text-end">Balance</th>
            </tr>
        </thead>
        <tbody>
            @forelse($rows as $row)
                <tr>
                    <td>{{ $row['date'] }}</td>
                    <td>{{ $row['description'] }}</td>
                    <td>{{ $row['account'] }}</td>
                    <td>{{ $row['number'] }}</td>
                    <td class="text-end hub-amount">{{ $row['credit'] > 0 ? '₹ '.number_format($row['credit'], 2) : '' }}</td>
                    <td class="text-end hub-amount">{{ $row['debit'] > 0 ? '₹ '.number_format($row['debit'], 2) : '' }}</td>
                    <td class="text-end hub-amount fw-medium">₹ {{ number_format($row['balance'], 2) }}</td>
                </tr>
            @empty
                <tr>
                    <td colspan="7" class="text-center text-muted py-4">No payments in this period.</td>
                </tr>
            @endforelse
        </tbody>
        @if(!empty($rows))
            <tfoot>
                <tr>
                    <td colspan="4" class="text-end">Totals on page</td>
                    <td class="text-end">₹ {{ number_format($totals['credit'] ?? 0, 2) }}</td>
                    <td class="text-end">₹ {{ number_format($totals['debit'] ?? 0, 2) }}</td>
                    <td class="text-end">₹ {{ number_format($totals['balance'] ?? 0, 2) }}</td>
                </tr>
            </tfoot>
        @endif
    </table>
    </div>
</div>
