<div class="mb-2">
    <button class="btn btn-primary" onclick="export2csv()">Download csv</button>
</div>
{{-- <div class="col-md-12">
    <div class="badge badge-info float-right m-1" style="text-align: ">Total Row: {{ $list->count() }}</div>
    <div class="badge badge-info float-right m-1" style="text-align: ">Total Amount {{ $list->sum('amount') }} TK</div>
    @can('show_commission_reseller_balance_log')
        <div class="badge badge-info float-right m-1" style="text-align: ">Total Manager Miscellaneous Expense
            {{ $list->sum('commission') }} TK</div>
    @endcan
</div> --}}
<div class="table-responsive">
    <table class="table table-bordered table-striped table-condensed" id="tableId">
        <thead>
            <tr>
                <th>#</th>
                <th>Reseller Name</th>
                <th>Total Amount</th>
            </tr>
        </thead>
        <tbody class="bg-white divide-y divide-gray-200">
            @php $total = 0; @endphp
            @forelse ($list as $item)
                <tr>
                    <td>{{ $loop->iteration }}</td>
                    <td>{{ $item->reseller->name ?? 'N/A' }}</td>
                    <td class="text-right">
                        @php $total += $item->total_amount @endphp
                        {{ number_format($item->total_amount, 2) }}
                    </td>
                </tr>
            @empty
            @endforelse
            <tr>
                <td></td>
                <td class="text-right">Total: </td>
                <td class="px-6 py-2 whitespace-nowrap text-right">{{ number_format($total, 2) }}</td>
            </tr>
        </tbody>
    </table>
</div>
