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

Main dashboard > supply-orders (v1)

Vijayakrishnan 4 лет назад
Родитель
Сommit
6bee4e864a

+ 13 - 1
app/Http/Controllers/HomeController.php

@@ -10,6 +10,7 @@ use App\Models\Facility;
 use App\Models\IncomingReport;
 use App\Models\MBPayer;
 use App\Models\ProProAccess;
+use App\Models\SupplyOrder;
 use App\Models\Ticket;
 use DateTime;
 
@@ -319,6 +320,12 @@ class HomeController extends Controller
             ->where('is_open', true)
             ->orderBy('created_at', 'ASC')
             ->get();
+        $supplyOrders = SupplyOrder::where('is_cleared_for_shipment', false)
+            ->where('is_cancelled', false)
+            ->whereRaw('created_by_session_id IN (SELECT id FROM app_session where pro_id = ?)', [$performer->pro->id])
+            ->orderBy('created_at', 'ASC')
+            ->get();
+
         $numERx = Ticket::where('ordering_pro_id', $performerProID)
             ->where('category', 'erx')
             ->where('is_entry_error', false)
@@ -334,9 +341,14 @@ class HomeController extends Controller
             ->where('is_entry_error', false)
             ->where('is_open', true)
             ->count();
+        $numSupplyOrders = SupplyOrder::where('is_cleared_for_shipment', false)
+            ->where('is_cancelled', false)
+            ->whereRaw('created_by_session_id IN (SELECT id FROM app_session where pro_id = ?)', [$performer->pro->id])
+            ->count();
 
         return view('app/dashboard', compact('keyNumbers', 'reimbursement', 'milliseconds', 'measurements', 'businessNumbers',
-            'incomingReports', 'tickets', 'numERx', 'numLabs', 'numImaging'));
+            'incomingReports', 'tickets', 'supplyOrders',
+            'numERx', 'numLabs', 'numImaging', 'numSupplyOrders'));
     }
 
     public function dashboardAppointments(Request $request, $from, $to) {

+ 10 - 0
resources/views/app/dashboard.blade.php

@@ -157,6 +157,13 @@
                             Imaging ({{$numImaging}})
                         </a>
                     </li>
+                    <li class="nav-item">
+                        <a native data-tab="supply_orders" class="nav-link {{$numSupplyOrders ? 'text-danger font-weight-bold' : ''}}"
+                           :class="tab == 'supply_orders' ? 'active' : ''" href="#"
+                           v-on:click.prevent="tab='supply_orders'">
+                            Supply Orders ({{$numSupplyOrders}})
+                        </a>
+                    </li>
                 </ul>
 
                 <div class="border-left border-right border-bottom p-3">
@@ -237,6 +244,9 @@
                     <div v-show="tab==='imaging'">
                         @include('app.dashboard.imaging')
                     </div>
+                    <div v-show="tab==='supply_orders'">
+                        @include('app.dashboard.supply_orders')
+                    </div>
                 </div>
             </div>
         </div>

+ 6 - 0
resources/views/app/dashboard/incoming_reports.blade.php

@@ -5,6 +5,7 @@
     <thead>
     <tr>
         <th class="px-2 text-secondary">Created</th>
+        <th class="px-2 text-secondary">Patient</th>
         <th class="px-2 text-secondary">Report</th>
         <th class="px-2 text-secondary">Sign</th>
         <th class="px-2 text-secondary">Title</th>
@@ -21,6 +22,11 @@
                     {{friendlier_date_time($document->created_at)}}
                 </a>
             </td>
+            <td class="px-2 text-nowrap">
+                <a href="/patients/view/{{$document->patient->uid}}/tickets/erx">
+                    {{$document->patient->displayName()}}
+                </a>
+            </td>
             <td class="px-2">
                 <div class="d-flex align-items-center">
                     <a class="pdf-viewer-trigger" native target="_blank"

+ 62 - 0
resources/views/app/dashboard/supply_orders.blade.php

@@ -0,0 +1,62 @@
+<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>