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");
51 $docid = empty($_REQUEST['docid']) ?
0 : intval($_REQUEST['docid']);
52 $orderid = empty($_REQUEST['orderid']) ?
0 : intval($_REQUEST['orderid']);
54 $result = getMails(IS_DASHBOARD ? IS_DASHBOARD
: IS_PORTAL
, 'inbox', '', '');
56 foreach ($result as $iter) {
62 $dashuser = getUserIDInfo($_SESSION['authUserID']);
65 function getAuthPortalUsers()
67 $resultpd = $resultusers = $resultpatients = array();
68 if (IS_DASHBOARD
) { // admin can mail anyone
69 $authusers = sqlStatement("SELECT users.username as userid,
70 CONCAT(users.fname,' ',users.lname) as username, 'user' as type FROM users WHERE authorized = 1");
71 while ($row = sqlFetchArray($authusers)) {
72 $resultusers[] = $row;
75 $authpatients = sqlStatement("SELECT LOWER(CONCAT(patient_data.fname, patient_data.id)) as userid,
76 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'");
77 while ($row = sqlFetchArray($authpatients)) {
78 $resultpatients[] = $row;
81 $resultpd[] = array_merge($resultusers, $resultpatients);
85 $authusers = sqlStatement("SELECT users.username as userid, CONCAT(users.fname,' ',users.lname) as username FROM users WHERE authorized = 1");
86 while ($row = sqlFetchArray($authusers)) {
97 <meta http
-equiv
="content-type" content
="text/html; charset=UTF-8">
98 <meta charset
="utf-8">
99 <title
><?php
echo xlt("Secure Messaging"); ?
></title
>
100 <meta name
="viewport"
101 content
="width=device-width, initial-scale=1, maximum-scale=1">
102 <meta name
="description" content
="Mail Application" />
104 href
="<?php echo $GLOBALS['assets_static_relative']; ?>/font-awesome-4-6-3/css/font-awesome.min.css"
105 type
="text/css" rel
="stylesheet">
107 href
="<?php echo $GLOBALS['assets_static_relative']; ?>/bootstrap-3-3-4/dist/css/bootstrap.min.css"
108 rel
="stylesheet" type
="text/css" />
109 <?php
if ($_SESSION['language_direction'] == 'rtl') { ?
>
111 href
="<?php echo $GLOBALS['assets_static_relative']; ?>/bootstrap-rtl-3-3-4/dist/css/bootstrap-rtl.min.css"
112 rel
="stylesheet" type
="text/css" />
114 <script type
='text/javascript'
115 src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-11-3/index.js"></script
>
116 <script type
='text/javascript'
117 src
="<?php echo $GLOBALS['assets_static_relative']; ?>/bootstrap-3-3-4/dist/js/bootstrap.min.js"></script
>
118 <link rel
="stylesheet"
119 href
="<?php echo $GLOBALS['assets_static_relative']; ?>/summernote-0-8-2/dist/summernote.css" />
120 <script type
='text/javascript'
121 src
="<?php echo $GLOBALS['assets_static_relative']; ?>/summernote-0-8-2/dist/summernote.js"></script
>
122 <script type
='text/javascript'
123 src
="<?php echo $GLOBALS['assets_static_relative']; ?>/angular-1-5-8/angular.min.js"></script
>
124 <script type
='text/javascript'
125 src
="<?php echo $GLOBALS['assets_static_relative']; ?>/angular-summernote-0-8-1/dist/angular-summernote.js"></script
>
126 <script type
='text/javascript'
127 src
="<?php echo $GLOBALS['assets_static_relative']; ?>/angular-sanitize-1-5-8/angular-sanitize.min.js"></script
>
129 src
='<?php echo $GLOBALS['assets_static_relative
']; ?>/checklist-model-0-10-0/checklist-model.js'></script
>
132 <body
class="skin-blue">
133 <!-- style
='background:#f1f2f7;' -->
136 var app
= angular
.module("emrMessageApp",['ngSanitize','summernote',"checklist-model"]);
137 app
.controller('inboxCtrl', ['$scope', '$filter','$http','$window', function ($scope, $filter,$http,$window) {
138 $scope.date
= new Date
;
139 $scope.sortingOrder
= 'id';
140 $scope.pageSizes
= [5,10,20,50,100];
141 $scope.reverse
= false;
142 $scope.filteredItems
= [];
143 $scope.groupedItems
= [];
144 $scope.itemsPerPage
= 8;
145 $scope.pagedItems
= [];
147 $scope.selrecip
= [];
148 $scope.currentPage
= 0;
149 $scope.sentItems
= [];
150 $scope.allItems
= [];
151 $scope.deletedItems
= [];
152 $scope.inboxItems
= [];
153 $scope.inboxItems
= <?php
echo json_encode($theresult);?
>;
154 $scope.userproper
= "<?php echo $_SESSION['ptName'] ? $_SESSION['ptName'] : ($dashuser['fname'] . ' ' . $dashuser['lname']) ;?>";
155 $scope.isPortal
= "<?php echo IS_PORTAL;?>" ;
156 $scope.isDashboard
= "<?php echo IS_DASHBOARD ? IS_DASHBOARD : 0;?>" ;
157 $scope.cUserId
= $scope.isPortal ?
$scope.isPortal
: $scope.isDashboard
;
158 $scope.authrecips
= <?php
echo json_encode(getAuthPortalUsers());?
>;
159 $scope.compose
.task
= 'add';
161 $scope.xLate
.confirm
= [];
162 $scope.xLate
.fwd
= "<?php echo xlt('Forwarded Portal Message Re: '); ?>";
163 $scope.xLate
.confirm
.one
= "<?php echo xlt('Confirm to Delete Current Thread?'); ?>";
164 $scope.xLate
.confirm
.all
= "<?php echo xlt('Confirm to Delete Selected?'); ?>";
165 $scope.xLate
.confirm
.err
= "<?php echo xlt('You are sending to yourself!'); ?>"; // I think I got rid of this ability - look into..
167 $scope.init
= function () {
168 $http.defaults
.headers
.post
["Content-Type"] = "application/x-www-form-urlencoded";
169 $scope.getSentMessages();
170 $scope.getAllMessages();
171 $scope.getDeletedMessages();
172 $scope.isInboxSelected();
174 $scope.isInit
= true;
178 var searchMatch
= function (haystack
, needle
) {
182 return haystack
.toLowerCase().indexOf(needle
.toLowerCase()) !== -1;
186 $scope.search
= function () {
187 $scope.filteredItems
= $filter('filter')($scope.items
, function (item
) {
188 for(var attr in item
) {
189 if (searchMatch(item
[attr
], $scope.query
))
194 $scope.currentPage
= 0;
195 // now group by pages
196 $scope.groupToPages();
199 // calculate page in place
200 $scope.groupToPages
= function () {
201 $scope.selected
= null;
202 $scope.pagedItems
= [];
203 for (var i
= 0; i
< $scope.filteredItems
.length
; i++
) {
204 if (i %
$scope.itemsPerPage
=== 0) {
205 $scope.pagedItems
[Math
.floor(i
/ $scope.itemsPerPage
)] = [ $scope.filteredItems
[i
] ];
207 $scope.pagedItems
[Math
.floor(i
/ $scope.itemsPerPage
)].push($scope.filteredItems
[i
]);
212 $scope.range
= function (start
, end
) {
218 for (var i
= start
; i
< end
; i++
) {
224 $scope.prevPage
= function () {
225 if ($scope.currentPage
> 0) {
226 $scope.currentPage
--;
231 $scope.nextPage
= function () {
232 if ($scope.currentPage
< $scope.pagedItems
.length
- 1) {
233 $scope.currentPage++
;
238 $scope.setPage
= function () {
239 $scope.currentPage
= this
.n
;
242 $scope.deleteItem
= function (idx
) {
243 if( !confirm($scope.xLate
.confirm
.one
) ) return false;
244 var itemToDelete
= $scope.allItems
[idx
];
245 var idxInItems
= $scope.items
.indexOf(itemToDelete
);
246 $scope.deleteMessage(itemToDelete
.mail_chain
); // Just this user's message
247 $scope.items
.splice(idxInItems
,1);
253 $scope.batchDelete
= function ( i
) {
254 if( !confirm($scope.xLate
.confirm
.all
) ) return false;
255 var itemToDelete
= [];
256 angular
.forEach(i
, function(o
, key
) {
257 if(o
.hasOwnProperty('deleted')){
258 itemToDelete
.push($scope.items
[i
.indexOf(o
)].id
);
261 $http.post('handle_note.php', $
.param({'task':'massdelete','notejson':JSON
.stringify(itemToDelete
)}))
262 .success(function(data
, status
, headers
, config
) {
263 $window.location
.reload();
264 }).error(function(data
, status
, headers
, config
) {
270 $scope.deleteMessage
= function (id
){
271 $http.post('handle_note.php', $
.param( {'task':'delete','noteid':id
} ))
272 .success(function(data
, status
, headers
, config
) {
274 }).error(function(data
, status
, headers
, config
) {
279 $scope.isMessageSelected
= function () {
280 if (typeof
$scope.selected
!=="undefined" && $scope.selected
!==null) {
288 $scope.isSentSelected
= function () {
289 $scope.isSent
= true; $scope.isTrash
= $scope.isAll
= $scope.isInbox
= false;
291 $scope.items
= $scope.sentItems
;
296 $scope.isTrashSelected
= function () {
297 $scope.isTrash
= true; $scope.isSent
= $scope.isAll
= $scope.isInbox
= false;
299 $scope.items
= $scope.deletedItems
;
304 $scope.isInboxSelected
= function () {
305 $scope.isInbox
= true; $scope.isTrash
= $scope.isAll
= $scope.isSent
= false;
306 $scope.items
= $scope.inboxItems
;
311 $scope.isAllSelected
= function () {
312 $scope.isAll
= true; $scope.isTrash
= $scope.isSent
= $scope.isInbox
= false;
313 $scope.items
= $scope.allItems
;
318 $scope.readMessage
= function (idx
) {
319 if( $scope.items
[idx
].message_status
== 'New'){ // mark mail read else ignore
320 $http.post('handle_note.php', $
.param({'task':'setread','noteid':$scope.items
[idx
].id
}))
321 .success(function(data
, status
, headers
, config
) {
322 $scope.items
[idx
].message_status
= 'Read';
323 $scope.selected
.message_status
= 'Read';
324 }).error(function(data
, status
, headers
, config
) {
328 idx
= $filter('getById')($scope.allItems
,this
.item
.id
);
329 $scope.isAll
= true; $scope.isTrash
= $scope.isSent
= $scope.isInbox
= false;
330 $scope.items
= $scope.allItems
;
331 $scope.selected
= $scope.items
[idx
];
333 $scope.selMessage
= function (idx
) {
334 $scope.selected
= $scope.allItems
[idx
];
338 $scope.readAll
= function () {
339 for (var i in
$scope.items
) {
340 $scope.items
[i
].message_status
= 'Read';
344 $scope.closeMessage
= function () {
345 $scope.selected
= null;
348 $scope.renderMessageBody
= function(html
)
353 $scope.getInbox
= function () {
354 $http.post('handle_note.php', $
.param({'task':'getinbox','owner':$scope.cUserId
}))
355 .success(function(data
, status
, headers
, config
) {
357 $scope.inboxItems
= angular
.copy(data
);
360 }).error(function(data
, status
, headers
, config
) {
365 $scope.getAllMessages
= function () {
366 $http.post('handle_note.php', $
.param({'task':'getall','owner':$scope.cUserId
}))
367 .success(function(data
, status
, headers
, config
) {
369 $scope.allItems
= angular
.copy(data
);
372 }).error(function(data
, status
, headers
, config
) {
377 $scope.getDeletedMessages
= function () {
378 $http.post('handle_note.php', $
.param({'task':'getdeleted','owner':$scope.cUserId
}))
379 .success(function(data
, status
, headers
, config
) {
381 $scope.deletedItems
= [];
382 $scope.deletedItems
= angular
.copy(data
);
385 }).error(function(data
, status
, headers
, config
) {
390 $scope.getSentMessages
= function () {
391 $http.post('handle_note.php', $
.param({'task':'getsent','owner':$scope.cUserId
}))
392 .success(function(data
, status
, headers
, config
) {
393 $scope.sentItems
= [];
394 $scope.sentItems
= angular
.copy(data
);
395 }).error(function(data
, status
, headers
, config
) {
400 $scope.submitForm
= function(compose
){
401 $http.defaults
.headers
.post
["Content-Type"] = "application/x-www-form-urlencoded";
402 // re-enable title for submit
403 $
("#title").prop( "disabled", false )
404 $
("#selSendto").prop( "disabled", false )
406 compose
.owner
= $scope.cUserId
407 compose
.sender_id
=$scope.cUserId
408 compose
.sender_name
=$scope.userproper
409 if( $scope.selrecip
== compose
.owner
){
410 if(!confirm($scope.xLate
.confirm
.err
))
413 if( compose
.task
== 'add' ){
414 compose
.recipient_name
=$
("#selSendto option:selected").text();
416 if( compose
.task
== 'forward' ){ // Just overwrite default reply but send to pnotes.
417 compose
.sender_id
=$
("#selForwardto option:selected").val();
418 compose
.sender_name
=$
("#selForwardto option:selected").text();
419 compose
.selrecip
= compose
.recipient_id
;
422 compose
.inputBody
= $
("#inputBody").summernote('code');
424 return true; // okay to submit
427 $
('#modalCompose').on('show.bs.modal', function(e
) {
428 // Sets up the compose modal before we show it
430 $
('#inputBody').summernote('destroy');
431 var mode
= $
(e
.relatedTarget
).attr('data-mode');
432 $scope.compose
.task
= mode
;
433 if(mode
== 'forward'){
434 $
('#modalCompose .modal-header .modal-title').html("Forward Message");
435 $scope.compose
.task
= mode
;
436 var recipId
= $
(e
.relatedTarget
).attr('data-whoto');
437 var title
= $
(e
.relatedTarget
).attr('data-mtitle');
438 var uname
= $
(e
.relatedTarget
).attr('data-username');
439 $
(e
.currentTarget
).find('select[id="selSendto"]').prop( "disabled", false );
440 $
(e
.currentTarget
).find('input[name="title"]').prop( "disabled", false );
441 $scope.compose
.title
= title
;
442 $scope.compose
.selrecip
= recipId
;
443 $scope.compose
.selrecip
.username
= uname
;
444 $scope.compose
.recipient_name
= uname
;
445 $scope.compose
.recipient_id
= recipId
;
446 angular
.forEach($scope.authrecips
, function(o
, key
) {// Need the pid of patient for pnotes.
447 if(o
.userid
== recipId
){
448 $scope.compose
.pid
= o
.pid
;
451 var fmsg
= '\n\n\n> ' +
$scope.xLate
.fwd+ title +
' by ' + uname +
'\n> '+ $
("#referMsg").text();
452 $
("textarea#finputBody").text(fmsg
)
453 $scope.compose
.noteid
= $
(e
.relatedTarget
).attr('data-noteid');
455 else if(mode
== 'reply'){
456 $
('#inputBody').summernote({focus
:true,height
:'225px'});
457 $
('#modalCompose .modal-header .modal-title').html("Compose Reply Message");
458 $scope.compose
.task
= mode
;
459 //get data attributes of the clicked element (selected recipient) for replies only
460 var chain
= $
(e
.relatedTarget
).attr('data-mailchain');
461 if(chain
== '0') chain
= $
(e
.relatedTarget
).attr('data-noteid');
462 var recipId
= $
(e
.relatedTarget
).attr('data-whoto');
463 var title
= $
(e
.relatedTarget
).attr('data-mtitle');
464 var uname
= $
(e
.relatedTarget
).attr('data-username');
465 $
(e
.currentTarget
).find('select[id="selSendto"]').val(recipId
)
466 $
(e
.currentTarget
).find('input[name="title"]').val(title
);
467 // Set the modal var's
468 $scope.compose
.title
= title
;
469 $scope.compose
.selrecip
= recipId
;
470 $scope.compose
.selrecip
.username
= uname
;
471 $scope.compose
.recipient_name
= uname
;
472 $scope.compose
.recipient_id
= recipId
;
473 $scope.compose
.noteid
= chain
;
476 $
('#inputBody').summernote({focus
:true,height
:'225px'});
477 $
('#modalCompose .modal-header .modal-title').html("Compose New Message");
478 $scope.compose
.task
= 'add';
479 $
(e
.currentTarget
).find('select[id="selSendto"]').prop( "disabled", false );
480 $
(e
.currentTarget
).find('input[name="title"]').prop( "disabled", false );
482 if($scope.compose
.task
!= 'reply'){
486 $
('#modalCompose').on('shown.bs.modal', function(e
) {
489 $
('#modalCompose').on('hidden.bs.modal', function(e
){
492 // initialize application
493 if( !$scope.isInit
){
496 }]) /* end inbox functions */
497 .filter('Chained', function () {
498 return function (input
, id
) {
504 angular
.forEach(input
, function (item
) {
505 if (item
.mail_chain
== id
) {
513 .filter('getById', function() {
514 return function(input
, id
) {
515 var i
=0, len
=input
.length
;
517 if (+input
[i
].id
== +id
) {
524 .controller('messageCtrl', ['$scope', function ($scope) {
525 $scope.message
= function(idx
) {
529 }]); // end messageCtrl
531 })(); // application end
533 <ng ng
-app
="emrMessageApp">
534 <div
class="container" id
='main' style
="display: none">
535 <div
class='header logo'>
537 <img style
='width: 25%; height: auto;' class='logo'
538 src
='<?php echo $GLOBALS['images_static_relative
']; ?>/logo-full-con.png' /> <?php
echo xlt('Patient Messaging'); ?
></h2
>
540 <div
class="row" ng
-controller
="inboxCtrl">
541 <aside
class="col-md-1"
542 style
='padding: 0 0; margin: 0 0; text-align: left;'>
543 <ul
class="nav nav-pills nav-stacked"
544 style
='padding: 0 0; margin: 0 0; text-align: left;'>
545 <li data
-toggle
="pill" class="active bg-info"><a
546 href
="javascript:;" ng
-click
="isInboxSelected()"><span
547 class="badge pull-right">{{inboxItems
.length
}}</span
><?php
echo xlt('Inbox'); ?
></a
></li
>
548 <li data
-toggle
="pill" class="bg-info"><a href
="javascript:;"
549 ng
-click
="isSentSelected()"><span
class="badge pull-right">{{sentItems
.length
}}</span
><?php
echo xlt('Sent'); ?
></a
></li
>
550 <li data
-toggle
="pill" class="bg-info"><a href
="javascript:;"
551 ng
-click
="isAllSelected()"><span
class="badge pull-right">{{allItems
.length
}}</span
><?php
echo xlt('All'); ?
></a
></li
>
552 <!-- <li data
-toggle
="pill" class="bg-info"><a href
="#"><span
class="badge pull-right">0</span
><?php
//echo xlt('Drafts'); ?></a></li> -->
553 <li data
-toggle
="pill" class="bg-info"><a href
="javascript:;"
554 ng
-click
="isTrashSelected()"><span
class="badge pull-right">{{deletedItems
.length
}}</span
><?php
echo xlt('Trash'); ?
></a
></li
>
555 <li
class="pill bg-danger"><a
556 href
="<?php echo $GLOBALS['web_root']?>/portal/patient/provider"
557 ng
-show
="!isPortal"><?php
echo xlt('Exit Mail'); ?
></a
></li
>
558 <li data
-toggle
="pill" class="bg-danger"><a href
="javascript:;"
559 onclick
='window.location.replace("<?php echo $GLOBALS['web_root
']?>/portal/home.php")'
560 ng
-show
="isPortal"><?php
echo xlt('Exit'); ?
></a
></li
>
563 <div
class="col-md-11">
565 <div
class="row" ng
-show
="!isMessageSelected()">
566 <div
class="col-xs-12">
567 <a
class="btn btn-default btn-lg" data
-toggle
="tooltip"
568 title
="Refresh" id
="refreshInbox" href
="javascript:;"
569 onclick
='window.location.replace("./messages.php")'> <span
570 class="fa fa-refresh fa-lg"></span
>
572 <button
class="btn btn-default btn-lg"
573 title
="<?php echo xla("New Note
"); ?>" data
-mode
="add"
574 data
-toggle
="modal" data
-target
="#modalCompose">
575 <span
class="fa fa-edit fa-lg"></span
>
577 <div
class="btn-group btn-group pull-right">
578 <button type
="button" class="btn btn-primary dropdown-toggle"
579 data
-toggle
="dropdown">
580 <?php
echo xlt('Actions'); ?
> <span
class="caret"></span
>
582 <ul
class="dropdown-menu" role
="menu">
583 <li
><a href
="javascript:;" ng
-click
="readAll()"><?php
echo xlt('Mark all as read'); ?
></a
></li
>
584 <li
class="divider"></li
>
585 <li
><a href
="" data
-mode
="add" data
-toggle
="modal"
586 data
-target
="#modalCompose"><?php
echo xlt('Compose new'); ?
></a
></li
>
587 <li ng
-show
='!isTrash'><a href
="javascript:;"
588 ng
-click
="batchDelete(items)"><i
class="fa fa-trash-o"></i
> <?php
echo xlt('Send Selected to Trash'); ?
></a
></li
>
589 <li
><a href
="javascript:;"
590 onclick
='window.location.replace("<?php echo $GLOBALS['web_root
']?>/portal/home.php")'
591 ng
-show
="isPortal" class="text-muted"><?php
echo xlt('Return Home'); ?
></a
></li
>
593 href
="<?php echo $GLOBALS['web_root']?>/portal/patient/provider"
594 ng
-show
="!isPortal" class="text-muted"><?php
echo xlt('Return Home'); ?
></a
></li
>
599 <div
class="col-xs-12 spacer5"></div
>
602 <!--/inbox toolbar
-->
603 <div
class="panel panel-default inbox" id
="inboxPanel">
605 <div
class="table-responsive" ng
-show
="!isMessageSelected()">
607 class="table table-striped table-hover refresh-container pull-down">
608 <thead
class="bg-info hidden-xs"></thead
>
610 <tr ng
-repeat
="item in pagedItems[currentPage]">
611 <!-- | orderBy
:sortingOrder
:reverse
-->
612 <td
><span
class="col-sm-1" style
="max-width: 5px;"><input
613 type
="checkbox" checklist
-model
="item.deleted"
614 value
={{item
.deleted
}}></span
> <span
class="col-sm-1"
615 style
="max-width: 8px;"><span ng
-class="{strong: !item.read}">{{item
.id
}}</span
></span
>
616 <span
class="col-sm-1" ng
-click
="readMessage($index)"><span
617 ng
-class="{strong: !item.read}">{{item
.message_status
}}</span
></span
>
618 <span
class="col-sm-2" ng
-click
="readMessage($index)"><span
619 ng
-class="{strong: !item.read}">{{item
.date |
620 date
:'yyyy-MM-dd hh:mm'}}</span
></span
> <span
621 class="col-sm-3" ng
-click
="readMessage($index)"><span
622 ng
-class="{strong: !item.read}">{{item
.sender_name
}} to
623 {{item
.recipient_name
}}</span
></span
> <span
class="col-sm-1"
624 ng
-click
="readMessage($index)"><span
625 ng
-class="{strong: !item.read}">{{item
.title
}}</span
></span
>
626 <span
class="col-sm-4" ng
-click
="readMessage($index)"><span
627 ng
-class="{strong: !item.read}"
628 ng
-bind
-html
='(renderMessageBody(item.body)| limitTo:35)'></span
></span
>
629 <!-- <span
class="col-sm-1 " ng
-click
="readMessage($index)"><span ng
-show
="item.attachment"
630 class="glyphicon glyphicon-paperclip pull-right"></span
> <span ng
-show
="item.priority==1"
631 class="pull-right glyphicon glyphicon-warning-sign text-danger"></span
></span
> -->
637 <!--message detail
-->
638 <div
class="container-fluid" ng
-show
="isMessageSelected()">
639 <div
class="row" ng
-controller
="messageCtrl">
640 <!-- <div
class="col-xs-12">
642 <button type
="button" class="btn btn-danger btn-sm pull-right" ng
-click
="closeMessage()"><?php
//echo xlt('Back'); ?></button>
643 <a href
="javascript:;" ng
-click
="groupToPages()"><?php
//echo xlt('This Conversation'); ?></a> > {{selected.title}}
646 <div
class="col-md-9">
647 <blockquote
class="bg-warning">
648 <a href
="javascript:;" ng
-click
="groupToPages()"><?php
echo xlt('Conversation'); ?
></a
>
649 <span
><?php
//echo xlt('Seleted Message id'); ?>
650 <!-- :{{selected
.id
}} --> <?php
echo xlt('from'); ?
> </span
> <strong
>{{selected
.sender_name
}}</strong
>
651 <?php
echo xlt('regarding'); ?
> {{selected
.title
}} <?php
echo xlt('on'); ?
> <
;{{selected
.date | date
:'yyyy-MM-dd hh:mm'}}>
;
654 <div
class="col-md-3">
655 <div
class="btn-group btn-group pull-right">
656 <button ng
-show
="selected.sender_id != cUserId"
657 class="btn btn-primary"
658 title
="<?php echo xla('Reply to this message'); ?>"
659 data
-toggle
="modal" data
-mode
="reply"
660 data
-noteid
={{selected
.id
}} data
-whoto
={{selected
.sender_id
}}
661 data
-mtitle
={{selected
.title
}}
662 data
-username
={{selected
.sender_name
}}
663 data
-mailchain
={{selected
.mail_chain
}}
664 data
-target
="#modalCompose">
665 <i
class="fa fa-reply"></i
> <?php
echo xlt('Reply'); ?
></button
>
666 <button
class="btn btn-primary dropdown-toggle"
667 data
-toggle
="dropdown"
668 title
="<?php echo xla("More options
"); ?>">
669 <i
class="fa fa-angle-down"></i
>
671 <ul
class="dropdown-menu pull-right">
673 <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>
674 <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>
675 <li
><a href
="javascript:;"><i
class="fa fa-print"></i
> <?php
//echo xlt('Print'); ?></a></li>
677 <li
class="divider"></li
>
678 <li ng
-show
='!isTrash'><a href
="javascript:;"
679 ng
-click
="batchDelete(items)"><i
class="fa fa-trash-o"></i
> <?php
echo xlt('Send to Trash'); ?
></a
></li
>
682 <div
class="spacer5 pull-right"></div
>
683 <button ng
-show
='!isTrash'
684 class="btn btn-md btn-primary pull-right"
685 ng
-click
="deleteItem(items.indexOf(selected))"
686 title
="<?php echo xla('Delete this message'); ?>"
687 data
-toggle
="tooltip">
688 <i
class="fa fa-trash-o fa-1x"></i
>
691 <div
class="table-responsive col-sm-12 col-md-12">
692 <table
class="table table-striped refresh-container pull-down">
693 <thead
><?php
//echo xlt('Associated Notes.');?></thead>
695 <tr
class="animate-repeat"
696 ng
-repeat
="item in allItems | Chained:selected.mail_chain">
698 <!-- 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
> -->
699 <span
class="col-sm-1" style
="max-width: 8px;"><span
700 ng
-class="{strong: !item.read}">{{item
.id
}}</span
></span
> <span
701 class="col-sm-2" ng
-click
="readMessage($index)"><span
>{{item
.date
702 | date
:'yyyy-MM-dd hh:mm'}}</span
></span
> <span
703 class="col-sm-1" ng
-click
="readMessage($index)"><span
>{{item
.message_status
}}</span
></span
>
704 <span
class="col-sm-3" ng
-click
="readMessage($index)"><span
>{{item
.sender_name
}}
705 to
{{item
.recipient_name
}}</span
></span
> <span
706 class="col-sm-1" ng
-click
="readMessage($index)"><span
>{{item
.title
}}</span
></span
>
707 <span
class="col-sm-4" ng
-click
="readMessage($index)"><span
708 ng
-bind
-html
='(renderMessageBody(item.body) | limitTo:35)'></span
></span
>
709 <span
class='pull-right' ng
-show
=" !isPortal">
711 ng
-show
="selected.id == item.id && selected.sender_id != cUserId"
712 class="btn btn-primary btn-xs"
713 title
="<?php echo xla('Forward message to practice.'); ?>"
714 data
-toggle
="modal" data
-mode
="forward"
715 data
-noteid
={{selected
.id
}}
716 data
-whoto
={{selected
.sender_id
}}
717 data
-mtitle
={{selected
.title
}}
718 data
-username
={{selected
.sender_name
}}
719 data
-mailchain
={{selected
.mail_chain
}}
720 data
-target
="#modalCompose">
721 <i
class="fa fa-mail-forward"></i
>
724 <div
class='col-sm-10 well' ng
-show
="selected.id == item.id"
725 style
='margin: 5px 5px; padding: 5px 5px; border-color: red; background: white;'>
726 <span ng
-bind
-html
=renderMessageBody(selected
.body
)></span
>
739 <div
class="well well-s text-right">
740 <em
>Inbox last updated
: <span id
="lastUpdated">{{date |
741 date
:'MM-dd-yyyy HH:mm:ss'}}</span
></em
>
744 <div
class="pull-right" ng
-hide
="selected">
745 <span
class="text-muted"><b
>{{(itemsPerPage
* currentPage
) +
1}}</b
>~
<b
>{{(itemsPerPage
746 * currentPage
) + pagedItems
[currentPage
].length
}}</b
> of
<b
>{{items
.length
}}</b
></span
>
747 <div
class="btn-group btn-group">
748 <button type
="button" class="btn btn-default btn-lg"
749 ng
-class="{disabled: currentPage == 0}" ng
-click
="prevPage()">
750 <span
class="glyphicon glyphicon-chevron-left"></span
>
752 <button type
="button" class="btn btn-default btn-lg"
753 ng
-class="{disabled: currentPage == pagedItems.length - 1}"
754 ng
-click
="nextPage()">
755 <span
class="glyphicon glyphicon-chevron-right"></span
>
761 <!-- /.modal compose message
-->
762 <div
class="modal fade" id
="modalCompose">
763 <div
class="modal-dialog modal-lg">
764 <div
class="modal-content">
765 <div
class="modal-header">
766 <button type
="button" class="close" data
-dismiss
="modal"
767 aria
-hidden
="true">X
</button
>
768 <h4
class="modal-title"><?php
echo xlt('Compose Message'); ?
></h4
>
770 <div
class="modal-body ">
771 <div
class="row container-fluid">
772 <label ng
-show
='selected.mail_chain'><?php
echo xlt('Refer to Message') . ' # ';?
>{{selected
.id
}}</label
>
773 <div
class="well well-sm col-12-md" id
="referMsg"
774 ng
-show
='selected.mail_chain'
775 style
='margin: 5px 5px; padding: 5px 5px; border-color: red; background: white;'
776 class='well well-lg row'
777 ng
-bind
-html
=renderMessageBody(selected
.body
)></div
>
779 <form role
="form" class="form-horizontal"
780 ng
-submit
="submitForm(compose)" name
="fcompose" id
="fcompose"
781 method
="post" action
="./handle_note.php">
783 <div
class="form-group">
784 <label
class="col-sm-1 col-md-1" for="selSendto"><?php
echo xlt('To'); ?
></label
>
785 <div
class="col-sm-3 col-md-3">
786 <select
class="form-control" id
="selForwardto"
787 ng
-hide
="compose.task != 'forward'"
788 ng
-model
="compose.selrecip"
789 ng
-options
="recip.userid as recip.username for recip in authrecips | filter:type = 'user' track by recip.userid"></select
>
790 <select
class="form-control" id
="selSendto"
791 ng
-hide
="compose.task == 'forward'"
792 ng
-model
="compose.selrecip"
793 ng
-options
="recip.userid as recip.username for recip in authrecips track by recip.userid"></select
>
796 <div
class="form-group">
797 <label
class="col-sm-1 col-md-1" for="title"><?php
echo xlt('Subject'); ?
></label
>
798 <div
class="col-sm-6 col-md-6">
799 <input type
='text' list='listid' name
='title' id
='title'
800 class="form-control" ng
-model
='compose.title'>
801 <datalist id
='listid'>
802 <option
><?php
echo xlt('Unassigned'); ?
></option
>
803 <option label
='<?php echo xlt('Insurance
'); ?>'
804 value
='<?php echo xlt('Insurance
'); ?>' />
805 <option label
='<?php echo xlt('Prior Auth
'); ?>'
806 value
='<?php echo xlt('Prior Auth
'); ?>' />
807 <option label
='<?php echo xlt('Bill
/Collect
'); ?>'
808 value
='<?php echo xlt('Bill
/Collect
'); ?>' />
809 <option label
='<?php echo xlt('Referral
'); ?>'
810 value
='<?php echo xlt('Referral
'); ?>' />
811 <option label
='<?php echo xlt('Pharmacy
'); ?>'
812 value
='<?php echo xlt('Pharmacy
'); ?>' />
816 <div
class="col-sm-12 col-md-12" id
="inputBody"
817 ng
-hide
="compose.task == 'forward'"
818 ng
-model
="compose.inputBody"></div
>
819 <textarea
class="col-sm-12 col-md-12" id
="finputBody" rows
="8"
820 ng
-hide
="compose.task != 'forward'"
821 ng
-model
="compose.inputBody"></textarea
>
823 <input type
='hidden' name
='noteid' id
='noteid'
824 ng
-value
="compose.noteid" /> <input type
='hidden'
825 name
='replyid' id
='replyid'
826 ng
-value
='selected.reply_mail_chain' /> <input type
='hidden'
827 name
='owner' ng
-value
='compose.owner' /> <input type
='hidden'
828 name
='recipient_id' ng
-value
='compose.selrecip' /> <input
829 type
='hidden' name
='recipient_name'
830 ng
-value
='compose.recipient_name' /> <input type
='hidden'
831 name
='sender_id' ng
-value
='compose.sender_id' /> <input
832 type
='hidden' name
='sender_name'
833 ng
-value
='compose.sender_name' /> <input type
='hidden'
834 name
='task' ng
-value
='compose.task' /> <input type
='hidden'
835 name
='inputBody' ng
-value
='compose.inputBody' /> <input
836 type
='hidden' name
='pid' ng
-value
='compose.pid' />
837 <div
class='modal-footer'>
838 <button type
="button" class="btn btn-default"
839 data
-dismiss
="modal"><?php
echo xlt('Cancel'); ?
></button
>
840 <button type
="submit" id
="submit" name
="submit"
841 class="btn btn-primary pull-right" value
="messages.php"><?php
echo xlt('Send'); ?
> <i
842 class="fa fa-arrow-circle-right fa-lg"></i
>
849 <!-- /.modal
-content
-->
851 <!-- /.modal
-dialog
-->
853 <!-- /.modal compose message
-->
855 <!--/row ng
-controller
-->
857 <!--/container
--> </ng
>