From 5e98186cd5c6b1ee1200b178db414af716b913d4 Mon Sep 17 00:00:00 2001 From: Jerry Padgett Date: Tue, 25 Apr 2023 23:40:41 -0400 Subject: [PATCH] Some portal fixes and changes (#6412) - style nav bar logo to be responsive - change Top Nav menu toggle to indicate menu state in button. - fix profile save alert to show in correct alert box. - add Dismiss Form button to top and bottom of editor - change edited document in select list to blue from red to indicated form is active. - change My Documents to Document Actions to be clearer with instructions. --- portal/patient/scripts/app.js | 24 ++++++++++++---------- portal/patient/scripts/app/onsitedocuments.js | 20 +++++++++++------- portal/patient/scripts/app/patientdata.js | 12 +++++------ .../templates/OnsiteDocumentListView.tpl.php | 16 ++++++++++++--- .../DocumentTemplates/DocumentTemplateService.php | 2 +- templates/portal/header.html.twig | 2 +- 6 files changed, 47 insertions(+), 29 deletions(-) diff --git a/portal/patient/scripts/app.js b/portal/patient/scripts/app.js index fbd934321..eac9b4c29 100644 --- a/portal/patient/scripts/app.js +++ b/portal/patient/scripts/app.js @@ -12,22 +12,24 @@ var app = { errorLandmarkEnd: ' /ERROR -->', /** - * Display an alert message inside the element with the id containerId - * - * @param string message to display - * @param string style: '', 'alert-error', 'alert-success' or 'alert-info' - * @param int timeout for message to hide itself - * @param string containerId (default = 'alert') - */ - appendAlert: function(message,style, timeout,containerId) { + * Display an alert message inside the element with the id containerId + * + * @param message + * @param style + * @param timeout + * @param containerId + */ + appendAlert: function(message, style, timeout,containerId) { if (!message) { return; } - timeout = 60000; // mostly errors so make long. + if (timeout < 1000) { + timeout = 15000; + } if (typeof signerAlertMsg !== 'undefined') { - signerAlertMsg("Error: " + message, timeout); + signerAlertMsg(message, timeout, style); } else { - alert("Error: " + message); + alert(message); } }, /** diff --git a/portal/patient/scripts/app/onsitedocuments.js b/portal/patient/scripts/app/onsitedocuments.js index 239b7f9b9..26a2a7f02 100644 --- a/portal/patient/scripts/app/onsitedocuments.js +++ b/portal/patient/scripts/app/onsitedocuments.js @@ -206,7 +206,7 @@ var page = { $("#submitTemplate").hide(); $("#sendTemplate").hide(); $("#downloadTemplate").hide(); - isModule ? $("#dismissOnsiteDocumentButton").show() : $("#dismissOnsiteDocumentButton").hide(); + isModule ? $(".dismissOnsiteDocumentButton").show() : $(".dismissOnsiteDocumentButton").hide(); ((isModule || page.isFrameForm) && !page.isLocked) ? $("#saveTemplate").show() : $("#saveTemplate").hide(); isModule ? $("#homeTemplate").show() : $("#homeTemplate").hide(); (page.encounterFormName === 'HIS' && !page.isLocked) ? $("#chartHistory").show() : $("#chartHistory").hide(); @@ -616,15 +616,22 @@ var page = { let currentNameStyled = currentName.substr(0, currentName.lastIndexOf('.')) || currentName; currentNameStyled = currentNameStyled.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, ' '); if (currentName === 'Help') { - $("#dismissOnsiteDocumentButton").addClass("d-none"); + $(".dismissOnsiteDocumentButton").addClass("d-none"); } else { - $("#dismissOnsiteDocumentButton").removeClass("d-none"); + $(".dismissOnsiteDocumentButton").removeClass("d-none"); } page.isFrameForm = 0; page.encounterFormId = 0; page.encounterFormName = ''; if (docid !== 'Help') { $("#topnav").hide(); + let menuMsg; + if($(parent.document.getElementById('topNav')).is('.collapse:not(.show)')) { + menuMsg = xl("Show Top Menu"); + } else { + menuMsg = xl("Hide Top Menu"); + } + document.getElementById("showNav").innerHTML = menuMsg; } if (currentName === templateName && currentName && !page.isNewDoc) { // update form for any submits.(downloads and prints) @@ -685,11 +692,10 @@ var page = { $('#patientSignature').css('cursor', 'default').off(); $('#witnessSignature').css('cursor', 'default').off(); } - bindFetch(); - - if (page.isFrameForm) { - //$("#editorContainer").removeClass('w-100').addClass('w-auto'); + if (typeof bindFetch == 'function') { + bindFetch(); } + // new encounter form // lbf has own signer instance. no binding here. // page.encounterFormName & page.isFrameForm is set from template directive diff --git a/portal/patient/scripts/app/patientdata.js b/portal/patient/scripts/app/patientdata.js index 431433514..7da89a16d 100644 --- a/portal/patient/scripts/app/patientdata.js +++ b/portal/patient/scripts/app/patientdata.js @@ -290,7 +290,7 @@ var page = { page.fetchInProgress = false; }, error: function (m, r) { - app.appendAlert(app.getErrorMessage(r), 'alert-danger', 0, 'collectionAlert'); + app.appendAlert(app.getErrorMessage(r), 'danger', 15000, 'collectionAlert'); app.hideProgress('modelLoader'); page.fetchInProgress = false; } @@ -316,7 +316,7 @@ var page = { page.getEditedPatient(pm) }, error: function (m, r) { - app.appendAlert(app.getErrorMessage(r), 'alert-danger', 0, 'modelAlert'); + app.appendAlert(app.getErrorMessage(r), 'danger', 15000, 'modelAlert'); app.hideProgress('modelLoader'); } }); @@ -444,7 +444,7 @@ var page = { wait: true, success: function () { if (live !== 1) { - setTimeout("app.appendAlert('Patient was successfully " + (isNew ? "inserted" : "updated") + "','alert-success',2000,'collectionAlert')", 200); + setTimeout("app.appendAlert('Patient was successfully " + (isNew ? "inserted" : "updated") + "','success',5000,'collectionAlert')", 200); setTimeout("window.location.href ='" + webRoot + "/portal/home.php'", 2500); } else if (live === 1 && register !== '0') { // for testing //alert('Save Success'); @@ -462,7 +462,7 @@ var page = { }, error: function (model, response, scope) { app.hideProgress('modelLoader'); - app.appendAlert(app.getErrorMessage(response), 'alert-danger', 0, 'modelAlert'); + app.appendAlert(app.getErrorMessage(response), 'danger', 15000, 'modelAlert'); try { var json = $.parseJSON(response.responseText); if (json.errors) { @@ -493,7 +493,7 @@ var page = { wait: true, success: function () { $('#patientDetailDialog').modal('hide'); - setTimeout("app.appendAlert('The Patient record was deleted','alert-success',3000,'collectionAlert')", 500); + setTimeout("app.appendAlert('The Patient record was deleted','success',5000,'collectionAlert')", 500); app.hideProgress('modelLoader'); if (model.reloadCollectionOnModelUpdate) { @@ -502,7 +502,7 @@ var page = { } }, error: function (model, response, scope) { - app.appendAlert(app.getErrorMessage(response), 'alert-danger', 0, 'modelAlert'); + app.appendAlert(app.getErrorMessage(response), 'danger', 15000, 'modelAlert'); app.hideProgress('modelLoader'); } }); diff --git a/portal/patient/templates/OnsiteDocumentListView.tpl.php b/portal/patient/templates/OnsiteDocumentListView.tpl.php index 7285bf3fd..f9418561e 100644 --- a/portal/patient/templates/OnsiteDocumentListView.tpl.php +++ b/portal/patient/templates/OnsiteDocumentListView.tpl.php @@ -129,6 +129,13 @@ $templateService = new DocumentTemplateService(); $(".helpHide").addClass("d-none"); $('#showNav').on('click', () => { + let menuMsg; + if($(parent.document.getElementById('topNav')).is('.collapse:not(.show)')) { + menuMsg = xl("Hide Top Menu"); + } else { + menuMsg = xl("Show Top Menu"); + } + document.getElementById("showNav").innerHTML = menuMsg; parent.document.getElementById('topNav').classList.toggle('collapse'); }); } @@ -364,7 +371,7 @@ $templateService = new DocumentTemplateService();
@@ -428,6 +435,9 @@ $templateService = new DocumentTemplateService();