PluginProbe
The Innovative Form Builder – IvyForms / 0.9
The Innovative Form Builder – IvyForms v0.9
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Template / HairSalonAppointmentFormTemplate.php

HairSalonAppointmentFormTemplate.php in The Innovative Form Builder – IvyForms 0.9, at backend/src/Services/Template/HairSalonAppointmentFormTemplate.php

386 lines 12.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Services\Template;
4
5 // phpcs:disable PSR1.Files.SideEffects
6 if (!defined('ABSPATH')) {
7 exit; // Exit if accessed directly
8 }
9
10 use IvyForms\Services\Translations\BackendStrings;
11
12 class HairSalonAppointmentFormTemplate
13 {
14 /**
15 * Get the hair salon appointment form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'hair_salon_appointment_form',
23 'name' => BackendStrings::getTemplateStrings()['hair_salon_appointment_form'],
24 'description' => BackendStrings::getTemplateStrings()['hair_salon_appointment_form_desc'],
25 'category' => 'booking-forms',
26 'subcategory' => 'appointment-booking-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'hair-salon-appointment-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['hair_salon_appointment_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getClientInformationFields(),
37 self::getAppointmentDetailsFields(),
38 self::getAdditionalPreferencesFields()
39 ),
40 'settings' => []
41 ]
42 ];
43 }
44
45 /**
46 * Get client information fields
47 *
48 * @return array<int, array<string, mixed>>
49 */
50 private static function getClientInformationFields(): array
51 {
52 return [
53 // Name Field - Parent
54 [
55 'id' => 1,
56 'fieldIndex' => 1,
57 'type' => 'name',
58 'label' => BackendStrings::getTemplateStrings()['full_name'],
59 'parentId' => null,
60 'defaultValue' => '',
61 'placeholder' => '',
62 'required' => true,
63 'readonly' => false,
64 'position' => 1,
65 ],
66 // First Name - Child of Name Field
67 [
68 'id' => 2,
69 'type' => 'text',
70 'label' => BackendStrings::getNewFormStrings()['first_name'],
71 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
72 'required' => true,
73 'parentId' => 1,
74 'fieldIndex' => 1,
75 'defaultValue' => '',
76 'position' => 1,
77 'optionHide' => false,
78 'description' => '',
79 'settings' => json_encode(['nameFieldType' => 'nameField1']),
80 ],
81 // Last Name - Child of Name Field
82 [
83 'id' => 3,
84 'type' => 'text',
85 'label' => BackendStrings::getNewFormStrings()['last_name'],
86 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
87 'required' => true,
88 'parentId' => 1,
89 'fieldIndex' => 1,
90 'defaultValue' => '',
91 'position' => 2,
92 'optionHide' => false,
93 'description' => '',
94 'settings' => json_encode(['nameFieldType' => 'nameField2']),
95 ],
96 // Email Address
97 [
98 'id' => 4,
99 'fieldIndex' => 2,
100 'type' => 'email',
101 'label' => BackendStrings::getTemplateStrings()['email_address'],
102 'placeholder' => '[email protected]',
103 'required' => true,
104 'parentId' => null,
105 'defaultValue' => '',
106 'position' => 2,
107 ],
108 // Phone Number
109 [
110 'id' => 5,
111 'fieldIndex' => 3,
112 'type' => 'phone',
113 'label' => BackendStrings::getTemplateStrings()['phone_number'],
114 'placeholder' => '+1 (_) _-_',
115 'required' => true,
116 'parentId' => null,
117 'defaultValue' => '',
118 'position' => 3,
119 'phoneAutoDetect' => true,
120 ],
121 ];
122 }
123
124 /**
125 * Get appointment details fields
126 *
127 * @return array<int, array<string, mixed>>
128 */
129 private static function getAppointmentDetailsFields(): array
130 {
131 return array_merge(
132 self::getServiceTypeField(),
133 self::getStylistPreferenceField(),
134 self::getPreferredDateField(),
135 self::getPreferredTimeField()
136 );
137 }
138
139 /**
140 * Get service type field
141 *
142 * @return array<int, array<string, mixed>>
143 */
144 private static function getServiceTypeField(): array
145 {
146 return [
147 [
148 'id' => 13,
149 'fieldIndex' => 4,
150 'type' => 'select',
151 'label' => BackendStrings::getTemplateStrings()['service_type'],
152 'placeholder' => BackendStrings::getTemplateStrings()['select_service_type'],
153 'required' => true,
154 'parentId' => null,
155 'defaultValue' => '',
156 'position' => 4,
157 'fieldOptions' => [
158 [
159 'id' => 6,
160 'label' => BackendStrings::getTemplateStrings()['haircut'],
161 'value' => 'haircut',
162 'isDefault' => false,
163 'position' => 1
164 ],
165 [
166 'id' => 7,
167 'label' => BackendStrings::getTemplateStrings()['hair_coloring'],
168 'value' => 'hair_coloring',
169 'isDefault' => false,
170 'position' => 2
171 ],
172 [
173 'id' => 8,
174 'label' => BackendStrings::getTemplateStrings()['hair_styling'],
175 'value' => 'hair_styling',
176 'isDefault' => false,
177 'position' => 3
178 ],
179 [
180 'id' => 9,
181 'label' => BackendStrings::getTemplateStrings()['hair_treatment'],
182 'value' => 'hair_treatment',
183 'isDefault' => false,
184 'position' => 4
185 ],
186 [
187 'id' => 10,
188 'label' => BackendStrings::getTemplateStrings()['highlights'],
189 'value' => 'highlights',
190 'isDefault' => false,
191 'position' => 5
192 ],
193 [
194 'id' => 11,
195 'label' => BackendStrings::getTemplateStrings()['perm'],
196 'value' => 'perm',
197 'isDefault' => false,
198 'position' => 6
199 ],
200 [
201 'id' => 12,
202 'label' => BackendStrings::getTemplateStrings()['other'],
203 'value' => 'other',
204 'isDefault' => false,
205 'position' => 7
206 ],
207 ]
208 ],
209 ];
210 }
211
212 /**
213 * Get stylist preference field
214 *
215 * @return array<int, array<string, mixed>>
216 */
217 private static function getStylistPreferenceField(): array
218 {
219 return [
220 [
221 'id' => 18,
222 'fieldIndex' => 5,
223 'type' => 'select',
224 'label' => BackendStrings::getTemplateStrings()['stylist_preference'],
225 'placeholder' => BackendStrings::getTemplateStrings()['select_stylist_preference'],
226 'required' => false,
227 'parentId' => null,
228 'defaultValue' => '',
229 'position' => 5,
230 'fieldOptions' => [
231 [
232 'id' => 14,
233 'label' => BackendStrings::getTemplateStrings()['no_preference'],
234 'value' => 'no_preference',
235 'isDefault' => true,
236 'position' => 1
237 ],
238 [
239 'id' => 15,
240 'label' => BackendStrings::getTemplateStrings()['stylist_1'],
241 'value' => 'stylist_1',
242 'isDefault' => false,
243 'position' => 2
244 ],
245 [
246 'id' => 16,
247 'label' => BackendStrings::getTemplateStrings()['stylist_2'],
248 'value' => 'stylist_2',
249 'isDefault' => false,
250 'position' => 3
251 ],
252 [
253 'id' => 17,
254 'label' => BackendStrings::getTemplateStrings()['stylist_3'],
255 'value' => 'stylist_3',
256 'isDefault' => false,
257 'position' => 4
258 ],
259 ]
260 ],
261 ];
262 }
263
264 /**
265 * Get preferred date field
266 *
267 * @return array<int, array<string, mixed>>
268 */
269 private static function getPreferredDateField(): array
270 {
271 return [
272 [
273 'id' => 19,
274 'fieldIndex' => 6,
275 'type' => 'date',
276 'label' => BackendStrings::getTemplateStrings()['preferred_appointment_date'],
277 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_date'],
278 'required' => true,
279 'parentId' => null,
280 'defaultValue' => '',
281 'position' => 6,
282 'dateFieldType' => 'picker',
283 'dateFormat' => 'MM/DD/YYYY',
284 ],
285 ];
286 }
287
288 /**
289 * Get preferred time field
290 *
291 * @return array<int, array<string, mixed>>
292 */
293 private static function getPreferredTimeField(): array
294 {
295 return [
296 [
297 'id' => 20,
298 'fieldIndex' => 7,
299 'type' => 'time',
300 'label' => BackendStrings::getTemplateStrings()['preferred_time_slot'],
301 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_time'],
302 'required' => true,
303 'parentId' => null,
304 'defaultValue' => '',
305 'position' => 7,
306 'timeFieldType' => 'time-picker',
307 'timeFormat' => 'ampm',
308 ],
309 ];
310 }
311
312 /**
313 * Get additional preferences fields
314 *
315 * @return array<int, array<string, mixed>>
316 */
317 private static function getAdditionalPreferencesFields(): array
318 {
319 return array_merge(
320 self::getSpecialRequestsField(),
321 self::getFirstTimeClientField()
322 );
323 }
324
325 /**
326 * Get special requests field
327 *
328 * @return array<int, array<string, mixed>>
329 */
330 private static function getSpecialRequestsField(): array
331 {
332 return [
333 [
334 'id' => 21,
335 'fieldIndex' => 8,
336 'type' => 'textarea',
337 'label' => BackendStrings::getTemplateStrings()['special_requests'],
338 'placeholder' => BackendStrings::getTemplateStrings()['any_special_requests_or_notes'],
339 'parentId' => null,
340 'defaultValue' => '',
341 'position' => 8,
342 'required' => false,
343 'rows' => 4,
344 ],
345 ];
346 }
347
348 /**
349 * Get first time client field
350 *
351 * @return array<int, array<string, mixed>>
352 */
353 private static function getFirstTimeClientField(): array
354 {
355 return [
356 [
357 'id' => 24,
358 'fieldIndex' => 9,
359 'type' => 'radio',
360 'label' => BackendStrings::getTemplateStrings()['first_time_client'],
361 'parentId' => null,
362 'position' => 9,
363 'required' => true,
364 'defaultValue' => '',
365 'placeholder' => '',
366 'fieldOptions' => [
367 [
368 'id' => 22,
369 'label' => BackendStrings::getTemplateStrings()['yes'],
370 'value' => 'yes',
371 'isDefault' => false,
372 'position' => 1
373 ],
374 [
375 'id' => 23,
376 'label' => BackendStrings::getTemplateStrings()['no'],
377 'value' => 'no',
378 'isDefault' => false,
379 'position' => 2
380 ],
381 ]
382 ],
383 ];
384 }
385 }
386