Przeglądaj źródła

Key number + listing => unsigned supply orders

Vijayakrishnan 4 lat temu
rodzic
commit
0724097c39

+ 7 - 0
app/Http/Controllers/HomeController.php

@@ -263,6 +263,13 @@ class HomeController extends Controller
             ->where('is_cancellation_acknowledged', false)
             ->count();
 
+        // unsigned supply orders created by authed pro
+        $keyNumbers['unsignedSupplyOrders'] = SupplyOrder
+            ::where('is_cancelled', false)
+            ->where('is_signed_by_pro', false)
+            ->whereRaw('created_by_session_id IN (SELECT id FROM app_session WHERE pro_id = ?)', [$performerProID])
+            ->count();
+
         // patientsHavingBirthdayToday
         $queryClients = $this->performer()->pro->getAccessibleClientsQuery();
         $keyNumbers['patientsHavingBirthdayToday'] = $queryClients

+ 12 - 1
app/Http/Controllers/PracticeManagementController.php

@@ -838,11 +838,22 @@ class PracticeManagementController extends Controller
         $supplyOrders = SupplyOrder::where('signed_by_pro_id', $this->performer()->pro->id)
             ->where('is_cancelled', true)
             ->where('is_cancellation_acknowledged', false)
-	    ->orderBy('created_at', 'desc')
+	        ->orderBy('created_at', 'desc')
             ->paginate();
         return view('app.practice-management.supply-orders-cancelled-but-unacknowledged', compact('supplyOrders'));
     }
 
+    public function supplyOrdersUnsigned(Request $request)
+    {
+        $supplyOrders = SupplyOrder
+            ::where('is_cancelled', false)
+            ->where('is_signed_by_pro', false)
+            ->whereRaw('created_by_session_id IN (SELECT id FROM app_session WHERE pro_id = ?)', [$this->performer()->pro->id])
+            ->orderBy('created_at', 'desc')
+            ->paginate();
+        return view('app.practice-management.supply-orders-unsigned', compact('supplyOrders'));
+    }
+
     private function getSupplyOrderCounts()
     {
         return [

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

@@ -57,6 +57,12 @@
                                         <a href="/practice-management/supply-orders/cancelled-but-unacknowledged">Unacknowledged Cancelled Supply Orders</a>
                                     </th>
                                 </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$keyNumbers['unsignedSupplyOrders']}}</th>
+                                    <th class="pl-2">
+                                        <a href="/practice-management/supply-orders/unsigned">Unsigned Supply Orders</a>
+                                    </th>
+                                </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$keyNumbers['patientsHavingBirthdayToday']}}</th>
                                     <th class="pl-2">

+ 1 - 1
resources/views/app/practice-management/supply-orders-cancelled-but-unacknowledged.blade.php

@@ -7,7 +7,7 @@
 
             <div class="card-header px-3 py-3 d-flex align-items-center bg-white">
                 <strong class="font-size-14">
-                    Supply Orders - Cancelled but unacknowledged
+                    Supply Orders - Cancelled but Unacknowledged
                 </strong>
             </div>
             <div class="card-body p-0">

+ 45 - 0
resources/views/app/practice-management/supply-orders-unsigned.blade.php

@@ -0,0 +1,45 @@
+@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 - Unsigned
+                </strong>
+            </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>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach ($supplyOrders as $supplyOrder)
+                        <tr data-client-uid="{{$supplyOrder->client->uid}}">
+                            <td class="align-top border-top">
+                                <a href="{{route('patients.view.supply-orders',['patient'=>$supplyOrder->client, 'supplyOrder'=>$supplyOrder, 'filter' => 'all'])}}"> {{$supplyOrder->client->displayName()}}</a>
+                            </td>
+                            <td class="align-top border-top">
+                                {!! $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">
+                                {{$supplyOrder->product->title}}
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+                <div>
+                    {{$supplyOrders->links()}}
+                </div>
+            </div>
+        </div>
+    </div>
+
+@endsection

+ 1 - 0
routes/web.php

@@ -136,6 +136,7 @@ Route::middleware('pro.auth')->group(function () {
         });
 
         Route::get('supply-orders/cancelled-but-unacknowledged', 'PracticeManagementController@supplyOrdersCancelledButUnacknowledged')->name('supply-orders-cancelled-but-unacknowledged');
+        Route::get('supply-orders/unsigned', 'PracticeManagementController@supplyOrdersUnsigned')->name('supply-orders-unsigned');
     });
 
     Route::middleware('pro.auth.admin')->group(function(){