Răsfoiți Sursa

Note claims - prevent double clicks in create-claim

Vijayakrishnan 3 ani în urmă
părinte
comite
257b5653f4
1 a modificat fișierele cu 10 adăugiri și 2 ștergeri
  1. 10 2
      resources/views/app/patient/note/_create-claim.blade.php

+ 10 - 2
resources/views/app/patient/note/_create-claim.blade.php

@@ -151,7 +151,8 @@
                         numberOfUnits: 1
                     }
                 ]
-            }
+            },
+            saving: false,
         },
         methods: {
             addLine: function () {
@@ -210,9 +211,13 @@
                 });
             },
             saveClaim: function() {
+                let self = this;
+                if(self.saving) return false;
+                self.saving = true;
                 let form = $('form#createClaimApp').first();
                 if(!form[0].checkValidity()) {
                     form[0].reportValidity();
+                    self.saving = false;
                     return false;
                 }
 
@@ -227,13 +232,16 @@
                         else {
                             toastr.error('Unable to save the claim!');
                         }
+                        self.saving = false;
                     }
                     else {
                         toastr.success('Claim saved!');
                         closeStagPopup();
                         fastReload();
                     }
-                }, 'json')
+                }, 'json').then(function() {
+                    self.saving = false;
+                });
             },
             getPrefillValues: function() {
                 @if(@$note && !empty($note->claim_suggestion_json))