<div class="d-flex align-items-end mb-3">
    <b class="large">Imaging - Open</b>
</div>
<table class="table table-sm table-bordered mb-0">
    <thead>
    <tr class="bg-light">
        <th class="px-2 text-secondary border-bottom-0 width-30px">Created</th>
        <th class="px-2 text-secondary border-bottom-0 width-30px">View/Open</th>
        <th class="px-2 text-secondary border-bottom-0 width-30px">Patient</th>
        <th class="px-2 text-secondary border-bottom-0">Imaging</th>
    </tr>
    </thead>
    <tbody>
    @foreach($tickets as $ticket)
        @if($ticket->category === 'imaging')
            <?php $data = json_decode($ticket->data); ?>
            <tr>
                <td class="px-2 text-nowrap">
                    {{friendlier_date_time($ticket->created_at)}}
                </td>
                <td class="px-2 text-nowrap">
                    <div class="d-flex align-items-center flex-nowrap">
                        <a href="/patients/view/{{$ticket->patient->uid}}/tickets/imaging/{{$ticket->uid}}?popupmode=1"
                           native target="_blank"
                           class="ticket-popup-trigger d-block text-nowrap mr-3">
                            View
                        </a>
                        <a href="/patients/view/{{$ticket->patient->uid}}/tickets/imaging/{{$ticket->uid}}"
                           class="d-block text-nowrap">
                            <i class="fa fa-external-link-alt"></i>
                            Open
                        </a>
                    </div>
                </td>
                <td class="px-2 text-nowrap">
                    <a href="/patients/view/{{$ticket->patient->uid}}/tickets/imaging">
                        {{$ticket->patient->displayName()}}
                    </a>
                </td>
                <td class="px-2">
                    @if(@$data->tests)
                        <div>
                            <span class="text-secondary">Tests:</span>
                            {{implode(", ", $data->tests)}}
                        </div>
                    @endif
                    @if(@$data->icds)
                        <div>
                            <span class="text-secondary">ICDs:</span>
                            {{implode(", ", $data->icds)}}
                        </div>
                    @endif
                </td>
            </tr>
        @endif
    @endforeach
    </tbody>
</table>