PSR2 fixes
[openemr.git] / portal / home.php
blobfe8f412b249ccb8e5babde6076655b2d6c438a3c
1 <?php
2 /**
4 * Copyright (C) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
6 * LICENSE: This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * @package OpenEMR
20 * @author Jerry Padgett <sjpadgett@gmail.com>
21 * @link http://www.open-emr.org
23 require_once("verify_session.php");
24 require_once("$srcdir/patient.inc");
25 require_once("lib/portal_mail.inc");
27 if ($_SESSION['register'] == true) {
28 session_destroy();
29 header('Location: '.$landingpage.'&w');
30 exit();
33 if (!isset($_SESSION['portal_init'])) {
34 $_SESSION['portal_init'] = true;
37 $whereto = 'profilepanel';
38 if (isset($_SESSION['whereto'])) {
39 $whereto = $_SESSION['whereto'];
42 $user = isset($_SESSION['sessionUser']) ? $_SESSION['sessionUser'] : 'portal user';
43 $result = getPatientData($pid);
45 $msgs = getPortalPatientNotes($_SESSION['portal_username']);
46 $msgcnt = count($msgs);
47 $newcnt = 0;
48 foreach ($msgs as $i) {
49 if ($i['message_status']=='New') {
50 $newcnt += 1;
54 require_once '_header.php';
55 echo "<script>var cpid='" . attr($pid) . "';var cuser='" . attr($user) . "';var webRoot='" . $GLOBALS['web_root'] . "';var ptName='" . attr($_SESSION['ptName']) . "';</script>";
57 <script type="text/javascript">
58 $(document).ready(function(){
59 $("#profilereport").load("./get_profile.php", { 'embeddedScreen' : true }, function() {
60 $( "table" ).addClass( "table table-responsive" );
61 $( ".demographics td" ).removeClass( "label" );
62 $( ".demographics td" ).addClass( "bold" );
63 $( ".insurance table" ).addClass( "table-sm table-striped" );
64 $("#editDems").click( function() {
65 showProfileModal()
66 });
67 });
68 $("#appointmentslist").load("./get_appointments.php", { 'embeddedScreen' : true }, function() {
69 $("#reports").load("./report/portal_patient_report.php?pid='<?php echo attr($pid) ?>'", { 'embeddedScreen' : true }, function() {
70 <?php if ($GLOBALS['portal_two_payments']) { ?>
71 $("#payment").load("./portal_payment.php", { 'embeddedScreen' : true }, function() { });
72 <?php } ?>
73 });
74 });
75 $("#medicationlist").load("./get_medications.php", { 'embeddedScreen' : true }, function() {
76 $("#allergylist").load("./get_allergies.php", { 'embeddedScreen' : true }, function() {
77 $("#problemslist").load("./get_problems.php", { 'embeddedScreen' : true }, function() {
78 $("#amendmentslist").load("./get_amendments.php", { 'embeddedScreen' : true }, function() {
79 $("#labresults").load("./get_lab_results.php", { 'embeddedScreen' : true }, function() {
81 });
82 });
83 });
84 });
85 });
87 $('.sigPad').signaturePad({ drawOnly: true });
88 $(".generateDoc_download").click( function() {
89 $("#doc_form").submit();
90 });
91 function showProfileModal(){
92 var title = '<?php echo xla('Demographics Legend Red: Charted Values. Blue: Patient Edits'); ?> ';
93 var params = {
94 buttons: [
95 { text: '<?php echo xla('Help'); ?>', close: false, style: 'info',id: 'formHelp'},
96 { text: '<?php echo xla('Cancel'); ?>', close: true, style: 'default'},
97 { text: '<?php echo xla('Revert Edits'); ?>', close: false, style: 'danger',id: 'replaceAllButton'},
98 { text: '<?php echo xla('Send for Review'); ?>', close: false, style: 'success', id: 'donePatientButton'}],
99 size: eModal.size.xl,
100 subtitle: '<?php echo xla('Changes take effect after provider review.'); ?>',
101 title: title,
102 useBin: false,
103 url: webRoot+'/portal/patient/patientdata?pid='+cpid+'&user='+cuser
105 return eModal.ajax(params)
106 .then(function () { });
108 function saveProfile(){
109 page.updateModel();
111 /* $(document.body).on('hidden.bs.modal', function (){
112 window.location.href = './home.php';
113 }); */
114 var gowhere = '#<?php echo $whereto?>';
115 $(gowhere).collapse('show');
117 var $doHides = $('#panelgroup');
118 $doHides.on('show.bs.collapse','.collapse', function() {
119 $doHides.find('.collapse.in').collapse('hide');
121 //Enable sidebar toggle
122 $("[data-toggle='offcanvas']").click(function(e) {
123 e.preventDefault();
124 //If window is small enough, enable sidebar push menu
125 if ($(window).width() <= 992) {
126 $('.row-offcanvas').toggleClass('active');
127 $('.left-side').removeClass("collapse-left");
128 $(".right-side").removeClass("strech");
129 $('.row-offcanvas').toggleClass("relative");
130 } else {
131 //Else, enable content streching
132 $('.left-side').toggleClass("collapse-left");
133 $(".right-side").toggleClass("strech");
136 $(function(){
137 $('#popwait').hide();
138 $('#callccda').click(function(){
139 $('#popwait').show();
143 </script>
144 <!-- Right side column. Contains content of the page -->
145 <aside class="right-side">
146 <!-- Main content -->
147 <section class="container-fluid content panel-group" id="panelgroup">
148 <div id="popwait" class="alert alert-warning" style="font-size:18px"><strong><?php echo xlt('Working!'); ?></strong> <?php echo xlt('Please wait...'); ?></div>
149 <div class="row collapse" id="lists">
150 <div class="col-sm-6">
151 <div class="panel panel-primary">
152 <header class="panel-heading"><?php echo xlt('Medications'); ?> </header>
153 <div id="medicationlist" class="panel-body"></div>
155 <div class="panel-footer"></div>
156 </div>
158 <div class="panel panel-primary">
159 <header class="panel-heading"><?php echo xlt('Medications Allergy List'); ?> </header>
160 <div id="allergylist" class="panel-body"></div>
162 <div class="panel-footer"></div>
163 </div>
164 </div><!-- /.col -->
165 <div class="col-sm-6">
166 <div class="panel panel-primary">
167 <header class="panel-heading"><?php echo xlt('Issues List'); ?></header>
168 <div id="problemslist" class="panel-body"></div>
170 <div class="panel-footer"></div>
171 </div>
172 <div class="panel panel-primary">
173 <header class="panel-heading"><?php echo xlt('Amendment List'); ?> </header>
174 <div id="amendmentslist" class="panel-body"></div>
176 <div class="panel-footer"></div>
177 </div>
178 </div><!-- /.col -->
179 <div class="col-sm-12">
180 <div class="panel panel-primary">
181 <header class="panel-heading"><?php echo xlt('Lab Results'); ?> </header>
182 <div id="labresults" class="panel-body"></div>
183 <div class="panel-footer"></div>
184 </div><!-- /.panel -->
185 </div><!-- /.col -->
187 </div><!-- /.lists -->
189 <div class="row">
190 <div class="col-sm-6">
191 <div class="panel panel-primary collapse" id="appointmentpanel">
192 <header class="panel-heading"><?php echo xlt('Appointments'); ?> </header>
193 <div id="appointmentslist" class="panel-body"></div>
194 <div class="panel-footer"></div>
195 </div><!-- /.panel -->
196 </div><!-- /.col -->
197 </div><!-- /.row -->
198 <?php if ($GLOBALS['portal_two_payments']) { ?>
199 <div class="row">
200 <div class="col-sm-12">
201 <div class="panel panel-primary collapse" id="paymentpanel">
202 <header class="panel-heading"> <?php echo xlt('Payments'); ?> </header>
203 <div id="payment" class="panel-body"></div>
204 <div class="panel-footer">
205 </div>
206 </div>
207 </div> <!--/.col -->
208 </div>
209 <?php } ?>
210 <div class="row">
211 <div class="col-sm-12">
212 <div class="panel panel-primary collapse" style="padding-top:0;padding-bottom:0;" id="messagespanel">
213 <!-- <header class="panel-heading"><?php //echo xlt('Secure Chat'); ?> </header>-->
214 <div id="messages" class="panel-body" style="height:calc(100vh - 120px);overflow:auto;padding:0 0 0 0;" >
215 <iframe src="./messaging/secure_chat.php" width="100%" height="100%"></iframe><!-- -->
216 </div>
217 </div>
218 </div><!-- /.col -->
219 </div>
221 <div class="row">
222 <div class="col-sm-8">
223 <div class="panel panel-primary collapse" id="reportpanel">
224 <header class="panel-heading"><?php echo xlt('Reports'); ?> </header>
225 <div id="reports" class="panel-body"></div>
226 <div class="panel-footer"></div>
227 </div>
229 </div>
230 <!-- /.col -->
231 <div class="col-sm-6">
232 <div class="panel panel-primary collapse" id="downloadpanel">
233 <header class="panel-heading"> <?php echo xlt('Download Documents'); ?> </header>
234 <div id="docsdownload" class="panel-body">
235 <?php if ($GLOBALS['portal_onsite_document_download']) {
236 ?>// really should always be able to download!
237 <div>
238 <span class="text"><?php echo xlt('Download all patient documents');?></span>
239 <form name='doc_form' id='doc_form' action='./get_patient_documents.php' method='post'>
240 <input type="button" class="generateDoc_download" value="<?php echo xla('Download'); ?>" />
241 </form>
242 </div>
243 <?php } ?>
244 </div><!-- /.panel-body -->
245 <div class="panel-footer"></div>
246 </div>
247 </div><!-- /.col -->
248 </div>
250 <div class="row">
251 <div class="col-sm-12">
252 <div class="panel panel-primary collapse" id="ledgerpanel">
253 <header class="panel-heading"><?php echo xlt('Ledger');?> </header>
254 <div id="patledger" class="panel-body"></div>
255 <div class="panel-footer">
256 <iframe src="./report/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" width="100%" height="475" scrolling="yes"></iframe>
257 </div>
258 </div>
259 </div><!-- /.col -->
260 </div>
262 <div class="row">
263 <div class="col-sm-12">
264 <div class="panel panel-primary collapse" id="profilepanel">
265 <header class="panel-heading"><?php echo xlt('Profile'); ?>
266 <!-- <button type="button" id="editDems" class="btn btn-info btn-sm pull-right">Pop-up Edit</button>
267 <button type="button" id="editProfile" class="btn btn-info btn-sm pull-right">Pop-up iFrame</button> -->
268 </header>
269 <div id="profilereport" class="panel-body"></div>
270 <div class="panel-footer"></div>
271 </div>
272 </div>
273 </div>
275 </section>
276 <!-- /.content -->
277 <!--<div class="footer-main">Onsite Patient Portal Beta v3.0 Copyright &copy By sjpadgett@gmail.com, 2016 All Rights Reserved and Recorded</div>-->
278 </aside><!-- /.right-side -->
279 </div><!-- ./wrapper -->
280 <div id="openSignModal" class="modal fade" role="dialog">
281 <div class="modal-dialog modal-lg">
282 <div class="modal-content">
283 <div class="modal-header">
284 <button type="button" class="close" data-dismiss="modal">&times;</button>
285 <div class="input-group">
286 <span class="input-group-addon"
287 onclick="getSignature(document.getElementById('patientSignaturem'))"><em> <?php echo xlt('Show Current Signature On File');?><br>
288 <?php echo xlt('As appears on documents');?>.</em></span> <img
289 class="signature form-control" type="patient-signature"
290 id="patientSignaturem" onclick="getSignature(this)"
291 alt="Signature On File" src="">
292 <!-- <span class="input-group-addon" onclick="clearSig(this)"><i class="glyphicon glyphicon-trash"></i></span> -->
293 </div>
294 <!-- <h4 class="modal-title">Sign</h4> -->
295 </div>
296 <div class="modal-body">
297 <form name="signit" id="signit" class="sigPad">
298 <input type="hidden" name="name" id="name" class="name">
299 <ul class="sigNav">
300 <label style='display: none;'><input style='display: none;'
301 type="checkbox" class="" id="isAdmin" name="isAdmin" /><?php echo xlt('Is Authorizing Signature');?></label>
302 <li class="clearButton"><a href="#clear"><button><?php echo xlt('Clear Signature');?></button></a></li>
303 </ul>
304 <div class="sig sigWrapper">
305 <div class="typed"></div>
306 <canvas class="spad" id="drawpad" width="765" height="325"
307 style="border: 1px solid #000000; left: 0px;"></canvas>
308 <img id="loading"
309 style="display: none; position: absolute; TOP: 150px; LEFT: 315px; WIDTH: 100px; HEIGHT: 100px"
310 src="sign/assets/loading.gif" /> <input type="hidden" id="output"
311 name="output" class="output">
312 </div>
313 <input type="hidden" name="type" id="type"
314 value="patient-signature">
315 <button type="button" onclick="signDoc(this)"><?php echo xlt('Acknowledge as my Electronic Signature');?>.</button>
316 </form>
317 </div>
318 </div>
319 <!-- <div class="modal-footer">
320 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
321 </div> -->
322 </div>
323 </div><!-- Modal -->
324 <img id="waitend"
325 style="display: none; position: absolute; top: 100px; left: 260px; width: 100px; height: 100px"
326 src="sign/assets/loading.gif" />
329 </body>
330 </html>