@switch($cell)
    @case('id')
        <span class="token_id_of_table text-nowrap" style="font-size: 0.9em;">{{ $r->id }}</span>
    @break

    @case('token_info')
        {{-- Token ID --}}
        <span class="badge badge-primary">TKN#</span>
        <strong style="font-size:12px;">{{ $r->token }}</strong>
        <br>

        {{-- Created Time --}}
        <span class="badge badge-info">Created</span>
        <small class="text-muted">{{ date('d-M-Y g:i a', strtotime($r->created_at)) }}</small>
        <br>

        {{-- Assign Status --}}
        @if ($r->assign_time)
            <span class="badge badge-warning text-dark">Assigned</span>
            <small class="text-muted">{{ date('d-M-Y g:i a', strtotime($r->assign_time)) }}</small>
            <br>
            @if ($r->close_time)
                <span class="badge badge-danger">Closed</span>
                <small class="text-muted">{{ date('d-M-Y g:i a', strtotime($r->close_time)) }}</small>
                <br>
            @else
                <span class="badge badge-warning text-dark">
                    <i class="fas fa-clock"></i>
                    Assigned {{ dateTimeDifferent(now(), $r->assign_time) }} ago &mdash; Not Closed
                </span>
                <br>
            @endif
        @else
            <span class="badge badge-secondary">
                <i class="fas fa-clock"></i>
                Created {{ dateTimeDifferent(now(), $r->created_at) }} ago &mdash; Not Assigned
            </span>
            <br>
        @endif

        {{-- Work Start / Solve Section --}}
        @if ($r->work_start_time)
            <hr class="my-1">

            <span class="badge badge-success">
                <i class="fas fa-play-circle"></i> W.Start
            </span>
            <small class="text-muted">{{ date('d-M-Y g:i a', strtotime($r->work_start_time)) }}</small>
            <br>

            @if ($r->close_time)
                <span class="badge badge-success">
                    <i class="fas fa-check-circle"></i> Closed
                </span>
                <small class="text-muted">{{ date('d-M-Y g:i a', strtotime($r->close_time)) }}</small>
                <br>
                <span class="badge badge-success" style="border-radius:20px; padding: 4px 10px;">
                    <i class="fas fa-bolt"></i>
                    Solved in {{ dateTimeDifferent($r->close_time, $r->work_start_time) }}
                </span>
            @else
                <span class="badge badge-warning text-dark" style="border-radius:20px; padding:4px 10px;">
                    <i class="fas fa-circle" style="font-size:7px; animation: tk-pulse 1.4s infinite;"></i>
                    Live &nbsp;
                    <span class="work-start-counter" data-work-start="{{ strtotime($r->work_start_time) }}">--:--:--</span>
                </span>
            @endif
        @endif
    @break

    @case('category_code')
        {{ $r->category->tokenCategory ?? '' }} ({{ $r->Code->tokenCode ?? '' }})
    @break

    @case('description')
        {{ $r->description }}
    @break

    @case('source')
        @if ($r->token_source == 'CRM')
            <span class="btn btn-info btn-xs">{{ $r->token_source }}</span>
        @else
            {{ $r->token_source }}
        @endif
    @break

    @case('creator')
        {{ $r->creator->name ?? '' }}
        @if ($r->createByClient)
            <span class="badge badge-danger">{{ $r->createByClient ?? '' }}</span>
        @endif
    @break

    @case('reseller')
        {{ $r->clients->pops->reseller->name ?? '' }}
    @break

    @case('pop')
        {{ $r->clients->pops->popname ?? '' }}
    @break

    @case('customer_id_username')
        {{ $r->clientId }} <br> {{ $r->clients->userid ?? '' }}
    @break

    @case('customer_info')
        <p style="font-size:14px;">
            @if (function_exists('checkAPI') && checkAPI())
                @if (isset($mikrotik_online_users['onlineUsers']) &&
                        array_key_exists($r->clients->userid ?? '', $mikrotik_online_users['onlineUsers']))
                    <span class="badge badge-success" title="Online">Online</span>
                @else
                    <span class="btn btn-danger btn-xs" title="Offline">Offline</span>
                @endif
                <br>
            @else
                @if (
                    !empty($mikrotik_online_users) &&
                        is_array($mikrotik_online_users) &&
                        in_array($r->clients->userid ?? '', $mikrotik_online_users))
                    <span class="btn btn-success btn-xs">Online</span>
                @else
                    <span class="btn btn-danger btn-xs">Offline</span>
                @endif
            @endif
            @if (!empty($r->clients->clientsinfo->clients_name ?? null))
                C Name : {{ $r->clients->clientsinfo->clients_name ?? '' }} <br>
            @endif
            @if (!empty($r->clients->pops->reseller->name))
                R Name : {{ $r->clients->pops->reseller->name ?? '' }} <br>
            @endif
            @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>
    @break

    @case('reporter_contact')
        {{ $r->reportedBy }} <br> {{ $r->reporterContact }}
    @break

    @case('assigned')
       @foreach ($r->assignUsers as $assignUser)
        {{ $assignUser->employee->name ?? '' }}
        <br>
       @endforeach
    @break

    @case('token_type')
        {{ $r->token_type ?? '' }}
    @break

    @case('actions')
        <div class="work-start-now-wrapper" data-token-id="{{ $r->id }}">
            <div class="dropdown">
                <button class="btn btn-sm btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton"
                    data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <i class="fas fa-list" style="font-size: 10px;"></i>
                </button>
                <div class="dropdown-menu dropdown-menu-right shadow" aria-labelledby="dropdownMenuButton">
                    @if ($r->close_time == null)
                        @can('close-token')
                            @if ($r->assign_time != null)
                                <button type="button" class="dropdown-item btn-small close_token_btn" data-toggle="modal"
                                    data-target="#closeTokenModel">
                                    <i class="fas fa-times-circle text-danger mr-2"></i> Close Token
                                </button>
                            @endif
                        @endcan
                        @can('assign-token')
                            @if ($r->assign_time == null)
                                <button type="button" class="dropdown-item btn-small assign_token_btn" data-toggle="modal"
                                    data-target="#assignTokenModel">
                                    <i class="fas fa-user-plus text-info mr-2"></i> Assign Token
                                </button>
                            @else
                                <button type="button" class="dropdown-item btn-small re_assign_token_btn" data-toggle="modal"
                                    data-target="#reAssignTokenModel">
                                    <i class="fas fa-user-edit text-warning mr-2"></i> Re-Assign Token
                                </button>
                            @endif
                        @endcan
                    @endif
                    <div class="dropdown-divider"></div>
                    <button type="button" class="dropdown-item add_note" data-toggle="modal" data-target="#addNoteModel">
                        <i class="fas fa-sticky-note text-primary mr-2"></i> Note
                    </button>
                    @if ($r->work_start_time == null && $r->assign_time != null && $r->close_time == null)
                        @canany(['ticket-work-start-now', 'assigner-token-start-work'])
                                <div class="dropdown-divider"></div>
                                <button type="button" class="dropdown-item work-start-now-btn" data-token-id="{{ $r->id }}"
                                    data-assigned-to="{{ $r->assignToken }}">
                                    <i class="fas fa-play-circle text-success mr-2"></i> Work Start Now
                                </button>
                        @endcanany
                    @endif
                </div>
            </div>
        </div>
    @break

    @default
        —
@endswitch
