added ability to see multiple eligibilities if (#6779)
[openemr.git] / portal / quickstart_page.php
blob26549d8499d4cba40caf980efab6bb65a4cc1c1e
1 <?php
3 /**
4 * Patient Portal QuickStart
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Jerry Padgett <sjpadgett@gmail.com>
9 * @copyright Copyright (c) 2023 Jerry Padgett <sjpadgett@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("verify_session.php");
15 $title = xlt("My Quickstarts");
17 $current_theme = sqlQuery("SELECT `setting_value` FROM `patient_settings` WHERE setting_patient = ? AND `setting_label` = ?", array($pid, 'portal_theme'))['setting_value'] ?? '';
19 use OpenEMR\Common\Csrf\CsrfUtils;
20 use OpenEMR\Core\Header;
23 <!DOCTYPE html>
24 <!-- Language grabbed by PDF var that has the correct format !-->
25 <html lang="<?php echo $GLOBALS['pdf_language']; ?>">
26 <head>
27 <title><?php echo($title); ?></title>
28 <meta name="description" content="Patient Portal" />
29 <meta name="author" content="Dashboard | sjpadgett@gmail.com" />
30 <?php
31 Header::setupHeader(['no_main-theme', 'portal-theme', 'datetime-picker']);
32 echo "<script>var cpid='" . attr($cpid ?? $pid) . "';var cuser='" . attr($cuser ?? 'portal-user') . "';var webRoot='" . $GLOBALS['web_root'] . "';</script>";
34 <link href="<?php echo $GLOBALS['web_root']; ?>/portal/sign/css/signer_modal.css?v=<?php echo $GLOBALS['v_js_includes']; ?>" rel="stylesheet">
35 <script src="<?php echo $GLOBALS['web_root']; ?>/portal/sign/assets/signature_pad.umd.js?v=<?php echo $GLOBALS['v_js_includes']; ?>"></script>
36 <script src="<?php echo $GLOBALS['web_root']; ?>/portal/sign/assets/signer_api.js?v=<?php echo $GLOBALS['v_js_includes']; ?>"></script>
38 <script>
39 $(function () {
40 let ele = parent.document.getElementById('topNav');
41 if ($(parent.document.getElementById('topNav')).is('.collapse:not(.show)')) {
42 ele.classList.toggle('collapse');
44 // ensure top level shows in quickstart
45 $(parent.document.getElementById('topNav')).removeClass("d-none");
46 $("#my_theme").on('change', function (e) {
47 let sel = $("#my_theme :selected").val();
48 persistPatientSetting(cpid, 'portal_theme', sel);
49 $(parent.document.getElementById('homeRefresh')).click();
50 });
51 });
53 function persistPatientSetting(pid, label, setting) {
54 fetch('lib/persist.php', {
55 method: 'POST',
56 headers: {
57 'Content-Type': 'application/json'
59 body: JSON.stringify(
61 'csrf_token_form': <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>,
62 'setting_patient': pid,
63 'setting_label': label,
64 'setting_value': setting
66 });
68 </script>
69 </head>
70 <body class="pt-2">
71 <!-- About Dialog -->
72 <div class="modal fade" id="formdialog" tabindex="-1" role="dialog" aria-hidden="true">
73 <div class="modal-dialog bg-light">
74 <div class="modal-content">
75 <div class="modal-header">
76 <h4 class="modal-title"><?php echo xlt('About Portal Dashboard') ?></h4>
77 <button type="button" class="close" data-dismiss="modal">&times;</button>
78 </div>
79 <div class="modal-body">
80 <div>
81 <span><?php echo xlt('Please see forum or wiki'); ?>
82 <a href="<?php echo attr('https://community.open-emr.org/'); ?>" target="_blank"><?php echo xlt("Visit Forum"); ?></a>
83 </span>
84 </div>
85 </div>
86 <div class="modal-footer">
87 <button id="okButton" data-dismiss="modal" class="btn btn-secondary"><?php echo xlt('Close...') ?></button>
88 </div>
89 </div>
90 </div>
91 </div>
92 <div class="container-xl p-3">
93 <div class="jumbotron jumbotron-fluid text-center p-1">
94 <h3><?php echo xlt('My Quick Starts') ?><i class="fa fa-user text-danger ml-2" style="font-size: 3rem;"></i></h3>
95 <p>
96 <button class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#formdialog"><?php echo xlt('Tell me more') ?></button>
97 </p>
98 </div>
99 <div class='jumbotron jumbotron-fluid p-4'>
100 <div class="row" id="inject_card">
101 <!-- Document -->
102 <div class="card d-flex mr-1 mb-1">
103 <div class="card-body">
104 <h4 class="card-title"><i class="fa fa-file-text mr-1"></i><?php echo xlt('My Documents') ?></h4>
105 <a class="btn btn-success" href="<?php echo $GLOBALS['web_root']; ?>/portal/patient/onsitedocuments?pid=<?php echo attr_url($pid); ?>"><?php echo xlt('Manage Documents') ?></a>
106 </div>
107 </div>
108 <!-- Signature -->
109 <div class="card d-flex mr-1 mb-1">
110 <div class="card-body">
111 <h4><i class="card-title fa fa-signature mr-1"></i><?php echo xlt('Signature') ?></h4>
112 <a data-type="patient-signature" class="btn btn-primary" href="#openSignModal" data-toggle="modal" data-backdrop="true" data-target="#openSignModal"><?php echo xlt('Manage Signature'); ?></a>
113 </div>
114 </div>
115 <!-- Theme -->
116 <div class="card d-flex mr-1 mb-1">
117 <div class="card-body row">
118 <h4 class="card-title"><i class="fa fa-link mr-1"></i><?php echo xlt('Settings') ?></h4>
119 <div class="col-12 form-group">
120 <div class="col">
121 <div class="input-group">
122 <label class="m-0" for='my_theme'><?php echo xlt('Current Theme') ?></label>
123 <select class='form-control ml-2' id='my_theme'>
124 <?php
125 $theme_dir = "$webserver_root/public/themes";
126 $fld_type = 'css';
127 $patternStyle = 'style_';
128 $dh = opendir($theme_dir);
129 if ($dh) {
130 // Collect styles
131 $styleArray = array();
132 while (false !== ($tfname = readdir($dh))) {
133 $patternStyle = 'style_';
134 if (
135 $tfname == 'style_blue.css' ||
136 $tfname == 'style_pdf.css' ||
137 !preg_match("/^" . $patternStyle . ".*\.css$/", $tfname)
139 continue;
141 $styleDisplayName = str_replace("_", " ", substr($tfname, 6));
142 $styleDisplayName = ucfirst(str_replace(".css", "", $styleDisplayName));
143 $styleArray[$tfname] = $styleDisplayName;
145 asort($styleArray);
146 // Generate style selector
147 foreach ($styleArray as $styleKey => $styleValue) {
148 echo "<option value='" . attr($styleKey) . "'";
149 if ($styleKey == $current_theme) {
150 echo " selected";
152 echo ">";
153 echo text($styleValue);
154 echo "</option>\n";
157 closedir($dh);
159 </select>
160 <div class="input-group-append">
161 <a class="btn btn-primary" href="./home.php" target="_parent"><?php echo xlt('Apply') ?></a>
162 </div>
163 </div>
164 </div>
165 <div class="col">
166 <div class="form-group form-check">
167 <input type="checkbox" class="form-check-input" id="exampleCheck1">
168 <label class="form-check-label" for="exampleCheck1"><?php echo xlt('Auto Save Documents') . " (Coming soon)" ?></label>
169 </div>
170 </div>
171 </div>
172 </div>
173 </div>
174 </div>
175 </div>
176 </body>
177 </html>