|
@@ -14,10 +14,14 @@ window.top.addEventListener('popstate', function (event) {
|
|
});
|
|
});
|
|
$(document).ready(function () {
|
|
$(document).ready(function () {
|
|
|
|
|
|
- if(window.location.pathname === window.top.location.pathname) {
|
|
|
|
- window.top.location.href = '/mc' + window.location.pathname;
|
|
|
|
- return;
|
|
|
|
|
|
+
|
|
|
|
+ if(!window.noMc){
|
|
|
|
+ if (window.location.pathname === window.top.location.pathname) {
|
|
|
|
+ window.top.location.href = '/mc' + window.location.pathname;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
// window.top.ensureRHS();
|
|
// window.top.ensureRHS();
|
|
$(document).on('click', '.stag_rhs_toggle', function () {
|
|
$(document).on('click', '.stag_rhs_toggle', function () {
|
|
var state = window.top.toggleRHS(),
|
|
var state = window.top.toggleRHS(),
|
|
@@ -52,31 +56,34 @@ $(document).ready(function () {
|
|
if (target.indexOf('/mc') === 0) {
|
|
if (target.indexOf('/mc') === 0) {
|
|
target = target.split('/mc')[1];
|
|
target = target.split('/mc')[1];
|
|
}
|
|
}
|
|
- fastLoad(target, true, false, true);
|
|
|
|
|
|
+ if(!window.noMc){
|
|
|
|
+ fastLoad(target, true, false, true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
});
|
|
});
|
|
function enableTimeSpecificFields(_checked, _valueClass, _rangeClass) {
|
|
function enableTimeSpecificFields(_checked, _valueClass, _rangeClass) {
|
|
- if(_valueClass) $('.' + _valueClass).prop('disabled', _checked);
|
|
|
|
- if(_rangeClass) $('.' + _rangeClass).prop('disabled', !_checked);
|
|
|
|
|
|
+ if (_valueClass) $('.' + _valueClass).prop('disabled', _checked);
|
|
|
|
+ if (_rangeClass) $('.' + _rangeClass).prop('disabled', !_checked);
|
|
}
|
|
}
|
|
function toggleDisabledAsNeeded(_el, _targetValue, _enableClass, _disableClass) {
|
|
function toggleDisabledAsNeeded(_el, _targetValue, _enableClass, _disableClass) {
|
|
- if(_el.value === _targetValue) {
|
|
|
|
- if(_enableClass) $('.' + _enableClass).prop('disabled', false);
|
|
|
|
- if(_disableClass) $('.' + _disableClass).prop('disabled', true);
|
|
|
|
|
|
+ if (_el.value === _targetValue) {
|
|
|
|
+ if (_enableClass) $('.' + _enableClass).prop('disabled', false);
|
|
|
|
+ if (_disableClass) $('.' + _disableClass).prop('disabled', true);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- if(_enableClass) $('.' + _enableClass).prop('disabled', true);
|
|
|
|
- if(_disableClass) $('.' + _disableClass).prop('disabled', false);
|
|
|
|
|
|
+ if (_enableClass) $('.' + _enableClass).prop('disabled', true);
|
|
|
|
+ if (_disableClass) $('.' + _disableClass).prop('disabled', false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function toggleVisibilityAsNeeded(_el, _targetValue, _visibleClass, _hiddenClass) {
|
|
function toggleVisibilityAsNeeded(_el, _targetValue, _visibleClass, _hiddenClass) {
|
|
- if(_el.value === _targetValue) {
|
|
|
|
- if(_visibleClass) $('.' + _visibleClass).removeClass('d-none');
|
|
|
|
- if(_hiddenClass) $('.' + _hiddenClass).addClass('d-none');
|
|
|
|
|
|
+ if (_el.value === _targetValue) {
|
|
|
|
+ if (_visibleClass) $('.' + _visibleClass).removeClass('d-none');
|
|
|
|
+ if (_hiddenClass) $('.' + _hiddenClass).addClass('d-none');
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- if(_visibleClass) $('.' + _visibleClass).addClass('d-none');
|
|
|
|
- if(_hiddenClass) $('.' + _hiddenClass).removeClass('d-none');
|
|
|
|
|
|
+ if (_visibleClass) $('.' + _visibleClass).addClass('d-none');
|
|
|
|
+ if (_hiddenClass) $('.' + _hiddenClass).removeClass('d-none');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var fastCache = {};
|
|
var fastCache = {};
|
|
@@ -89,12 +96,12 @@ function initFastLoad(_parent = false) {
|
|
}
|
|
}
|
|
|
|
|
|
// clear cache
|
|
// clear cache
|
|
- if(!_parent) {
|
|
|
|
|
|
+ if (!_parent) {
|
|
fastCache = {};
|
|
fastCache = {};
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
allAs.each(function () {
|
|
allAs.each(function () {
|
|
- if(typeof fastCache[this.href] !== 'undefined') {
|
|
|
|
|
|
+ if (typeof fastCache[this.href] !== 'undefined') {
|
|
delete fastCache[this.href];
|
|
delete fastCache[this.href];
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -146,7 +153,7 @@ function onFastLoaded(_data, _href, _history) {
|
|
content = content.html();
|
|
content = content.html();
|
|
content += '<script src="/js/yemi.js?_=7"></script>';
|
|
content += '<script src="/js/yemi.js?_=7"></script>';
|
|
targetParent.html(content);
|
|
targetParent.html(content);
|
|
- window.setTimeout(function() {
|
|
|
|
|
|
+ window.setTimeout(function () {
|
|
initCreateNote();
|
|
initCreateNote();
|
|
initQuillEdit();
|
|
initQuillEdit();
|
|
initFastLoad(targetParent);
|
|
initFastLoad(targetParent);
|
|
@@ -174,7 +181,7 @@ function fastLoad(_href, _history = true, _useCache = true, _replaceState = fals
|
|
|
|
|
|
showMask();
|
|
showMask();
|
|
|
|
|
|
- if(_href === '') _href = '/';
|
|
|
|
|
|
+ if (_href === '') _href = '/';
|
|
|
|
|
|
// push state
|
|
// push state
|
|
if (_history) {
|
|
if (_history) {
|
|
@@ -185,8 +192,8 @@ function fastLoad(_href, _history = true, _useCache = true, _replaceState = fals
|
|
target = target.substr(target.indexOf('/') + 1);
|
|
target = target.substr(target.indexOf('/') + 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(target[0] === '/') target = target.substr(1);
|
|
|
|
- if(_replaceState) {
|
|
|
|
|
|
+ if (target[0] === '/') target = target.substr(1);
|
|
|
|
+ if (_replaceState) {
|
|
window.top.history.replaceState(target, null, '/mc/' + target);
|
|
window.top.history.replaceState(target, null, '/mc/' + target);
|
|
console.log('ALIX replaceState: [' + target + ']');
|
|
console.log('ALIX replaceState: [' + target + ']');
|
|
}
|
|
}
|
|
@@ -199,9 +206,9 @@ function fastLoad(_href, _history = true, _useCache = true, _replaceState = fals
|
|
if (_useCache && !!fastCache[_href]) {
|
|
if (_useCache && !!fastCache[_href]) {
|
|
onFastLoaded(fastCache[_href], _href, _history);
|
|
onFastLoaded(fastCache[_href], _href, _history);
|
|
} else {
|
|
} else {
|
|
- $.get(_href, function(_data) {
|
|
|
|
|
|
+ $.get(_href, function (_data) {
|
|
onFastLoaded(_data, _href, _history);
|
|
onFastLoaded(_data, _href, _history);
|
|
- }).fail(function() {
|
|
|
|
|
|
+ }).fail(function () {
|
|
onFastLoaded('error', _href, _history);
|
|
onFastLoaded('error', _href, _history);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -212,11 +219,11 @@ function initPrimaryForm(_form = false) {
|
|
if (primaryForm.length) {
|
|
if (primaryForm.length) {
|
|
primaryForm = primaryForm.first();
|
|
primaryForm = primaryForm.first();
|
|
var rte = primaryForm.find('[contenteditable="true"]').first();
|
|
var rte = primaryForm.find('[contenteditable="true"]').first();
|
|
- if(rte.length) {
|
|
|
|
|
|
+ if (rte.length) {
|
|
rte.focus().select();
|
|
rte.focus().select();
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- if(primaryForm.find('[autofocus]:visible').length) {
|
|
|
|
|
|
+ if (primaryForm.find('[autofocus]:visible').length) {
|
|
primaryForm.find('[autofocus]:visible').first().focus().select();
|
|
primaryForm.find('[autofocus]:visible').first().focus().select();
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -237,10 +244,10 @@ function openInRHS(_url) {
|
|
function initCreateNote() {
|
|
function initCreateNote() {
|
|
$(document)
|
|
$(document)
|
|
.off('click.create-note', '.create-auto-note-trigger')
|
|
.off('click.create-note', '.create-auto-note-trigger')
|
|
- .on('click.create-note', '.create-auto-note-trigger', function() {
|
|
|
|
|
|
+ .on('click.create-note', '.create-auto-note-trigger', function () {
|
|
createNewNote($(this).attr('data-patient-uid'), $(this).attr('data-hcp-uid'), $(this).attr('data-effective-date'));
|
|
createNewNote($(this).attr('data-patient-uid'), $(this).attr('data-hcp-uid'), $(this).attr('data-effective-date'));
|
|
});
|
|
});
|
|
- if($('select[name="hasMcpDoneOnboardingVisit"]').length) {
|
|
|
|
|
|
+ if ($('select[name="hasMcpDoneOnboardingVisit"]').length) {
|
|
$('select[name="hasMcpDoneOnboardingVisit"]')[0].onchange();
|
|
$('select[name="hasMcpDoneOnboardingVisit"]')[0].onchange();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -252,7 +259,7 @@ function createNewNote(_patientUid, _hcpUid, _date) {
|
|
clientUid: _patientUid,
|
|
clientUid: _patientUid,
|
|
hcpProUid: _hcpUid,
|
|
hcpProUid: _hcpUid,
|
|
effectiveDateEST: _date,
|
|
effectiveDateEST: _date,
|
|
- }, function(_data) {
|
|
|
|
|
|
+ }, function (_data) {
|
|
hideMask();
|
|
hideMask();
|
|
if (!_data.success) {
|
|
if (!_data.success) {
|
|
toastr.error(_data.message);
|
|
toastr.error(_data.message);
|
|
@@ -267,14 +274,14 @@ function initQuillEdit(_selector = '.note-content[auto-edit]') {
|
|
|
|
|
|
$(document)
|
|
$(document)
|
|
.off('click.enable-edit', '.note-content:not([auto-edit]):not(.readonly)')
|
|
.off('click.enable-edit', '.note-content:not([auto-edit]):not(.readonly)')
|
|
- .on('click.enable-edit', '.note-content:not([auto-edit]):not(.readonly)', function() {
|
|
|
|
|
|
+ .on('click.enable-edit', '.note-content:not([auto-edit]):not(.readonly)', function () {
|
|
$(this).attr('auto-edit', 1);
|
|
$(this).attr('auto-edit', 1);
|
|
initQuillEdit();
|
|
initQuillEdit();
|
|
initPrimaryForm();
|
|
initPrimaryForm();
|
|
initPatientPresenceIndicator();
|
|
initPatientPresenceIndicator();
|
|
});
|
|
});
|
|
|
|
|
|
- if(!$(_selector).length) return;
|
|
|
|
|
|
+ if (!$(_selector).length) return;
|
|
var noteUid = $(_selector).attr('data-note-uid');
|
|
var noteUid = $(_selector).attr('data-note-uid');
|
|
var qe = new Quill(_selector, {
|
|
var qe = new Quill(_selector, {
|
|
theme: 'snow',
|
|
theme: 'snow',
|
|
@@ -283,8 +290,8 @@ function initQuillEdit(_selector = '.note-content[auto-edit]') {
|
|
bindings: {
|
|
bindings: {
|
|
handleEnter: {
|
|
handleEnter: {
|
|
key: 13,
|
|
key: 13,
|
|
- handler: function() {
|
|
|
|
- if(!$('.stag-shortcuts:visible').length) return true;
|
|
|
|
|
|
+ handler: function () {
|
|
|
|
+ if (!$('.stag-shortcuts:visible').length) return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -294,11 +301,11 @@ function initQuillEdit(_selector = '.note-content[auto-edit]') {
|
|
var toolbar = $(qe.container).prev('.ql-toolbar');
|
|
var toolbar = $(qe.container).prev('.ql-toolbar');
|
|
var saveButton = $('<button class="btn btn-sm btn-primary w-auto px-3 py-0 text-sm text-white save-note-content">Save</button>');
|
|
var saveButton = $('<button class="btn btn-sm btn-primary w-auto px-3 py-0 text-sm text-white save-note-content">Save</button>');
|
|
toolbar.append(saveButton);
|
|
toolbar.append(saveButton);
|
|
- saveButton.on('click', function() {
|
|
|
|
|
|
+ saveButton.on('click', function () {
|
|
$.post('/api/note/putFreeTextHtml', {
|
|
$.post('/api/note/putFreeTextHtml', {
|
|
uid: noteUid,
|
|
uid: noteUid,
|
|
freeTextHtml: qe.root.innerHTML,
|
|
freeTextHtml: qe.root.innerHTML,
|
|
- }, function(_data) {
|
|
|
|
|
|
+ }, function (_data) {
|
|
if (!_data.success) {
|
|
if (!_data.success) {
|
|
toastr.error(_data.message);
|
|
toastr.error(_data.message);
|
|
}
|
|
}
|
|
@@ -328,20 +335,20 @@ function initQuillEdit(_selector = '.note-content[auto-edit]') {
|
|
|
|
|
|
var patientPresenceTimer = false;
|
|
var patientPresenceTimer = false;
|
|
function initPatientPresenceIndicator() {
|
|
function initPatientPresenceIndicator() {
|
|
- if(patientPresenceTimer !== false) {
|
|
|
|
|
|
+ if (patientPresenceTimer !== false) {
|
|
window.clearInterval(patientPresenceTimer);
|
|
window.clearInterval(patientPresenceTimer);
|
|
patientPresenceTimer = false;
|
|
patientPresenceTimer = false;
|
|
console.log('Cancelled previous timer!');
|
|
console.log('Cancelled previous timer!');
|
|
}
|
|
}
|
|
var elem = $('.patient-presence-indicator[data-patient-uid]');
|
|
var elem = $('.patient-presence-indicator[data-patient-uid]');
|
|
- if(elem.length) {
|
|
|
|
|
|
+ if (elem.length) {
|
|
var patientUid = elem.attr('data-patient-uid');
|
|
var patientUid = elem.attr('data-patient-uid');
|
|
- patientPresenceTimer = window.setInterval(function() {
|
|
|
|
|
|
+ patientPresenceTimer = window.setInterval(function () {
|
|
var elem = $('.patient-presence-indicator[data-patient-uid]');
|
|
var elem = $('.patient-presence-indicator[data-patient-uid]');
|
|
- if(elem.length) {
|
|
|
|
|
|
+ if (elem.length) {
|
|
var patientUid = elem.attr('data-patient-uid');
|
|
var patientUid = elem.attr('data-patient-uid');
|
|
- $.get('/patients/' + patientUid + '/presence', function(_data) {
|
|
|
|
- if(_data.online) {
|
|
|
|
|
|
+ $.get('/patients/' + patientUid + '/presence', function (_data) {
|
|
|
|
+ if (_data.online) {
|
|
elem.addClass('online');
|
|
elem.addClass('online');
|
|
}
|
|
}
|
|
else {
|
|
else {
|