3 * interface/therapy_groups/therapy_groups_views/groupDetailsParticipants.php contains group participants details view .
5 * This is the therapy group's participants detail screen for the chosen group.
7 * Copyright (C) 2016 Shachar Zilbershlag <shaharzi@matrix.co.il>
8 * Copyright (C) 2016 Amiel Elboim <amielel@matrix.co.il>
10 * LICENSE: This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 3
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @author Shachar Zilbershlag <shaharzi@matrix.co.il>
23 * @author Amiel Elboim <amielel@matrix.co.il>
24 * @link http://www.open-emr.org
27 <?php
$edit = acl_check("groups","gadd",false, 'write');?
>
28 <?php
$edit_encounter = acl_check("groups","glog",false, 'write');?
>
29 <?php
$view = acl_check("groups","gadd",false, 'view');?
>
31 <?php
require 'header.php'; ?
>
32 <?php
if($view ||
$edit) :?
>
33 <main id
="group-details">
34 <div
class="container-group">
35 <span
class="hidden title"><?php
echo text($groupName);?
></span
>
37 <div id
="main-component" class="col-md-8 col-sm-12">
39 <div
class="col-md-8 col-sm-12">
41 <li
><a href
="<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupDetails&group_id=' . attr($groupId); ?>"><?php
echo xlt('General data');?
></a
></li
>
42 <li
class="current"><a href
="<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupParticipants&group_id=' . attr($groupId); ?>"><?php
echo xlt('Participants ');?
></a
></li
>
45 <div
class="col-md-4 col-sm-4">
47 <?php
if($edit_encounter):?
>
48 <button onclick
="newGroup()"><?php
echo xlt('Add encounter'); ?
></button
>
50 <?php
if($readonly == ''): ?
>
51 <button
class="float-right" onclick
="location.href='<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupParticipants&group_id=' . attr($groupId); ?>'"><?php
echo xlt('Cancel');?
></button
>
52 <button id
="saveForm" class="float-right"><?php
echo xlt('Save');?
></button
>
54 <button
class="float-right" onclick
="location.href='<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupParticipants&editParticipants=1&group_id=' . attr($groupId); ?>'"><?php
echo xlt('Update');?
></button
>
60 <div
class="col-md-12">
61 <div id
="component-border">
63 <form id
="add-participant-form" name
="add-participant-form" class="<?php echo isset($addStatus) ? 'showAddForm' : '' ?>" action
="<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=addParticipant&group_id=' . attr($groupId)?>" method
="post">
64 <input type
="hidden" id
="pid" name
="pid" value
="<?php echo !is_null($participant_data) ? attr($participant_data['pid']): ''?>">
65 <div
class="col-md-12">
67 <div
class="col-md-offset-1 col-md-5">
69 <div
class="col-md-4">
70 <span
class="bold"><?php
echo xlt("Participant's name"); ?
>:</span
>
72 <div
class="col-md-8">
73 <input type
="text" id
="participant_name" name
="participant_name" class="full-width" value
="<?php echo !is_null($participant_data) ? attr($participant_data['participant_name']): ''?>" readonly
>
77 <div
class="col-md-5">
79 <div
class="col-md-4">
80 <span
class="bold"><?php
echo xlt('Date of registration'); ?
>:</span
>
82 <div
class="col-md-8">
83 <input type
="text" id
="group_patient_start" name
="group_patient_start" class="full-width datepicker" value
="<?php echo !is_null($participant_data) ? attr(oeFormatShortDate($participant_data['group_patient_start'])): oeFormatShortDate(date('Y-m-d'));?>">
89 <div
class="col-md-offset-1 col-md-2">
90 <span
class="bold"><?php
echo xlt('Comment'); ?
>:</span
>
92 <div
class="col-md-8">
93 <input type
="text" id
="group_patient_comment" name
="group_patient_comment" value
="<?php echo !is_null($participant_data) ? attr($participant_data['group_patient_comment']): ''?>" class="full-width">
97 <div
class="col-md-offset-4 col-md-4 text-center">
99 <input type
="submit" name
="save_new" value
="<?php echo xla('Adding a participant'); ?>">
100 <input id
="cancelAddParticipant" type
="button" value
="<?php echo xla('Cancel'); ?>">
104 <?php
if(isset($message)): ?
>
106 <div
class="col-md-offset-2 col-md-8">
107 <p
class="<?php echo $addStatus == 'failed' ? 'groups-error-msg' : 'groups-success-msg' ?>"><?php
echo text($message)?
></p
>
112 <div
class="col-md-12">
120 <div
class="col-md-12">
121 <form id
="updateParticipants" method
="post">
122 <input type
="hidden" name
="group_id" value
="<?php echo attr($groupId); ?>" />
124 <button id
="addParticipant"><?php
echo xlt('Add'); ?
></button
>
126 <table id
="participants_table" class="dataTable display">
129 <th
><?php
echo xlt("Participant's name"); ?
></th
>
130 <th
><?php
echo xlt("Patient's number"); ?
></th
>
131 <th
><?php
echo xlt('Status in the group'); ?
></th
>
132 <th
><?php
echo xlt('Date of registration'); ?
></th
>
133 <th
><?php
echo xlt('Date of exit'); ?
></th
>
134 <th
><?php
echo xlt('Comment'); ?
></th
>
135 <?php
if($readonly == ''): ?
>
136 <th
><?php
echo xlt('Delete'); ?
></th
>
141 <?php
foreach ($participants as $i => $participant) : ?
>
144 <input type
="hidden" name
="pid[]" value
="<?php echo htmlspecialchars($participant['pid'],ENT_QUOTES); ?>" />
145 <span
><?php
echo text($participant['lname']) .', ' . text($participant['fname']); ?
></span
>
147 <td
><span
><?php
echo text($participant['pid']); ?
></span
></td
>
149 <select name
="group_patient_status[]" <?php
echo $readonly; ?
>>
150 <?php
foreach ($statuses as $key => $status): ?
>
151 <option value
="<?php echo attr($key);?>" <?php
if($key == $participant['group_patient_status']) echo 'selected'; ?
> > <?php
echo text($status); ?
> </option
>
155 <td
><input type
="text" name
="group_patient_start[]" id
="start-date<?php echo $i+1?>" class="datepicker" value
="<?php echo attr(oeFormatShortDate($participant['group_patient_start']));?>" <?php
echo $readonly; ?
>></td
>
156 <td
><input type
="text" name
="group_patient_end[]" id
="end-date<?php echo $i+1?>" class="datepicker" value
="<?php echo $participant['group_patient_end'] == '0000-00-00' ? '' : attr(oeFormatShortDate($participant['group_patient_end'])) ;?>" <?php
echo $readonly; ?
>></td
>
157 <td
><input type
="text" name
="group_patient_comment[]" class="full-width" value
="<?php echo attr($participant['group_patient_comment']);?>" <?php
echo $readonly; ?
> /></td
>
158 <?php
if($readonly == ''): ?
>
159 <td
class="delete_btn">
160 <a href
="<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupParticipants&group_id='. attr($groupId) .'&deleteParticipant=1&pid=' . attr($participant['pid']); ?>"><span
>X
</span
></a
>
174 <div id
="appointment-component" class="col-md-4 col-sm-12">
175 <?php
require 'appointmentComponent.php';?
>
181 $
(document
).ready(function(){
182 $
('.datepicker').datetimepicker({
183 <?php
$datetimepicker_timepicker = false; ?
>
184 <?php
$datetimepicker_showseconds = false; ?
>
185 <?php
$datetimepicker_formatInput = true; ?
>
186 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
187 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
190 var table
= $
('#participants_table').DataTable({
192 { "width": "35%", "targets": 5 }
195 "order": [[ 0, "asc" ],[ 2, "desc" ]],
197 <?php
// Bring in the translations ?>
198 <?php
$translationsDatatablesOverride = array('lengthMenu'=>(xla('Display').' _MENU_ '.xla('records per page')),
199 'zeroRecords'=>(xla('Nothing found - sorry')),
200 'info'=>(xla('Showing page') .' _PAGE_ '. xla('of') . ' _PAGES_'),
201 'infoEmpty'=>(xla('No records available')),
202 'infoFiltered'=>('('.xla('filtered from').' _MAX_ '.xla('total records').')'),
205 <?php
require($GLOBALS['srcdir'] . '/js/xl/datatables-net.js.php'); ?
>
207 var countRows
=table
.rows().count();
208 console
.log(countRows
);
210 // validation on submit -
211 // 1. start date not empty
212 // 2. end date not smaller than start date
213 $
('#updateParticipants').on('submit', function(e
){
215 for(var i
= 1; i
<= countRows
; i++
){
217 if($
('#start-date'+i
).val() == ''){
219 $
('#start-date'+i
).addClass('error-border').after('<p class="error-message" id="error-start-date' + i +
'" ><?php echo xlt('is not valid
');?></p>');
220 $
('#start-date'+i
).on('focus', function(){
221 $
(this
).removeClass('error-border');
222 $
('#error-start-date' + i
).hide();
224 return e
.preventDefault();
226 if(typeof $
('#end-date'+i
).val() == 'string'){
227 if(moment($
('#end-date'+i
).val()).isBefore($
('#start-date'+i
).val())){
228 $
('#end-date'+i
).addClass('error-border').after('<p class="error-message" id="error-end-date' + i +
'" ><?php echo xlt('End date must be equal
or bigger than start date
');?></p>');
229 $
('#end-date'+i
).on('focus', function(){
230 $
(this
).removeClass('error-border');
231 $
('#error-end-date' + i
).hide();
233 return e
.preventDefault();
239 $
('#saveForm').on('click', function () {
240 top
.restoreSession();
241 $
('#updateParticipants').append('<input type="hidden" name="save">').submit();
244 $
('#addParticipant').on('click', function(e
){
246 if(!$
('#add-participant-form').hasClass('showAddForm')){
247 $
('#add-participant-form').addClass('showAddForm');
249 $
('#add-participant-form').removeClass('showAddForm');
252 $
('#cancelAddParticipant').on('click', function(e
){
254 $
('#add-participant-form').removeClass('showAddForm');
255 $
('#participant_name').val('');
256 $
('#group_patient_comment').val('');
257 $
('#group_patient_start').val('<?php echo date('Y
-m
-d
');?>');
260 $
('#participant_name').on('click', function(){
261 top
.restoreSession();
262 var url
= '<?php echo $GLOBALS['webroot
']?>/interface/main/calendar/find_patient_popup.php';
263 dlgopen(url
, '_blank', 500, 400);
268 function setpatient(pid
, lname
, fname
, dob
){
271 $
('#participant_name').val(fname +
" " + lname
);
274 function refreshme() {
275 top
.restoreSession();
276 location
.href
= "<?php echo $GLOBALS['webroot'] . '/interface/therapy_groups/index.php?method=groupParticipants&group_id='. attr($groupId) ?>";
280 <?php
if ($GLOBALS['new_tabs_layout']) : ?
>
281 top
.restoreSession();
282 parent
.left_nav
.loadFrame('gcv4','enc','forms/newGroupEncounter/new.php?autoloaded=1&calenc=')
284 top
.restoreSession();
285 top
.frames
['RBot'].location
= '<?php echo $GLOBALS['web_root
'] . "/interface/" ?>' +
'forms/newGroupEncounter/new.php?autoloaded=1&calenc=';
288 // parent.left_nav.setTherapyGroup(<?php echo attr($group_id);?>,'<?php echo 'test'?>');
289 /* show the encounters menu in the title menu (code like interface/forms/newGroupEncounter/save.php) */
291 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_groups_encounter AS fe ".
292 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.group_id = ? order by fe.date desc", array($groupId));
295 EncounterDateArray
=new Array;
296 CalendarCategoryArray
=new Array;
297 EncounterIdArray
=new Array;
300 if(sqlNumRows($result4)>0)
301 while($rowresult4 = sqlFetchArray($result4))
304 EncounterIdArray
[Count
]='<?php echo attr($rowresult4['encounter
']); ?>';
305 EncounterDateArray
[Count
]='<?php echo attr(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date
'])))); ?>';
306 CalendarCategoryArray
[Count
]='<?php echo attr(xl_appt_category($rowresult4['pc_catname
'])); ?>';
311 top
.window
.parent
.left_nav
.setPatientEncounter(EncounterIdArray
,EncounterDateArray
,CalendarCategoryArray
);
314 <?php
$use_validate_js = 1;?
>
315 <?php
validateUsingPageRules($_SERVER['PHP_SELF'] . '?method=groupParticipants');?
>
316 <script src
="<?php echo $GLOBALS['webroot']?>/library/dialog.js"></script
>
317 <?php
require 'footer.php'; ?
>
321 <div
class="container">
323 <div
class="row alert alert-info">
324 <h1
class="col-md-12"><i
class="col-md-3 glyphicon glyphicon-alert"></i
><span
class="col-md-6"><?php
echo xlt("access not allowed");?
></span
></h1
>