Ver código fonte

Fix: on vitals, save just spins forever (check save button on typical day as well)

Vijayakrishnan 3 anos atrás
pai
commit
22c0d86a88
1 arquivos alterados com 12 adições e 10 exclusões
  1. 12 10
      js-dev/mc.js

+ 12 - 10
js-dev/mc.js

@@ -590,6 +590,8 @@ window.saveVisitForm = function(_trigger, _silent = false, _close = false, _done
                 // if /api/visitPoint/upsertChildReview - refresh subjective_general_v2
                 // if /api/visitPoint/upsertChildPlan - refresh plan_free_text_v2
 
+                let parentPopup = form.closest('.stag-popup');
+
                 let eps = [
                     '/api/visitPoint/upsertChildReview',
                     '/api/visitPoint/upsertChildPlan',
@@ -598,32 +600,32 @@ window.saveVisitForm = function(_trigger, _silent = false, _close = false, _done
                     '/api/visitPoint/addTopLevelBulkPreExisting'
                 ];
 
-                if(eps.indexOf(form.attr('url')) !== -1) {
-                    if(form.closest('.stag-popup').attr('stag-popup-key').indexOf('past_medical_history/edit') !== -1) {
+                if(parentPopup.length && eps.indexOf(form.attr('url')) !== -1) {
+                    if(parentPopup.attr('stag-popup-key').indexOf('past_medical_history/edit') !== -1) {
                         $('.visit-segment[data-segment-template-name="omega_history_past_medical"]').find('.refresh-segment').trigger('click');
                     }
-                    else if(form.closest('.stag-popup').attr('stag-popup-key').indexOf('history_family/edit') !== -1) {
+                    else if(parentPopup.attr('stag-popup-key').indexOf('history_family/edit') !== -1) {
                         $('.visit-segment[data-segment-template-name="omega_history_family"]').find('.refresh-segment').trigger('click');
                     }
-                    else if(form.closest('.stag-popup').attr('stag-popup-key').indexOf('history_social/edit') !== -1) {
+                    else if(parentPopup.attr('stag-popup-key').indexOf('history_social/edit') !== -1) {
                         $('.visit-segment[data-segment-template-name="omega_history_social"]').find('.refresh-segment').trigger('click');
                     }
-                    else if(form.closest('.stag-popup').attr('stag-popup-key').indexOf('history_surgical/edit') !== -1) {
+                    else if(parentPopup.attr('stag-popup-key').indexOf('history_surgical/edit') !== -1) {
                         $('.visit-segment[data-segment-template-name="omega_history_surgical"]').find('.refresh-segment').trigger('click');
                     }
-                    else if(form.closest('.stag-popup').attr('stag-popup-key').indexOf('allergies-center') !== -1) {
+                    else if(parentPopup.attr('stag-popup-key').indexOf('allergies-center') !== -1) {
                         $('.visit-segment[data-segment-template-name="omega_allergies"]').find('.refresh-segment').trigger('click');
                     }
-                    else if(form.closest('.stag-popup').attr('stag-popup-key').indexOf('medications-center') !== -1) {
+                    else if(parentPopup.attr('stag-popup-key').indexOf('medications-center') !== -1) {
                         $('.visit-segment[data-segment-template-name="omega_medications"]').find('.refresh-segment').trigger('click');
                     }
-                    else if(form.closest('.stag-popup').attr('stag-popup-key').indexOf('problems-center') !== -1) {
+                    else if(parentPopup.attr('stag-popup-key').indexOf('problems-center') !== -1) {
                         $('.visit-segment[data-segment-template-name="omega_problems"]').find('.refresh-segment').trigger('click');
                     }
-                    else if(form.closest('.stag-popup').attr('stag-popup-key').indexOf('goals-center') !== -1) {
+                    else if(parentPopup.attr('stag-popup-key').indexOf('goals-center') !== -1) {
                         $('.visit-segment[data-segment-template-name="omega_goals"]').find('.refresh-segment').trigger('click');
                     }
-                    else if(form.closest('.stag-popup').attr('stag-popup-key').indexOf('careteam-center') !== -1) {
+                    else if(parentPopup.attr('stag-popup-key').indexOf('careteam-center') !== -1) {
                         $('.visit-segment[data-segment-template-name="omega_care_team"]').find('.refresh-segment').trigger('click');
                     }
                 }