 <div class="table-responsive">
    <table id="example" class="table table-bordered align-middle" style="width:100%">
        <thead class="table-light">
            <tr>
                <th class="thbutton">Sl No</th>
                <!-- <th>Order ID</th> -->
                <th>License No</th>
                <!-- <th>Order Date</th> -->
                {{-- <th>Project</th> --}}
                <th>Customer Details</th>
                <th>Customer Contacts</th>
                <th>Service Details</th>
                <th>Manager</th>
                <!-- <th>Expiry Date</th> -->
                <th width="10%">Status</th>
                <th class="thbutton">Keys</th>
                @if(in_array('license-registered-edit', $authRolePermissions))
                <th class="thbutton">Edit</th>
                @endif
                @if(in_array('license-registered-delete', $authRolePermissions))
                <th class="thbutton">Delete</th>
                @endif
            </tr>
        </thead>
        <tbody>
            @php $i=1;@endphp
            @if(count($data)>0)
                @foreach($data as $key=> $list)
                    <tr>
                        <td class="text-center">{{$data->firstItem() + $key}}</td>
                        <!-- <td>{!! $list->id !!}</td> -->
                        <td>
                            <a href="{!! route('license-registered-details', $list->id) !!}">
                                <strong>{!! $list->license_no !!}</strong>
                            </a><br>
                            {{-- {!! formatedDate($list->license_date) !!} <br /> --}}
                            Order Date: {!! formatedDate($list->order_date) !!} <br />
                        </td>
                        {{-- <td>
                            <strong>{!! @$list->project->title !!}</strong><br />
                            {!! @$list->project->code !!}
                        </td> --}}
                        <!-- <td>{!! formatedDate($list->order_date) !!}</td> -->
                        <!-- <td>
                            <strong>{!! @$list->project->title !!}</strong><br />
                            {!! @$list->project->code !!}
                        </td> -->
                        <td>
                            <strong>{!! @$list->bill_to->name !!}</strong><br />
                            @if (@$list->bill_to->account_contact->email != '')
                            <a href="mailto:{!! @$list->bill_to->account_contact->email !!}"><i class="bi bi-envelope"></i> {!! @$list->bill_to->account_contact->email !!}</a><br />
                            @endif
                        </td>
                        <td>
                            @if (@$list->bill_to->account_contact->phone_no != '')
                            <a href="tel:{!! @$list->bill_to->account_contact->phone_no !!}"><i class="bi bi-telephone-fill"></i> {!! @$list->bill_to->account_contact->phone_no !!}</a><br />
                            @endif
                            @if (@$list->bill_to->account_contact->whatsapp_no != '')
                            <a href="https://wa.me/{!! @$list->bill_to->account_contact->phone_no !!}"><i class="bi bi-whatsapp"></i> {!! @$list->bill_to->account_contact->whatsapp_no !!}</a><br />
                            @endif
                        </td>
                        <td>
                            {!! @$list->services !!}
                        </td>
                        <td>
                            {!! @$list->manager->name !!}
                        </td>
                        <?php
                            if (isset($list->license_detail->license_activation_history)) {
                            $expiryDate = \Carbon\Carbon::parse($list->license_detail->license_activation_history->expiry_date);
                            $currentDate = \Carbon\Carbon::now();
                            $remainingDays = $currentDate->diffInDays($expiryDate);
                            }
                        ?>
                        <!-- <td>
                            {!! formatedDate(@$list->license_detail->license_activation_history->expiry_date) !!}
                            @if (isset($list->license_detail->license_activation_history))
                            ({!! $remainingDays !!} Days)
                            @endif
                        </td> -->
                        <td>
                            <div class="form-check form-check-inline{{$i}}">
                                <input class="form-check-input{{$i}} btn-lg changeStatusCustom" type="checkbox" id="inlineCheckbox{{$i}}" data-url="{{route('license-registered.changeStatus')}}" data-id="{{$list->id}}" data-status="{{$list->license_status=='0' ? '1' : '0'}}" {{ $list->license_status=='1' ? 'checked' : ''}}>
                            </div>
                        </td>
                        <td class="text-center">
                            <button type="button" class="btn btn-primary show-keys" data-href="{!! route('license-registered-keys', $list->id) !!}" data-bs-toggle="modal" data-bs-target="#commonModal"><i class="bx bx-key"></i></button>
                        </td>
                        @if(in_array('license-registered-edit', $authRolePermissions))
                        <td class="text-center">
                            <a class="btn btn-warning" href="{!! route('license-register.edit', $list->id) !!}"><i class="bi bi-pencil-square text-white"></i></a>
                            <!-- <button type="button" class="btn btn-warning edit" data-id="{!! $list->id !!}" id="edit"  data-bs-toggle="modal" data-bs-target="#commonModal"><i class="bi bi-pencil-square text-white"></i></button> -->
                        </td>
                        @endif
                        @if(in_array('license-registered-delete', $authRolePermissions))
                        <td class="text-center">
                            <a data-url="{{route('license-register.destroy', $list->id)}}" data-id="{{$list->id}}" class="btn btn-danger deleteDataCustom" href="#" class="text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Delete">
                                <i class="bi bi-trash text-white"></i>
                            </a>
                        </td>
                        @endif
                    </tr>
                    @php $i++; @endphp
                @endforeach
            @else
            <tr>
                <td colspan="13">No Data Found</td>
            </tr>
            @endif
        </tbody>
    </table>
</div>
<nav class="mt-2 row">
    <div class="col-lg-8 col-md-8 col-8 float-start">
        {!! $data->onEachSide(0)->render('license-registered.pagination') !!}
    </div>
    <div class="col-lg-2 col-md-2 col-2 dataTables_length" id="example_length" style="text-align: right;">
            <i class="bi bi-funnel" style=" top: 11px;left: 20px;"></i>
            <select class="form-select sorting sorting-box" id="" name="example_length" aria-controls="example" style="padding-left: 30px;">
                <option value="10">Show: 10</option>
                <option value="30">Show: 30</option>
                <option value="50">Show: 50</option>
            </select>
    </div>

     <div class="col-md-2" style="text-align: right;">
        <div class="btn-group mb-0">
            <a class="btn btn-outline-primary" href="{!! route('license.report.export') !!}" target="_blank"><i class="bx bx-download"></i> Export</a>
        </div>
    </div>
</nav>
</div>

