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/>.
20 * @author Jerry Padgett <sjpadgett@gmail.com>
21 * @link http://www.open-emr.org
24 if (isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite_two'])) {
25 $_SESSION['whereto'] = 'profilepanel';
26 $pid = $_SESSION['pid'];
28 require_once(dirname(__FILE__
) . "/../../interface/globals.php");
29 define('IS_DASHBOARD', false);
30 define('IS_PORTAL', $_SESSION['portal_username']);
34 require_once(dirname(__FILE__
) . "/../../interface/globals.php");
35 if (! isset($_SESSION['authUserID'])) {
36 $landingpage = "index.php";
37 header('Location: ' . $landingpage);
41 define('IS_DASHBOARD', $_SESSION['authUser']);
42 define('IS_PORTAL', false);
45 require_once("$srcdir/acl.inc");
46 require_once("$srcdir/patient.inc");
47 require_once("$srcdir/options.inc.php");
48 require_once("$srcdir/classes/Document.class.php");
49 require_once("./../lib/portal_mail.inc");
50 use OpenEMR\Core\Header
;
52 $docid = empty($_REQUEST['docid']) ?
0 : intval($_REQUEST['docid']);
53 $orderid = empty($_REQUEST['orderid']) ?
0 : intval($_REQUEST['orderid']);
55 $result = getMails(IS_DASHBOARD ? IS_DASHBOARD
: IS_PORTAL
, 'inbox', '', '');
57 foreach ($result as $iter) {
63 $dashuser = getUserIDInfo($_SESSION['authUserID']);
66 function getAuthPortalUsers()
68 $resultpd = $resultusers = $resultpatients = array();
69 if (IS_DASHBOARD
) { // admin can mail anyone
70 $authusers = sqlStatement("SELECT users.username as userid,
71 CONCAT(users.fname,' ',users.lname) as username, 'user' as type FROM users WHERE authorized = 1");
72 while ($row = sqlFetchArray($authusers)) {
73 $resultusers[] = $row;
76 $authpatients = sqlStatement("SELECT LOWER(CONCAT(patient_data.fname, patient_data.id)) as userid,
77 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'");
78 while ($row = sqlFetchArray($authpatients)) {
79 $resultpatients[] = $row;
82 $resultpd[] = array_merge($resultusers, $resultpatients);
86 $authusers = sqlStatement("SELECT users.username as userid, CONCAT(users.fname,' ',users.lname) as username FROM users WHERE authorized = 1");
87 while ($row = sqlFetchArray($authusers)) {
98 <meta http
-equiv
="content-type" content
="text/html; charset=UTF-8">
99 <meta charset
="utf-8">
100 <title
><?php
echo xlt("Secure Messaging"); ?
></title
>
101 <meta name
="viewport"
102 content
="width=device-width, initial-scale=1, maximum-scale=1">
103 <meta name
="description" content
="Mail Application" />
105 <?php Header
::setupHeader(['summernote', 'angular', 'angular-summernote', 'angular-sanitize', 'checklist-model']); ?
>
108 <body
class="skin-blue">
109 <!-- style
='background:#f1f2f7;' -->
112 var app
= angular
.module("emrMessageApp",['ngSanitize','summernote',"checklist-model"]);
113 app
.controller('inboxCtrl', ['$scope', '$filter','$http','$window', function ($scope, $filter,$http,$window) {
114 $scope.date
= new Date
;
115 $scope.sortingOrder
= 'id';
116 $scope.pageSizes
= [5,10,20,50,100];
117 $scope.reverse
= false;
118 $scope.filteredItems
= [];
119 $scope.groupedItems
= [];
120 $scope.itemsPerPage
= 8;
121 $scope.pagedItems
= [];
123 $scope.selrecip
= [];
124 $scope.currentPage
= 0;
125 $scope.sentItems
= [];
126 $scope.allItems
= [];
127 $scope.deletedItems
= [];
128 $scope.inboxItems
= [];
129 $scope.inboxItems
= <?php
echo json_encode($theresult);?
>;
130 $scope.userproper
= "<?php echo $_SESSION['ptName'] ? $_SESSION['ptName'] : ($dashuser['fname'] . ' ' . $dashuser['lname']) ;?>";
131 $scope.isPortal
= "<?php echo IS_PORTAL;?>" ;
132 $scope.isDashboard
= "<?php echo IS_DASHBOARD ? IS_DASHBOARD : 0;?>" ;
133 $scope.cUserId
= $scope.isPortal ?
$scope.isPortal
: $scope.isDashboard
;
134 $scope.authrecips
= <?php
echo json_encode(getAuthPortalUsers());?
>;
135 $scope.compose
.task
= 'add';
137 $scope.xLate
.confirm
= [];
138 $scope.xLate
.fwd
= "<?php echo xlt('Forwarded Portal Message Re: '); ?>";
139 $scope.xLate
.confirm
.one
= "<?php echo xlt('Confirm to Delete Current Thread?'); ?>";
140 $scope.xLate
.confirm
.all
= "<?php echo xlt('Confirm to Delete Selected?'); ?>";
141 $scope.xLate
.confirm
.err
= "<?php echo xlt('You are sending to yourself!'); ?>"; // I think I got rid of this ability - look into..
143 $scope.init
= function () {
144 $http.defaults
.headers
.post
["Content-Type"] = "application/x-www-form-urlencoded";
145 $scope.getSentMessages();
146 $scope.getAllMessages();
147 $scope.getDeletedMessages();
148 $scope.isInboxSelected();
150 $scope.isInit
= true;
154 var searchMatch
= function (haystack
, needle
) {
158 return haystack
.toLowerCase().indexOf(needle
.toLowerCase()) !== -1;
162 $scope.search
= function () {
163 $scope.filteredItems
= $filter('filter')($scope.items
, function (item
) {
164 for(var attr in item
) {
165 if (searchMatch(item
[attr
], $scope.query
))
170 $scope.currentPage
= 0;
171 // now group by pages
172 $scope.groupToPages();
175 // calculate page in place
176 $scope.groupToPages
= function () {
177 $scope.selected
= null;
178 $scope.pagedItems
= [];
179 for (var i
= 0; i
< $scope.filteredItems
.length
; i++
) {
180 if (i %
$scope.itemsPerPage
=== 0) {
181 $scope.pagedItems
[Math
.floor(i
/ $scope.itemsPerPage
)] = [ $scope.filteredItems
[i
] ];
183 $scope.pagedItems
[Math
.floor(i
/ $scope.itemsPerPage
)].push($scope.filteredItems
[i
]);
188 $scope.range
= function (start
, end
) {
194 for (var i
= start
; i
< end
; i++
) {
200 $scope.prevPage
= function () {
201 if ($scope.currentPage
> 0) {
202 $scope.currentPage
--;
207 $scope.nextPage
= function () {
208 if ($scope.currentPage
< $scope.pagedItems
.length
- 1) {
209 $scope.currentPage++
;
214 $scope.setPage
= function () {
215 $scope.currentPage
= this
.n
;
218 $scope.deleteItem
= function (idx
) {
219 if( !confirm($scope.xLate
.confirm
.one
) ) return false;
220 var itemToDelete
= $scope.allItems
[idx
];
221 var idxInItems
= $scope.items
.indexOf(itemToDelete
);
222 $scope.deleteMessage(itemToDelete
.mail_chain
); // Just this user's message
223 $scope.items
.splice(idxInItems
,1);
229 $scope.batchDelete
= function ( i
) {
230 if( !confirm($scope.xLate
.confirm
.all
) ) return false;
231 var itemToDelete
= [];
232 angular
.forEach(i
, function(o
, key
) {
233 if(o
.hasOwnProperty('deleted')){
234 itemToDelete
.push($scope.items
[i
.indexOf(o
)].id
);
237 $http.post('handle_note.php', $
.param({'task':'massdelete','notejson':JSON
.stringify(itemToDelete
)}))
238 .success(function(data
, status
, headers
, config
) {
239 $window.location
.reload();
240 }).error(function(data
, status
, headers
, config
) {
246 $scope.deleteMessage
= function (id
){
247 $http.post('handle_note.php', $
.param( {'task':'delete','noteid':id
} ))
248 .success(function(data
, status
, headers
, config
) {
250 }).error(function(data
, status
, headers
, config
) {
255 $scope.isMessageSelected
= function () {
256 if (typeof
$scope.selected
!=="undefined" && $scope.selected
!==null) {
264 $scope.isSentSelected
= function () {
265 $scope.isSent
= true; $scope.isTrash
= $scope.isAll
= $scope.isInbox
= false;
267 $scope.items
= $scope.sentItems
;
272 $scope.isTrashSelected
= function () {
273 $scope.isTrash
= true; $scope.isSent
= $scope.isAll
= $scope.isInbox
= false;
275 $scope.items
= $scope.deletedItems
;
280 $scope.isInboxSelected
= function () {
281 $scope.isInbox
= true; $scope.isTrash
= $scope.isAll
= $scope.isSent
= false;
282 $scope.items
= $scope.inboxItems
;
287 $scope.isAllSelected
= function () {
288 $scope.isAll
= true; $scope.isTrash
= $scope.isSent
= $scope.isInbox
= false;
289 $scope.items
= $scope.allItems
;
294 $scope.readMessage
= function (idx
) {
295 if( $scope.items
[idx
].message_status
== 'New'){ // mark mail read else ignore
296 $http.post('handle_note.php', $
.param({'task':'setread','noteid':$scope.items
[idx
].id
}))
297 .success(function(data
, status
, headers
, config
) {
298 $scope.items
[idx
].message_status
= 'Read';
299 $scope.selected
.message_status
= 'Read';
300 }).error(function(data
, status
, headers
, config
) {
304 idx
= $filter('getById')($scope.allItems
,this
.item
.id
);
305 $scope.isAll
= true; $scope.isTrash
= $scope.isSent
= $scope.isInbox
= false;
306 $scope.items
= $scope.allItems
;
307 $scope.selected
= $scope.items
[idx
];
309 $scope.selMessage
= function (idx
) {
310 $scope.selected
= $scope.allItems
[idx
];
314 $scope.readAll
= function () {
315 for (var i in
$scope.items
) {
316 $scope.items
[i
].message_status
= 'Read';
320 $scope.closeMessage
= function () {
321 $scope.selected
= null;
324 $scope.renderMessageBody
= function(html
)
329 $scope.getInbox
= function () {
330 $http.post('handle_note.php', $
.param({'task':'getinbox','owner':$scope.cUserId
}))
331 .success(function(data
, status
, headers
, config
) {
333 $scope.inboxItems
= angular
.copy(data
);
336 }).error(function(data
, status
, headers
, config
) {
341 $scope.getAllMessages
= function () {
342 $http.post('handle_note.php', $
.param({'task':'getall','owner':$scope.cUserId
}))
343 .success(function(data
, status
, headers
, config
) {
345 $scope.allItems
= angular
.copy(data
);
348 }).error(function(data
, status
, headers
, config
) {
353 $scope.getDeletedMessages
= function () {
354 $http.post('handle_note.php', $
.param({'task':'getdeleted','owner':$scope.cUserId
}))
355 .success(function(data
, status
, headers
, config
) {
357 $scope.deletedItems
= [];
358 $scope.deletedItems
= angular
.copy(data
);
361 }).error(function(data
, status
, headers
, config
) {
366 $scope.getSentMessages
= function () {
367 $http.post('handle_note.php', $
.param({'task':'getsent','owner':$scope.cUserId
}))
368 .success(function(data
, status
, headers
, config
) {
369 $scope.sentItems
= [];
370 $scope.sentItems
= angular
.copy(data
);
371 }).error(function(data
, status
, headers
, config
) {
376 $scope.submitForm
= function(compose
){
377 $http.defaults
.headers
.post
["Content-Type"] = "application/x-www-form-urlencoded";
378 // re-enable title for submit
379 $
("#title").prop( "disabled", false )
380 $
("#selSendto").prop( "disabled", false )
382 compose
.owner
= $scope.cUserId
383 compose
.sender_id
=$scope.cUserId
384 compose
.sender_name
=$scope.userproper
385 if( $scope.selrecip
== compose
.owner
){
386 if(!confirm($scope.xLate
.confirm
.err
))
389 if( compose
.task
== 'add' ){
390 compose
.recipient_name
=$
("#selSendto option:selected").text();
392 if( compose
.task
== 'forward' ){ // Just overwrite default reply but send to pnotes.
393 compose
.sender_id
=$
("#selForwardto option:selected").val();
394 compose
.sender_name
=$
("#selForwardto option:selected").text();
395 compose
.selrecip
= compose
.recipient_id
;
398 compose
.inputBody
= $
("#inputBody").summernote('code');
400 return true; // okay to submit
403 $
('#modalCompose').on('show.bs.modal', function(e
) {
404 // Sets up the compose modal before we show it
406 $
('#inputBody').summernote('destroy');
407 var mode
= $
(e
.relatedTarget
).attr('data-mode');
408 $scope.compose
.task
= mode
;
409 if(mode
== 'forward'){
410 $
('#modalCompose .modal-header .modal-title').html("Forward Message");
411 $scope.compose
.task
= mode
;
412 var recipId
= $
(e
.relatedTarget
).attr('data-whoto');
413 var title
= $
(e
.relatedTarget
).attr('data-mtitle');
414 var uname
= $
(e
.relatedTarget
).attr('data-username');
415 $
(e
.currentTarget
).find('select[id="selSendto"]').prop( "disabled", false );
416 $
(e
.currentTarget
).find('input[name="title"]').prop( "disabled", false );
417 $scope.compose
.title
= title
;
418 $scope.compose
.selrecip
= recipId
;
419 $scope.compose
.selrecip
.username
= uname
;
420 $scope.compose
.recipient_name
= uname
;
421 $scope.compose
.recipient_id
= recipId
;
422 angular
.forEach($scope.authrecips
, function(o
, key
) {// Need the pid of patient for pnotes.
423 if(o
.userid
== recipId
){
424 $scope.compose
.pid
= o
.pid
;
427 var fmsg
= '\n\n\n> ' +
$scope.xLate
.fwd+ title +
' by ' + uname +
'\n> '+ $
("#referMsg").text();
428 $
("textarea#finputBody").text(fmsg
)
429 $scope.compose
.noteid
= $
(e
.relatedTarget
).attr('data-noteid');
431 else if(mode
== 'reply'){
432 $
('#inputBody').summernote({focus
:true,height
:'225px'});
433 $
('#modalCompose .modal-header .modal-title').html("Compose Reply Message");
434 $scope.compose
.task
= mode
;
435 //get data attributes of the clicked element (selected recipient) for replies only
436 var chain
= $
(e
.relatedTarget
).attr('data-mailchain');
437 if(chain
== '0') chain
= $
(e
.relatedTarget
).attr('data-noteid');
438 var recipId
= $
(e
.relatedTarget
).attr('data-whoto');
439 var title
= $
(e
.relatedTarget
).attr('data-mtitle');
440 var uname
= $
(e
.relatedTarget
).attr('data-username');
441 $
(e
.currentTarget
).find('select[id="selSendto"]').val(recipId
)
442 $
(e
.currentTarget
).find('input[name="title"]').val(title
);
443 // Set the modal var's
444 $scope.compose
.title
= title
;
445 $scope.compose
.selrecip
= recipId
;
446 $scope.compose
.selrecip
.username
= uname
;
447 $scope.compose
.recipient_name
= uname
;
448 $scope.compose
.recipient_id
= recipId
;
449 $scope.compose
.noteid
= chain
;
452 $
('#inputBody').summernote({focus
:true,height
:'225px'});
453 $
('#modalCompose .modal-header .modal-title').html("Compose New Message");
454 $scope.compose
.task
= 'add';
455 $
(e
.currentTarget
).find('select[id="selSendto"]').prop( "disabled", false );
456 $
(e
.currentTarget
).find('input[name="title"]').prop( "disabled", false );
458 if($scope.compose
.task
!= 'reply'){
462 $
('#modalCompose').on('shown.bs.modal', function(e
) {
465 $
('#modalCompose').on('hidden.bs.modal', function(e
){
468 // initialize application
469 if( !$scope.isInit
){
472 }]) /* end inbox functions */
473 .filter('Chained', function () {
474 return function (input
, id
) {
480 angular
.forEach(input
, function (item
) {
481 if (item
.mail_chain
== id
) {
489 .filter('getById', function() {
490 return function(input
, id
) {
491 var i
=0, len
=input
.length
;
493 if (+input
[i
].id
== +id
) {
500 .controller('messageCtrl', ['$scope', function ($scope) {
501 $scope.message
= function(idx
) {
505 }]); // end messageCtrl
507 })(); // application end
509 <ng ng
-app
="emrMessageApp">
510 <div
class="container" id
='main' style
="display: none">
511 <div
class='header logo'>
513 <i style
='width: auto; height: auto;' class='glyphicon glyphicon-envelope'></i
> <?php
echo xlt('Patient Secure Mail'); ?
></h2
>
515 <div
class="row" ng
-controller
="inboxCtrl">
516 <aside
class="col-md-1"
517 style
='padding: 0 0; margin: 0 0; text-align: left;'>
518 <ul
class="nav nav-pills nav-stacked"
519 style
='padding: 0 0; margin: 0 0; text-align: left;'>
520 <li data
-toggle
="pill" class="active bg-info"><a
521 href
="javascript:;" ng
-click
="isInboxSelected()"><span
522 class="badge pull-right">{{inboxItems
.length
}}</span
><?php
echo xlt('Inbox'); ?
></a
></li
>
523 <li data
-toggle
="pill" class="bg-info"><a href
="javascript:;"
524 ng
-click
="isSentSelected()"><span
class="badge pull-right">{{sentItems
.length
}}</span
><?php
echo xlt('Sent'); ?
></a
></li
>
525 <li data
-toggle
="pill" class="bg-info"><a href
="javascript:;"
526 ng
-click
="isAllSelected()"><span
class="badge pull-right">{{allItems
.length
}}</span
><?php
echo xlt('All'); ?
></a
></li
>
527 <!-- <li data
-toggle
="pill" class="bg-info"><a href
="#"><span
class="badge pull-right">0</span
><?php
//echo xlt('Drafts'); ?></a></li> -->
528 <li data
-toggle
="pill" class="bg-info"><a href
="javascript:;"
529 ng
-click
="isTrashSelected()"><span
class="badge pull-right">{{deletedItems
.length
}}</span
><?php
echo xlt('Archive'); ?
></a
></li
>
530 <li
class="pill bg-danger"><a
531 href
="<?php echo $GLOBALS['web_root']?>/portal/patient/provider"
532 ng
-show
="!isPortal"><?php
echo xlt('Exit Mail'); ?
></a
></li
>
533 <li data
-toggle
="pill" class="bg-danger"><a href
="javascript:;"
534 onclick
='window.location.replace("<?php echo $GLOBALS['web_root
']?>/portal/home.php")'
535 ng
-show
="isPortal"><?php
echo xlt('Exit'); ?
></a
></li
>
538 <div
class="col-md-11">
540 <div
class="row" ng
-show
="!isMessageSelected()">
541 <div
class="col-xs-12">
542 <a
class="btn btn-default btn-lg" data
-toggle
="tooltip"
543 title
="Refresh" id
="refreshInbox" href
="javascript:;"
544 onclick
='window.location.replace("./messages.php")'> <span
545 class="fa fa-refresh fa-lg"></span
>
547 <button
class="btn btn-default btn-lg"
548 title
="<?php echo xla("New Note
"); ?>" data
-mode
="add"
549 data
-toggle
="modal" data
-target
="#modalCompose">
550 <span
class="fa fa-edit fa-lg"></span
>
552 <div
class="btn-group btn-group pull-right">
553 <button type
="button" class="btn btn-primary dropdown-toggle"
554 data
-toggle
="dropdown">
555 <?php
echo xlt('Actions'); ?
> <span
class="caret"></span
>
557 <ul
class="dropdown-menu" role
="menu">
558 <li
><a href
="javascript:;" ng
-click
="readAll()"><?php
echo xlt('Mark all as read'); ?
></a
></li
>
559 <li
class="divider"></li
>
560 <li
><a href
="" data
-mode
="add" data
-toggle
="modal"
561 data
-target
="#modalCompose"><?php
echo xlt('Compose new'); ?
></a
></li
>
562 <li ng
-show
='!isTrash'><a href
="javascript:;"
563 ng
-click
="batchDelete(items)"><i
class="fa fa-trash-o"></i
> <?php
echo xlt('Send Selected to Archive'); ?
></a
></li
>
564 <li
><a href
="javascript:;"
565 onclick
='window.location.replace("<?php echo $GLOBALS['web_root
']?>/portal/home.php")'
566 ng
-show
="isPortal" class="text-muted"><?php
echo xlt('Return Home'); ?
></a
></li
>
568 href
="<?php echo $GLOBALS['web_root']?>/portal/patient/provider"
569 ng
-show
="!isPortal" class="text-muted"><?php
echo xlt('Return Home'); ?
></a
></li
>
574 <div
class="col-xs-12 spacer5"></div
>
577 <!--/inbox toolbar
-->
578 <div
class="panel panel-default inbox" id
="inboxPanel">
580 <div
class="table-responsive" ng
-show
="!isMessageSelected()">
582 class="table table-striped table-hover refresh-container pull-down">
583 <thead
class="bg-info hidden-xs"></thead
>
585 <tr ng
-repeat
="item in pagedItems[currentPage]">
586 <!-- | orderBy
:sortingOrder
:reverse
-->
587 <td
><span
class="col-sm-1" style
="max-width: 5px;"><input
588 type
="checkbox" checklist
-model
="item.deleted"
589 value
={{item
.deleted
}}></span
> <span
class="col-sm-1"
590 style
="max-width: 8px;"><span ng
-class="{strong: !item.read}">{{item
.id
}}</span
></span
>
591 <span
class="col-sm-1" ng
-click
="readMessage($index)"><span
592 ng
-class="{strong: !item.read}">{{item
.message_status
}}</span
></span
>
593 <span
class="col-sm-2" ng
-click
="readMessage($index)"><span
594 ng
-class="{strong: !item.read}">{{item
.date |
595 date
:'yyyy-MM-dd hh:mm'}}</span
></span
> <span
596 class="col-sm-3" ng
-click
="readMessage($index)"><span
597 ng
-class="{strong: !item.read}">{{item
.sender_name
}} to
598 {{item
.recipient_name
}}</span
></span
> <span
class="col-sm-1"
599 ng
-click
="readMessage($index)"><span
600 ng
-class="{strong: !item.read}">{{item
.title
}}</span
></span
>
601 <span
class="col-sm-4" ng
-click
="readMessage($index)"><span
602 ng
-class="{strong: !item.read}"
603 ng
-bind
-html
='(renderMessageBody(item.body)| limitTo:35)'></span
></span
>
604 <!-- <span
class="col-sm-1 " ng
-click
="readMessage($index)"><span ng
-show
="item.attachment"
605 class="glyphicon glyphicon-paperclip pull-right"></span
> <span ng
-show
="item.priority==1"
606 class="pull-right glyphicon glyphicon-warning-sign text-danger"></span
></span
> -->
612 <!--message detail
-->
613 <div
class="container-fluid" ng
-show
="isMessageSelected()">
614 <div
class="row" ng
-controller
="messageCtrl">
615 <!-- <div
class="col-xs-12">
617 <button type
="button" class="btn btn-danger btn-sm pull-right" ng
-click
="closeMessage()"><?php
//echo xlt('Back'); ?></button>
618 <a href
="javascript:;" ng
-click
="groupToPages()"><?php
//echo xlt('This Conversation'); ?></a> > {{selected.title}}
621 <div
class="col-md-9">
622 <span
class="bg-warning">
623 <a href
="javascript:;" ng
-click
="groupToPages()"><?php
echo xlt('Conversation from'); ?
></a
>
624 <strong
>{{selected
.sender_name
}}</strong
>
625 <?php
echo xlt('regarding'); ?
> {{selected
.title
}} <?php
echo xlt('on'); ?
> <
;{{selected
.date | date
:'yyyy-MM-dd hh:mm'}}>
;
628 <div
class="col-md-3">
629 <div
class="btn-group btn-group pull-right">
630 <button ng
-show
="selected.sender_id != cUserId"
631 class="btn btn-primary"
632 title
="<?php echo xla('Reply to this message'); ?>"
633 data
-toggle
="modal" data
-mode
="reply"
634 data
-noteid
={{selected
.id
}} data
-whoto
={{selected
.sender_id
}}
635 data
-mtitle
={{selected
.title
}}
636 data
-username
={{selected
.sender_name
}}
637 data
-mailchain
={{selected
.mail_chain
}}
638 data
-target
="#modalCompose">
639 <i
class="fa fa-reply"></i
> <?php
echo xlt('Reply'); ?
></button
>
640 <button
class="btn btn-primary dropdown-toggle"
641 data
-toggle
="dropdown"
642 title
="<?php echo xla("More options
"); ?>">
643 <i
class="fa fa-angle-down"></i
>
645 <ul
class="dropdown-menu pull-right">
647 <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>
648 <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>
649 <li
><a href
="javascript:;"><i
class="fa fa-print"></i
> <?php
//echo xlt('Print'); ?></a></li>
651 <li
class="divider"></li
>
652 <li ng
-show
='!isTrash'><a href
="javascript:;"
653 ng
-click
="batchDelete(items)"><i
class="fa fa-trash-o"></i
> <?php
echo xlt('Send to Archive'); ?
></a
></li
>
656 <div
class="spacer5 pull-right"></div
>
657 <button ng
-show
='!isTrash'
658 class="btn btn-md btn-primary pull-right"
659 ng
-click
="deleteItem(items.indexOf(selected))"
660 title
="<?php echo xla('Delete this message'); ?>"
661 data
-toggle
="tooltip">
662 <i
class="fa fa-trash-o fa-1x"></i
>
665 <div
class="table-responsive col-sm-12 col-md-12">
666 <table
class="table table-striped refresh-container pull-down">
667 <thead
><?php
//echo xlt('Associated Notes.');?></thead>
669 <tr
class="animate-repeat"
670 ng
-repeat
="item in allItems | Chained:selected.mail_chain">
672 <!-- 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
> -->
673 <span
class="col-sm-1" style
="max-width: 8px;"><span
674 ng
-class="{strong: !item.read}">{{item
.id
}}</span
></span
> <span
675 class="col-sm-2" ng
-click
="readMessage($index)"><span
>{{item
.date
676 | date
:'yyyy-MM-dd hh:mm'}}</span
></span
> <span
677 class="col-sm-1" ng
-click
="readMessage($index)"><span
>{{item
.message_status
}}</span
></span
>
678 <span
class="col-sm-3" ng
-click
="readMessage($index)"><span
>{{item
.sender_name
}}
679 to
{{item
.recipient_name
}}</span
></span
> <span
680 class="col-sm-1" ng
-click
="readMessage($index)"><span
>{{item
.title
}}</span
></span
>
681 <span
class="col-sm-4" ng
-click
="readMessage($index)"><span
682 ng
-bind
-html
='(renderMessageBody(item.body) | limitTo:35)'></span
></span
>
683 <span
class='pull-right' ng
-show
=" !isPortal">
685 ng
-show
="selected.id == item.id && selected.sender_id != cUserId"
686 class="btn btn-primary btn-xs"
687 title
="<?php echo xla('Forward message to practice.'); ?>"
688 data
-toggle
="modal" data
-mode
="forward"
689 data
-noteid
={{selected
.id
}}
690 data
-whoto
={{selected
.sender_id
}}
691 data
-mtitle
={{selected
.title
}}
692 data
-username
={{selected
.sender_name
}}
693 data
-mailchain
={{selected
.mail_chain
}}
694 data
-target
="#modalCompose">
695 <i
class="fa fa-mail-forward"></i
>
698 <div
class='col-sm-10 well' ng
-show
="selected.id == item.id"
699 style
='margin: 5px 5px; padding: 5px 5px; border-color: red; background: white;'>
700 <span ng
-bind
-html
=renderMessageBody(selected
.body
)></span
>
713 <div
class="well well-s text-right">
714 <em
>Inbox last updated
: <span id
="lastUpdated">{{date |
715 date
:'MM-dd-yyyy HH:mm:ss'}}</span
></em
>
718 <div
class="pull-right" ng
-hide
="selected">
719 <span
class="text-muted"><b
>{{(itemsPerPage
* currentPage
) +
1}}</b
>~
<b
>{{(itemsPerPage
720 * currentPage
) + pagedItems
[currentPage
].length
}}</b
> of
<b
>{{items
.length
}}</b
></span
>
721 <div
class="btn-group btn-group">
722 <button type
="button" class="btn btn-default btn-lg"
723 ng
-class="{disabled: currentPage == 0}" ng
-click
="prevPage()">
724 <span
class="glyphicon glyphicon-chevron-left"></span
>
726 <button type
="button" class="btn btn-default btn-lg"
727 ng
-class="{disabled: currentPage == pagedItems.length - 1}"
728 ng
-click
="nextPage()">
729 <span
class="glyphicon glyphicon-chevron-right"></span
>
735 <!-- /.modal compose message
-->
736 <div
class="modal fade" id
="modalCompose">
737 <div
class="modal-dialog modal-lg">
738 <div
class="modal-content">
739 <div
class="modal-header">
740 <button type
="button" class="close" data
-dismiss
="modal"
741 aria
-hidden
="true">X
</button
>
742 <h4
class="modal-title"><?php
echo xlt('Compose Message'); ?
></h4
>
744 <div
class="modal-body ">
745 <div
class="row container-fluid">
746 <label ng
-show
='selected.mail_chain'><?php
echo xlt('Refer to Message') . ' # ';?
>{{selected
.id
}}</label
>
747 <div
class="well well-sm col-12-md" id
="referMsg"
748 ng
-show
='selected.mail_chain'
749 style
='margin: 5px 5px; padding: 5px 5px; border-color: red; background: white;'
750 class='well well-lg row'
751 ng
-bind
-html
=renderMessageBody(selected
.body
)></div
>
753 <form role
="form" class="form-horizontal"
754 ng
-submit
="submitForm(compose)" name
="fcompose" id
="fcompose"
755 method
="post" action
="./handle_note.php">
757 <div
class="form-group">
758 <label
class="col-sm-1 col-md-1" for="selSendto"><?php
echo xlt('To'); ?
></label
>
759 <div
class="col-sm-3 col-md-3">
760 <select
class="form-control" id
="selForwardto"
761 ng
-hide
="compose.task != 'forward'"
762 ng
-model
="compose.selrecip"
763 ng
-options
="recip.userid as recip.username for recip in authrecips | filter:type = 'user' track by recip.userid"></select
>
764 <select
class="form-control" id
="selSendto"
765 ng
-hide
="compose.task == 'forward'"
766 ng
-model
="compose.selrecip"
767 ng
-options
="recip.userid as recip.username for recip in authrecips track by recip.userid"></select
>
770 <div
class="form-group">
771 <label
class="col-sm-1 col-md-1" for="title"><?php
echo xlt('Subject'); ?
></label
>
772 <div
class="col-sm-6 col-md-6">
773 <input type
='text' list='listid' name
='title' id
='title'
774 class="form-control" ng
-model
='compose.title'>
775 <datalist id
='listid'>
776 <option
><?php
echo xlt('Unassigned'); ?
></option
>
777 <option label
='<?php echo xlt('Insurance
'); ?>'
778 value
='<?php echo xlt('Insurance
'); ?>' />
779 <option label
='<?php echo xlt('Prior Auth
'); ?>'
780 value
='<?php echo xlt('Prior Auth
'); ?>' />
781 <option label
='<?php echo xlt('Bill
/Collect
'); ?>'
782 value
='<?php echo xlt('Bill
/Collect
'); ?>' />
783 <option label
='<?php echo xlt('Referral
'); ?>'
784 value
='<?php echo xlt('Referral
'); ?>' />
785 <option label
='<?php echo xlt('Pharmacy
'); ?>'
786 value
='<?php echo xlt('Pharmacy
'); ?>' />
790 <div
class="col-sm-12 col-md-12" id
="inputBody"
791 ng
-hide
="compose.task == 'forward'"
792 ng
-model
="compose.inputBody"></div
>
793 <textarea
class="col-sm-12 col-md-12" id
="finputBody" rows
="8"
794 ng
-hide
="compose.task != 'forward'"
795 ng
-model
="compose.inputBody"></textarea
>
797 <input type
='hidden' name
='noteid' id
='noteid'
798 ng
-value
="compose.noteid" /> <input type
='hidden'
799 name
='replyid' id
='replyid'
800 ng
-value
='selected.reply_mail_chain' /> <input type
='hidden'
801 name
='owner' ng
-value
='compose.owner' /> <input type
='hidden'
802 name
='recipient_id' ng
-value
='compose.selrecip' /> <input
803 type
='hidden' name
='recipient_name'
804 ng
-value
='compose.recipient_name' /> <input type
='hidden'
805 name
='sender_id' ng
-value
='compose.sender_id' /> <input
806 type
='hidden' name
='sender_name'
807 ng
-value
='compose.sender_name' /> <input type
='hidden'
808 name
='task' ng
-value
='compose.task' /> <input type
='hidden'
809 name
='inputBody' ng
-value
='compose.inputBody' /> <input
810 type
='hidden' name
='pid' ng
-value
='compose.pid' />
811 <div
class='modal-footer'>
812 <button type
="button" class="btn btn-default"
813 data
-dismiss
="modal"><?php
echo xlt('Cancel'); ?
></button
>
814 <button type
="submit" id
="submit" name
="submit"
815 class="btn btn-primary pull-right" value
="messages.php"><?php
echo xlt('Send'); ?
> <i
816 class="fa fa-arrow-circle-right fa-lg"></i
>
823 <!-- /.modal
-content
-->
825 <!-- /.modal
-dialog
-->
827 <!-- /.modal compose message
-->
829 <!--/row ng
-controller
-->
831 <!--/container
--> </ng
>