<div class="card shadow-none" style="margin-bottom:0.8rem;">
    <div class="card-header d-flex align-items-center justify-content-between">
        <h6 class="mb-0">Total Charges in Cart <i class="bi bi-cart"></i> ({!! isset($data['charges']) ? count($data['charges']) : '0' !!})</h6>
        <button class="btn btn-primary" id="checkoutt" > </button>
     </div>

<div class="card-body pb-0">
    <div class="table-responsive">
        <table id="example" class="table table-bordered align-middle" style="width:100%">
            <thead class="table-light">
                <tr>
                    <th>Charge Name</th>
                    <th>Rate</th>
                    <th>Qty</th>
                    <th>Tax</th>
                    <th>Amount</th>
                    <th class="thbutton">Delete</th>
                </tr>
            </thead>
            <tbody>
                @php
                $i = 1;
                $charge_price = 0;
                @endphp
                @if (isset($data['charges']) && count($data['charges']) > 0)
                @foreach ($data['charges'] as $key => $list)
    
                <tr class="cart-charges" data-consignors_id="{{ $list['charge_id'] }}">
                    <td >{{ $list['charge'] ?? '' }} </td>
                    <td class="text-center">{{ $list['charge_rate'] ?? '' }}</td>
                    <td style="width:280px"><input type="number" name="charge_qty_update" data-id="{{ $list['charge_id'] }}" class="form-control bg-white" value="{{ convertDecimelPoint($list['charge_qty'] ?? '') }}" placeholder="00.00" ></td>
                    <td > {{ $list['tax_per'] ?? '' }}%<br>{{ convertDecimelPoint($list['tax_flat'] ?? '') }} </td>
                    <td class="text-center">{{ convertDecimelPoint($list['amount'] ?? ($list['amount'] ?? '')) }}</td>
                    <td class="text-center">
                        <a style="line-height:24px;" data-url="{{ route('cart-charge-remove') }}" data-type='charge' data-id="{{ $list['charge_id'] }}" class="btn btn-danger deleteDataCustom" href="#" class="text-danger" data-bs-toggle="tooltip" data-bs-placement="left" title="Delete">
                            <i class="bi bi-trash text-white"></i>
                        </a>
                    </td>
                    @php $charge_price += preg_replace("/[^0-9.]/", "", $list['amount']); @endphp
                </tr>
                @php $i++; @endphp
                @endforeach
                @else
                <tr>
                    <td colspan="9">No Data Found</td>
                </tr>
                @endif

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


<script type="text/javascript">
    $(document).ready(function() {
        $('#checkoutt').html('Total Amount in cart  {!! $charge_price !!} ')
    });
</script>
