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

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