Эх сурвалжийг харах

Moe <-> stag-popup parent link

Vijayakrishnan 4 жил өмнө
parent
commit
6759434356

+ 2 - 1
public/js/pro-suggest.js

@@ -91,7 +91,7 @@
     window.initProSuggest = function() {
 
         // make select[provider-search] hidden & insert a textbox with pro-suggest
-        $('select[provider-search]').each(function() {
+        $('select[provider-search]:not([pro-suggest-initialized])').each(function() {
             let elem = $(this);
             elem.next('.pro-suggest-input').remove();
             elem.next('.pro-suggestions-container').remove();
@@ -134,6 +134,7 @@
                 //     }, 50);
                 // });
 
+            $(this).attr('pro-suggest-initialized', 1);
         });
 
         $(document).off('click', '.suggest-item.pro-suggest[data-target-uid]');

+ 14 - 3
public/js/stag-popup.js

@@ -87,9 +87,16 @@ function openDynamicStagPopup(url, initer, title, updateParent) {
         }
         showStagPopup(url);
         if(initer) runMCInitializer(initer);
+        runMCInitializer('pro-suggest');
         hideMask();
     });
 }
+function isDynamicStagPopupPresent() {
+    if(!stagPopupsQueue.length) return false;
+    let popup = stagPopupsQueue[stagPopupsQueue.length - 1];
+    if(popup.is('.dynamic-popup')) return true;
+    return false;
+}
 function refreshDynamicStagPopup() {
     if(!stagPopupsQueue.length) return;
     let popup = stagPopupsQueue[stagPopupsQueue.length - 1];
@@ -99,7 +106,9 @@ function refreshDynamicStagPopup() {
         let url = popup.attr('stag-popup-key'),
             initer = popup.attr('mc-initer');
         $.get(url, (_data) => {
+            popup.find('.stag-popup-content-inner').html(_data);
             if(initer) runMCInitializer(initer);
+            runMCInitializer('pro-suggest');
             hideMask();
         });
     }
@@ -119,9 +128,11 @@ function refreshDynamicStagPopup() {
             .off('keydown.stag-popup-escape')
             .on('keydown.stag-popup-escape', function (e) {
                 if(e.which === 27) {
-                    if(stagPopupsQueue.length) {
-                        closeStagPopup();
-                        return false;
+                    if(!window.moeClosedAt || (new Date()).getTime() - window.moeClosedAt > 1000) {
+                        if(stagPopupsQueue.length) {
+                            closeStagPopup();
+                            return false;
+                        }
                     }
                 }
             });

+ 5 - 0
public/js/yemi.js

@@ -527,6 +527,8 @@ var initMoes = function() {
                                 initFastLoad(moeParent);
                                 initAutoRxAndICDComplete();
                             });
+                        } else if(isDynamicStagPopupPresent()) {
+                            refreshDynamicStagPopup();
                         } else {
                             pageReload();
                         }
@@ -559,6 +561,8 @@ var initMoes = function() {
                                 initFastLoad(moeParent);
                                 initAutoRxAndICDComplete();
                             });
+                        } else if(isDynamicStagPopupPresent()) {
+                            refreshDynamicStagPopup();
                         } else {
                             pageReload();
                         }
@@ -1097,6 +1101,7 @@ $(document).ready(function () {
                 if (visibleMoes.length) {
                     hideMoeFormMask();
                     visibleMoes.hide();
+                    window.moeClosedAt = (new Date()).getTime();
                     return false;
                 }
             }

+ 1 - 0
resources/views/app/patient/claims-resolver.blade.php

@@ -269,6 +269,7 @@
                 <a native target="_blank"
                    open-in-stag-popup
                    update-parent
+                   mc-initer="note-single"
                    title="Note Details"
                    href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">
                     {{ friendly_date_time($d, false) }}