<div class="card shadow-none" style="margin-bottom:0.6rem;">
    <div class="card-header d-flex align-items-center justify-content-between">
        <h6 class="mb-0">Total Invoices in Cart <i class="bi bi-cart"></i> ({!! isset($data['invoice']) ? count($data['invoice']) : '0' !!})</h6>
    <button class="btn btn-primary" id="invoice_total"> </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>Invoice No</th>
                    <th>Invoice Date</th>
                    <th>Invoice Value</th>
                    <th>Way Bill No</th>
                    <th>Way Bill Date</th>
                    <th>Way Exp Date</th>
                    <th class="thbutton">Delete</th>
                </tr>
            </thead>
            <tbody>
                @php
                $i = 1;
                $invoice_value = 0;
                @endphp
                @if (isset($data['invoice']) && count($data['invoice']) > 0)
                @foreach ($data['invoice'] as $key => $list)
                <tr class="cart-invoice" >
                    <td >{{ $list['bill_no'] ?? '' }} </td>
                    <td class="text-center">{{ $list['bill_date'] ?? '' }}</td>
                    <td class="text-center">{{ convertDecimelPoint($list['amount'] ?? ($list['amount'] ?? '')) }}</td>   
                    <td class="text-center">{{ $list['way_bill_no'] ?? '' }}</td>
                    <td class="text-center">{{ $list['way_bill_date'] ?? '' }}</td>
                    <td class="text-center">{{ $list['way_exp_date'] ?? '' }}</td>
                    <td class="text-center">
                        <a style="line-height:24px;" data-url="{{ route('cart-invoice-remove') }}" data-type='invoice' data-id="{{ $list['bill_no'] }}" 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 $invoice_value += 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() {
        $('#invoice_total').html('Total Amount in cart  {!! $invoice_value !!} ')
    });
</script>
