@extends ('layouts/template')

@section('content')

    <div id="practice-supply-orders" class="p-3 mcp-theme-1">
        <div class="card">

            <div class="card-header px-3 py-3 d-flex align-items-center bg-white">
                <strong class="font-size-14">
                    Supply Orders - Hanging ({{$counts['supplyOrdersHanging']}})
                </strong>
                <span class="mx-3 text-secondary">|</span>
                <a href="{{route('practice-management.supply-orders-ready-to-ship')}}">Ready to Ship ({{$counts['supplyOrdersReadyToShip']}})</a>
                <span class="mx-3 text-secondary">|</span>
                <a href="{{route('practice-management.supply-orders-shipment-underway')}}">Shipment Underway ({{$counts['supplyOrdersShipmentUnderway']}})</a>
                <span class="mx-3 text-secondary">|</span>
                <a href="{{route('practice-management.supply-orders')}}">All ({{$counts['supplyOrders']}})</a>
            </div>
            <div class="card-body p-0">
                <table class="table table-sm table-condensed p-0 m-0" style="table-layout: fixed">
                    <thead class="bg-light">
                    <tr>
                        <th class="border-0">Patient</th>
                        <th class="border-0">Address</th>
                        <th class="border-0">Item(s)</th>
                        <th class="border-0">Shipment</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach ($supplyOrders as $supplyOrder)
                        <tr class="{{$supplyOrder->is_cancelled ? 'bg-light' : ''}}"
                            data-client-uid="{{$supplyOrder->client->uid}}">
                            <td class="align-top border-top-0">
                                <a href="{{route('patients.view.supply-orders',['patient'=>$supplyOrder->client, 'supplyOrder'=>$supplyOrder])}}"> {{$supplyOrder->client->displayName()}}</a>
                            </td>
                            <td class="align-top border-top-0">
                                {!! $supplyOrder->mailing_address_full ? implode(" ", [$supplyOrder->mailing_address_line1 . ' ' . $supplyOrder->mailing_address_line2, $supplyOrder->mailing_address_city . ' ' . $supplyOrder->mailing_address_state . ' ' . $supplyOrder->mailing_address_zip]) : '-'  !!}
                            </td>
                            <td class="align-top border-top-0">
                                {{$supplyOrder->product->title}}
                            </td>
                            <td class="align-top border-top-0">
                                <b>CANCELLED</b>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                <div>
                    {{$supplyOrders->links()}}
                </div>
            </div>
        </div>
    </div>

@endsection
