<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($charges)? count($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">Edit</th>
                    <th class="thbutton">Delete</th>
                </tr>
            </thead>
            <tbody>
                @php
                $i = 1;
                $charge_price = 0;
                @endphp
                @if (isset($charges) && count($charges) > 0)
                @foreach ($charges as $key => $list)
                <tr class="cart-charges" data-consignors_id="{{ $list['charge_id'] }}">
                    <td >{{ $list['additional_charges'] ?? '' }} </td>
                    <td class="text-center">{{ $list['charge_rate'] ?? '' }}</td>
                    <td class="text-center"> {{ $list['charge_quantity'] ??  ""}} </td>
                    <td >  {{ $charge_tax_per ?? '' }}%<br>{{ convertDecimelPoint($charge_tax ?? '') }}  </td>
                    <td class="text-center">{{ convertDecimelPoint($list['charge_amount'] ?? ($list['charge_amount'] ?? '')) }}</td>
                    <td>
                            <button data-id="{{ $list->id }}" class="btn btn-outline-secondary edit_charge" data-bs-toggle="modal" data-bs-target="#commonModal" title="Edit">
                                <i class="bi bi-pencil-square"></i>
                            </button>
                        </td>
                        <td class="text-center">
                        <a style="line-height:24px;" data-url="{{route('charge-delete')}}" data-type='charge' data-id="{{$list->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>