Samson Mutunga 3 years ago
parent
commit
1bf6482791

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

@@ -299,7 +299,7 @@ class PatientController extends Controller
 
         $reviewRequests = ClientReviewRequest::where('client_id', $patient->id);
         if($pro->pro_type !== 'ADMIN'){
-            $reviewRequests = $reviewRequests->where('pro_id', $pro->id);
+            $reviewRequests = $reviewRequests->where('pro_id', $pro->id)->where('is_active', true);
         }
         $reviewRequests = $reviewRequests->orderBy('created_at', 'DESC')->paginate(50);
         return view('app.patient.review-requests.list', compact('patient', 'reviewRequests'));

+ 1 - 1
app/Models/Pro.php

@@ -842,7 +842,7 @@ WHERE
                     ->orWhereRaw('id IN (SELECT mcp_pro_id FROM client_program WHERE client_id = client.id AND is_active = TRUE)')
                     ->orWhereRaw('id IN (SELECT manager_pro_id FROM client_program WHERE client_id = client.id AND is_active = TRUE)')
                     ->orWhereRaw('id IN (SELECT client_id FROM note WHERE ally_pro_id = ? AND is_cancelled = FALSE)', [$proID])
-                    ->orWhereRaw('id IN (SELECT client_id FROM client_review_request WHERE pro_id = ? AND access_start_date <= NOW() AND access_end_date >= NOW())', [$proID]);
+                    ->orWhereRaw('id IN (SELECT client_id FROM client_review_request WHERE pro_id = ? AND access_start_date <= NOW() AND access_end_date >= NOW() AND client_review_request.is_active IS true)', [$proID]);
             })->count();
         return !!$canAccess;
     }

+ 3 - 3
resources/views/app/patient/note/partials/flag-note-by-supervisor.blade.php

@@ -5,7 +5,7 @@
             <span class="text-success mr-2"><i class="fas fa-badge-check"></i> Stamped</span>
             <span class="mr-1">by {{ $note->stampedBySupervisingPhysicianBySession->pro->displayName() }}</span>
             <span class="mr-1">at {{ friendlier_date($note->stamped_by_supervising_physician_at) }} <i class="fas fa-info-circle" title="{{ $note->stamping_note_by_supervising_physician }}"></i></span>
-            @if($note->isProPhysicianSupervisor($pro->id))
+            @if($pro->currentMonthClientReviewRequest($patient->id))
             <div moe class="ml-2">
                 <a href="#" start show class="text-danger"><i class="fas fa-stamp"></i> Undo Stamp</a>
                 <form url="/api/note/undoStampAsSupervisingPhysician">
@@ -42,8 +42,8 @@
                     </div>
                 </div>
             @endif
-            <!-- Ask Josh, should any supervising physician stamp this note -->
-            @if($note->isProPhysicianSupervisor($performer->pro->id)) 
+            
+            @if($pro->currentMonthClientReviewRequest($patient->id)) 
                 <div moe class="ml-2">
                     <a href="#" start show class="text-success"><i class="fas fa-stamp"></i> Stamp Note</a>
                     <form url="/api/note/stampAsSupervisingPhysician">