Explorar el Código

Allow CM/RM entry deletion only if no active bill

Vijayakrishnan Krishnan hace 5 años
padre
commit
081d4b3a80
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      resources/views/app/patient/care-month/dashboard.blade.php

+ 4 - 2
resources/views/app/patient/care-month/dashboard.blade.php

@@ -135,7 +135,6 @@
         foreach ($cmBills as $cmBill) {
             if(!$cmBill->is_cancelled && $careMonth->cm_bill_id === $cmBill->id) {
                 $activeCMBill = $cmBill;
-                break;
             }
             else if($cmBill->is_cancelled) {
                 $cancelledCMBills->add($cmBill);
@@ -148,7 +147,6 @@
         foreach ($rmBills as $rmBill) {
             if(!$rmBill->is_cancelled && $careMonth->rm_bill_id === $rmBill->id) {
                 $activeRMBill = $rmBill;
-                break;
             }
             else if($rmBill->is_cancelled) {
                 $cancelledRMBills->add($rmBill);
@@ -249,6 +247,7 @@
                                 <div class="text-secondary text-sm">{{$entry->content_detail}}</div>
                             </td>
                             <td class="px-2 text-center delete-column">
+                                @if(!$activeCMBill)
                                 <div moe relative>
                                     <a start show><i class="on-hover-opaque fa fa-trash-alt text-danger"></i></a>
                                     <form url="/api/careMonthEntry/remove" right>
@@ -260,6 +259,9 @@
                                         </div>
                                     </form>
                                 </div>
+                                @else
+                                    <a href="#" class="text-secondary" title="Cannot modify. Bill existing."><i class="on-hover-opaque fa fa-trash-alt"></i></a>
+                                @endif
                             </td>
                         </tr>
                         @endif