<div class="col-md-12">
    <div class="badge badge-info float-right m-1" style="text-align: ">Total Row: {{ $payments->count() }}</div>
</div>
<div class="table-responsive">
<table id="dataTable" class="table">
    <thead class="bg-blue-50">
        <tr>
            <th scope="col" class="___class_+?2___">
                ID
            </th>
            <th scope="col" class="___class_+?3___">
                C. date
            </th>

            <th scope="col" class="___class_+?4___">
                Clients Name
            </th>
            <th scope="col" class="___class_+?4___">
                Area
            </th>
            <th scope="col" class="___class_+?5___">
                Contact No
            </th>

            <th scope="col" class="text-right">
                OTC
            </th>



        </tr>
    </thead>
        @php
            $sum_of_amount = 0;
        @endphp
    <tbody class="bg-white divide-y divide-gray-200">
        @foreach ($payments as $item)
        @php
            $sum_of_amount += $item->paid_amount;
        @endphp
            <tr>
                <td>{{ $item->id }}</td>
                <td>{{ $item->clients->clientsinfo->joinDate ?? ""}}</td>
                <td>{{ $item->clients->clientsinfo->clients_name }}</td>
                <td>{{ $item->clients->clientsinfo->area }}</td>
                <td >{{ $item->clients->clientsinfocontact_no }}</td>
                <td class="text-right"> {{number_format($item->paid_amount, 2, '.', '')  }}</td>
            </tr>
        @endforeach
            <tr>
                <td colspan="5"><strong>Total</strong></td>
                <td class="text-right"><strong>{{number_format($sum_of_amount, 2, '.', '')}}</strong></td>
            </tr>

    </tbody>
</table>
</div>
</div>
