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 / customerinfo / tmpl / default_appointments.php
vikappointments / admin / views / customerinfo / tmpl Last commit date
default.php 3 days ago default_appointments.php 3 days ago default_billing.php 3 days ago default_draft.php 3 days ago default_notes.php 3 days ago default_packages.php 3 days ago index.html 3 days ago
default_appointments.php
347 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 $vik = VAPApplication::getInstance();
15
16 $config = VAPFactory::getConfig();
17 $currency = VAPFactory::getCurrency();
18
19 ?>
20
21 <!-- Define role to detect the supported hook -->
22 <!-- {"rule":"customizer","event":"onDisplayViewCustomerinfo","key":"appointments.start","type":"field"} -->
23
24 <?php
25 // plugins can use the "appointments.start" key to introduce custom
26 // HTML before the appointments list
27 if (isset($this->addons['appointments.start']))
28 {
29 echo $this->addons['appointments.start'];
30
31 // unset details form to avoid displaying it twice
32 unset($this->addons['appointments.start']);
33 }
34 ?>
35
36 <table class="order-status-table">
37
38 <thead>
39 <tr>
40
41 <!-- Order Number -->
42
43 <th width="20%" style="text-align: left;" class="hidden-phone">
44 <?php echo JText::translate('VAPMANAGERESERVATION1'); ?>
45 </th>
46
47 <!-- Check-in -->
48
49 <th width="20%" style="text-align: left;">
50 <?php echo JText::translate('VAPMANAGERESERVATION26'); ?>
51 </th>
52
53 <!-- Service -->
54
55 <th width="15%" style="text-align: left;">
56 <?php echo JText::translate('VAPMANAGERESERVATION4'); ?>
57 </th>
58
59 <!-- Order Total -->
60
61 <th width="10%" style="text-align: left;" class="hidden-phone">
62 <?php echo JText::translate('VAPMANAGERESERVATION9'); ?>
63 </th>
64
65 <!-- Status -->
66
67 <th width="10%" style="text-align: left;">
68 <?php echo JText::translate('VAPMANAGERESERVATION12'); ?>
69 </th>
70
71 <!-- Toggle -->
72
73 <th width="2%" style="text-align: right;" class="hidden-phone">
74 <a href="javascript:void(0);" id="appointments-toggle-all">
75 <i class="fas fa-toggle-off medium-big"></i>
76 </a>
77 </th>
78
79 </tr>
80 </thead>
81
82 <tbody>
83
84 <?php
85 foreach ($this->appointments as $order)
86 {
87 foreach ($order->appointments as $app)
88 {
89 ?>
90 <tr>
91
92 <!-- Order Number, Creation Date -->
93
94 <td class="hidden-phone">
95 <div class="td-primary">
96 <?php echo $app->id . '-' . $order->sid; ?>
97 </div>
98
99 <div class="td-secondary">
100 <?php echo JHtml::fetch('date', $order->createdon, JText::translate('DATE_FORMAT_LC1') . ' ' . $config->get('timeformat')); ?>
101 </div>
102 </td>
103
104 <!-- Check-in, Check-out -->
105
106 <td>
107 <div class="td-primary">
108 <?php echo JHtml::fetch('date', $app->checkin->utc, JText::translate('DATE_FORMAT_LC1')); ?>
109 </div>
110
111 <div class="td-secondary">
112 <span class="checkin-time">
113 <i class="fas fa-sign-in-alt"></i>
114 <?php echo JHtml::fetch('date', $app->checkin->utc, $config->get('timeformat')); ?>
115 </span>
116
117 <span class="checkin-time" style="margin-left: 4px;">
118 <i class="fas fa-sign-out-alt"></i>
119 <?php echo JHtml::fetch('date', $app->checkout->utc, $config->get('timeformat')); ?>
120 </span>
121 </div>
122 </td>
123
124 <!-- Service, Employee -->
125
126 <td>
127 <div class="td-primary">
128 <?php echo $app->service->name; ?>
129 </div>
130
131 <div class="td-secondary">
132 <?php echo $app->employee->name; ?>
133 </div>
134 </td>
135
136 <!-- Total -->
137
138 <td class="hidden-phone">
139 <div class="td-primary">
140 <?php echo $currency->format($order->totals->gross); ?>
141 </div>
142
143 <div class="td-secondary">
144 <?php
145 if ($order->totals->due)
146 {
147 // display remaining balance
148 echo JText::translate('VAPORDERDUE') . ': ' . $currency->format($order->totals->due);
149 }
150 ?>
151 </div>
152 </td>
153
154 <!-- Status -->
155
156 <td>
157 <?php echo JHtml::fetch('vaphtml.status.display', $app->status); ?>
158 </td>
159
160 <!-- Toggle -->
161
162 <td class="hidden-phone" style="text-align: right;">
163 <a href="javascript:void(0);" class="appointments-res-toggle" data-id="<?php echo $app->id; ?>">
164 <i class="fas fa-chevron-right medium-big"></i>
165 </a>
166 </td>
167
168 </tr>
169
170 <tr class="track-comment hidden-phone" id="order-details-<?php echo $app->id; ?>" style="display:none;">
171
172 <!-- Options -->
173
174 <td colspan="6">
175
176 <?php
177 if ($app->options)
178 {
179 ?>
180 <ul class="items-list">
181 <?php
182 foreach ($app->options as $opt)
183 {
184 ?>
185 <li class="item-row">
186
187 <div class="item-row-details">
188
189 <div class="item-name"><?php echo $opt->fullName; ?></div>
190
191 <div class="item-quantity">x<?php echo $opt->quantity; ?></div>
192
193 <div class="item-price"><?php echo $currency->format($opt->totals->gross); ?></div>
194
195 </div>
196
197 </li>
198 <?php
199 }
200 ?>
201 </ul>
202 <?php
203 }
204 else
205 {
206 echo $vik->alert(JText::translate('VAPRESNOEXTRAOPTIONS'));
207 }
208 ?>
209
210 </td>
211
212 </tr>
213 <?php
214 }
215 }
216 ?>
217
218 </tbody>
219
220 <?php
221 if ($this->appCount > 1)
222 {
223 ?>
224 <tfoot>
225 <tr>
226 <td>
227 <b><?php echo JText::plural('VAP_N_RESERVATIONS', $this->appCount); ?></b>
228 </td>
229
230 <td class="hidden-phone">&nbsp;</td>
231
232 <td style="text-align: right;" class="hidden-phone">
233 <?php echo JText::translate('VAPMANAGERESERVATION9'); ?>
234 </td>
235
236 <td>
237 <b style="font-size: larger;"><?php echo $currency->format($this->appTotal); ?></b>
238 </td>
239
240 <td colspan="2" class="hidden-phone">&nbsp;</td>
241 </tr>
242 </tfoot>
243 <?php
244 }
245 ?>
246
247 </table>
248
249 <!-- Define role to detect the supported hook -->
250 <!-- {"rule":"customizer","event":"onDisplayViewCustomerinfo","key":"appointments.nav","type":"field"} -->
251
252 <?php
253 // plugins can use the "appointments.nav" key to introduce custom
254 // HTML between the appointments list and the pagination
255 if (isset($this->addons['appointments.nav']))
256 {
257 echo $this->addons['appointments.nav'];
258
259 // unset details form to avoid displaying it twice
260 unset($this->addons['appointments.nav']);
261 }
262 ?>
263
264 <?php
265 if ($this->appNav)
266 {
267 echo '<br />' . $this->appNav;
268 }
269 ?>
270
271 <!-- Define role to detect the supported hook -->
272 <!-- {"rule":"customizer","event":"onDisplayViewCustomerinfo","key":"appointments.end","type":"field"} -->
273
274 <?php
275 // plugins can use the "appointments.end" key to introduce custom
276 // HTML after the appointments list
277 if (isset($this->addons['appointments.end']))
278 {
279 echo $this->addons['appointments.end'];
280
281 // unset details form to avoid displaying it twice
282 unset($this->addons['appointments.end']);
283 }
284 ?>
285
286 <script>
287
288 jQuery(function($) {
289 const toggleAll = (link, status) => {
290 var toggle = 0;
291
292 if ($(link).find('i').hasClass('fa-toggle-off') || status == 1) {
293 // open
294 $(link).find('i').removeClass('fa-toggle-off').addClass('fa-toggle-on');
295
296 toggle = 1;
297 } else {
298 // close
299 $(link).find('i').removeClass('fa-toggle-on').addClass('fa-toggle-off');
300 }
301
302 if (status == undefined) {
303 $('.appointments-res-toggle').each(function() {
304 toggleDetails(this, toggle);
305 });
306 }
307 }
308
309 const toggleDetails = (link, status) => {
310 var id = $(link).data('id');
311
312 if (($(link).find('i').hasClass('fa-chevron-right') && status !== 0) || status == 1) {
313 // open
314 $(link).find('i').removeClass('fa-chevron-right').addClass('fa-chevron-down');
315
316 $('#order-details-' + id).show();
317 } else {
318 // close
319 $(link).find('i').removeClass('fa-chevron-down').addClass('fa-chevron-right');
320
321 $('#order-details-' + id).hide();
322 }
323
324 if (status == undefined) {
325 var open = $('.appointments-res-toggle i.fa-chevron-down').length;
326
327 if (open > 0) {
328 // at least a record open
329 toggleAll($('#appointments-toggle-all')[0], 1);
330 } else {
331 // all records closed
332 toggleAll($('#appointments-toggle-all')[0], 0);
333 }
334 }
335 }
336
337 $('#appointments-toggle-all').on('click', function() {
338 toggleAll(this);
339 });
340
341 $('.appointments-res-toggle').on('click', function() {
342 toggleDetails(this);
343 });
344 });
345
346 </script>
347