PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.20
VikAppointments Services Booking Calendar v1.2.20
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / site / views / employeeslist / tmpl / default_toolbar.php
vikappointments / site / views / employeeslist / tmpl Last commit date
default.php 1 month ago default.xml 1 month ago default_contact.php 1 month ago default_employee.php 1 month ago default_employee_search.php 1 month ago default_toolbar.php 1 month ago index.html 1 month ago
default_toolbar.php
211 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 $filtersUri = 'index.php?option=com_vikappointments&view=employeeslist';
15
16 /**
17 * Use an apposite helper method to support multi-selection filters.
18 *
19 * @since 1.7.6
20 */
21 if ($query = $this->getUriFilters())
22 {
23 $filtersUri .= '&' . $query;
24 }
25
26 if ($this->itemid)
27 {
28 $filtersUri .= "&Itemid={$this->itemid}";
29 }
30
31 $config = VAPFactory::getConfig();
32
33 ?>
34
35 <div class="vap-emplist-toolbar">
36
37 <?php
38 /**
39 * The toolbar TOP box contains the select to filter the employees by group
40 * and a button to toggle the box containing the sortable fields.
41 */
42 ?>
43
44 <div class="vap-emplist-toolbar-top">
45
46 <?php
47 // check if the group selection is allowed and the groups list
48 // contains more than one element
49 if (count($this->groups) > 1 && $config->getBool('empgroupfilter'))
50 {
51 $url = $filtersUri . '&ordering=' . $this->options['ordering'];
52
53 ?>
54
55 <div class="vap-empgroup-filterblock">
56
57 <form action="<?php echo JRoute::rewrite($url); ?>" id="vap-empgroup-form" method="post">
58 <div class="vap-emplist-groups">
59 <select name="employee_group" class="vap-empgroup-sel">
60 <option></option>
61 <?php echo JHtml::fetch('select.options', $this->groups, 'id', 'name', $this->empGroup); ?>
62 </select>
63 </div>
64 </form>
65
66 </div>
67
68 <?php
69 }
70
71 // check if the customers are allowed to sort the employees list
72 if ($config->getBool('empordfilter'))
73 {
74 // display the button to toggle the sortable fields
75 ?>
76 <div class="vap-emplist-ordering">
77 <span>
78 <button type="button" class="vap-btn small blue" onClick="vapDisplayFilters(this);">
79 <?php echo JText::translate('VAPEMPORDERINGTITLE'); ?>
80 </button>
81 </span>
82
83 <div class="vap-emplist-ordering-fields">
84 <ul>
85 <?php
86 foreach (VikAppointments::getEmployeesAvailableOrderings() as $ord)
87 {
88 if (empty($this->filters['service']) && in_array($ord, array(7, 8)))
89 {
90 // it is not possible to sort by rate if the service hasn't been selected
91 continue;
92 }
93
94 $url = $filtersUri . '&ordering=' . $ord;
95
96 if ($this->empGroup)
97 {
98 $url .= '&employee_group=' . $this->empGroup;
99 }
100 ?>
101
102 <li class="<?php echo $ord == $this->options['ordering'] ? 'selected' : ''; ?>">
103 <?php
104 if ($ord != $this->options['ordering'])
105 {
106 // create a link to sort the employees using this type
107 ?>
108 <a href="<?php echo $url; ?>"><?php echo JText::translate('VAPEMPORDERING' . $ord); ?></a>
109 <?php
110 }
111 else
112 {
113 // this sortable type is already selected
114 ?>
115 <span><?php echo JText::translate('VAPEMPORDERING' . $ord); ?></span>
116 <?php
117 }
118 ?>
119 </li>
120 <?php
121 }
122 ?>
123 </ul>
124 </div>
125
126 </div>
127 <?php
128 }
129 ?>
130
131 </div>
132
133 <?php
134 /**
135 * End of toolbar top box.
136 */
137
138 // check if the customer is filtering the employees list
139 if ($this->hasFilters)
140 {
141 // we need to show a response about the filtered used
142 ?>
143 <div class="vap-empfilters_response">
144 <?php
145 if ($this->employeesCount > 0)
146 {
147 // we found something while searching with the given filters
148 ?>
149 <span class="success-result">
150 <?php
151 if ($this->employeesCount > 1)
152 {
153 // the search found more than one employee
154 echo JText::sprintf('VAPEMPLISTRESULTPLUS', $this->employeesCount);
155 }
156 else
157 {
158 // the search found only one employee
159 echo JText::translate('VAPEMPLISTRESULT1');
160 }
161 ?>
162 </span>
163 <?php
164 }
165 else
166 {
167 // no employee found while searching with the given filters
168 ?>
169 <span class="bad-result">
170 <?php echo JText::translate('VAPEMPLISTRESULT0'); ?>
171 </span>
172 <?php
173 }
174 ?>
175 </div>
176 <?php
177 }
178 ?>
179 </div>
180
181 <?php
182 JText::script('VAPEMPALLGROUPSOPTION');
183 ?>
184
185 <script>
186
187 jQuery(function($) {
188 $('.vap-empgroup-sel').select2({
189 placeholder: Joomla.JText._('VAPEMPALLGROUPSOPTION'),
190 allowClear: true,
191 width: 300
192 });
193
194 $('.vap-empgroup-sel').on('change', () => {
195 $('#vap-empgroup-form').submit();
196 });
197 });
198
199 function vapDisplayFilters(button) {
200 var fields = jQuery('.vap-emplist-ordering-fields');
201 if (!fields.is(':visible')) {
202 fields.slideDown();
203 jQuery(button).addClass('active');
204 } else {
205 fields.slideUp();
206 jQuery(button).removeClass('active');
207 }
208 }
209
210 </script>
211