@php
$supplyOrdersPendingMyAck = $performer->pro->supplyOrdersPendingMyAckRecordsAsRd();
@endphp
<div class="p-3" id="patients-list">
    <div class="card">
        <div class="card-body p-0">
            <table class="table table-sm table-striped p-0 m-0">
                <thead class="bg-light">
                    <tr>
                        <th class="border-0">Date</th>
                        <th class="border-0">Patient</th>
                        <th class="border-0">Product</th>
                        <th class="border-0">Memo</th>
                        <th class="border-0">Is Cancelled</th>
                        <th class="border-0">Shipment</th>
                        <th class="border-0"></th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($supplyOrdersPendingMyAck as $supplyOrder)
                    <tr>
                        <td>{{ friendlier_date_time($supplyOrder->created_at)}}</td>
                        <td>{{ $supplyOrder->client->displayName() }} -</td>
                        <td>{{ $supplyOrder->product->title }}</td>
                        <td style="width: 300px;">{{ $supplyOrder->reason }}</td>
                        <td>{{ $supplyOrder->is_cancelled ? 'Yes' : 'No' }}</td>
                        <td>
                            @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>
                        <td>
                            @if(!$supplyOrder->has_na_pro_signed)
                            <div moe relative class="ml-auto">
                                <form show url="/api/supplyOrder/signAsNaPro">
                                    <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
                                    <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
                                </form>
                            </div>
                            @endif
                        </td>
                    </tr>
                    @endforeach

                    @if(count($supplyOrdersPendingMyAck) === 0)
                    <tr>
                        <td colspan="7">No records found!</td>
                    </tr>
                    @endif
                </tbody>

            </table>
            @if($supplyOrdersPendingMyAck->hasPages())
            <div class="ml-2 mt-2">
                {{ $supplyOrdersPendingMyAck->appends(request()->input())->links() }}
            </div>
            @endif
        </div>
    </div>
</div>