Procházet zdrojové kódy

Disallow note cancellation if careplan created during note

Vijayakrishnan před 3 roky
rodič
revize
b9523ae243

+ 14 - 10
resources/views/app/patient/note/_cancel-signed-note.blade.php

@@ -8,16 +8,20 @@
                 Cancel Signed Note
             </a>
             <form url="/api/note/cancel">
-                <input type="hidden" name="uid" value="{{$note->uid}}">
-                <p class="small mb-1 font-weight-bold">This note has been already signed by the HCP.</p>
-                <p class="mb-2">Do you still want to cancel this note?</p>
-                <div class="mb-2">
-                    <textarea name="memo" id="" cols="30" rows="5" placeholder="Memo (required to cancel signed note)" class="memo-textarea form-control form-control-sm" required></textarea>
-                </div>
-                <div class="d-flex align-items-center">
-                    <button class="btn btn-sm btn-danger mr-2" submit>Yes</button>
-                    <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
-                </div>
+                @if($patient->has_cm_setup_been_performed && $patient->cm_setup_note_id === $note->id)
+                    A care-plan was created during this note. Please undo that before cancelling the note.
+                @else
+                    <input type="hidden" name="uid" value="{{$note->uid}}">
+                    <p class="small mb-1 font-weight-bold">This note has been already signed by the HCP.</p>
+                    <p class="mb-2">Do you still want to cancel this note?</p>
+                    <div class="mb-2">
+                        <textarea name="memo" id="" cols="30" rows="5" placeholder="Memo (required to cancel signed note)" class="memo-textarea form-control form-control-sm" required></textarea>
+                    </div>
+                    <div class="d-flex align-items-center">
+                        <button class="btn btn-sm btn-danger mr-2" submit>Yes</button>
+                        <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
+                    </div>
+                @endif
             </form>
         </div>
     </div>

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

@@ -685,15 +685,19 @@ use App\Models\Handout;
                              title="{{ $hasBills ? 'Cannot cancel note since it has un-cancelled bills in it' : '' }}">
                             <a class="text-danger" href="" show start>Cancel</a>
                             <form url="/api/note/cancel" right>
-                                <input type="hidden" name="uid" value="{{$note->uid}}">
-                                <p class="small mb-2">Are you sure you want to cancel this note?</p>
-                                <div class="mb-2">
-                                    <textarea name="memo" id="" cols="30" rows="5" placeholder="Memo" class="memo-textarea form-control form-control-sm"></textarea>
-                                </div>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-danger mr-2" submit>Yes</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
-                                </div>
+                                @if($patient->has_cm_setup_been_performed && $patient->cm_setup_note_id === $note->id)
+                                    A care-plan was created during this note. Please undo that before cancelling the note.
+                                @else
+                                    <input type="hidden" name="uid" value="{{$note->uid}}">
+                                    <p class="small mb-2">Are you sure you want to cancel this note?</p>
+                                    <div class="mb-2">
+                                        <textarea name="memo" id="" cols="30" rows="5" placeholder="Memo" class="memo-textarea form-control form-control-sm"></textarea>
+                                    </div>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-danger mr-2" submit>Yes</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
+                                    </div>
+                                @endif
                             </form>
                         </div>
                         @else