PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / serworkdays / tmpl / default.php
vikappointments / admin / views / serworkdays / tmpl Last commit date
default.php 3 months ago index.html 4 years ago
default.php
298 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 JHtml::fetch('bootstrap.tooltip', '.hasTooltip');
15 JHtml::fetch('formbehavior.chosen');
16 JHtml::fetch('vaphtml.assets.fontawesome');
17
18 $rows = $this->rows;
19 $navbut = $this->navbut;
20
21 $filters = $this->filters;
22
23 $employees = $this->employees;
24
25 $config = VAPFactory::getConfig();
26
27 $date_format = $config->get('dateformat');
28 $time_format = $config->get('timeformat');
29
30 $vik = VAPApplication::getInstance();
31
32 $canEdit = JFactory::getUser()->authorise('core.edit', 'com_vikappointments');
33
34 $date = JFactory::getDate();
35
36 $is_searching = $this->hasFilters();
37
38 ?>
39
40 <form action="index.php?option=com_vikappointments" method="post" name="adminForm" id="adminForm">
41
42 <div class="btn-toolbar" style="height: 32px;">
43
44 <div class="btn-group pull-left">
45 <?php
46 $options = array();
47
48 foreach ($employees as $e)
49 {
50 $options[] = JHtml::fetch('select.option', $e->id, $e->nickname);
51 }
52 ?>
53 <select name="id_employee" id="vap-employee-sel" onChange="document.adminForm.submit();">
54 <?php echo JHtml::fetch('select.options', $options, 'value', 'text', $filters['id_employee']); ?>
55 </select>
56 </div>
57
58 <div class="btn-group pull-left">
59 <button type="button" class="btn <?php echo ($is_searching ? 'btn-primary' : ''); ?>" onclick="vapToggleSearchToolsButton(this);">
60 <?php echo JText::translate('JSEARCH_TOOLS'); ?>&nbsp;<i class="fas fa-caret-<?php echo ($is_searching ? 'up' : 'down'); ?>" id="vap-tools-caret"></i>
61 </button>
62 </div>
63
64 <div class="btn-group pull-left">
65 <button type="button" class="btn" onclick="clearFilters();">
66 <?php echo JText::translate('JSEARCH_FILTER_CLEAR'); ?>
67 </button>
68 </div>
69
70 </div>
71
72 <div class="btn-toolbar" id="vap-search-tools" style="height: 32px;<?php echo ($is_searching ? '' : 'display: none;'); ?>">
73
74 <div class="btn-group pull-left">
75 <?php
76 $options = array();
77 $options[] = JHtml::fetch('select.option', -1, JText::translate('VAPFILTERSELECTTYPE'));
78 $options[] = JHtml::fetch('select.option', 1, JText::translate('VAPWDLEGENDLABEL1'));
79 $options[] = JHtml::fetch('select.option', 2, JText::translate('VAPWDLEGENDLABEL2'));
80 ?>
81 <select name="type" id="vap-type-sel" class="<?php echo ($filters['type'] != -1 ? 'active' : ''); ?>" onChange="document.adminForm.submit();">
82 <?php echo JHtml::fetch('select.options', $options, 'value', 'text', $filters['type']); ?>
83 </select>
84 </div>
85
86 <div class="btn-group pull-left">
87 <?php
88 $options = array();
89 $options[] = JHtml::fetch('select.option', -1, JText::translate('VAPFILTERSELECTSTATUS'));
90 $options[] = JHtml::fetch('select.option', 1, JText::translate('VAPMANAGEWD5'));
91 $options[] = JHtml::fetch('select.option', 0, JText::translate('VAPMANAGEEMPLOYEE22'));
92 ?>
93 <select name="status" id="vap-status-sel" class="<?php echo ($filters['status'] != -1 ? 'active' : ''); ?>" onChange="document.adminForm.submit();">
94 <?php echo JHtml::fetch('select.options', $options, 'value', 'text', $filters['status']); ?>
95 </select>
96 </div>
97
98 <div class="btn-group pull-left">
99 <?php echo $vik->calendar($filters['date'], 'date', 'vap-date', null, array('onChange' => 'document.adminForm.submit();')); ?>
100 </div>
101
102 </div>
103
104 <?php
105 if (count($rows) == 0)
106 {
107 $url = 'index.php?option=com_vikappointments&amp;task=employee.edit&amp;cid[]=' . $filters['id_employee'] . '#employee_workdays';
108
109 if (!$is_searching)
110 {
111 // no active filters, display tip to create new working times
112 echo $vik->alert(
113 '<div>' . JText::translate('JGLOBAL_NO_MATCHING_RESULTS') . '</div>'
114 . '<a href="' . $url . '" target="_blank">' . JText::translate('VAPSERWDLINKTO') . '</a>'
115 );
116 }
117 else
118 {
119 // no active filters, display tip to create new working times
120 echo $vik->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'));
121 }
122 }
123 else
124 {
125 ?>
126 <table cellpadding="4" cellspacing="0" border="0" width="100%" class="<?php echo $vik->getAdminTableClass(); ?>">
127 <?php echo $vik->openTableHead(); ?>
128 <tr>
129
130 <th width="1%">
131 <?php echo $vik->getAdminToggle(count($rows)); ?>
132 </th>
133
134 <!-- DAY -->
135
136 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="30%" style="text-align: left;">
137 <?php echo JText::translate('VAPMANAGEWD2'); ?>
138 </th>
139
140 <!-- PARENT -->
141
142 <th class="<?php echo $vik->getAdminThClass(); ?>" width="10%" style="text-align: center;">
143 &nbsp;
144 </th>
145
146 <!-- FROM -->
147
148 <th class="<?php echo $vik->getAdminThClass(); ?>" width="15%" style="text-align: center;">
149 <?php echo JText::translate('VAPMANAGEWD3'); ?>
150 </th>
151
152 <!-- TO -->
153
154 <th class="<?php echo $vik->getAdminThClass(); ?>" width="15%" style="text-align: center;">
155 <?php echo JText::translate('VAPMANAGEWD4'); ?>
156 </th>
157
158 <!-- STATUS -->
159
160 <th class="<?php echo $vik->getAdminThClass(); ?>" width="10%" style="text-align: center;">
161 <?php echo JText::translate('VAPMANAGEWD5'); ?>
162 </th>
163
164 </tr>
165 <?php echo $vik->closeTableHead(); ?>
166
167 <?php
168 for ($i = 0, $n = count($rows); $i < $n; $i++)
169 {
170 $row = $rows[$i];
171
172 if ($row['ts'] == -1)
173 {
174 // weekly
175 $day = $date->dayToString($row['day']);
176 }
177 else
178 {
179 // recurring
180 $day = JHtml::fetch('date', $row['ts'], JText::translate('DATE_FORMAT_LC1'), date_default_timezone_get());
181 }
182 ?>
183 <tr class="row<?php echo ($i % 2); ?>">
184
185 <td>
186 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['id']; ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
187 </td>
188
189 <!-- DAY -->
190
191 <td>
192 <div class="td-primary">
193 <?php
194 if ($canEdit)
195 {
196 ?>
197 <a href="index.php?option=com_vikappointments&amp;task=serworkday.edit&amp;cid[]=<?php echo $row['id']; ?>">
198 <?php echo $day; ?>
199 </a>
200 <?php
201 }
202 else
203 {
204 echo $day;
205 }
206 ?>
207 </div>
208 </td>
209
210 <!-- PARENT -->
211
212 <td style="text-align: center;">
213 <?php
214 if ($row['parent'] > 0)
215 {
216 $icon = 'link';
217 $tooltip = JText::translate('VAPMANAGEWD_LINK');
218 }
219 else
220 {
221 $icon = 'unlink';
222 $tooltip = JText::translate('VAPMANAGEWD_UNLINK');
223 }
224 ?>
225
226 <i class="fas fa-<?php echo $icon; ?> big hasTooltip" title="<?php echo $this->escape($tooltip); ?>"></i>
227 </td>
228
229 <!-- FROM -->
230
231 <td style="text-align: center;">
232 <?php
233 if ($row['closed'])
234 {
235 echo '/';
236 }
237 else
238 {
239 echo JHtml::fetch('vikappointments.min2time', $row['fromts'], $string = true);
240 }
241 ?>
242 </td>
243
244 <!-- TO -->
245
246 <td style="text-align: center;">
247 <?php
248 if ($row['closed'])
249 {
250 echo '/';
251 }
252 else
253 {
254 echo JHtml::fetch('vikappointments.min2time', $row['endts'], $string = true);
255 }
256 ?>
257 </td>
258
259 <!-- STATUS -->
260
261 <td style="text-align: center;">
262 <?php echo JHtml::fetch('vaphtml.admin.stateaction', !$row['closed']); ?>
263 </td>
264
265 </tr>
266 <?php
267 }
268 ?>
269 </table>
270 <?php
271 }
272 ?>
273
274 <input type="hidden" name="task" value="" />
275 <input type="hidden" name="view" value="serworkdays" />
276 <input type="hidden" name="boxchecked" value="0" />
277 <input type="hidden" name="id_service" value="<?php echo $filters['id_service']; ?>" />
278
279 <?php echo JHtml::fetch('form.token'); ?>
280 <?php echo $this->navbut; ?>
281 </form>
282
283 <script>
284
285 jQuery(function($) {
286 VikRenderer.chosen('.btn-toolbar');
287 });
288
289 function clearFilters() {
290 jQuery('#vap-type-sel').updateChosen(-1);
291 jQuery('#vap-status-sel').updateChosen(-1);
292 jQuery('#vap-date').val('');
293
294 document.adminForm.submit();
295 }
296
297 </script>
298