translation constant fixes (#1514)
[openemr.git] / interface / therapy_groups / therapy_groups_views / groupDetailsGeneralData.php
blob2e73053a23b5722b1863ada5782036aa22541d65
1 <?php
2 /**
3 * interface/therapy_groups/therapy_groups_views/groupDetailsGeneralData.php contains group details view .
5 * This is the therapy group 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>;.
21 * @package OpenEMR
22 * @author Shachar Zilbershlag <shaharzi@matrix.co.il>
23 * @author Amiel Elboim <amielel@matrix.co.il>
24 * @link http://www.open-emr.org
29 <?php $edit = acl_check("groups", "gadd", false, 'write');?>
30 <?php $edit_encounter = acl_check("groups", "glog", false, 'write');?>
31 <?php $view = acl_check("groups", "gadd", false, 'view');?>
34 <?php require 'header.php'; ?>
35 <?php if ($view || $edit) :?>
37 <main id="group-details">
38 <div class="container-group">
39 <span class="hidden title"><?php echo text($groupData['group_name']);?></span>
40 <div class="row">
41 <div id="main-component" class="col-md-8 col-sm-12">
42 <div class="row">
43 <div class="col-md-8 col-sm-12">
44 <ul class="tabNav">
45 <li class="current"><a href="<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupDetails&group_id=' . attr($groupData['group_id']); ?>"><?php echo xlt('General data');?></a></li>
46 <li><a href="<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupParticipants&group_id=' . attr($groupData['group_id']); ?>"><?php echo xlt('Participants ');?></a></li>
47 </ul>
48 </div>
49 <div class="col-md-4 col-sm-4">
50 <?php if ($edit) :?>
51 <?php if ($edit_encounter) :?>
52 <button onclick="newGroup()"><?php echo xlt('Add encounter'); ?></button>
53 <?php endif;?>
54 <?php if ($readonly == '') : ?>
55 <button class="float-right" onclick="location.href='<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupDetails&group_id=' . attr($groupData['group_id']); ?>'"><?php echo xlt('Cancel');?></button>
56 <button id="saveUpdates" class="float-right"><?php echo xlt('Save');?></button>
57 <?php else : ?>
58 <button class="float-right" onclick="location.href='<?php echo $GLOBALS['rootdir'] . '/therapy_groups/index.php?method=groupDetails&editGroup=1&group_id=' . attr($groupData['group_id']); ?>'"><?php echo xlt('Update');?></button>
59 <?php endif; ?>
60 <?php endif;?>
61 </div>
62 </div>
63 <div class="row">
64 <div class="col-md-12">
65 <div id="component-border">
66 <form method="post" id='editGroup' name="editGroup">
67 <input type="hidden" name="group_id" value="<?php echo isset($groupData['group_id']) ? attr($groupData['group_id']) : '';?>">
68 <div class="row group-row">
69 <div class="col-md-6 col-sm-7">
70 <div class="row">
71 <div class="col-md-4 col-sm-5">
72 <span class="bold"><?php echo xlt("Group's name") ?>:</span>
73 </div>
74 <div class="col-md-8 col-sm-7">
75 <input type="text" name="group_name" class="full-width" value="<?php echo attr($groupData['group_name']);?>" <?php echo $readonly; ?>>
76 </div>
77 </div>
78 </div>
79 <div class="col-md-2 col-sm-3">
80 <span class="bold"><?php echo xlt('Group number') ?>:</span>
81 <span ><?php echo text($groupData['group_id'])?></span>
82 </div>
83 <div class="col-md-4">
84 <div class="row">
85 <div class="col-md-6 col-sm-6 attach-input">
86 <span class="bold"><?php echo xlt('Status'); ?>:</span>
87 </div>
88 <div class="col-md-6 col-sm-6">
89 <select name="group_status" class="full-width" value="<?php echo attr($groupData['group_status']);?>" <?php echo $readonly; ?>>
90 <?php foreach ($statuses as $key => $status) : ?>
91 <option value="<?php echo attr($key);?>" <?php echo $key == $groupData['group_status'] ? 'selected' : ''; ?>><?php echo xlt($status); ?></option>
92 <?php endforeach; ?>
93 </select>
94 </div>
95 </div>
96 </div>
97 </div>
98 <div class="row group-row">
99 <div class="col-md-6">
100 <span class="bold"><?php echo xlt('Type of group'); ?>:</span>
101 <label class="radio-inline radio-pos">
102 <input type="radio" value="1" name="group_type" <?php echo is_null($groupData['group_type']) || $groupData['group_type'] == '1' ? 'checked' : '';?> <?php echo $readonly; ?>><?php echo xlt('Closed'); ?>
103 </label>
104 <label class="radio-inline radio-pos">
105 <input type="radio" value="2" name="group_type" <?php echo $groupData['group_type'] == '2' ? 'checked' : '';?> <?php echo $readonly; ?>><?php echo xlt('Open'); ?>
106 </label>
107 <label class="radio-inline radio-pos">
108 <input type="radio" value="3" name="group_type" <?php echo $groupData['group_type'] == '3' ? 'checked' : '';?> <?php echo $readonly; ?>><?php echo xlt('Train'); ?>
109 </label>
110 </div>
111 <div class="col-md-6">
112 <span class="bold"><?php echo xlt('Obligatory participation'); ?>:</span>
113 <label class="radio-inline radio-pos">
114 <input type="radio" value="1" name="group_participation" <?php echo is_null($groupData['group_participation']) || $groupData['group_participation'] == '1' ? 'checked' : '';?> <?php echo $readonly; ?>><?php echo xlt('Mandatory'); ?>
115 </label>
116 <label class="radio-inline radio-pos">
117 <input type="radio" value="2" name="group_participation" <?php echo $groupData['group_participation'] == '2' ? 'checked' : '';?> <?php echo $readonly; ?>><?php echo xlt('Optional'); ?>
118 </label>
119 </div>
120 </div>
121 <div class="row group-row">
122 <div class="col-md-6 col-sm-6">
123 <div class="row">
124 <div class="col-md-5 col-sm-6">
125 <span class="bold"><?php echo xlt('Starting date'); ?>:</span>
126 </div>
127 <div class="col-md-offset1 col-md-6 col-sm-6">
128 <input type="text" name="group_start_date" class="full-width datepicker" value="<?php echo attr(oeFormatShortDate($groupData['group_start_date']));?>" <?php echo $readonly; ?>>
129 </div>
130 </div>
131 </div>
132 <div class="col-md-6 col-sm-6">
133 <div class="row">
134 <div class="col-md-5 col-sm-6">
135 <span class="bold"><?php echo xlt('Ending date'); ?>:</span>
136 </div>
137 <div class="col-md-6 col-sm-6">
138 <input type="text" name="group_end_date" class="full-width datepicker" value="<?php echo $groupData['group_end_date'] == '0000-00-00' ? '' : attr(oeFormatShortDate($groupData['group_end_date'])) ;?>" <?php echo $readonly; ?>>
139 </div>
140 </div>
141 </div>
142 </div>
143 <div class="row group-row">
144 <div class="col-md-6">
145 <div class="row">
146 <div class="col-md-4 col-sm-5">
147 <span class="bold"><?php echo xlt('Main Counselors'); ?>:</span>
148 </div>
149 <div class="col-md-8 col-sm-7">
150 <select name="counselors[]" multiple class="full-width" <?php echo $readonly; ?>>
151 <?php foreach ($users as $user) : ?>
152 <option value="<?php echo attr($user['id']);?>" <?php echo !is_null($groupData['counselors']) && in_array($user['id'], $groupData['counselors']) ? 'selected' : '';?>><?php echo text($user['fname'] . ' ' . $user['lname']);?></option>
153 <?php endforeach; ?>
154 </select>
155 </div>
156 </div>
157 </div>
158 <div class="col-md-6">
159 <div class="row">
160 <div class="col-md-3 col-sm-5">
161 <span class="bold"><?php echo xlt('Notes'); ?>:</span>
162 </div>
163 <div class="col-md-9 col-sm-7">
164 <textarea name="group_notes" class="full-width" style="height: 70px" <?php echo $readonly; ?>><?php echo text($groupData['group_notes']);?></textarea>
165 </div>
166 </div>
167 </div>
168 </div>
169 <div class="row group-row">
170 <div class="col-md-8">
171 <div class="row">
172 <div class="col-md-4 col-sm-5">
173 <span class="bold"><?php echo xlt('Guest counselors'); ?>:</span>
174 </div>
175 <div class="col-md-8 col-sm-7">
176 <input type="text" name="group_guest_counselors" class="full-width" value="<?php echo attr($groupData['group_guest_counselors']);?>" <?php echo $readonly; ?>>
177 </div>
178 </div>
179 </div>
180 </div>
181 <div class="row group-row">
182 <div class="col-md-9 col-sm 12">
183 <?php if ($savingStatus == 'exist') : ?>
184 <div id="exist-group"><h4 class="group-error-msg"><?php echo text($message) ?></h4> <?php if ($edit) :
185 ?><button id="cancel-save"><?php echo xlt('cancel') ?></button><button type="submit" value="save_anyway" name="save"><?php echo xlt('Creating anyway') ?></button><?php
186 endif;?></div>
187 <?php endif ?>
188 <?php if ($savingStatus == 'success') : ?>
189 <h4 class="group-success-msg"><?php echo text($message) ?></h4>
190 <?php endif ?>
191 <?php if ($savingStatus == 'failed') : ?>
192 <h4 class="group-serror-msg"><?php echo text($message) ?></h4>
193 <?php endif ?>
194 </div>
195 </div>
196 </form>
197 </div>
198 </div>
199 </div>
200 </div>
201 <div id="appointment-component" class="col-md-2 col-sm-12">
202 <?php require 'appointmentComponent.php';?>
203 </div>
204 </div>
205 </div>
206 </main>
207 <script>
208 $(document).ready(function(){
209 $('.datepicker').datetimepicker({
210 <?php $datetimepicker_timepicker = false; ?>
211 <?php $datetimepicker_showseconds = false; ?>
212 <?php $datetimepicker_formatInput = true; ?>
213 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
214 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
217 $('#cancel-save').on('click', function(e){
218 e.preventDefault();
219 $('#exist-group').hide();
222 $('#saveUpdates').on('click', function () {
223 $('#editGroup').append('<input type="hidden" name="save">').submit();
226 function refreshme() {
227 top.restoreSession();
228 location.href = "<?php echo $GLOBALS['webroot'] . '/interface/therapy_groups/index.php?method=groupDetails&group_id='. attr($groupId) ?>";
231 function newGroup(){
232 <?php if ($GLOBALS['new_tabs_layout']) : ?>
233 top.restoreSession();
234 parent.left_nav.loadFrame('gcv4','enc','forms/newGroupEncounter/new.php?autoloaded=1&calenc=')
235 <?php else : ?>
236 top.restoreSession();
237 top.frames['RBot'].location = '<?php echo $GLOBALS['web_root'] . "/interface/" ?>' + 'forms/newGroupEncounter/new.php?autoloaded=1&calenc=';
238 <?php endif; ?>
241 parent.left_nav.setTherapyGroup(<?php echo attr($groupData['group_id'])?>,'<?php echo attr($groupData['group_name'])?>');
242 <?php if (!$GLOBALS['new_tabs_layout']) : ?>
243 top.restoreSession();
244 parent.left_nav.loadFrame('enc2', 'RBot', '/patient_file/history/encounters.php');
245 $(parent.Title.document.getElementById('clear_active')).hide();
246 <?php endif;?>
247 /* show the encounters menu in the title menu (code like interface/forms/newGroupEncounter/save.php) */
248 <?php
249 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_groups_encounter AS fe ".
250 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.group_id = ? order by fe.date desc", array( $groupData['group_id']));
253 EncounterDateArray=new Array;
254 CalendarCategoryArray=new Array;
255 EncounterIdArray=new Array;
256 Count=0;
257 <?php
258 if (sqlNumRows($result4)>0) {
259 while ($rowresult4 = sqlFetchArray($result4)) {
261 EncounterIdArray[Count]='<?php echo attr($rowresult4['encounter']); ?>';
262 EncounterDateArray[Count]='<?php echo attr(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date'])))); ?>';
263 CalendarCategoryArray[Count]='<?php echo attr(xl_appt_category($rowresult4['pc_catname'])); ?>';
264 Count++;
265 <?php
269 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
270 </script>
271 <?php $use_validate_js = 1;?>
272 <?php validateUsingPageRules($_SERVER['PHP_SELF'] . '?method=groupDetails');?>
273 <?php require 'footer.php'; ?>
275 <?php else :?>
277 <div class="container">
279 <div class="row alert alert-info">
280 <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>
281 </div>
282 </div>
286 <?php endif;?>