Prechádzať zdrojové kódy

Note - allow HCP to unsign if no claims

Vijayakrishnan 3 rokov pred
rodič
commit
09eb18e880

+ 6 - 0
app/Models/Note.php

@@ -206,4 +206,10 @@ class Note extends Model
             ->where('is_cancellation_acknowledged', false)
             ->count();
     }
+
+    public function hasClaims() {
+        return Claim::where('note_id', $this->id)
+            ->where('status', '!=', 'CANCELLED')
+            ->count();
+    }
 }

+ 2 - 2
resources/views/app/patient/note/dashboard.blade.php

@@ -335,10 +335,10 @@ use App\Models\Handout;
                                     <i class="fa fa-check"></i>
                                     Note Signed
                                 </div>
-                                @if($pro->pro_type === 'ADMIN')
+                                @if($pro->pro_type === 'ADMIN' || ($note->hcpPro && $pro->id === $note->hcpPro->id && !$note->hasClaims()))
                                     <div class="ml-3">
                                         <div moe>
-                                            <a class="" href="" show start>Undo Sign As HCP</a>
+                                            <a class="" href="" show start>Undo Sign{{$pro->pro_type === 'ADMIN' ? ' As HCP' : ''}}</a>
                                             <form url="/api/note/adminUndoSignAsHcp" right>
                                                 <input type="hidden" name="uid" value="{{$note->uid}}">
                                                 <p>Undo HCP signature?</p>