<a class="noprint btn btn-primary"
    href="{{ route('indexSearchPrint') }}?reseller={{ request()->reseller }}&pop={{ request()->pop }}"
    target="_blank">
    <i class="fa fa-print"></i> Print Result
</a>
<div class="table-responsive">
    <table id="dataTable" class="table table-bordered table-striped table-condensed">
        <thead class="bg-gray-50">
            <tr class="bg-black text-center">
                <th scope="col">ID</th>
                <th scope="col" class="col">Token#</th>
                <th scope="col" class="col">Date</th>
                <th scope="col" class="col">Category</th>
                <th scope="col" class="col">Code</th>
                <th scope="col" class="col">Description</th>
                <th scope="col" class="col">Customer ID</th>
                <th scope="col" class="col">UserName</th>
                <th scope="col" class="col">Customer</th>
                <th scope="col" class="col">Manager</th>
                <th scope="col" class="col">Address</th>
                <th scope="col" class="col">Reporter</th>
                <th scope="col" class="col">Contact</th>
                <th scope="col" class="col">Creator</th>
                <th scope="col" class="col">Creator(Client)</th>
                <th scope="col" class="col">Assigned</th>
                <th scope="col" class="col">Action</th>
            </tr>
        </thead>
        <tbody>
            @foreach ($list as $r)
                <tr>
                    <td>{{ $r->id }}</td>
                    <td>{{ $r->token }}</td>
                    <td style="min-width: 94px">{{ date('d-M-Y g:i: a ', strtotime($r->created_at)) }}</td>
                    <td>{{ $r->category->tokenCategory ?? '' }}</td>
                    <td style="min-width: 185px">{{ $r->Code->tokenCode ?? '' }}</td>
                    <td>{{ $r->description }}</td>
                    <td style="min-width: 104px">{{ $r->clientId }}</td>
                    <td>{{ $r->clients->userid ?? '' }}</td>
                    <td>{{ $r->clients->clientsInfo->clients_name ?? '' }}</td>
                    <td>{{ $r->clients->pops->reseller->name ?? '' }}</td>
                    <td style="width:350px;">
                        <p style="font-size:14px;">
                            @if (!empty($r->clients->clientsinfo->flat_no))
                                Flat No: {{ $r->clients->clientsinfo->flat_no ?? '' }},
                            @endif
                            @if (!empty($r->clients->clientsinfo->building_name))
                                Building Name: {{ $r->clients->clientsinfo->building_name ?? '' }},<br>
                            @endif
                            @if (!empty($r->clients->clientsinfo->road_no))
                                Road No: {{ $r->clients->clientsinfo->road_no ?? '' }},<br>
                            @endif
                            @if (!empty($r->clients->clientsinfo->block_sector))
                                Block/Sector: {{ $r->clients->clientsinfo->block_sector ?? '' }},
                            @endif
                            @if (!empty($r->clients->clientsinfo->area))
                                Area : {{ $r->clients->clientsinfo->area ?? '' }}, <br>
                            @endif
                            @if (!empty($r->clients->clientsinfo->box))
                                Box : {{ $r->clients->clientsinfo->box ?? '' }}
                            @endif
                        </p>
                    </td>
                    <td>{{ $r->reportedBy }}</td>
                    <td>{{ $r->reporterContact }}</td>
                    <td> {{ $r->creator->name ?? '' }}</td>
                    <td>{{ $r->createByClient ?? '' }}</td>
                    <td>{{ $r->employees->name ?? '' }}</td>
                    <td>
                        @can('delete-token')
                            <form action="{{ route('token.destroy', $r->id) }}" method="POST">
                                @method('DELETE')
                                @csrf
                                <button class=" btn btn-danger form-control">Delete</button>
                            </form>
                        @endcan
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
</div>
