some portal work
[openemr.git] / portal / messaging / messages.php
blobbbad7c458663104fcc3882b87dbccae2fa4f3f41
1 <?php
2 /**
3 * messages.php
5 * @package OpenEMR
6 * @link https://www.open-emr.org
7 * @author Jerry Padgett <sjpadgett@gmail.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
10 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 // Will start the (patient) portal OpenEMR session/cookie.
15 require_once(dirname(__FILE__) . "/../../src/Common/Session/SessionUtil.php");
16 OpenEMR\Common\Session\SessionUtil::portalSessionStart();
18 if (isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite_two'])) {
19 $_SESSION['whereto'] = 'profilecard';
20 $pid = $_SESSION['pid'];
21 $ignoreAuth = true;
22 require_once(dirname(__FILE__) . "/../../interface/globals.php");
23 define('IS_DASHBOARD', false);
24 define('IS_PORTAL', $_SESSION['portal_username']);
25 } else {
26 OpenEMR\Common\Session\SessionUtil::portalSessionCookieDestroy();
27 $ignoreAuth = false;
28 require_once(dirname(__FILE__) . "/../../interface/globals.php");
29 if (! isset($_SESSION['authUserID'])) {
30 $landingpage = "index.php";
31 header('Location: ' . $landingpage);
32 exit();
35 define('IS_DASHBOARD', $_SESSION['authUser']);
36 define('IS_PORTAL', false);
39 require_once("$srcdir/acl.inc");
40 require_once("$srcdir/patient.inc");
41 require_once("$srcdir/options.inc.php");
42 require_once("$srcdir/classes/Document.class.php");
43 require_once("./../lib/portal_mail.inc");
45 use OpenEMR\Core\Header;
47 $docid = empty($_REQUEST['docid']) ? 0 : intval($_REQUEST['docid']);
48 $orderid = empty($_REQUEST['orderid']) ? 0 : intval($_REQUEST['orderid']);
50 $result = getMails(IS_DASHBOARD ? IS_DASHBOARD : IS_PORTAL, 'inbox', '', '');
51 $theresult = array();
52 foreach ($result as $iter) {
53 $theresult[] = $iter;
56 $dashuser = array();
57 if (IS_DASHBOARD) {
58 $dashuser = getUserIDInfo($_SESSION['authUserID']);
61 function getAuthPortalUsers()
63 $resultpd = $resultusers = $resultpatients = array();
64 if (IS_DASHBOARD) { // admin can mail anyone
65 $authusers = sqlStatement("SELECT users.username as userid,
66 CONCAT(users.fname,' ',users.lname) as username, 'user' as type FROM users WHERE authorized = 1");
67 while ($row = sqlFetchArray($authusers)) {
68 $resultusers[] = $row;
71 $authpatients = sqlStatement("SELECT LOWER(CONCAT(patient_data.fname, patient_data.id)) as userid,
72 CONCAT(patient_data.fname,' ',patient_data.lname) as username,'p' as type,patient_data.pid as pid FROM patient_data WHERE allow_patient_portal = 'YES'");
73 while ($row = sqlFetchArray($authpatients)) {
74 $resultpatients[] = $row;
77 $resultpd[] = array_merge($resultusers, $resultpatients);
78 return $resultpd[0];
79 } else {
80 $resultpd = array();
81 $authusers = sqlStatement("SELECT users.username as userid, CONCAT(users.fname,' ',users.lname) as username FROM users WHERE authorized = 1");
82 while ($row = sqlFetchArray($authusers)) {
83 $resultpd[] = $row;
87 return $resultpd;
90 <!DOCTYPE html>
91 <html lang="en">
92 <head>
93 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
94 <meta charset="utf-8">
95 <title><?php echo xlt("Secure Messaging"); ?></title>
96 <meta name="viewport"
97 content="width=device-width, initial-scale=1, maximum-scale=1">
98 <meta name="description" content="Mail Application" />
100 <?php Header::setupHeader(['no_main-theme', 'summernote', 'fontawesome', 'angular', 'angular-summernote', 'angular-sanitize', 'checklist-model']); ?>
102 </head>
103 <body class="skin-blue">
104 <!-- style='background:#f1f2f7;' -->
105 <script>
106 (function() {
107 var app = angular.module("emrMessageApp",['ngSanitize','summernote',"checklist-model"]);
108 app.controller('inboxCtrl', ['$scope', '$filter','$http','$window', function ($scope, $filter,$http,$window) {
109 $scope.date = new Date;
110 $scope.sortingOrder = 'id';
111 $scope.pageSizes = [5,10,20,50,100];
112 $scope.reverse = false;
113 $scope.filteredItems = [];
114 $scope.groupedItems = [];
115 $scope.itemsPerPage = 8;
116 $scope.pagedItems = [];
117 $scope.compose = [];
118 $scope.selrecip = [];
119 $scope.currentPage = 0;
120 $scope.sentItems = [];
121 $scope.allItems = [];
122 $scope.deletedItems = [];
123 $scope.inboxItems = [];
124 $scope.inboxItems = <?php echo json_encode($theresult);?>;
125 $scope.userproper = <?php echo $_SESSION['ptName'] ? js_escape($_SESSION['ptName']) : js_escape($dashuser['fname'] . ' ' . $dashuser['lname']) ;?>;
126 $scope.isPortal = "<?php echo IS_PORTAL;?>" ;
127 $scope.isDashboard = "<?php echo IS_DASHBOARD ? IS_DASHBOARD : 0;?>" ;
128 $scope.cUserId = $scope.isPortal ? $scope.isPortal : $scope.isDashboard;
129 $scope.authrecips = <?php echo json_encode(getAuthPortalUsers());?>;
130 $scope.compose.task = 'add';
131 $scope.xLate = [];
132 $scope.xLate.confirm = [];
133 $scope.xLate.fwd = <?php echo xlj('Forwarded Portal Message Re: '); ?>;
134 $scope.xLate.confirm.one = <?php echo xlj('Confirm to Delete Current Thread?'); ?>;
135 $scope.xLate.confirm.all = <?php echo xlj('Confirm to Delete Selected?'); ?>;
136 $scope.xLate.confirm.err = <?php echo xlj('You are sending to yourself!'); ?>; // I think I got rid of this ability - look into..
138 $scope.init = function () {
139 $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
140 $scope.getSentMessages();
141 $scope.getAllMessages();
142 $scope.getDeletedMessages();
143 $scope.isInboxSelected();
144 $scope.search();
145 $scope.isInit = true;
146 $('#main').show();
149 var searchMatch = function (haystack, needle) {
150 if (!needle) {
151 return true;
153 return haystack.toLowerCase().indexOf(needle.toLowerCase()) !== -1;
156 // filter the items
157 $scope.search = function () {
158 $scope.filteredItems = $filter('filter')($scope.items, function (item) {
159 for(var attr in item) {
160 if (searchMatch(item[attr], $scope.query))
161 return true;
163 return false;
165 $scope.currentPage = 0;
166 // now group by pages
167 $scope.groupToPages();
170 // calculate page in place
171 $scope.groupToPages = function () {
172 $scope.selected = null;
173 $scope.pagedItems = [];
174 for (var i = 0; i < $scope.filteredItems.length; i++) {
175 if (i % $scope.itemsPerPage === 0) {
176 $scope.pagedItems[Math.floor(i / $scope.itemsPerPage)] = [ $scope.filteredItems[i] ];
177 } else {
178 $scope.pagedItems[Math.floor(i / $scope.itemsPerPage)].push($scope.filteredItems[i]);
183 $scope.range = function (start, end) {
184 var ret = [];
185 if (!end) {
186 end = start;
187 start = 0;
189 for (var i = start; i < end; i++) {
190 ret.push(i);
192 return ret;
195 $scope.prevPage = function () {
196 if ($scope.currentPage > 0) {
197 $scope.currentPage--;
199 return false;
202 $scope.nextPage = function () {
203 if ($scope.currentPage < $scope.pagedItems.length - 1) {
204 $scope.currentPage++;
206 return false;
209 $scope.setPage = function () {
210 $scope.currentPage = this.n;
213 $scope.deleteItem = function (idx) {
214 if( !confirm($scope.xLate.confirm.one) ) return false;
215 var itemToDelete = $scope.allItems[idx];
216 var idxInItems = $scope.items.indexOf(itemToDelete);
217 $scope.deleteMessage(itemToDelete.mail_chain); // Just this user's message
218 $scope.items.splice(idxInItems,1);
219 $scope.search();
220 $scope.init()
221 return false;
224 $scope.batchDelete = function ( i ) {
225 if( !confirm($scope.xLate.confirm.all) ) return false;
226 var itemToDelete = [];
227 angular.forEach(i, function(o, key) {
228 if(o.hasOwnProperty('deleted')){
229 itemToDelete.push($scope.items[i.indexOf(o)].id);
232 $http.post('handle_note.php', $.param({'task':'massdelete','notejson':JSON.stringify(itemToDelete)}))
233 .then(function successCallback(response) {
234 $window.location.reload();
235 }, function errorCallback(response) {
236 alert(response.data);
238 return false;
241 $scope.deleteMessage = function (id){
242 $http.post('handle_note.php', $.param( {'task':'delete','noteid':id} ))
243 .then(function successCallback(response) {
244 return true;
245 }, function errorCallback(response) {
246 alert(response.data);
251 $scope.isMessageSelected = function () {
252 if (typeof $scope.selected!=="undefined" && $scope.selected!==null) {
253 return true;
255 else {
256 return false;
260 $scope.isSentSelected = function () {
261 $scope.isSent = true;
262 $scope.isTrash = $scope.isAll = $scope.isInbox = false;
263 $scope.items = [];
264 $scope.items = $scope.sentItems;
265 $scope.search();
266 return true;
269 $scope.isTrashSelected = function () {
270 $scope.isTrash = true;
271 $scope.isSent = $scope.isAll = $scope.isInbox = false;
272 $scope.items = [];
273 $scope.items = $scope.deletedItems;
274 $scope.search();
275 return true;
278 $scope.isInboxSelected = function () {
279 $scope.isInbox = true;
280 $scope.isTrash = $scope.isAll = $scope.isSent = false;
281 $scope.items = $scope.inboxItems;
282 $scope.search();
283 return true;
286 $scope.isAllSelected = function () {
287 $scope.isAll = true; $scope.isTrash = $scope.isSent = $scope.isInbox = false;
288 $scope.items = $scope.allItems;
289 $scope.search();
290 return true;
293 $scope.readMessage = function (idx) {
294 if( $scope.items[idx].message_status == 'New'){ // mark mail read else ignore
295 $http.post('handle_note.php', $.param({'task':'setread','noteid':$scope.items[idx].id}))
296 .then(function successCallback(response) {
297 $scope.items[idx].message_status = 'Read';
298 $scope.selected.message_status = 'Read';
299 }, function errorCallback(response) {
300 alert(response.data);
303 idx = $filter('getById')($scope.allItems,this.item.id);
304 $scope.isAll = true; $scope.isTrash = $scope.isSent = $scope.isInbox = false;
305 $scope.items = $scope.allItems;
306 $scope.selected = $scope.items[idx];
308 $scope.selMessage = function (idx) {
309 $scope.selected = $scope.allItems[idx];
313 $scope.readAll = function () {
314 for (var i in $scope.items) {
315 $scope.items[i].message_status = 'Read';
319 $scope.closeMessage = function () {
320 $scope.selected = null;
323 $scope.renderMessageBody = function(html)
325 return html;
328 $scope.getInbox = function () {
329 $http.post('handle_note.php', $.param({'task':'getinbox','owner':$scope.cUserId}))
330 .then(function successCallback(response) {
331 if(response.data){
332 $scope.inboxItems = angular.copy(response.data);
334 else alert(response.data);
335 }, function errorCallback(response) {
336 alert(response.data);
340 $scope.getAllMessages = function () {
341 $http.post('handle_note.php', $.param({'task':'getall','owner':$scope.cUserId}))
342 .then(function successCallback(response) {
343 if(response.data){
344 $scope.allItems = angular.copy(response.data);
346 else alert(response.data);
347 }, function errorCallback(response) {
348 alert(response.data);
352 $scope.getDeletedMessages = function () {
353 $http.post('handle_note.php', $.param({'task':'getdeleted','owner':$scope.cUserId}))
354 .then(function successCallback(response) {
355 if(response.data){
356 $scope.deletedItems = [];
357 $scope.deletedItems = angular.copy(response.data);
359 else alert(response.data);
360 }, function errorCallback(response) {
361 alert(response.data);
365 $scope.getSentMessages = function () {
366 $http.post('handle_note.php', $.param({'task':'getsent','owner':$scope.cUserId}))
367 .then(function successCallback(response) {
368 $scope.sentItems = [];
369 $scope.sentItems = angular.copy(response.data);
370 }, function errorCallback(response) {
371 alert(response.data);
375 $scope.submitForm = function(compose){
376 $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
377 // re-enable title for submit
378 $("#title").prop( "disabled", false );
379 $("#selSendto").prop( "disabled", false );
381 compose.owner = $scope.cUserId;
382 compose.sender_id=$scope.cUserId;
383 compose.sender_name=$scope.userproper;
384 if( $scope.selrecip == compose.owner ){
385 if(!confirm($scope.xLate.confirm.err))
386 return false;
388 if( compose.task == 'add' ){
389 compose.recipient_name=$("#selSendto option:selected").text();
391 if( compose.task == 'forward' ){ // Just overwrite default reply but send to pnotes.
392 compose.sender_id=$("#selForwardto option:selected").val();
393 compose.sender_name=$("#selForwardto option:selected").text();
394 compose.selrecip = compose.recipient_id;
396 else{
397 compose.inputBody = $("#inputBody").summernote('code');
399 return true; // okay to submit
402 $('#modalCompose').on('show.bs.modal', function(e) {
403 // Sets up the compose modal before we show it
404 $scope.compose = [];
405 $('#inputBody').summernote('destroy');
406 var mode = $(e.relatedTarget).attr('data-mode');
407 $scope.compose.task = mode;
408 if(mode == 'forward'){
409 $('#modalCompose .modal-header .modal-title').html("Forward Message");
410 $scope.compose.task = mode;
411 var recipId = $(e.relatedTarget).attr('data-whoto');
412 var title = $(e.relatedTarget).attr('data-mtitle');
413 var uname = $(e.relatedTarget).attr('data-username');
414 $(e.currentTarget).find('select[id="selSendto"]').prop( "disabled", false );
415 $(e.currentTarget).find('input[name="title"]').prop( "disabled", false );
416 $scope.compose.title = title;
417 $scope.compose.selrecip = recipId;
418 $scope.compose.selrecip.username = uname;
419 $scope.compose.recipient_name = uname;
420 $scope.compose.recipient_id = recipId;
421 angular.forEach($scope.authrecips, function(o, key) {// Need the pid of patient for pnotes.
422 if(o.userid == recipId){
423 $scope.compose.pid = o.pid;
426 var fmsg = '\n\n\n> ' + $scope.xLate.fwd+ title + ' by ' + uname + '\n> '+ $("#referMsg").text();
427 $("textarea#finputBody").text(fmsg)
428 $scope.compose.noteid = $(e.relatedTarget).attr('data-noteid');
430 else if(mode == 'reply'){
431 $('#inputBody').summernote({focus:true,height:'225px'});
432 $('#modalCompose .modal-header .modal-title').html("Compose Reply Message");
433 $scope.compose.task = mode;
434 //get data attributes of the clicked element (selected recipient) for replies only
435 var chain = $(e.relatedTarget).attr('data-mailchain');
436 if(chain == '0') chain = $(e.relatedTarget).attr('data-noteid');
437 var recipId = $(e.relatedTarget).attr('data-whoto');
438 var title = $(e.relatedTarget).attr('data-mtitle');
439 var uname = $(e.relatedTarget).attr('data-username');
440 $(e.currentTarget).find('select[id="selSendto"]').val(recipId)
441 $(e.currentTarget).find('input[name="title"]').val(title);
442 // Set the modal var's
443 $scope.compose.title = title;
444 $scope.compose.selrecip = recipId;
445 $scope.compose.selrecip.username = uname;
446 $scope.compose.recipient_name = uname;
447 $scope.compose.recipient_id = recipId;
448 $scope.compose.noteid = chain;
450 else{
451 $('#inputBody').summernote({focus:true,height:'225px'});
452 $('#modalCompose .modal-header .modal-title').html("Compose New Message");
453 $scope.compose.task = 'add';
454 $(e.currentTarget).find('select[id="selSendto"]').prop( "disabled", false );
455 $(e.currentTarget).find('input[name="title"]').prop( "disabled", false );
457 if($scope.compose.task != 'reply'){
458 $scope.$apply();
460 }); // on modal
461 $('#modalCompose').on('shown.bs.modal', function(e) {
462 // may yet need
464 $('#modalCompose').on('hidden.bs.modal', function(e){
465 // cleanup
467 // initialize application
468 if( !$scope.isInit ){
469 $scope.init();
471 }]) /* end inbox functions */
472 .filter('Chained', function () {
473 return function (input, id) {
474 var output = [];
475 if (isNaN(id)) {
476 output = input;
478 else {
479 angular.forEach(input, function (item) {
480 if (item.mail_chain == id) {
481 output.push(item)
485 return output;
488 .filter('getById', function() {
489 return function(input, id) {
490 var i=0, len=input.length;
491 for (; i<len; i++) {
492 if (+input[i].id == +id) {
493 return i;
496 return null;
499 .controller('messageCtrl', ['$scope', function ($scope) {
500 $scope.message = function(idx) {
501 return items(idx);
504 }]); // end messageCtrl
506 })(); // application end
507 </script>
508 <ng ng-app="emrMessageApp">
509 <div class="container" id='main' style="display: none">
510 <div class='header logo'>
511 <h2>
512 <i style='width: auto; height: auto;' class='fa fa-envelope'></i> <?php echo xlt('Patient Secure Mail'); ?></h2>
513 </div>
514 <div class="row" ng-controller="inboxCtrl">
515 <div class="col-md-1" style='padding: 0 0; margin: 0 0; text-align: left;'>
516 <ul class="nav nav-pills flex-column">
517 <li class="nav-item"><a class="nav-link active" href="javascript:;" ng-click="isInboxSelected()"><span class="badge float-right">{{inboxItems.length}}</span><?php echo xlt('Inbox'); ?></a></li>
518 <li class="nav-item"><a class="nav-link" href="javascript:;" ng-click="isSentSelected()"><span class="badge float-right">{{sentItems.length}}</span><?php echo xlt('Sent{{Mails}}'); ?></a></li>
519 <li class="nav-item"><a class="nav-link" href="javascript:;" ng-click="isAllSelected()"><span class="badge float-right">{{allItems.length}}</span><?php echo xlt('All{{Mails}}'); ?></a></li>
520 <!-- <li class="bg-info"><a href="#"><span class="badge float-right">0</span><?php //echo xlt('Drafts'); ?></a></li> -->
521 <li class="nav-item"><a class="nav-link" href="javascript:;" ng-click="isTrashSelected()"><span class="badge float-right">{{deletedItems.length}}</span><?php echo xlt('Archive'); ?></a></li>
522 <li class="nav-item"><a class="nav-link bg-danger" href="<?php echo $GLOBALS['web_root']?>/portal/patient/provider" ng-show="!isPortal"><?php echo xlt('Exit Mail'); ?></a></li>
523 <li class="nav-item"><a class="nav-link bg-danger" href="javascript:;" onclick='window.location.replace("<?php echo $GLOBALS['web_root']?>/portal/home.php")' ng-show="isPortal"><?php echo xlt('Exit'); ?></a></li>
524 </ul>
525 </div>
526 <div class="col-md-11">
527 <!--inbox toolbar-->
528 <div class="row" ng-show="!isMessageSelected()">
529 <div class="col-12">
530 <a class="btn btn-secondary btn-lg" data-toggle="tooltip"
531 title="Refresh" id="refreshInbox" href="javascript:;"
532 onclick='window.location.replace("./messages.php")'> <span
533 class="fa fa-refresh fa-lg"></span>
534 </a>
535 <button class="btn btn-secondary btn-lg"
536 title="<?php echo xla("New Note"); ?>" data-mode="add"
537 data-toggle="modal" data-target="#modalCompose">
538 <span class="fa fa-edit fa-lg"></span>
539 </button>
540 <div class="btn-group btn-group float-right">
541 <button type="button" class="btn btn-primary dropdown-toggle"
542 data-toggle="dropdown">
543 <?php echo xlt('Actions'); ?> <span class="caret"></span>
544 </button>
545 <ul class="dropdown-menu" role="menu">
546 <li><a href="javascript:;" ng-click="readAll()"><?php echo xlt('Mark all as read'); ?></a></li>
547 <li class="divider"></li>
548 <li><a href="" data-mode="add" data-toggle="modal"
549 data-target="#modalCompose"><?php echo xlt('Compose new'); ?></a></li>
550 <li ng-show='!isTrash'><a href="javascript:;"
551 ng-click="batchDelete(items)"><i class="fa fa-trash-o"></i> <?php echo xlt('Send Selected to Archive'); ?></a></li>
552 <li><a href="javascript:;"
553 onclick='window.location.replace("<?php echo $GLOBALS['web_root']?>/portal/home.php")'
554 ng-show="isPortal" class="text-muted"><?php echo xlt('Return Home'); ?></a></li>
555 <li><a
556 href="<?php echo $GLOBALS['web_root']?>/portal/patient/provider"
557 ng-show="!isPortal" class="text-muted"><?php echo xlt('Return Home'); ?></a></li>
558 </ul>
559 </div>
560 </div>
561 <!--/col-->
562 <div class="col-12 spacer5"></div>
563 </div>
564 <!--/row-->
565 <!--/inbox toolbar-->
566 <div class="card panel-default inbox" id="inboxPanel">
567 <!--message list-->
568 <div class="table-responsive" ng-show="!isMessageSelected()">
569 <table
570 class="table table-striped table-hover refresh-container pull-down">
571 <thead class="bg-info d-none"></thead>
572 <tbody>
573 <tr ng-repeat="item in pagedItems[currentPage]">
574 <!-- | orderBy:sortingOrder:reverse -->
575 <td><span class="col-sm-1" style="max-width: 5px;"><input
576 type="checkbox" checklist-model="item.deleted"
577 value={{item.deleted}}></span> <span class="col-sm-1"
578 style="max-width: 8px;"><span ng-class="{strong: !item.read}">{{item.id}}</span></span>
579 <span class="col-sm-1" ng-click="readMessage($index)"><span
580 ng-class="{strong: !item.read}">{{item.message_status}}</span></span>
581 <span class="col-sm-2" ng-click="readMessage($index)"><span
582 ng-class="{strong: !item.read}">{{item.date |
583 date:'yyyy-MM-dd hh:mm'}}</span></span> <span
584 class="col-sm-3" ng-click="readMessage($index)"><span
585 ng-class="{strong: !item.read}">{{item.sender_name}} to
586 {{item.recipient_name}}</span></span> <span class="col-sm-1"
587 ng-click="readMessage($index)"><span
588 ng-class="{strong: !item.read}">{{item.title}}</span></span>
589 <span class="col-sm-4" ng-click="readMessage($index)"><span
590 ng-class="{strong: !item.read}"
591 ng-bind-html='(renderMessageBody(item.body)| limitTo:35)'></span></span>
592 <!-- <span class="col-sm-1 " ng-click="readMessage($index)"><span ng-show="item.attachment"
593 class="glyphicon glyphicon-paperclip float-right"></span> <span ng-show="item.priority==1"
594 class="float-right glyphicon glyphicon-warning-sign text-danger"></span></span> -->
595 </td>
596 </tr>
597 </tbody>
598 </table>
599 </div>
600 <!--message detail-->
601 <div class="container-fluid" ng-show="isMessageSelected()">
602 <div class="row" ng-controller="messageCtrl">
603 <!-- <div class="col-12">
604 <h4 title="subject">
605 <button type="button" class="btn btn-danger btn-sm float-right" ng-click="closeMessage()"><?php //echo xlt('Back'); ?></button>
606 <a href="javascript:;" ng-click="groupToPages()"><?php //echo xlt('This Conversation'); ?></a> &gt; {{selected.title}}
607 </h4>
608 </div>-->
609 <div class="col-md-9">
610 <span class="bg-warning">
611 <a href="javascript:;" ng-click="groupToPages()"><?php echo xlt('Conversation from'); ?></a>
612 <strong>{{selected.sender_name}}</strong>
613 <?php echo xlt('regarding'); ?> {{selected.title}} <?php echo xlt('on'); ?> &lt;{{selected.date | date:'yyyy-MM-dd hh:mm'}}&gt;
614 </span>
615 </div>
616 <div class="col-md-3">
617 <div class="btn-group btn-group float-right">
618 <button ng-show="selected.sender_id != cUserId"
619 class="btn btn-primary"
620 title="<?php echo xla('Reply to this message'); ?>"
621 data-toggle="modal" data-mode="reply"
622 data-noteid={{selected.id}} data-whoto={{selected.sender_id}}
623 data-mtitle={{selected.title}}
624 data-username={{selected.sender_name}}
625 data-mailchain={{selected.mail_chain}}
626 data-target="#modalCompose">
627 <i class="fa fa-reply"></i> <?php echo xlt('Reply'); ?></button>
628 <button class="btn btn-primary dropdown-toggle"
629 data-toggle="dropdown"
630 title="<?php echo xla("More options"); ?>">
631 <i class="fa fa-angle-down"></i>
632 </button>
633 <ul class="dropdown-menu float-right">
634 <!-- Leave below
635 <li><a href="javascript:;"><i class="fa fa-reply" ng-show="selected.id == item.id && selected.sender_id != cUserId"></i> <?php //echo xlt('Reply'); ?></a></li>
636 <li><a href="javascript:;"><i class="fa fa-mail-forward" ng-show="selected.id == item.id && selected.sender_id != cUserId"></i><?php //echo xlt('Forward'); ?></a></li>
637 <li><a href="javascript:;"><i class="fa fa-print"></i> <?php //echo xlt('Print'); ?></a></li>
639 <li class="divider"></li>
640 <li ng-show='!isTrash'><a href="javascript:;"
641 ng-click="batchDelete(items)"><i class="fa fa-trash-o"></i> <?php echo xlt('Send to Archive'); ?></a></li>
642 </ul>
643 </div>
644 <div class="spacer5 float-right"></div>
645 <button ng-show='!isTrash'
646 class="btn btn-md btn-primary float-right"
647 ng-click="deleteItem(items.indexOf(selected))"
648 title="<?php echo xla('Delete this message'); ?>"
649 data-toggle="tooltip">
650 <i class="fa fa-trash-o fa-1x"></i>
651 </button>
652 </div>
653 <div class="table-responsive col-sm-12 col-md-12">
654 <table class="table table-striped refresh-container pull-down">
655 <thead><?php //echo xlt('Associated Notes.');?></thead>
656 <tbody>
657 <tr class="animate-repeat"
658 ng-repeat="item in allItems | Chained:selected.mail_chain">
659 <td>
660 <!-- Please do not remove comment items - future use --> <!-- <span class="col-sm-1" style="max-width: 5px;"><input type="checkbox" checklist-model="item.deleted" value={{item.deleted}}></span> -->
661 <span class="col-sm-1" style="max-width: 8px;"><span
662 ng-class="{strong: !item.read}">{{item.id}}</span></span> <span
663 class="col-sm-2" ng-click="readMessage($index)"><span>{{item.date
664 | date:'yyyy-MM-dd hh:mm'}}</span></span> <span
665 class="col-sm-1" ng-click="readMessage($index)"><span>{{item.message_status}}</span></span>
666 <span class="col-sm-3" ng-click="readMessage($index)"><span>{{item.sender_name}}
667 to {{item.recipient_name}}</span></span> <span
668 class="col-sm-1" ng-click="readMessage($index)"><span>{{item.title}}</span></span>
669 <span class="col-sm-4" ng-click="readMessage($index)"><span
670 ng-bind-html='(renderMessageBody(item.body) | limitTo:35)'></span></span>
671 <span class='float-right' ng-show=" !isPortal">
672 <button
673 ng-show="selected.id == item.id && selected.sender_id != cUserId"
674 class="btn btn-primary btn-sm"
675 title="<?php echo xla('Forward message to practice.'); ?>"
676 data-toggle="modal" data-mode="forward"
677 data-noteid={{selected.id}}
678 data-whoto={{selected.sender_id}}
679 data-mtitle={{selected.title}}
680 data-username={{selected.sender_name}}
681 data-mailchain={{selected.mail_chain}}
682 data-target="#modalCompose">
683 <i class="fa fa-mail-forward"></i>
684 </button>
685 </span>
686 <div class='col-sm-10 well' ng-show="selected.id == item.id"
687 style='margin: 5px 5px; padding: 5px 5px; border-color: red; background: white;'>
688 <span ng-bind-html=renderMessageBody(selected.body)></span>
689 </div>
690 </td>
691 </tr>
692 </tbody>
693 </table>
694 </div>
695 <!--/message body-->
696 </div>
697 <!--/row-->
698 </div>
699 </div>
700 <!--/inbox panel-->
701 <div class="jumbletron jumbletron-sm well-s text-right">
702 <em>Inbox last updated: <span id="lastUpdated">{{date |
703 date:'MM-dd-yyyy HH:mm:ss'}}</span></em>
704 </div>
705 <!--paging-->
706 <div class="float-right" ng-hide="selected">
707 <span class="text-muted"><b>{{(itemsPerPage * currentPage) + 1}}</b>~<b>{{(itemsPerPage
708 * currentPage) + pagedItems[currentPage].length}}</b> of <b>{{items.length}}</b></span>
709 <div class="btn-group">
710 <button type="button" class="btn btn-secondary btn-lg"
711 ng-class="{disabled: currentPage == 0}" ng-click="prevPage()">
712 <span class="glyphicon glyphicon-chevron-left"></span>
713 </button>
714 <button type="button" class="btn btn-secondary btn-lg"
715 ng-class="{disabled: currentPage == pagedItems.length - 1}"
716 ng-click="nextPage()">
717 <span class="glyphicon glyphicon-chevron-right"></span>
718 </button>
719 </div>
720 </div>
721 <hr>
722 </div>
723 <!-- /.modal compose message -->
724 <div class="modal fade" id="modalCompose">
725 <div class="modal-dialog modal-lg">
726 <div class="modal-content">
727 <div class="modal-header">
728 <button type="button" class="close" data-dismiss="modal"
729 aria-hidden="true">X</button>
730 <h4 class="modal-title"><?php echo xlt('Compose Message'); ?></h4>
731 </div>
732 <div class="modal-body ">
733 <div class="row container-fluid">
734 <label ng-show='selected.mail_chain'><?php echo xlt('Refer to Message') . ' # ';?>{{selected.id}}</label>
735 <div class="jumbotron col-md-12" id="referMsg" ng-show='selected.mail_chain'
736 style='margin: 5px 5px; padding: 5px 5px; border-color: red; background: white;'
737 class='jumbotron row'
738 ng-bind-html=renderMessageBody(selected.body)></div>
740 <form role="form" class="form-horizontal"
741 ng-submit="submitForm(compose)" name="fcompose" id="fcompose"
742 method="post" action="./handle_note.php">
743 <fieldset>
744 <div class="form-group">
745 <label class="col-sm-1 col-md-1" for="selSendto"><?php echo xlt('To{{Destination}}'); ?></label>
746 <div class="col-sm-3 col-md-3">
747 <select class="form-control" id="selForwardto"
748 ng-hide="compose.task != 'forward'"
749 ng-model="compose.selrecip"
750 ng-options="recip.userid as recip.username for recip in authrecips | filter:type = 'user' track by recip.userid"></select>
751 <select class="form-control" id="selSendto"
752 ng-hide="compose.task == 'forward'"
753 ng-model="compose.selrecip"
754 ng-options="recip.userid as recip.username for recip in authrecips track by recip.userid"></select>
755 </div>
756 </div>
757 <div class="form-group">
758 <label class="col-sm-1 col-md-1" for="title"><?php echo xlt('Subject'); ?></label>
759 <div class="col-sm-6 col-md-6">
760 <input type='text' list='listid' name='title' id='title'
761 class="form-control" ng-model='compose.title'>
762 <datalist id='listid'>
763 <option><?php echo xlt('Unassigned'); ?></option>
764 <option label='<?php echo xlt('Insurance'); ?>'
765 value='<?php echo xlt('Insurance'); ?>' />
766 <option label='<?php echo xlt('Prior Auth'); ?>'
767 value='<?php echo xlt('Prior Auth'); ?>' />
768 <option label='<?php echo xlt('Bill/Collect'); ?>'
769 value='<?php echo xlt('Bill/Collect'); ?>' />
770 <option label='<?php echo xlt('Referral'); ?>'
771 value='<?php echo xlt('Referral'); ?>' />
772 <option label='<?php echo xlt('Pharmacy'); ?>'
773 value='<?php echo xlt('Pharmacy'); ?>' />
774 </datalist>
775 </div>
776 </div>
777 <div class="col-sm-12 col-md-12" id="inputBody"
778 ng-hide="compose.task == 'forward'"
779 ng-model="compose.inputBody"></div>
780 <textarea class="col-sm-12 col-md-12" id="finputBody" rows="8"
781 ng-hide="compose.task != 'forward'"
782 ng-model="compose.inputBody"></textarea>
783 </fieldset>
784 <input type='hidden' name='noteid' id='noteid'
785 ng-value="compose.noteid" /> <input type='hidden'
786 name='replyid' id='replyid'
787 ng-value='selected.reply_mail_chain' /> <input type='hidden'
788 name='owner' ng-value='compose.owner' /> <input type='hidden'
789 name='recipient_id' ng-value='compose.selrecip' /> <input
790 type='hidden' name='recipient_name'
791 ng-value='compose.recipient_name' /> <input type='hidden'
792 name='sender_id' ng-value='compose.sender_id' /> <input
793 type='hidden' name='sender_name'
794 ng-value='compose.sender_name' /> <input type='hidden'
795 name='task' ng-value='compose.task' /> <input type='hidden'
796 name='inputBody' ng-value='compose.inputBody' /> <input
797 type='hidden' name='pid' ng-value='compose.pid' />
798 <div class='modal-footer'>
799 <button type="button" class="btn btn-secondary"
800 data-dismiss="modal"><?php echo xlt('Cancel'); ?></button>
801 <button type="submit" id="submit" name="submit"
802 class="btn btn-primary float-right" value="messages.php"><?php echo xlt('Send'); ?> <i
803 class="fa fa-arrow-circle-right fa-lg"></i>
804 </button>
805 </div>
806 </form>
807 </div>
808 </div>
809 </div>
810 <!-- /.modal-content -->
811 </div>
812 <!-- /.modal-dialog -->
813 </div>
814 <!-- /.modal compose message -->
815 </div>
816 <!--/row ng-controller-->
817 </div>
818 <!--/container--> </ng>
820 </body>
821 </html>