Skip to content

Commit

Permalink
Some portal fixes and changes (openemr#6412)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
sjpadgett authored Apr 26, 2023
1 parent aee650a commit 5e98186
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 29 deletions.
24 changes: 13 additions & 11 deletions portal/patient/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},
/**
Expand Down
20 changes: 13 additions & 7 deletions portal/patient/scripts/app/onsitedocuments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions portal/patient/scripts/app/patientdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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');
}
});
Expand Down Expand Up @@ -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');
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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');
}
});
Expand Down
16 changes: 13 additions & 3 deletions portal/patient/templates/OnsiteDocumentListView.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@
$(".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');
});
}
Expand Down Expand Up @@ -364,7 +371,7 @@ function restoreDocumentEdits() {
</script>
<div class="container-xl px-1">
<nav id="verytop" class="navbar navbar-expand-lg navbar-light bg-light px-1 pt-3 pb-1 m-0 sticky-top" style="z-index:1030;">
<a class="navbar-brand mt-1 mr-1"><h3><?php echo xlt("My Documents") ?></h3></a>
<a class="navbar-brand mt-1 mr-1"><h3><?php echo xlt("Document Actions") ?></h3></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#topmenu" aria-controls="topmenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
Expand Down Expand Up @@ -412,7 +419,7 @@ function restoreDocumentEdits() {
<a class='nav-link btn btn-secondary' data-toggle='tooltip' title='Refresh' id='refreshPage' href='javascript:' onclick='window.location.reload()'> <span class='fa fa-sync fa-lg'></span></a>
</li>
<li class='nav-item mb-1'>
<a id='showNav' class='nav-link btn btn-secondary'><span class='navbar-toggler-icon mr-1'></span><?php echo xlt('Menu'); ?></a>
<a id='showNav' class='nav-link btn btn-secondary'><span class='navbar-toggler-icon mr-1'></span><?php echo xlt('Top Menu'); ?></a>
</li>
</ul>
</div>
Expand All @@ -428,6 +435,9 @@ function restoreDocumentEdits() {
<script type="text/template" id="onsiteDocumentModelTemplate">
<div class="card m-0 p-0" id="docpanel">
<!-- Document edit container -->
<span>
<button id="dismissOnsiteDocumentButtonTop" class="dismissOnsiteDocumentButton btn btn-outline-primary float-right m-1" onclick="window.location.reload()"><?php echo xlt('Dismiss Form'); ?></button>
</span>
<header class="card-header bg-dark text-light helpHide" id='docPanelHeader'><?php echo xlt('Editing'); ?></header>
<!-- editor form -->
<form class="container-xl p-0" id='template' name='template' role="form" action="./../lib/doc_lib.php" method="POST">
Expand All @@ -446,7 +456,7 @@ function restoreDocumentEdits() {
</form>
<div class="clearfix">
<span>
<button id="dismissOnsiteDocumentButton" class="btn btn-secondary float-right" onclick="window.location.reload()"><?php echo xlt('Dismiss Form'); ?></button>
<button id="dismissOnsiteDocumentButton" class="dismissOnsiteDocumentButton btn btn-outline-primary float-right m-1" onclick="window.location.reload()"><?php echo xlt('Dismiss Form'); ?></button>
</span>
<!-- delete button is a separate form to prevent enter key from triggering a delete-->
<form id="deleteOnsiteDocumentButtonContainer" class="form-inline" onsubmit="return false;">
Expand Down
2 changes: 1 addition & 1 deletion src/Services/DocumentTemplates/DocumentTemplateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ public function renderPortalTemplateMenu($current_patient, $current_user, $dropd
$id = $template['id'];
$btnname = $template['template_name'];
if (!empty($in_edit)) {
$menu .= '<a class="dropdown-item template-item text-danger btn btn-link" id="' . attr($id) . '"' . ' href="#" onclick="page.editHistoryDocument(' . attr_js($in_edit['id']) . ')">' . text($btnname) . "</a>\n";
$menu .= '<a class="dropdown-item template-item text-primary btn btn-link font-weight-bold" id="' . attr($id) . '"' . ' href="#" onclick="page.editHistoryDocument(' . attr_js($in_edit['id']) . ')">' . text($btnname) . "</a>\n";
} else {
$menu .= '<a class="dropdown-item template-item text-success btn btn-link" id="' . attr($id) . '"' . ' href="#" onclick="page.newDocument(' . attr_js($current_patient) . ', ' . attr_js($current_user) . ', ' . attr_js($btnname) . ', ' . attr_js($id) . ')">' . text($btnname) . "</a>\n";
}
Expand Down
2 changes: 1 addition & 1 deletion templates/portal/header.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<nav id="topNav" class="navbar navbar-expand-lg navbar-light bg-light sticky-top">
<a class="navbar-brand" href="home.php">
<img class="img-fluid" width="140" src="{{ menuLogo | attr }}"/>
<img class="img-fluid" width="15%" src="{{ menuLogo | attr }}"/>
</a>

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#nav" aria-controls="nav" aria-expanded="false" aria-label="Toggle navigation">
Expand Down

0 comments on commit 5e98186

Please sign in to comment.