Samson Mutunga 1 год назад
Родитель
Сommit
ed631af2b2

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

@@ -158,7 +158,7 @@
             addLine: function () {
                 this.payload.lines.push({
                     cpt: '',
-                    dateOfService: '{{date_format($note->created_at, 'Y-m-d')}}',
+                    dateOfService: '{{date("Y-m-d", strtotime($note->created_at))}}',
                     icds: JSON.parse(JSON.stringify(window.noteReasons?window.noteReasons:[])),
                     numberOfUnits: 1
                 });

+ 8 - 6
resources/views/app/patient/surveys/forms/form.blade.php

@@ -44,6 +44,8 @@
 
       form: <?= json_encode(json_decode($survey->survey_data ?? '{}')) ?>,
       socketIo: null,
+      submitting: false,
+      loading: false,
     },
     methods: {
       onFormFieldChange: function(){
@@ -60,17 +62,14 @@
           return;
         });
 
-        form.find('input[type=text], textarea').off('keyup');
-        form.find('input[type=text], textarea').on('keyup', function(){
-          self.autosaveChanges();
-          return;
-        });
-
       },
       autosaveChanges: function(){
         var self = this;
+        if(self.submitting) return;
+        self.submitting = true;
         var url = "{{ @$survey->access_key ? route('view-survey-form-auto-submit', @$survey->access_key) : '' }}";
         $.post(url, { dataJson: JSON.stringify(self.form) }, function(response){
+          self.submitting = false;
           if(response.success){
             self.socketIo.emit('SURVEY_DATA_CHANGED_BY_SESSION', {socketSessionID: self.socketSessionID, surveyAccessKey: self.surveyAccessKey});
           }else{
@@ -88,8 +87,11 @@
       },
       updateUi: function(){
         var self = this;
+        if(self.loading) return;
+        self.loading = true;
         var url = "{{ @$survey->access_key ? route('view-survey-form-get-data', @$survey->access_key) : '' }}";
         $.get(url, {}, function(response){
+          self.loading = false;
           if(response.success){
             const data = JSON.parse(response.data.survey_data);
             self.form = data;