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 / layouts / wizard / steps / taxes.php
vikappointments / admin / layouts / wizard / steps Last commit date
employees.php 3 days ago index.html 3 days ago locations.php 3 days ago locwdays.php 3 days ago options.php 3 days ago packages.php 3 days ago payments.php 3 days ago services.php 3 days ago subscriptions.php 3 days ago syspack.php 3 days ago syssubscr.php 3 days ago system.php 3 days ago taxes.php 3 days ago
taxes.php
104 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 /**
15 * Layout variables
16 * -----------------
17 * @var VAPWizardStep $step The wizard step instance.
18 */
19 extract($displayData);
20
21 $vik = VAPApplication::getInstance();
22
23 $id = $step->getID();
24
25 if (!$step->isCompleted())
26 {
27 ?>
28 <div class="wizard-form">
29
30 <div style="display: flex; justify-content: space-between;">
31 <select name="wizard[<?php echo $id; ?>][type]" class="required">
32 <option value="vat"><?php echo JText::translate('VAPWIZARDTAXVATINCL'); ?></option>
33 <option value="+%"><?php echo JText::translate('VAPWIZARDTAXVATEXCL'); ?></option>
34 </select>
35
36 <div class="input-append" style="margin-left: 5px;">
37 <input type="number" name="wizard[<?php echo $id; ?>][amount]" value="20" min="0" max="100" step="any" />
38 <span class="btn">%</span>
39 </div>
40 </div>
41
42 <?php echo $vik->alert(JText::translate('VAP_WIZARD_STEP_TAXES_DESC_ADV'), 'info'); ?>
43
44 </div>
45
46 <script>
47 (function($) {
48 'use strict';
49
50 VAPWizard.addPreflight('<?php echo $id; ?>', (role, step) => {
51 if (role != 'process') {
52 return true;
53 }
54
55 // create form validator
56 const validator = new VikFormValidator(step);
57
58 // validate form
59 if (!validator.validate()) {
60 // prevent request
61 return false;
62 }
63
64 return true;
65 });
66
67 $(function() {
68 VikRenderer.chosen('[data-id="<?php echo $id; ?>"] select');
69 });
70 })(jQuery);
71 </script>
72 <?php
73 }
74 else
75 {
76 ?>
77 <ul class="wizard-step-summary">
78 <?php
79 $taxes = $step->getTaxes();
80
81 // display at most 3 taxes
82 for ($i = 0; $i < min(array(3, count($taxes))); $i++)
83 {
84 ?>
85 <li>
86 <b><?php echo $taxes[$i]->name; ?></b>
87 </li>
88 <?php
89 }
90
91 // count remaining taxes
92 $remaining = count($taxes) - 3;
93
94 if ($remaining > 0)
95 {
96 ?>
97 <li><?php echo JText::plural('VAPWIZARDOTHER_N_ITEMS', $remaining); ?></li>
98 <?php
99 }
100 ?>
101 </ul>
102 <?php
103 }
104