ソースを参照

Allow cancel-note only if it doesn't have any un-cancelled bills in it

Vijayakrishnan Krishnan 4 年 前
コミット
152f4d1c45
1 ファイル変更15 行追加1 行削除
  1. 15 1
      resources/views/app/patient/note/dashboard.blade.php

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

@@ -5,6 +5,18 @@
 
 @section('inner-content')
 
+    <?php
+    $hasBills = false;
+    if($note->bills->count()) {
+        foreach ($note->bills as $bill) {
+            if(!$bill->is_cancelled) {
+                $hasBills = true;
+                break;
+            }
+        }
+    }
+    ?>
+
     <div class="pt-2 pb-3 d-flex align-items-start">
         <h6 class="my-0 text-secondary d-flex align-items-start">
             <a href="/patients/view/{{ $patient->uid }}/notes" class="small text-decoration-none mr-3">
@@ -202,7 +214,9 @@
                     </div>
                     <div class="d-flex justify-content-end">
                         @if(!$note->is_cancelled)
-                        <div moe relatve class="">
+                        <div moe relatve
+                             class="{{ $hasBills ? 'moe-disabled' : '' }}"
+                             title="{{ $hasBills ? 'Cannot cancel note since it has un-cancelled bills in it' : '' }}">
                             <a class="text-danger" href="" show start>Cancel Note</a>
                             <form url="/api/note/cancel" right>
                                 <input type="hidden" name="uid" value="{{$note->uid}}">