|
@@ -157,20 +157,39 @@ function initFastLoad(_parent = false) {
|
|
}
|
|
}
|
|
|
|
|
|
function onFastLoaded(_data, _href, _history, _target = null) {
|
|
function onFastLoaded(_data, _href, _history, _target = null) {
|
|
- var targetSelector = _target ? _target : '.stag-content';
|
|
|
|
- var targetParent = $(targetSelector);
|
|
|
|
- console.log('ALIX load target: ' + targetSelector);
|
|
|
|
|
|
+
|
|
if (!Number.isInteger(_data)) {
|
|
if (!Number.isInteger(_data)) {
|
|
_data = '<div>' + _data + '</div>';
|
|
_data = '<div>' + _data + '</div>';
|
|
- var content = $(_data).find(targetSelector);
|
|
|
|
- if (content && content.length) {
|
|
|
|
- targetParent.html(content.html());
|
|
|
|
|
|
+
|
|
|
|
+ // do for each element in _target
|
|
|
|
+ let responseError = false;
|
|
|
|
+ _target = _target ? _target : '.stag-content';
|
|
|
|
+ _target = _target.split(',').map(_x => $.trim(_x));
|
|
|
|
+ for (let i = 0; i < _target.length; i++) {
|
|
|
|
+ let t = _target[i];
|
|
|
|
+ let targetElement = $(t).first();
|
|
|
|
+ if(targetElement.length) {
|
|
|
|
+ let sourceElement = $(_data).find(t).first();
|
|
|
|
+ if (sourceElement && sourceElement.length) {
|
|
|
|
+ targetElement.html(sourceElement.html());
|
|
|
|
+ initFastLoad(targetElement);
|
|
|
|
+ console.log('ALIX loaded element: ' + t);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ responseError = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ responseError = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!responseError) {
|
|
hideMask();
|
|
hideMask();
|
|
hideMoeFormMask();
|
|
hideMoeFormMask();
|
|
window.setTimeout(function () {
|
|
window.setTimeout(function () {
|
|
initCreateNote();
|
|
initCreateNote();
|
|
initQuillEdit();
|
|
initQuillEdit();
|
|
- initFastLoad(targetParent);
|
|
|
|
initPrimaryForm();
|
|
initPrimaryForm();
|
|
initPatientPresenceIndicator();
|
|
initPatientPresenceIndicator();
|
|
runMCInitializers();
|
|
runMCInitializers();
|
|
@@ -180,19 +199,10 @@ function onFastLoaded(_data, _href, _history, _target = null) {
|
|
$(window).scrollTop(0);
|
|
$(window).scrollTop(0);
|
|
}
|
|
}
|
|
window.top.currentMcUrl = window.top.location.href;
|
|
window.top.currentMcUrl = window.top.location.href;
|
|
-
|
|
|
|
- /*let activeLeftNavLink = $('#sidebarMenu .nav-item>.nav-link.active').first();
|
|
|
|
- if(activeLeftNavLink.length) {
|
|
|
|
- activeLeftNavLink[0].scrollIntoView({
|
|
|
|
- behavior: "smooth",
|
|
|
|
- block: "nearest",
|
|
|
|
- inline: "nearest"
|
|
|
|
- });
|
|
|
|
- }*/
|
|
|
|
}, 0);
|
|
}, 0);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- targetParent.html('<p class="text-danger p-3 small">Error on page: <b>' + _href + '</b></p>');
|
|
|
|
|
|
+ $('.stag-content').first().html('<p class="text-danger p-3 small">Error on page: <b>' + _href + '</b></p>');
|
|
hideMask();
|
|
hideMask();
|
|
hideMoeFormMask();
|
|
hideMoeFormMask();
|
|
}
|
|
}
|
|
@@ -214,7 +224,7 @@ function onFastLoaded(_data, _href, _history, _target = null) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
console.warn('MC: Target page failed: ' + _href);
|
|
console.warn('MC: Target page failed: ' + _href);
|
|
- targetParent.html('<p class="text-danger p-3 small"><b>' + _data + '</b> - ' + msg + '<b>' + _href + '</b></p>');
|
|
|
|
|
|
+ $('.stag-content').first().html('<p class="text-danger p-3 small"><b>' + _data + '</b> - ' + msg + '<b>' + _href + '</b></p>');
|
|
hideMask();
|
|
hideMask();
|
|
hideMoeFormMask();
|
|
hideMoeFormMask();
|
|
}
|
|
}
|