Skip to content

Commit

Permalink
fix: fix summary screen cards expand and collapse persistence (openem…
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymiller authored Sep 13, 2023
1 parent b284377 commit 28ccace
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 30 deletions.
55 changes: 31 additions & 24 deletions interface/patient_file/summary/demographics.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
];
Expand All @@ -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']),
];
Expand Down Expand Up @@ -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(),
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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'],
Expand All @@ -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'),
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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' => '',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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(),
Expand All @@ -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',
Expand Down Expand Up @@ -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();",
Expand All @@ -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",
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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(),
Expand Down
10 changes: 5 additions & 5 deletions interface/patient_file/summary/stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
Expand Down Expand Up @@ -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'])
Expand Down Expand Up @@ -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,
]);
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion templates/patient/card/card_base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</span>
{% endif %}
</h6>
<div id="{{ id|attr }}" class="card-text collapse{{ initiallyCollapsed|default(1) == 1 ? " show" : ""}}">
<div id="{{ id|attr }}" class="card-text collapse{{ initiallyCollapsed ? "" : " show"}}">
<div class="clearfix pt-2">
{% block content %}{% endblock %}
</div>
Expand Down

0 comments on commit 28ccace

Please sign in to comment.