Эх сурвалжийг харах

Make individual tickets linkable

Vijayakrishnan 4 жил өмнө
parent
commit
cc4bf94eff

+ 2 - 2
app/Http/Controllers/HomeController.php

@@ -315,8 +315,8 @@ class HomeController extends Controller
             ->get();
         // erx, labs & imaging that are not closed
         $tickets = Ticket::where('ordering_pro_id', $performerProID)
-            // ->where('is_entry_error', false)
-            // ->where('is_open', true)
+            ->where('is_entry_error', false)
+            ->where('is_open', true)
             ->orderBy('created_at', 'ASC')
             ->get();
         $numERx = Ticket::where('ordering_pro_id', $performerProID)

+ 2 - 2
app/Http/Controllers/PatientController.php

@@ -341,10 +341,10 @@ class PatientController extends Controller
         return view('app.patient.vitals-graph', compact('patient', 'pros', 'filter'));
     }
 
-    public function tickets(Request $request, Client $patient, $type = '') {
+    public function tickets(Request $request, Client $patient, $type = '', Ticket $currentTicket = null) {
         $pros = $this->pros;
         $allPros = Pro::all();
-        return view('app.patient.tickets', compact('patient', 'pros', 'allPros', 'type'));
+        return view('app.patient.tickets', compact('patient', 'pros', 'allPros', 'type', 'currentTicket'));
     }
 
     public function supplyOrders(Request $request, Client $patient, SupplyOrder $supplyOrder = null)

+ 6 - 1
resources/views/app/dashboard/erx.blade.php

@@ -14,7 +14,12 @@
         @if($ticket->category === 'erx')
             <?php $data = json_decode($ticket->data); ?>
             <tr>
-                <td class="px-2 text-nowrap">{{friendlier_date_time($ticket->created_at)}}</td>
+                <td class="px-2 text-nowrap">
+                    <a href="/patients/view/{{$ticket->patient->uid}}/tickets/erx/{{$ticket->uid}}">
+                        <i class="fa fa-arrow-right"></i>
+                        {{friendlier_date_time($ticket->created_at)}}
+                    </a>
+                </td>
                 <td class="px-2 text-nowrap">
                     <a href="/patients/view/{{$ticket->patient->uid}}/tickets/erx">
                         {{$ticket->patient->displayName()}}

+ 10 - 2
resources/views/app/patient/tickets.blade.php

@@ -931,11 +931,19 @@
                         this.initDomElementEvents();
                         this.initAutoOpen();
 
-                        <?php for ($i=0; $i<count($categories); $i++) { ?>
+                        @for ($i=0; $i<count($categories); $i++)
                             this.{{ $categories[$i] }}AutoSave = debounce(() => {
                                 this.{{ $categories[$i] }}SavePopupItem(true);
                             }, 1000);
-                        <?php } ?>
+                        @endfor
+
+                        @if(@$currentTicket && $currentTicket->category && $currentTicket->uid)
+                            setTimeout(() => {
+                                let currentTicket = this.tickets.filter(_x => _x.uid === '{{$currentTicket->uid}}');
+                                if (currentTicket && currentTicket.length)
+                                    this.erxShowPopup(currentTicket[0]);
+                            }, 250);
+                        @endif
 
                     }
                 })

+ 1 - 1
routes/web.php

@@ -190,7 +190,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('vitals-graph/{filter?}', 'PatientController@vitalsGraph')->name('vitals-graph');
 
         // tickets
-        Route::get('tickets/{type?}', 'PatientController@tickets')->name('patient-tickets');
+        Route::get('tickets/{type?}/{currentTicket?}', 'PatientController@tickets')->name('patient-tickets');
 
         // appointments
         Route::get('appointments/{forPro}/{status}', 'PatientController@appointments')->name('appointments');