<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 Products in Cart <i class="bi bi-cart"></i> ({!! isset($items) ? count($items) : '0' !!})</h6>
        <button class="btn btn-primary float-left" id="checkout" > </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 class="text-start" style="text-align: right">Item Details </th>
                    <th >Rate Calculation on </th>
                    <th >Item QTY</th>
                    <th >Gross Weight</th>
                    <th >Rate</th>
                    <th>TAX </th>
                    <th >AMOUNT</th>
                    <th class="thbutton">Edit</th>
                    <th class="thbutton">Delete</th>                                   
                </tr>
            </thead>
            <tbody>
                @php
                $i = 1;
                $product_price = 0;
                @endphp
                @if (isset($items) && count($items) > 0)
                @foreach ($items as $key => $list)
                <tr class="cart-products" data-id="{{ $list['product_id'] }}">
                    <td class="text-start">{{ $list['item_details'] ?? '' }} 
                    </td>
                     <td class="text-center" name="rate_calculation_update" id="rate_calculation_update"   >
                       {{ $list['rate_calculation_type'] ?? '' }}
                    </td>
                    <td class="text-center">
                       {{ $list['quantity'] ??  ""}} 
                    </td>
                    <td class="text-center">
                       {{ $list['gross_weight'] ?? '' }}  {{ $list['weight_calculation_on'] ?? '' }} 
                    </td>
                    <td class="text-center">
                       {{ $list['rate'] ?? '' }}
                    </td>
                    <td class="text-center" >
                         {{ $item_tax_per ?? '' }}%<br>{{ convertDecimelPoint($item_tax_amount ?? '') }} 
                    </td>
                    <td class="text-center">{{ convertDecimelPoint($list['total_amount'] ?? ($list['total_amount'] ?? '')) }}</td>
                    <td>
                            <button data-id="{{ $list->id }}" class="btn btn-outline-secondary edit" 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('item-delete')}}" data-type='product' 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 $product_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() {
        $('#checkout').html('Total Amount  in cart {!! $product_price !!} ')
    });
</script>
