<div class="d-flex align-items-end mb-3">
    <b class="large">Supply Orders not cleared for shipment</b>
</div>
<table class="table table-sm table-bordered mb-0" style="table-layout: fixed">
    @if($supplyOrders && count($supplyOrders))
        <thead>
        <tr class="bg-light">
            <th class="px-2 text-nowrap text-secondary border-bottom-0"><div class="text-ellipsis">Created At</div></th>
            <th class="px-2 text-nowrap text-secondary border-bottom-0"><div class="text-ellipsis">Patient</div></th>
            <th class="px-2 text-nowrap text-secondary border-bottom-0"><div class="text-ellipsis">Title</div></th>
            <th class="px-2 text-nowrap text-secondary border-bottom-0"><div class="text-ellipsis">Reason</div></th>
            <th class="px-2 text-nowrap text-secondary border-bottom-0"><div class="text-ellipsis">Pro Signed?</div></th>
            <th class="px-2 text-nowrap text-secondary border-bottom-0"><div class="text-ellipsis">Cancelled?</div></th>
            <th class="px-2 text-nowrap text-secondary border-bottom-0"><div class="text-ellipsis">Shipment</div></th>
        </tr>
        </thead>
        <tbody>
        @foreach($supplyOrders as $supplyOrder)
            <tr>
                <td class="px-2">
                    <a href="{{route('patients.view.supply-orders', ['patient' => $supplyOrder->client, 'supplyOrder' => $supplyOrder])}}">
                        {{ friendlier_date_time($supplyOrder->created_at) }}
                    </a>
                </td>
                <td class="px-2 text-nowrap">
                    <a href="/patients/view/{{$supplyOrder->client->uid}}/tickets/erx">
                        {{$supplyOrder->client->displayName()}}
                    </a>
                </td>
                <td class="px-2">
                    {{ $supplyOrder->product->title }}
                </td>
                <td class="px-2">{{ $supplyOrder->reason }}</td>
                <td class="px-2">{{ $supplyOrder->is_signed_by_pro ? $supplyOrder->signedPro->displayName() : '-' }}</td>
                <td class="px-2">{{ $supplyOrder->is_cancelled ? 'Yes' : 'No' }}</td>
                <td class="px-2">
                    @if($supplyOrder->shipment_id)
                        <i class="fa fa-building"></i>
                        {{$supplyOrder->shipment->status ? $supplyOrder->shipment->status : 'CREATED'}}
                    @elseif($supplyOrder->is_cleared_for_shipment)
                        <span class="text-info">
                                            <i class="fa fa-user-nurse"></i>
                                            Cleared for shipment
                                        </span>
                    @else
                        <span class="text-warning-mellow">
                                            <i class="fa fa-user-nurse"></i>
                                            Not cleared for shipment
                                        </span>
                    @endif
                </td>
            </tr>
        @endforeach
        </tbody>
    @else
        <tbody>
        <tr>
            <td class="text-secondary p-3">No supply orders have been created for this patient</td>
        </tr>
        </tbody>
    @endif
</table>