couple more minor adjustment to prior commit
[openemr.git] / portal / home.php
blobd5ce380d5303e8ababa875344fd7bd10a1b4d2ed
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 (!isset($_SESSION['portal_init'])) {
28 $_SESSION['portal_init'] = true;
31 $whereto = 'profilepanel';
32 if (isset($_SESSION['whereto'])) {
33 $whereto = $_SESSION['whereto'];
36 $user = isset($_SESSION['sessionUser']) ? $_SESSION['sessionUser'] : 'portal user';
37 $result = getPatientData($pid);
39 $msgs = getPortalPatientNotes($_SESSION['portal_username']);
40 $msgcnt = count($msgs);
41 $newcnt = 0;
42 foreach ($msgs as $i) {
43 if ($i['message_status']=='New') {
44 $newcnt += 1;
48 require_once '_header.php';
49 echo "<script>var cpid='" . attr($pid) . "';var cuser='" . attr($user) . "';var webRoot='" . $GLOBALS['web_root'] . "';var ptName='" . attr($_SESSION['ptName']) . "';</script>";
51 <script type="text/javascript">
52 $(document).ready(function(){
53 $("#profilereport").load("./get_profile.php", { 'embeddedScreen' : true }, function() {
54 $( "table" ).addClass( "table table-responsive" );
55 $( ".demographics td" ).removeClass( "label" );
56 $( ".demographics td" ).addClass( "bold" );
57 $( ".insurance table" ).addClass( "table-sm table-striped" );
58 $("#editDems").click( function() {
59 showProfileModal()
60 });
61 });
62 $("#appointmentslist").load("./get_appointments.php", { 'embeddedScreen' : true }, function() {
63 $("#reports").load("./report/portal_patient_report.php?pid='<?php echo attr($pid) ?>'", { 'embeddedScreen' : true }, function() {
64 /* $("#payment").load("./portal_payment.php", { 'embeddedScreen' : true }, function() {
65 }); */
66 });
67 });
68 $("#medicationlist").load("./get_medications.php", { 'embeddedScreen' : true }, function() {
69 $("#allergylist").load("./get_allergies.php", { 'embeddedScreen' : true }, function() {
70 $("#problemslist").load("./get_problems.php", { 'embeddedScreen' : true }, function() {
71 $("#amendmentslist").load("./get_amendments.php", { 'embeddedScreen' : true }, function() {
72 $("#labresults").load("./get_lab_results.php", { 'embeddedScreen' : true }, function() {
74 });
75 });
76 });
77 });
78 });
80 $('.sigPad').signaturePad({ drawOnly: true });
81 $(".generateDoc_download").click( function() {
82 $("#doc_form").submit();
83 });
84 function showProfileModal(){
85 var title = '<?php echo xla('Demographics Legend Red: Charted Values. Blue: Patient Edits'); ?> ';
86 var params = {
87 buttons: [
88 { text: '<?php echo xla('Help'); ?>', close: false, style: 'info',id: 'formHelp'},
89 { text: '<?php echo xla('Cancel'); ?>', close: true, style: 'default'},
90 { text: '<?php echo xla('Revert Edits'); ?>', close: false, style: 'danger',id: 'replaceAllButton'},
91 { text: '<?php echo xla('Send for Review'); ?>', close: false, style: 'success', id: 'donePatientButton'}],
92 size: eModal.size.xl,
93 subtitle: '<?php echo xla('Changes take effect after provider review.'); ?>',
94 title: title,
95 useBin: false,
96 url: webRoot+'/portal/patient/patientdata?pid='+cpid+'&user='+cuser
98 return eModal.ajax(params)
99 .then(function () { });
101 function saveProfile(){
102 page.updateModel();
104 /* $(document.body).on('hidden.bs.modal', function (){
105 window.location.href = './home.php';
106 }); */
107 var gowhere = '#<?php echo $whereto?>';
108 $(gowhere).collapse('show');
110 var $doHides = $('#panelgroup');
111 $doHides.on('show.bs.collapse','.collapse', function() {
112 $doHides.find('.collapse.in').collapse('hide');
114 //Enable sidebar toggle
115 $("[data-toggle='offcanvas']").click(function(e) {
116 e.preventDefault();
117 //If window is small enough, enable sidebar push menu
118 if ($(window).width() <= 992) {
119 $('.row-offcanvas').toggleClass('active');
120 $('.left-side').removeClass("collapse-left");
121 $(".right-side").removeClass("strech");
122 $('.row-offcanvas').toggleClass("relative");
123 } else {
124 //Else, enable content streching
125 $('.left-side').toggleClass("collapse-left");
126 $(".right-side").toggleClass("strech");
129 $(function(){
130 $('#popwait').hide();
131 $('#callccda').click(function(){
132 $('#popwait').show();
136 </script>
137 <!-- Right side column. Contains content of the page -->
138 <aside class="right-side">
139 <!-- Main content -->
140 <section class="container-fluid content panel-group" id="panelgroup">
141 <div id="popwait" class="alert alert-warning" style="font-size:18px"><strong><?php echo xlt('Working!'); ?></strong> <?php echo xlt('Please wait...'); ?></div>
142 <div class="row collapse" id="lists">
143 <div class="col-sm-6">
144 <div class="panel panel-primary">
145 <header class="panel-heading"><?php echo xlt('Medications'); ?> </header>
146 <div id="medicationlist" class="panel-body"></div>
148 <div class="panel-footer"></div>
149 </div>
151 <div class="panel panel-primary">
152 <header class="panel-heading"><?php echo xlt('Medications Allergy List'); ?> </header>
153 <div id="allergylist" class="panel-body"></div>
155 <div class="panel-footer"></div>
156 </div>
157 </div><!-- /.col -->
158 <div class="col-sm-6">
159 <div class="panel panel-primary">
160 <header class="panel-heading"><?php echo xlt('Issues List'); ?></header>
161 <div id="problemslist" class="panel-body"></div>
163 <div class="panel-footer"></div>
164 </div>
165 <div class="panel panel-primary">
166 <header class="panel-heading"><?php echo xlt('Amendment List'); ?> </header>
167 <div id="amendmentslist" class="panel-body"></div>
169 <div class="panel-footer"></div>
170 </div>
171 </div><!-- /.col -->
172 <div class="col-sm-12">
173 <div class="panel panel-primary">
174 <header class="panel-heading"><?php echo xlt('Lab Results'); ?> </header>
175 <div id="labresults" class="panel-body"></div>
176 <div class="panel-footer"></div>
177 </div><!-- /.panel -->
178 </div><!-- /.col -->
180 </div><!-- /.lists -->
182 <div class="row">
183 <div class="col-sm-6">
184 <div class="panel panel-primary collapse" id="appointmentpanel">
185 <header class="panel-heading"><?php echo xlt('Appointments'); ?> </header>
186 <div id="appointmentslist" class="panel-body"></div>
187 <div class="panel-footer"></div>
188 </div><!-- /.panel -->
189 </div><!-- /.col -->
190 </div><!-- /.row -->
191 <div class="row">
192 <!--<div class="col-sm-12">
193 <div class="panel panel-primary collapse" id="paymentpanel">
194 <header class="panel-heading"> <?php echo xlt('Payments'); ?> </header>
195 <div id="payment" class="panel-body"></div>
196 <div class="panel-footer">
197 </div>
198 </div>
199 </div> /.col -->
200 </div>
201 <div class="row">
202 <div class="col-sm-12">
203 <div class="panel panel-primary collapse" style="padding-top:0;padding-bottom:0;" id="messagespanel">
204 <!-- <header class="panel-heading"><?php //echo xlt('Secure Chat'); ?> </header>-->
205 <div id="messages" class="panel-body" style="height:calc(100vh - 120px);overflow:auto;padding:0 0 0 0;" >
206 <iframe src="./messaging/secure_chat.php" width="100%" height="100%"></iframe><!-- -->
207 </div>
208 </div>
209 </div><!-- /.col -->
210 </div>
212 <div class="row">
213 <div class="col-sm-8">
214 <div class="panel panel-primary collapse" id="reportpanel">
215 <header class="panel-heading"><?php echo xlt('Reports'); ?> </header>
216 <div id="reports" class="panel-body"></div>
217 <div class="panel-footer"></div>
218 </div>
220 </div>
221 <!-- /.col -->
222 <div class="col-sm-6">
223 <div class="panel panel-primary collapse" id="downloadpanel">
224 <header class="panel-heading"> <?php echo xlt('Download Documents'); ?> </header>
225 <div id="docsdownload" class="panel-body">
226 <?php if ($GLOBALS['portal_onsite_document_download']) {
227 ?>// really should always be able to download!
228 <div>
229 <span class="text"><?php echo xlt('Download all patient documents');?></span>
230 <form name='doc_form' id='doc_form' action='./get_patient_documents.php' method='post'>
231 <input type="button" class="generateDoc_download" value="<?php echo xla('Download'); ?>" />
232 </form>
233 </div>
234 <?php } ?>
235 </div><!-- /.panel-body -->
236 <div class="panel-footer"></div>
237 </div>
238 </div><!-- /.col -->
239 </div>
241 <div class="row">
242 <div class="col-sm-12">
243 <div class="panel panel-primary collapse" id="ledgerpanel">
244 <header class="panel-heading"><?php echo xlt('Ledger');?> </header>
245 <div id="patledger" class="panel-body"></div>
246 <div class="panel-footer">
247 <iframe src="./report/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" width="100%" height="475" scrolling="yes"></iframe>
248 </div>
249 </div>
250 </div><!-- /.col -->
251 </div>
253 <div class="row">
254 <div class="col-sm-12">
255 <div class="panel panel-primary collapse" id="profilepanel">
256 <header class="panel-heading"><?php echo xlt('Profile'); ?>
257 <!-- <button type="button" id="editDems" class="btn btn-info btn-sm pull-right">Pop-up Edit</button>
258 <button type="button" id="editProfile" class="btn btn-info btn-sm pull-right">Pop-up iFrame</button> -->
259 </header>
260 <div id="profilereport" class="panel-body"></div>
261 <div class="panel-footer"></div>
262 </div>
263 </div>
264 </div>
266 </section>
267 <!-- /.content -->
268 <!--<div class="footer-main">Onsite Patient Portal Beta v3.0 Copyright &copy By sjpadgett@gmail.com, 2016 All Rights Reserved and Recorded</div>-->
269 </aside><!-- /.right-side -->
270 </div><!-- ./wrapper -->
271 <div id="openSignModal" class="modal fade" role="dialog">
272 <div class="modal-dialog modal-lg">
273 <div class="modal-content">
274 <div class="modal-header">
275 <button type="button" class="close" data-dismiss="modal">&times;</button>
276 <div class="input-group">
277 <span class="input-group-addon"
278 onclick="getSignature(document.getElementById('patientSignaturem'))"><em> <?php echo xlt('Show Current Signature On File');?><br>
279 <?php echo xlt('As appears on documents');?>.</em></span> <img
280 class="signature form-control" type="patient-signature"
281 id="patientSignaturem" onclick="getSignature(this)"
282 alt="Signature On File" src="">
283 <!-- <span class="input-group-addon" onclick="clearSig(this)"><i class="glyphicon glyphicon-trash"></i></span> -->
284 </div>
285 <!-- <h4 class="modal-title">Sign</h4> -->
286 </div>
287 <div class="modal-body">
288 <form name="signit" id="signit" class="sigPad">
289 <input type="hidden" name="name" id="name" class="name">
290 <ul class="sigNav">
291 <label style='display: none;'><input style='display: none;'
292 type="checkbox" class="" id="isAdmin" name="isAdmin" /><?php echo xlt('Is Authorizing Signature');?></label>
293 <li class="clearButton"><a href="#clear"><button><?php echo xlt('Clear Signature');?></button></a></li>
294 </ul>
295 <div class="sig sigWrapper">
296 <div class="typed"></div>
297 <canvas class="spad" id="drawpad" width="765" height="325"
298 style="border: 1px solid #000000; left: 0px;"></canvas>
299 <img id="loading"
300 style="display: none; position: absolute; TOP: 150px; LEFT: 315px; WIDTH: 100px; HEIGHT: 100px"
301 src="sign/assets/loading.gif" /> <input type="hidden" id="output"
302 name="output" class="output">
303 </div>
304 <input type="hidden" name="type" id="type"
305 value="patient-signature">
306 <button type="button" onclick="signDoc(this)"><?php echo xlt('Acknowledge as my Electronic Signature');?>.</button>
307 </form>
308 </div>
309 </div>
310 <!-- <div class="modal-footer">
311 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
312 </div> -->
313 </div>
314 </div><!-- Modal -->
315 <img id="waitend"
316 style="display: none; position: absolute; top: 100px; left: 260px; width: 100px; height: 100px"
317 src="sign/assets/loading.gif" />
320 </body>
321 </html>