Просмотр исходного кода

Supply orders - shipment underway page

Vijayakrishnan 4 лет назад
Родитель
Сommit
11f9e4a095

+ 43 - 106
resources/views/app/practice-management/supply-orders-shipment-underway.blade.php

@@ -16,87 +16,62 @@
 <!--                <a href="{{route('practice-management.supply-orders-ready-to-ship')}}" class="ml-auto">Clear Filters</a>-->
             </div>
             <div class="card-body p-0">
-                <table class="table table-sm table-condensed p-0 m-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">Client</th>
-                        <th class="border-0">Product</th>
-                        <th class="border-0">Reason</th>
-                        <th class="border-0">Client Understanding Memo</th>
-                        <th class="border-0">Pro Sign</th>
-                        <th class="border-0">Client Sign</th>
+                        <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>
-                        <th class="border-0">Lot #</th>
-                        <th class="border-0">IMEI</th>
-                        <th class="border-0">Created At</th>
-                        <th class="border-0">Cancelled?</th>
                     </tr>
                     </thead>
                     <tbody>
+                    <?php
+                    $prevClientAndAddress = null;
+                    $shipmentIndex = 0;
+                    ?>
                     @foreach ($supplyOrders as $supplyOrder)
-                        <tr class="{{$supplyOrder->is_cancelled ? 'bg-light' : ''}}">
-                            <td>{{$supplyOrder->client->displayName()}}</a></td>
-                            <td>{{$supplyOrder->product->title}}</td>
-                            <td>{{$supplyOrder->reason}}</td>
-                            <td>{{$supplyOrder->client_understanding_memo}}</td>
-                            <td>
-                                @if($supplyOrder->is_signed_by_pro)
-                                    <b>Signed</b>
-                                    <div class="text-secondary text-sm mt-1">
-                                        By {{$supplyOrder->signedPro->displayName()}}<br>
-                                        {{friendlier_date_time($supplyOrder->pro_signed_at)}}
-                                    </div>
-                                @else
-                                    Not Signed
+                        <?php
+                        $currentClientAndAddress = implode('|', [$supplyOrder->client_id, $supplyOrder->mailing_address_full]);
+                        $sameClientAndAddress = false;
+                        ?>
+                        @if($currentClientAndAddress !== $prevClientAndAddress)
+                            <tr class="sep"><td colspan="4"></td></tr>
+                            <?php
+                            $shipmentIndex++;
+                            $prevClientAndAddress = $currentClientAndAddress;
+                            ?>
+                        @else
+                            <?php $sameClientAndAddress = true; ?>
+                        @endif
+                        <tr class="{{$supplyOrder->is_cancelled ? 'bg-light' : ''}}"
+                            data-client-uid="{{$supplyOrder->client->uid}}"
+                            data-address-line1="{{$supplyOrder->mailing_address_line1}}"
+                            data-address-line2="{{$supplyOrder->mailing_address_line2}}"
+                            data-address-city="{{$supplyOrder->mailing_address_city}}"
+                            data-address-state="{{$supplyOrder->mailing_address_state}}"
+                            data-address-zip="{{$supplyOrder->mailing_address_zip}}"
+                            data-shipment-index="{{$shipmentIndex}}"
+                            data-supply-order-uid="{{$supplyOrder->uid}}">
+                            <td class="align-top border-top-0">
+                                @if(!$sameClientAndAddress)
+                                    {{$supplyOrder->client->displayName()}}
                                 @endif
                             </td>
-                            <td>
-                                @if($supplyOrder->is_signed_by_client)
-                                    <b>Signed</b>
-                                    <div class="text-secondary text-sm mt-1">
-                                        By {{$patient->displayName()}}<br>
-                                        On {{friendlier_date_time($supplyOrder->client_signed_at)}}
-                                    </div>
-                                @elseif($supplyOrder->is_client_signature_waived)
-                                    <b>Waived</b>
-                                    <div class="text-secondary text-sm mt-1">
-                                        By {{$supplyOrder->waiverPro->displayName()}}<br>
-                                        on {{friendlier_date_time($supplyOrder->client_signature_waived_at)}}
-                                    </div>
-                                @else
-                                    Not Signed
+                            <td class="align-top border-top-0">
+                                @if(!$sameClientAndAddress)
+                                    {!! $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]) : '-'  !!}
                                 @endif
                             </td>
-                            <td>
-                                @if($supplyOrder->shipment_id)
-                                    <i class="fa fa-building"></i>
-                                    {{$supplyOrder->shipment->status}}
-                                    @if($supplyOrder->shipment && $supplyOrder->shipment->status === 'DELIVERED' && $supplyOrder->shipment->delivered_date)
-                                        <div class="text-secondary text-sm mt-1">
-                                            on {{friendlier_date_time($supplyOrder->shipment->delivered_date)}}
-                                        </div>
-                                    @endif
-                                @elseif($supplyOrder->is_cleared_for_shipment)
-                                    <i class="fa fa-user-nurse"></i>
-                                    Cleared for shipment
-                                    <div class="text-secondary text-sm mt-1">
-                                        By {{$supplyOrder->clearedForShipmentPro->displayName()}}<br>
-                                        on {{friendlier_date_time($supplyOrder->cleared_for_shipment_at)}}
-                                    </div>
-                                @else
-                                    <i class="fa fa-user-nurse"></i>
-                                    Not cleared for shipment
-                                @endif
+                            <td class="align-top border-top-0">
+                                {{$supplyOrder->product->title}}
                             </td>
-                            <td>{{$supplyOrder->lot_number}}</td>
-                            <td>{{$supplyOrder->imei}}</td>
-                            <td>
-                                {{friendlier_date_time($supplyOrder->created_at)}}
-                                <div class="text-secondary text-sm mt-1">
-                                    By {{$supplyOrder->createdSession->pro->displayName()}}
-                                </div>
+                            <td class="align-top border-top-0">
+                                @if(!$sameClientAndAddress)
+                                    {{$supplyOrder->shipment->status ? $supplyOrder->shipment->status : 'CREATED'}}
+                                    <span class="text-secondary text-sm">(Generated: {{friendlier_date_time($supplyOrder->shipment->created_at, false)}})</span>
+                                @endif
                             </td>
-                            <td>{!! $supplyOrder->is_cancelled ? '<b class="text-warning-mellow">Yes</b>' : 'No' !!}</td>
                         </tr>
                     @endforeach
                     </tbody>
@@ -108,42 +83,4 @@
         </div>
     </div>
 
-    <script>
-        (function() {
-
-            function applyFilters() {
-                let params = {}, queryLine = [];
-                $('[data-filter]').each(function() {
-                    if($.trim($(this).val())) {
-                        params[$(this).attr('data-filter')] = $.trim($(this).val());
-                    }
-                });
-                for(let x in params) {
-                    if(params.hasOwnProperty(x)) {
-                        queryLine.push(x + '=' + encodeURIComponent(params[x]));
-                    }
-                }
-                queryLine = queryLine.join('&');
-
-                fastLoad('/practice-management/supply-orders?' + queryLine);
-            }
-
-            function init() {
-                $('select[data-filter]')
-                    .off('change')
-                    .on('change', applyFilters);
-                $('input[data-filter]')
-                    .off('keyup')
-                    .on('keyup', function(_event) {
-                        if(_event.which === 13) {
-                            applyFilters();
-                            return false;
-                        }
-                    });
-            }
-
-            addMCInitializer('practice-supply-orders', init, '#practice-supply-orders')
-
-        }).call(window);
-    </script>
 @endsection