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 / manageclosure / tmpl / default.php
vikappointments / admin / views / manageclosure / tmpl Last commit date
default.php 3 days ago index.html 3 days ago
default.php
201 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('vaphtml.assets.select2');
15
16 $closure = $this->closure;
17
18 $vik = VAPApplication::getInstance();
19
20 $times = JHtml::fetch('vikappointments.times', array(
21 'step' => 5,
22 'value' => 'int',
23 ));
24
25 /**
26 * Trigger event to display custom HTML.
27 * In case it is needed to include any additional fields,
28 * it is possible to create a plugin and attach it to an event
29 * called "onDisplayViewClosure".
30 * It is also possible to use "onDisplayViewClosureSidebar"
31 * to include any additional fieldsets within the right sidebar.
32 * The event method receives the view instance as argument.
33 *
34 * @since 1.7
35 */
36 $detailsForms = $this->onDisplayView();
37 $sidebarForms = $this->onDisplayView('Sidebar');
38
39 ?>
40
41 <form name="adminForm" action="index.php" method="post" id="adminForm">
42
43 <?php echo $vik->openCard(); ?>
44
45 <div class="span7">
46
47 <?php echo $vik->openFieldset($sidebarForms ? JText::translate('VAPCUSTFIELDSLEGEND1') : ''); ?>
48
49 <!-- EMPLOYEES - Select -->
50
51 <?php
52 echo $vik->openControl(JText::translate('VAPMANAGECUSTOMF10') . '*');
53
54 // load employees and group them
55 $options = JHtml::fetch('vaphtml.admin.employees', $strict = false, $blank = false, $group = true);
56
57 $attrs = array('class' => 'required');
58
59 if ($closure->id)
60 {
61 // edit, use only the assigned employee
62 $val = array_shift($closure->id_employees);
63 $name = 'id_employee';
64 }
65 else
66 {
67 // create, inject all selected employees
68 $val = $closure->id_employees;
69 // allow multiple selection
70 $attrs['multiple'] = true;
71 $name = 'id_employees[]';
72 }
73
74 // create dropdown attributes
75 $params = array(
76 'id' => 'vap-employees-sel',
77 'group.items' => null,
78 'list.select' => $val,
79 'list.attr' => $attrs,
80 );
81
82 // render select
83 echo JHtml::fetch('select.groupedList', $options, $name, $params);
84
85 echo $vik->closeControl();
86 ?>
87
88 <!-- FROM DATE - Calendar -->
89
90 <?php
91 echo $vik->openControl(JText::translate('VAPMANAGEWD2') . '*');
92 echo $vik->calendar(VAPDateHelper::sql2date($closure->fromdate), 'fromdate', null, null, array('class' => 'required'));
93 echo $vik->closeControl();
94 ?>
95
96 <!-- FROM TIME - Select -->
97
98 <?php echo $vik->openControl(JText::translate('VAPMANAGEWD3') . '*'); ?>
99 <select name="fromtime" class="time-select">
100 <?php echo JHtml::fetch('select.options', $times, 'value', 'text', $closure->fromtime); ?>
101 </select>
102 <?php echo $vik->closeControl(); ?>
103
104 <!-- TO TIME - Select -->
105
106 <?php echo $vik->openControl(JText::translate('VAPMANAGEWD4') . '*'); ?>
107 <select name="totime" class="time-select">
108 <?php echo JHtml::fetch('select.options', $times, 'value', 'text', $closure->totime); ?>
109 </select>
110 <?php echo $vik->closeControl(); ?>
111
112 <!-- Define role to detect the supported hook -->
113 <!-- {"rule":"customizer","event":"onDisplayViewClosure","type":"field"} -->
114
115 <?php
116 /**
117 * Look for any additional fields to be pushed within
118 * the main fieldset (left-side).
119 */
120 foreach ($detailsForms as $formField)
121 {
122 echo $formField;
123 }
124 ?>
125
126 <?php echo $vik->closeFieldset(); ?>
127
128 </div>
129
130 <?php
131 if ($sidebarForms)
132 {
133 ?>
134 <div class="span5 full-width">
135
136 <?php
137 // iterate forms to be displayed within the sidebar panel
138 foreach ($sidebarForms as $formName => $formHtml)
139 {
140 $title = JText::translate($formName);
141 ?>
142 <div class="row-fluid">
143 <div class="span12">
144 <?php
145 echo $vik->openFieldset($title);
146 echo $formHtml;
147 echo $vik->closeFieldset();
148 ?>
149 </div>
150 </div>
151 <?php
152 }
153 ?>
154 </div>
155 <?php
156 }
157 ?>
158
159 <!-- Define role to detect the supported hook -->
160 <!-- {"rule":"customizer","event":"onDisplayViewClosureSidebar","type":"fieldset"} -->
161
162 <?php echo $vik->closeCard(); ?>
163
164 <?php echo JHtml::fetch('form.token'); ?>
165
166 <input type="hidden" name="id" value="<?php echo $closure->id; ?>" />
167 <input type="hidden" name="task" value="" />
168 <input type="hidden" name="option" value="com_vikappointments" />
169 </form>
170
171 <script>
172
173 jQuery(function($) {
174 $('#vap-employees-sel').select2({
175 placeholder: '--',
176 allowClear: false,
177 width: '90%',
178 });
179
180 $('.time-select').select2({
181 allowClear: false,
182 width: 200,
183 });
184 });
185
186 // validate
187
188 var validator = new VikFormValidator('#adminForm');
189
190 Joomla.submitbutton = function(task) {
191 if (task.indexOf('save') !== -1) {
192 if (validator.validate()) {
193 Joomla.submitform(task, document.adminForm);
194 }
195 } else {
196 Joomla.submitform(task, document.adminForm);
197 }
198 }
199
200 </script>
201