3 * interface/therapy_groups/therapy_groups_views/listGroups.php contains the group list view .
5 * In this view all therapy groups are listed with their details and links to their details screen.
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
require 'header.php'; ?
>
28 <span
class="hidden title"><?php
echo xlt('Therapy Group Finder');?
></span
>
29 <div id
="therapy_groups_list_container" class="container">
31 <!--------- ERRORS
----------->
32 <?php
if($deletion_try == 1 && $deletion_response['success'] == 0) :?
>
34 <div
class="col-md-6 col-md-offset-3">
35 <div
class="alert alert-danger text-center">
36 <p
class="failed_message"><?php
echo xlt($deletion_response['message']);?
></p
>
42 <!---------- FILTERS SECTION
------------->
43 <button id
="clear_filters" class="btn"><?php
echo xlt("Clear Filters")?
></button
>
47 <div
class=" form-group col-md-2">
48 <label
class="" for="group_name_filter"><?php
echo xlt('Group Name');?
>:</label
>
49 <input type
="text" class="form-control" id
="group_name_filter" placeholder
="" >
51 <div
class=" form-group col-md-2">
52 <label
class="" for="group_id_filter"><?php
echo xlt('Group Id');?
>:</label
>
53 <input type
="number" class="form-control" id
="group_id_filter" placeholder
="" >
55 <div
class=" form-group col-md-2">
56 <label
class="" for="group_type_filter"><?php
echo xlt('Group Type');?
>:</label
>
57 <select type
="text" class="form-control" id
="group_type_filter" placeholder
="" >
58 <option value
=""><?php
echo xlt('choose');?
></option
>
59 <?php
foreach ($group_types as $type):?
>
60 <option value
="<?php echo attr($type);?>"><?php
echo text($type) ;?
></option
>
64 <div
class=" form-group col-md-2">
65 <label
class="" for="group_status_filter"><?php
echo xlt('Status');?
>:</label
>
66 <select type
="text" class="form-control" id
="group_status_filter" placeholder
="" >
67 <option value
="<?php echo attr($statuses[10]); ?>"><?php
echo xlt($statuses[10]);?
></option
>
68 <?php
foreach ($statuses as $status):?
>
69 <?php
if($status != $statuses[10]): ?
>
70 <option value
="<?php echo attr($status);?>"><?php
echo xlt($status) ;?
></option
>
73 <option value
="all"><?php
echo xlt("all");?
></option
>
76 <div
class=" form-group col-md-2">
77 <label
class="" for="counselors_filter"><?php
echo xlt('Main Counselors');?
>:</label
>
78 <select type
="text" class="form-control" id
="counselors_filter" placeholder
="" >
79 <option value
=""><?php
echo xlt('choose');?
></option
>
80 <?php
foreach ($counselors as $counselor):?
>
81 <option value
="<?php echo attr($counselor);?>"><?php
echo text($counselor) ;?
></option
>
87 <div
class=" form-group col-md-2">
88 <label
class="" for="group_from_start_date_filter"><?php
echo xlt('Starting Date From');?
>:</label
>
89 <input type
="text" class="form-control datepicker" id
="group_from_start_date_filter" placeholder
="" >
91 <div
class=" form-group col-md-2">
92 <label
class="" for="group_to_start_date_filter"><?php
echo xlt('Starting Date To');?
>:</label
>
93 <input type
="text" class="form-control datepicker" id
="group_to_start_date_filter" placeholder
="" >
95 <div
class=" form-group col-md-2">
96 <label
class="" for="group_from_end_date_filter"><?php
echo xlt('End Date From');?
>:</label
>
97 <input type
="text" class="form-control datepicker" id
="group_from_end_date_filter" placeholder
="" >
99 <div
class=" form-group col-md-2">
100 <label
class="" for="group_to_end_date_filter"><?php
echo xlt('End Date To');?
>:</label
>
101 <input type
="text" class="form-control datepicker" id
="group_to_end_date_filter" placeholder
="" >
106 <!---------- END OF FILTERS SECTION
------------->
110 <!---------- TABLE SECTION
-------------->
112 <table id
="therapy_groups_list" class="dataTable display">
115 <th
><?php
echo xlt('Group Name'); ?
></th
>
116 <th
><?php
echo xlt('Group Id'); ?
></th
>
117 <th
><?php
echo xlt('Group Type'); ?
></th
>
118 <th
><?php
echo xlt('Status'); ?
></th
>
119 <th
><?php
echo xlt('Start Date'); ?
></th
>
120 <th
><?php
echo xlt('End Date'); ?
></th
>
121 <th
><?php
echo xlt('Main Counselors'); ?
></th
>
122 <th
><?php
echo xlt('Comment'); ?
></th
>
123 <th
><?php
echo xlt('Delete'); ?
></th
>
127 <?php
foreach ($therapyGroups as $group) : ?
>
129 <td
><a href
="<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupDetails&group_id=' . attr($group['group_id']); ?>"><?php
echo text($group['group_name']);?
></a
></td
>
130 <td
><?php
echo text($group['group_id']);?
></td
>
131 <td
><?php
echo xlt($group_types[$group['group_type']]);?
></td
>
132 <td
><?php
echo xlt($statuses[$group['group_status']]);?
></td
>
133 <td
><?php
echo text(oeFormatShortDate($group['group_start_date']));?
></td
>
134 <td
><?php
echo ($group['group_end_date'] == '0000-00-00' OR $group['group_end_date'] == '00-00-0000' OR empty($group['group_end_date'])) ?
'' : text(oeFormatShortDate($group['group_end_date'])); ?
></td
>
136 <?php
foreach ($group['counselors'] as $counselor){
137 echo text($counselor) . " </br> ";
140 <td
><?php
echo text($group['group_notes']);?
></td
>
141 <td
class="delete_btn">
143 //Enable deletion only for groups that weren't yet deleted.
144 if($group['group_status'] == 10): ?
>
145 <a href
="<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=listGroups&deleteGroup=1&group_id=' . attr($group['group_id']); ?>"><button
>X
</button
></a
></td
>
154 <!---------- END OF TABLE SECTION
-------------->
161 /* ========= Initialise Data Table & Filters ========= */
162 $
(document
).ready(function() {
164 // var lang = '<?php //echo $lang ?>//';//get language support for filters
166 /* Initialise Date Picker */
167 $
('.datepicker').datetimepicker({
168 <?php
$datetimepicker_timepicker = false; ?
>
169 <?php
$datetimepicker_showseconds = false; ?
>
170 <?php
$datetimepicker_formatInput = true; ?
>
171 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
172 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
175 /* Initialise Datatable */
176 var table
= $
('#therapy_groups_list').DataTable({
177 initComplete
: function () {
178 $
('#therapy_groups_list_filter').hide(); //hide searchbar
180 <?php
// Bring in the translations ?>
181 <?php
$translationsDatatablesOverride = array('lengthMenu'=>(xla('Display').' _MENU_ '.xla('records per page')),
182 'zeroRecords'=>(xla('Nothing found - sorry')),
183 'info'=>(xla('Showing page') .' _PAGE_ '. xla('of') . ' _PAGES_'),
184 'infoEmpty'=>(xla('No records available')),
185 'infoFiltered'=>('('.xla('filtered from').' _MAX_ '.xla('total records').')'),
188 <?php
require($GLOBALS['srcdir'] . '/js/xl/datatables-net.js.php'); ?
>
191 /* Order by Start Date column (descending) */
192 table
.order( [ 4, 'desc' ] ).draw();
194 /* Hide/Show filters */
195 $
("#show_filters").click(function () {
196 $
('#filters').show();
197 $
("#hide_filters").show();
198 $
("#show_filters").hide();
201 $
("#hide_filters").click(function () {
202 $
('#filters').hide();
203 $
("#hide_filters").hide();
204 $
("#show_filters").show();
207 /* ------------ Toggle filter functions on keyup/change ----------- */
210 * Note: where there is an explicit extension made for the filter, just table.draw() was used.
211 * Otherwise 'table.columns( ).search( this.value ).draw();' was used.
215 /* ---- Datetimepickers ---- */
216 $
('#group_from_start_date_filter').change( function() {
219 $
('#group_to_start_date_filter').change( function() {
223 $
('#group_from_end_date_filter').change( function() {
226 $
('#group_to_end_date_filter').change( function() {
230 /* --- Text inputs --- */
231 $
('#group_name_filter').keyup( function() {
234 $
('#group_id_filter').keyup( function() {
238 /* ---- Select Boxes ---- */
239 $
('#group_type_filter').change(function () {
240 table
.columns( 2 ).search( this
.value
).draw();
243 $
('#group_status_filter').change( function() {
247 $
('#counselors_filter').change( function() {
248 table
.columns( 6 ).search( this
.value
).draw();
251 /* ----------------- End of filter toggles -------------------- */
254 /* --------- Reset Filters ------ */
255 $
('#clear_filters').click(function(){
256 top
.restoreSession();
261 /* Bring in the DateToYYYYMMDD_js function */
262 <?php
require($GLOBALS['srcdir'] . '/formatting_DateToYYYYMMDD_js.js.php'); ?
>
264 /* ========= End Of Data Table & Filters Initialisation ========= */
266 /* ======= DATATABLE FILTER EXTENSIONS ======== */
268 /* Extension for distribution date */
269 $
.fn
.dataTableExt
.afnFiltering
.push(
270 function( oSettings
, aData
, iDataIndex
) {
272 if(document
.getElementById('group_from_start_date_filter').value
=== ""){
273 var iFini
= document
.getElementById('group_from_start_date_filter').value
;
276 var iFini
= new Date(DateToYYYYMMDD_js(document
.getElementById('group_from_start_date_filter').value
));
279 if(document
.getElementById('group_to_start_date_filter').value
=== ""){
280 var iFfin
= document
.getElementById('group_to_start_date_filter').value
;
283 var iFfin
= new Date(DateToYYYYMMDD_js(document
.getElementById('group_to_start_date_filter').value
));
286 var iStartDateCol
= 4;
289 var datofini
= new Date(DateToYYYYMMDD_js(aData
[iStartDateCol
]));
290 var datoffin
= new Date(DateToYYYYMMDD_js(aData
[iEndDateCol
]));
293 if ( iFini
=== "" && iFfin
=== "" )
297 else if ( iFini
<= datofini
&& iFfin
=== "")
301 else if ( iFfin
>= datoffin
&& iFini
=== "")
305 else if (iFini
<= datofini
&& iFfin
>= datoffin
)
313 /* Extension for Irregular approval date */
314 $
.fn
.dataTableExt
.afnFiltering
.push(
315 function( oSettings
, aData
, iDataIndex
) {
317 if(document
.getElementById('group_from_end_date_filter').value
=== ""){
318 var iFini
= document
.getElementById('group_from_end_date_filter').value
;
321 var iFini
= new Date(DateToYYYYMMDD_js(document
.getElementById('group_from_end_date_filter').value
));
324 if(document
.getElementById('group_to_end_date_filter').value
=== ""){
325 var iFfin
= document
.getElementById('group_to_end_date_filter').value
;
328 var iFfin
= new Date(DateToYYYYMMDD_js(document
.getElementById('group_to_end_date_filter').value
));
331 var iStartDateCol
= 5;
336 var datofini
= new Date(DateToYYYYMMDD_js(aData
[iStartDateCol
]));
337 var datoffin
= new Date(DateToYYYYMMDD_js(aData
[iEndDateCol
]));
340 if ( iFini
=== "" && iFfin
=== "" )
344 else if ( iFini
<= datofini
&& iFfin
=== "")
348 else if ( iFfin
>= datoffin
&& iFini
=== "")
352 else if (iFini
<= datofini
&& iFfin
>= datoffin
)
360 /* Extension for group name */
361 $
.fn
.dataTableExt
.afnFiltering
.push(
362 function( oSettings
, aData
, iDataIndex
) {
364 var iVal
= document
.getElementById('group_name_filter').value
;
365 var iVersion
= aData
[iColumn
] == "-" ?
0 : aData
[iColumn
];
367 if(iVal
=== "" || iVal
== 0){
370 else if(iVersion
.indexOf(iVal
) != -1){
377 /* Extension for group id */
378 $
.fn
.dataTableExt
.afnFiltering
.push(
379 function( oSettings
, aData
, iDataIndex
) {
381 var iVal
= document
.getElementById('group_id_filter').value
;
382 var iVersion
= aData
[iColumn
] == "-" ?
0 : aData
[iColumn
];
384 if(iVal
=== "" || iVal
== 0){
387 else if(iVersion
.indexOf(iVal
) != -1){
394 /* Extension for group status */
395 $
.fn
.dataTableExt
.afnFiltering
.push(
396 function( settings
, data
, dataIndex
) {
397 var status_selected
= $
("#group_status_filter").val()||
'';
398 var status
= data
[3] ||
'';
399 if(status_selected
=='' || status_selected
== 'all'){
402 if(status
==status_selected
)
409 /* ========= END OF EXTENSIONS ============= */
414 <?php
require 'footer.php'; ?
>