PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / employees / tmpl / default.php
vikappointments / admin / views / employees / tmpl Last commit date
default.php 4 days ago index.html 4 days ago
default.php
477 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('behavior.modal');
15 JHtml::fetch('formbehavior.chosen');
16
17 $rows = $this->rows;
18
19 $filters = $this->filters;
20
21 $vik = VAPApplication::getInstance();
22
23 $multi_lang = VikAppointments::isMultilanguage();
24
25 $config = VAPFactory::getConfig();
26
27 $user = JFactory::getUser();
28
29 $canEdit = $user->authorise('core.edit', 'com_vikappointments');
30 $canEditState = $user->authorise('core.edit.state', 'com_vikappointments');
31
32 $lifetime_label = JText::translate('VAPSUBSCRTYPE5');
33
34 $dt_format = $config->get('dateformat') . ' ' . $config->get('timeformat');
35
36 $is_searching = $this->hasFilters();
37
38 /**
39 * Trigger event to display custom HTML.
40 * In case it is needed to include any additional fields,
41 * it is possible to create a plugin and attach it to an event
42 * called "onDisplayViewEmployeesList". The event method receives the
43 * view instance as argument.
44 *
45 * @since 1.6.6
46 */
47 $forms = $this->onDisplayListView($is_searching);
48
49 ?>
50
51 <form action="index.php?option=com_vikappointments" method="post" name="adminForm" id="adminForm">
52
53 <div class="btn-toolbar" style="height: 32px;">
54 <div class="btn-group pull-left input-append">
55 <input type="text" name="keys" id="vapkeysearch" size="32"
56 value="<?php echo $this->escape($filters['keys']); ?>" placeholder="<?php echo $this->escape(JText::translate('JSEARCH_FILTER_SUBMIT')); ?>" />
57
58 <button type="submit" class="btn">
59 <i class="fas fa-search"></i>
60 </button>
61 </div>
62
63 <!-- Define role to detect the supported hook -->
64 <!-- {"rule":"customizer","event":"onDisplayViewEmployeesList","type":"search","key":"search"} -->
65
66 <?php
67 // plugins can use the "search" key to introduce custom
68 // filters within the search bar
69 if (isset($forms['search']))
70 {
71 echo $forms['search'];
72 }
73 ?>
74
75 <div class="btn-group pull-left">
76 <button type="button" class="btn <?php echo ($is_searching ? 'btn-primary' : ''); ?>" onclick="vapToggleSearchToolsButton(this);">
77 <?php echo JText::translate('JSEARCH_TOOLS'); ?>&nbsp;<i class="fas fa-caret-<?php echo ($is_searching ? 'up' : 'down'); ?>" id="vap-tools-caret"></i>
78 </button>
79 </div>
80
81 <div class="btn-group pull-left">
82 <button type="button" class="btn" onclick="clearFilters();">
83 <?php echo JText::translate('JSEARCH_FILTER_CLEAR'); ?>
84 </button>
85 </div>
86
87 </div>
88
89 <div class="btn-toolbar" id="vap-search-tools" style="height: 32px;<?php echo ($is_searching ? '' : 'display: none;'); ?>">
90
91 <?php
92 $options = array(
93 JHtml::fetch('select.option', '', 'JOPTION_SELECT_PUBLISHED'),
94 JHtml::fetch('select.option', 1, 'JPUBLISHED'),
95 JHtml::fetch('select.option', 0, 'JUNPUBLISHED'),
96 );
97 ?>
98 <div class="btn-group pull-left">
99 <select name="status" id="vap-status-sel" class="<?php echo (strlen($filters['status']) ? 'active' : ''); ?>" onchange="document.adminForm.submit();">
100 <?php echo JHtml::fetch('select.options', $options, 'value', 'text', $filters['status'], true); ?>
101 </select>
102 </div>
103
104 <?php
105 $options = array(
106 JHtml::fetch('select.option', -1, JText::translate('VAPFILTERSELECTGROUP')),
107 JHtml::fetch('select.option', 0, JText::translate('VAPSERVICENOGROUP')),
108 );
109
110 $options = array_merge($options, JHtml::fetch('vaphtml.admin.groups', 2));
111 ?>
112 <div class="btn-group pull-left">
113 <select name="id_group" id="vap-group-sel" class="<?php echo ($filters['id_group'] != -1 ? 'active' : ''); ?>" onchange="document.adminForm.submit();">
114 <?php echo JHtml::fetch('select.options', $options, 'value', 'text', $filters['id_group']); ?>
115 </select>
116 </div>
117
118 <!-- Define role to detect the supported hook -->
119 <!-- {"rule":"customizer","event":"onDisplayViewEmployeesList","type":"search","key":"filters"} -->
120
121 <?php
122 // plugins can use the "filters" key to introduce custom
123 // filters within the search bar
124 if (isset($forms['filters']))
125 {
126 echo $forms['filters'];
127 }
128 ?>
129
130 </div>
131
132 <?php
133 if (count($rows) == 0)
134 {
135 echo $vik->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'));
136 }
137 else
138 {
139 /**
140 * Trigger event to display custom columns.
141 *
142 * @since 1.7
143 */
144 $columns = $this->onDisplayTableColumns();
145 ?>
146
147 <!-- Define role to detect the supported hook -->
148 <!-- {"rule":"customizer","event":"onDisplayEmployeesTableTH","type":"th"} -->
149
150 <!-- Define role to detect the supported hook -->
151 <!-- {"rule":"customizer","event":"onDisplayEmployeesTableTD","type":"td"} -->
152
153 <table cellpadding="4" cellspacing="0" border="0" width="100%" class="<?php echo $vik->getAdminTableClass(); ?>">
154
155 <?php echo $vik->openTableHead(); ?>
156 <tr>
157
158 <th width="1%">
159 <?php echo $vik->getAdminToggle(count($rows)); ?>
160 </th>
161
162 <!-- ID -->
163
164 <th class="<?php echo $vik->getAdminThClass('left hidden-phone nowrap'); ?>" width="1%" style="text-align: left;">
165 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEEMPLOYEE1', 'e.id', $this->orderDir, $this->ordering); ?>
166 </th>
167
168 <!-- NAME -->
169
170 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="15%" style="text-align: left;">
171 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEEMPLOYEE4', 'e.nickname', $this->orderDir, $this->ordering); ?>
172 </th>
173
174 <!-- CONTACTS -->
175
176 <th class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>" width="15%" style="text-align: left;">
177 <?php echo JText::translate('VAPCONTACT'); ?>
178 </th>
179
180 <!-- CUSTOM -->
181
182 <?php
183 foreach ($columns as $k => $col)
184 {
185 ?>
186 <th data-id="<?php echo $this->escape($k); ?>" class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>">
187 <?php echo $col->th; ?>
188 </th>
189 <?php
190 }
191 ?>
192
193 <!-- GROUP -->
194
195 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="15%" style="text-align: center;">
196 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEEMPLOYEE26', 'g.name', $this->orderDir, $this->ordering); ?>
197 </th>
198
199 <!-- SERVICES -->
200
201 <th class="<?php echo $vik->getAdminThClass(); ?>" width="6%" style="text-align: center;">
202 <?php echo JText::translate('VAPMENUSERVICES'); ?>
203 </th>
204
205 <!-- PAYMENTS -->
206
207 <?php
208 if ($user->authorise('core.access.payments', 'com_vikappointments'))
209 {
210 ?>
211 <th class="<?php echo $vik->getAdminThClass(); ?>" width="6%" style="text-align: center;">
212 <?php echo JText::translate('VAPMANAGEEMPLOYEE21'); ?>
213 </th>
214 <?php
215 }
216 ?>
217
218 <!-- LOCATIONS -->
219
220 <?php
221 if ($user->authorise('core.access.locations', 'com_vikappointments'))
222 {
223 ?>
224 <th class="<?php echo $vik->getAdminThClass(); ?>" width="6%" style="text-align: center;">
225 <?php echo JText::translate('VAPMANAGEEMPLOYEE29'); ?>
226 </th>
227 <?php
228 }
229 ?>
230
231 <!-- LISTABLE -->
232
233 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="6%" style="text-align: center;">
234 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEEMPLOYEE18', 'e.listable', $this->orderDir, $this->ordering); ?>
235 </th>
236
237 <!-- LANGUAGES -->
238
239 <?php
240 if ($multi_lang && $canEdit)
241 {
242 ?>
243 <th class="<?php echo $vik->getAdminThClass(); ?>" width="6%" style="text-align: center;">
244 <?php echo JText::translate('VAPLANGUAGES');?>
245 </th>
246 <?php
247 }
248 ?>
249
250 <!-- IMAGE -->
251
252 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="6%" style="text-align: center;">
253 <?php echo JText::translate('VAPMANAGEEMPLOYEE7'); ?>
254 </th>
255
256 </tr>
257 <?php echo $vik->closeTableHead(); ?>
258
259 <?php
260 for ($i = 0, $n = count($rows); $i < $n; $i++)
261 {
262 $row = $rows[$i];
263
264 $listable_title = $lifetime_label;
265
266 if ($row['active_to'] > 0)
267 {
268 $listable_title = date($dt_format, $row['active_to']);
269 }
270
271 ?>
272 <tr class="row<?php echo ($i % 2); ?>">
273
274 <td>
275 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['id']; ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
276 </td>
277
278 <!-- ID -->
279
280 <td class="hidden-phone">
281 <?php echo $row['id']; ?>
282 </td>
283
284 <!-- NAME -->
285
286 <td>
287 <div class="td-primary">
288 <?php
289 if ($canEdit)
290 {
291 ?>
292 <a href="index.php?option=com_vikappointments&amp;task=employee.edit&amp;cid[]=<?php echo $row['id']; ?>">
293 <?php echo $row['nickname']; ?>
294 </a>
295 <?php
296 }
297 else
298 {
299 echo $row['nickname'];
300 }
301 ?>
302 </div>
303 </td>
304
305 <!-- CONTACT -->
306
307 <td class="hidden-phone">
308 <div class="td-primary">
309 <?php echo $row['email']; ?>
310 </div>
311
312 <div class="td-secondary">
313 <?php echo $row['phone']; ?>
314 </div>
315 </td>
316
317 <!-- CUSTOM -->
318
319 <?php
320 foreach ($columns as $k => $col)
321 {
322 ?>
323 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
324 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
325 </td>
326 <?php
327 }
328 ?>
329
330 <!-- GROUP -->
331
332 <td style="text-align: center;" class="hidden-phone">
333 <?php
334 if ($row['id_group'] > 0)
335 {
336 if ($canEdit && $user->authorise('core.access.groups', 'com_vikappointments'))
337 {
338 ?>
339 <a href="index.php?option=com_vikappointments&amp;task=group.edit&amp;type=2&amp;cid[]=<?php echo $row['id_group']; ?>">
340 <?php echo $row['gname']; ?>
341 </a>
342 <?php
343 }
344 else
345 {
346 echo $row['gname'];
347 }
348 }
349 else
350 {
351 echo '/';
352 }
353 ?>
354 </td>
355
356 <!-- SERVICES -->
357
358 <td style="text-align: center;">
359 <a href="index.php?option=com_vikappointments&amp;view=emprates&amp;cid[]=<?php echo $row['id']; ?>">
360 <i class="fas fa-project-diagram big"></i>
361 </a>
362 </td>
363
364 <!-- PAYMENTS -->
365
366 <?php
367 if ($user->authorise('core.access.payments', 'com_vikappointments'))
368 {
369 ?>
370 <td style="text-align: center;">
371 <a href="index.php?option=com_vikappointments&amp;view=payments&amp;id_employee=<?php echo $row['id']; ?>">
372 <i class="fas fa-credit-card big"></i>
373 </a>
374 </td>
375 <?php
376 }
377 ?>
378
379 <!-- LOCATIONS -->
380
381 <?php
382 if ($user->authorise('core.access.locations', 'com_vikappointments'))
383 {
384 ?>
385 <td style="text-align: center;">
386 <a href="index.php?option=com_vikappointments&amp;view=locations&amp;id_employee=<?php echo $row['id']; ?>">
387 <i class="fas fa-map-marker-alt big"></i>
388 </a>
389 </td>
390 <?php
391 }
392 ?>
393
394 <!-- LISTABLE -->
395
396 <td style="text-align: center;" class="hidden-phone">
397 <?php echo JHtml::fetch('vaphtml.admin.stateaction', $row['listable'], $row['id'], 'employee.listable', $canEditState); ?>
398 </td>
399
400 <!-- LANGUAGES -->
401
402 <?php
403 if ($multi_lang && $canEdit)
404 {
405 ?>
406 <td style="text-align: center;">
407 <a href="index.php?option=com_vikappointments&amp;view=langemployees&amp;id_employee=<?php echo $row['id']; ?>">
408 <?php
409 foreach ($row['languages'] as $lang)
410 {
411 echo ' ' . JHtml::fetch('vaphtml.site.flag', $lang) . ' ';
412 }
413 ?>
414 </a>
415 </td>
416 <?php
417 }
418 ?>
419
420 <!-- IMAGE -->
421
422 <td style="text-align: center;" class="hidden-phone">
423 <?php echo JHtml::fetch('vaphtml.admin.imagestatus', $row['image']); ?>
424 </td>
425 </tr>
426
427 <?php } ?>
428
429 </table>
430
431 <?php } ?>
432
433 <!-- hidden input for import tool -->
434 <input type="hidden" name="import_type" value="employees" />
435
436 <input type="hidden" name="boxchecked" value="0" />
437 <input type="hidden" name="task" value="" />
438 <input type="hidden" name="view" value="employees" />
439 <input type="hidden" name="from" value="employees" />
440
441 <input type="hidden" name="filter_order" value="<?php echo $this->ordering; ?>" />
442 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDir; ?>" />
443
444 <?php echo JHtml::fetch('form.token'); ?>
445 <?php echo $this->navbut; ?>
446 </form>
447
448 <script>
449
450 (function($) {
451 'use strict';
452
453 window['clearFilters'] = () => {
454 $('#vapkeysearch').val('');
455 $('#vap-status-sel').updateChosen('');
456 $('#vap-group-sel').updateChosen(-1);
457
458 document.adminForm.submit();
459 }
460
461 $(function() {
462 VikRenderer.chosen('.btn-toolbar');
463
464 Joomla.submitbutton = function(task) {
465 if (task == 'reportsemp' || task == 'import' || task == 'export') {
466 // populate view instead of task
467 document.adminForm.view.value = task;
468 task = '';
469 }
470
471 Joomla.submitform(task, document.adminForm);
472 }
473 });
474 })(jQuery);
475
476 </script>
477