From 28ccace5f2cb1fc2926b52c5ddc4cfd3359d8b56 Mon Sep 17 00:00:00 2001 From: Brady Miller Date: Wed, 13 Sep 2023 12:18:52 -0700 Subject: [PATCH] fix: fix summary screen cards expand and collapse persistence (#6836) --- .../patient_file/summary/demographics.php | 55 +++++++++++-------- interface/patient_file/summary/stats.php | 10 ++-- templates/patient/card/card_base.html.twig | 2 +- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/interface/patient_file/summary/demographics.php b/interface/patient_file/summary/demographics.php index 5964d141c10..995f8395061 100644 --- a/interface/patient_file/summary/demographics.php +++ b/interface/patient_file/summary/demographics.php @@ -1067,12 +1067,13 @@ function filterActiveIssues(array $i): array } $allergyTouchListSQL = "SELECT COUNT(*) as touched FROM lists_touch WHERE pid = ? AND type = 'allergy'"; $allergyTouchListResult = sqlQuery($allergyTouchListSQL, [$pid]); - + $id = 'allergy_ps_expand'; $viewArgs = [ 'title' => xl('Allergies'), 'card_container_class_list' => ['flex-fill', 'mx-1'], - 'id' => 'allergies_ps_expand', + 'id' => $id, 'forceAlwaysOpen' => false, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'linkMethod' => "javascript", 'list' => ['priority' => $_priority, 'standard' => $_standard], 'listTouched' => ($allergyTouchListResult['touched'] > 0) ? true : false, @@ -1090,11 +1091,13 @@ function filterActiveIssues(array $i): array // MEDICAL PROBLEMS CARD if (AclMain::aclCheckIssue('medical_problem')) { $_rawPL = $patIssueService->search(['lists.pid' => $pid, 'lists.type' => 'medical_problem'])->getData(); + $id = 'medical_problem_ps_expand'; $viewArgs = [ 'title' => xl('Medical Problems'), 'card_container_class_list' => ['flex-fill', 'mx-1'], - 'id' => 'medical_problem_ps_expand', + 'id' => $id, 'forceAlwaysOpen' => false, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'linkMethod' => "javascript", 'list' => filterActiveIssues($_rawPL), 'auth' => true, @@ -1109,11 +1112,13 @@ function filterActiveIssues(array $i): array // MEDICATION CARD if (AclMain::aclCheckIssue('medication')) { $_rawMedList = $patIssueService->search(['lists.pid' => $pid, 'lists.type' => 'medication'])->getData(); + $id = 'medication_ps_expand'; $viewArgs = [ 'title' => xl('Medications'), 'card_container_class_list' => ['flex-fill', 'mx-1'], - 'id' => 'medications_ps_expand', + 'id' => $id, 'forceAlwaysOpen' => false, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'linkMethod' => "javascript", 'list' => filterActiveIssues($_rawMedList), 'auth' => true, @@ -1143,7 +1148,8 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl('Current Medications'), 'id' => $id, - 'forceAlwaysOpen' => (getUserSetting($id) == 0) ? false : true, + 'forceAlwaysOpen' => false, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'auth' => false, 'rxList' => $rxArr, ]; @@ -1156,7 +1162,8 @@ function filterActiveIssues(array $i): array 'title' => xl("Prescriptions"), 'card_container_class_list' => ['flex-fill', 'mx-1'], 'id' => $id, - 'forceAlwaysOpen' => (getUserSetting($id) == 0) ? false : true, + 'forceAlwaysOpen' => false, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => "Edit", 'auth' => AclMain::aclCheckCore('patients', 'rx', '', ['write', 'addonly']), ]; @@ -1226,7 +1233,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => $card->getTitle(), 'id' => $card->getIdentifier(), - 'initiallyCollapsed' => !$card->isInitiallyCollapsed(), + 'initiallyCollapsed' => $card->isInitiallyCollapsed(), 'card_bg_color' => $card->getBackgroundColorClass(), 'card_text_color' => $card->getTextColorClass(), 'forceAlwaysOpen' => !$card->canCollapse(), @@ -1250,7 +1257,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl('Billing'), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'hideBtn' => true, 'patientBalance' => $patientbalance, 'insuranceBalance' => $insurancebalance, @@ -1290,7 +1297,7 @@ function filterActiveIssues(array $i): array 'linkMethod' => "html", 'auth' => ACLMain::aclCheckCore('patients', 'demo', '', 'write'), 'requireRestore' => (!isset($_SESSION['patient_portal_onsite_two'])) ? true : false, - 'initiallyCollapsed' => getUserSetting("demographics_ps_expand") == true ? true : false, + 'initiallyCollapsed' => (getUserSetting("demographics_ps_expand") == 0) ? true : false, 'tabID' => "DEM", 'result' => $result, 'result2' => $result2, @@ -1400,7 +1407,7 @@ function filterActiveIssues(array $i): array 'btnLabel' => "Edit", 'btnLink' => "demographics_full.php", 'linkMethod' => 'html', - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'ins' => $insArr, 'eligibility' => $output, 'enable_oa' => $GLOBALS['enable_oa'], @@ -1423,7 +1430,7 @@ function filterActiveIssues(array $i): array 'id' => $id, 'btnLabel' => "Edit", 'btnLink' => "pnotes_full.php?form_active=1", - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'linkMethod' => "html", 'bodyClass' => "notab", 'auth' => AclMain::aclCheckCore('patients', 'notes', '', 'write'), @@ -1440,7 +1447,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl('Patient Reminders'), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => 'Edit', 'btnLink' => '../reminder/patient_reminders.php?mode=simple&patient_id=' . attr_url($pid), 'linkMethod' => 'html', @@ -1461,7 +1468,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl('Disclosures'), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => 'Edit', 'btnLink' => 'disclosure_full.php', 'linkMethod' => 'html', @@ -1487,7 +1494,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl('Amendments'), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => 'Edit', 'btnLink' => $GLOBALS['webroot'] . "/interface/patient_file/summary/list_amendments.php?id=" . attr_url($pid), 'btnCLass' => '', @@ -1517,7 +1524,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl('Labs'), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => 'Trend', 'btnLink' => "../summary/labdata.php", 'linkMethod' => 'html', @@ -1540,7 +1547,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl('Vitals'), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => 'Trend', 'btnLink' => "../encounter/trend_form.php?formname=vitals&context=dashboard", 'linkMethod' => 'html', @@ -1584,7 +1591,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl($gfrow['title']), 'id' => $vitals_form_id, - 'initiallyCollapsed' => getUserSetting($vitals_form_id) == true ? true : false, + 'initiallyCollapsed' => (getUserSetting($vitals_form_id) == 0) ? true : false, 'btnLabel' => 'Trend', 'btnLink' => "../encounter/trend_form.php?formname=vitals&context=dashboard", 'linkMethod' => 'html', @@ -1638,7 +1645,7 @@ function filterActiveIssues(array $i): array 'id' => $card->getIdentifier() . "_expand", 'auth' => $auth, 'linkMethod' => 'html', - 'initiallyCollapsed' => !$card->isInitiallyCollapsed(), + 'initiallyCollapsed' => $card->isInitiallyCollapsed(), 'card_bg_color' => $card->getBackgroundColorClass(), 'card_text_color' => $card->getTextColorClass(), 'forceAlwaysOpen' => !$card->canCollapse(), @@ -1665,7 +1672,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl("ID Card / Photos"), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => 'Edit', 'linkMethod' => "javascript", 'bodyClass' => 'collapse show', @@ -1728,7 +1735,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl("Advance Directives"), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => 'Edit', 'linkMethod' => "javascript", 'btnLink' => "return advdirconfigure();", @@ -1754,7 +1761,7 @@ function filterActiveIssues(array $i): array $viewArgs = [ 'title' => xl("Clinical Reminders"), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => "Edit", 'btnLink' => "../reminder/clinical_reminders.php?patient_id=" . attr_url($pid), 'linkMethod' => "html", @@ -1931,7 +1938,7 @@ function filterActiveIssues(array $i): array echo $twig->getTwig()->render('patient/card/recall.html.twig', [ 'title' => xl('Recall'), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'recalls' => $recallArr, 'recallsAvailable' => ($count < 1 && empty($count2)) ? false : true, 'prependedInjection' => $dispatchResult->getPrependedInjection(), @@ -2019,7 +2026,7 @@ function filterActiveIssues(array $i): array echo $twig->getTwig()->render('patient/card/appointments.html.twig', [ 'title' => xl("Appointments"), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => "Add", 'btnLink' => "return newEvt()", 'linkMethod' => "javascript", @@ -2051,7 +2058,7 @@ function filterActiveIssues(array $i): array echo $twig->getTwig()->render('patient/card/loader.html.twig', [ 'title' => xl("Tracks"), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLink' => "../../forms/track_anything/create.php", 'linkMethod' => "html", 'prependedInjection' => $dispatchResult->getPrependedInjection(), diff --git a/interface/patient_file/summary/stats.php b/interface/patient_file/summary/stats.php index 429dc530588..48be4bddeed 100644 --- a/interface/patient_file/summary/stats.php +++ b/interface/patient_file/summary/stats.php @@ -166,7 +166,7 @@ function load_location(location) { $viewArgs = [ 'title' => xl('Current Medications'), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'auth' => false, 'rxList' => $rxArr, ]; @@ -201,7 +201,7 @@ function load_location(location) { $viewArgs = [ 'title' => xl($arr[0]), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'linkMethod' => "javascript", 'list' => $listData, 'auth' => AclMain::aclCheckIssue($key, '', ['write', 'addonly']) @@ -255,7 +255,7 @@ function load_location(location) { echo $t->render('patient/card/tp_il.html.twig', [ 'title' => xl("Injury Log"), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'formName' => $formname, 'formRows' => $formRows, ]); @@ -298,7 +298,7 @@ function load_location(location) { echo $t->render('patient/card/immunizations.html.twig', [ 'title' => xl('Immunizations'), 'id' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => 'Edit', 'btnLink' => 'immunizations.php', 'linkMethod' => 'html', @@ -325,7 +325,7 @@ function load_location(location) { $viewArgs = [ 'title' => xl('Old Medication'), 'label' => $id, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, 'btnLabel' => 'Edit', 'btnLink' => "return load_location(\"{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=medication\")", 'linkMethod' => 'javascript', diff --git a/templates/patient/card/card_base.html.twig b/templates/patient/card/card_base.html.twig index 188f9f835ca..a3f02334044 100644 --- a/templates/patient/card/card_base.html.twig +++ b/templates/patient/card/card_base.html.twig @@ -13,7 +13,7 @@ {% endif %} -
+
{% block content %}{% endblock %}