PluginProbe
The Innovative Form Builder – IvyForms / 0.6
The Innovative Form Builder – IvyForms v0.6
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.6, at backend/src/Services/Template/HairSalonAppointmentFormTemplate.php

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