Browse Source

[STAG-37] Fix AC after edit Rx/Dx in dashboard

Vijayakrishnan Krishnan 4 years ago
parent
commit
339b84a401
2 changed files with 7 additions and 4 deletions
  1. 1 0
      public/js/yemi.js
  2. 6 4
      resources/views/layouts/template.blade.php

+ 1 - 0
public/js/yemi.js

@@ -417,6 +417,7 @@ var initMoes = function() {
                             hideMoeFormMask();
                             initMoes();
                             initFastLoad(moeParent);
+                            initAutoRxAndICDComplete();
                         });
                     } else {
                         pageReload();

+ 6 - 4
resources/views/layouts/template.blade.php

@@ -246,8 +246,8 @@
     </script>
     <script>
         (function() {
-            function init() {
-                $('input[type="text"][name="ICD"]').each(function() {
+            window.initAutoRxAndICDComplete = function () {
+                $('input[type="text"][name="ICD"]:not([ac-initialized])').each(function() {
                     var elem = this,
                         dynID = 'icd-' + Math.ceil(Math.random() * 1000000);
                     $(elem).attr('id', dynID);
@@ -264,8 +264,9 @@
                         $(elem).closest('form').find('[name="contentText"]').val(name);
                         return false;
                     });
+                    $(elem).attr('ac-initialized', 1);
                 });
-                $('[rx-section] input[type="text"][name="contentText"]').each(function() {
+                $('[rx-section] input[type="text"][name="contentText"]:not([ac-initialized])').each(function() {
                     var elem = this,
                         dynID = 'rx-' + Math.ceil(Math.random() * 1000000);
                     $(elem).attr('id', dynID);
@@ -282,9 +283,10 @@
                         if (strengths)
                             strengthElem.autocomp.setListAndField(strengths, '');
                     });
+                    $(elem).attr('ac-initialized', 1);
                 });
             }
-            addMCInitializer('patient-single', init);
+            addMCInitializer('patient-single', window.initAutoRxAndICDComplete);
         })();
     </script>