PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
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 / FitnessClassRegistrationFormTemplate.php

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

495 lines 17.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 use IvyForms\Services\Translations\BackendStrings;
6
7 class FitnessClassRegistrationFormTemplate
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' => 'fitness_class_registration_form',
18 'name' => BackendStrings::getTemplateStrings()['fitness_class_registration_form'],
19 'description' => BackendStrings::getTemplateStrings()[
20 'fitness_class_registration_form_desc'
21 ],
22 'category' => 'registration-forms',
23 'subcategory' => 'class-registration-forms',
24 'is_pro' => false,
25 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'fitness-class-registration-form.svg'
26 ];
27 }
28
29 /**
30 * Get the full template including form data
31 *
32 * @return array<string, mixed>
33 */
34 public static function getTemplate(): array
35 {
36 return array_merge(
37 self::getTemplateMeta(),
38 [
39 'form_data' => [
40 'name' => BackendStrings::getTemplateStrings()['fitness_class_registration_form'],
41 'published' => 1,
42 'showTitle' => 1,
43 'storeEntries' => 1,
44 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
45 'fields' => array_merge(
46 self::getPersonalInformationFields(),
47 self::getClassSelectionFields(),
48 self::getSchedulePreferenceFields(),
49 self::getHealthAndGoalsFields(),
50 self::getAdditionalOptionsFields()
51 ),
52 'settings' => []
53 ]
54 ]
55 );
56 }
57
58 /**
59 * Personal information fields (name, email, phone)
60 *
61 * @return array<int, array<string, mixed>>
62 */
63 private static function getPersonalInformationFields(): array
64 {
65 return [
66 // Name Field - Parent
67 [
68 'id' => 1,
69 'fieldIndex' => 1,
70 'type' => 'name',
71 'label' => BackendStrings::getTemplateStrings()['full_name'],
72 'parentId' => null,
73 'defaultValue' => '',
74 'placeholder' => '',
75 'required' => true,
76 'readonly' => false,
77 'position' => 1,
78 ],
79 // First Name - Child of Name Field
80 [
81 'id' => 2,
82 'type' => 'text',
83 'label' => BackendStrings::getTemplateStrings()['first_name'],
84 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
85 'required' => true,
86 'parentId' => 1,
87 'fieldIndex' => 1,
88 'defaultValue' => '',
89 'position' => 1,
90 'optionHide' => false,
91 'description' => '',
92 'settings' => json_encode(['nameFieldType' => 'nameField1']),
93 ],
94 // Last Name - Child of Name Field
95 [
96 'id' => 3,
97 'type' => 'text',
98 'label' => BackendStrings::getTemplateStrings()['last_name'],
99 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
100 'required' => true,
101 'parentId' => 1,
102 'fieldIndex' => 1,
103 'defaultValue' => '',
104 'position' => 2,
105 'optionHide' => false,
106 'description' => '',
107 'settings' => json_encode(['nameFieldType' => 'nameField2']),
108 ],
109 // Email Address
110 [
111 'id' => 4,
112 'fieldIndex' => 2,
113 'type' => 'email',
114 'label' => BackendStrings::getTemplateStrings()['email_address'],
115 'placeholder' => BackendStrings::getTemplateStrings()['name_placeholder'],
116 'required' => true,
117 'parentId' => null,
118 'defaultValue' => '',
119 'position' => 2,
120 ],
121 // Phone Number
122 [
123 'id' => 5,
124 'fieldIndex' => 3,
125 'type' => 'phone',
126 'label' => BackendStrings::getTemplateStrings()['phone_number'],
127 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
128 'required' => false,
129 'parentId' => null,
130 'defaultValue' => '',
131 'position' => 3,
132 'phoneAutoDetect' => true,
133 ],
134 ];
135 }
136
137 /**
138 * Class selection fields (class type, skill level)
139 *
140 * @return array<int, array<string, mixed>>
141 */
142 private static function getClassSelectionFields(): array
143 {
144 return [
145 // Class Type
146 [
147 'id' => 12,
148 'fieldIndex' => 4,
149 'type' => 'select',
150 'label' => BackendStrings::getTemplateStrings()['class_type'],
151 'placeholder' => BackendStrings::getTemplateStrings()['select_class_type'],
152 'required' => true,
153 'parentId' => null,
154 'defaultValue' => '',
155 'position' => 4,
156 'fieldOptions' => [
157 [
158 'id' => 6,
159 'label' => BackendStrings::getTemplateStrings()['yoga'],
160 'value' => 'yoga',
161 'isDefault' => false,
162 'position' => 1
163 ],
164 [
165 'id' => 7,
166 'label' => BackendStrings::getTemplateStrings()['pilates'],
167 'value' => 'pilates',
168 'isDefault' => false,
169 'position' => 2
170 ],
171 [
172 'id' => 8,
173 'label' => BackendStrings::getTemplateStrings()['hiit'],
174 'value' => 'hiit',
175 'isDefault' => false,
176 'position' => 3
177 ],
178 [
179 'id' => 9,
180 'label' => BackendStrings::getTemplateStrings()['zumba'],
181 'value' => 'zumba',
182 'isDefault' => false,
183 'position' => 4
184 ],
185 [
186 'id' => 10,
187 'label' => BackendStrings::getTemplateStrings()['crossfit'],
188 'value' => 'crossfit',
189 'isDefault' => false,
190 'position' => 5
191 ],
192 [
193 'id' => 11,
194 'label' => BackendStrings::getTemplateStrings()['other'],
195 'value' => 'other',
196 'isDefault' => false,
197 'position' => 6
198 ],
199 ]
200 ],
201 // Skill Level
202 [
203 'id' => 16,
204 'fieldIndex' => 5,
205 'type' => 'select',
206 'label' => BackendStrings::getTemplateStrings()['skill_level'],
207 'placeholder' => BackendStrings::getTemplateStrings()['select_skill_level'],
208 'required' => true,
209 'parentId' => null,
210 'defaultValue' => '',
211 'position' => 5,
212 'fieldOptions' => [
213 [
214 'id' => 13,
215 'label' => BackendStrings::getTemplateStrings()['beginner'],
216 'value' => 'beginner',
217 'isDefault' => false,
218 'position' => 1
219 ],
220 [
221 'id' => 14,
222 'label' => BackendStrings::getTemplateStrings()['intermediate'],
223 'value' => 'intermediate',
224 'isDefault' => false,
225 'position' => 2
226 ],
227 [
228 'id' => 15,
229 'label' => BackendStrings::getTemplateStrings()['advanced'],
230 'value' => 'advanced',
231 'isDefault' => false,
232 'position' => 3
233 ],
234 ]
235 ],
236 ];
237 }
238
239 /**
240 * Schedule preference fields (start date, time, duration)
241 *
242 * @return array<int, array<string, mixed>>
243 */
244 private static function getSchedulePreferenceFields(): array
245 {
246 return [
247 // Preferred Start Date
248 [
249 'id' => 17,
250 'fieldIndex' => 6,
251 'type' => 'date',
252 'label' => BackendStrings::getTemplateStrings()['preferred_start_date'],
253 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_start_date'],
254 'required' => true,
255 'parentId' => null,
256 'defaultValue' => '',
257 'position' => 6,
258 'dateFieldType' => 'picker',
259 'dateFormat' => 'MM/DD/YYYY',
260 ],
261 // Preferred Class Time
262 [
263 'id' => 21,
264 'fieldIndex' => 9,
265 'type' => 'select',
266 'label' => BackendStrings::getTemplateStrings()['preferred_class_time'],
267 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_class_time'],
268 'required' => false,
269 'parentId' => null,
270 'defaultValue' => '',
271 'position' => 9,
272 'fieldOptions' => [
273 [
274 'id' => 18,
275 'label' => BackendStrings::getTemplateStrings()['morning'],
276 'value' => 'morning',
277 'isDefault' => false,
278 'position' => 1
279 ],
280 [
281 'id' => 19,
282 'label' => BackendStrings::getTemplateStrings()['afternoon'],
283 'value' => 'afternoon',
284 'isDefault' => false,
285 'position' => 2
286 ],
287 [
288 'id' => 20,
289 'label' => BackendStrings::getTemplateStrings()['evening'],
290 'value' => 'evening',
291 'isDefault' => false,
292 'position' => 3
293 ],
294 ]
295 ],
296 // Preferred Class Duration
297 [
298 'id' => 26,
299 'fieldIndex' => 11,
300 'type' => 'select',
301 'label' => BackendStrings::getTemplateStrings()['preferred_class_duration'],
302 'placeholder' => BackendStrings::getTemplateStrings()[
303 'select_preferred_class_duration'
304 ],
305 'required' => false,
306 'parentId' => null,
307 'defaultValue' => '',
308 'position' => 11,
309 'fieldOptions' => [
310 [
311 'id' => 22,
312 'label' => BackendStrings::getTemplateStrings()['duration_30_min'],
313 'value' => '30_min',
314 'isDefault' => false,
315 'position' => 1
316 ],
317 [
318 'id' => 23,
319 'label' => BackendStrings::getTemplateStrings()['duration_1_hour'],
320 'value' => '1_hour',
321 'isDefault' => false,
322 'position' => 2
323 ],
324 [
325 'id' => 24,
326 'label' => BackendStrings::getTemplateStrings()['duration_90_min'],
327 'value' => '90_min',
328 'isDefault' => false,
329 'position' => 3
330 ],
331 [
332 'id' => 25,
333 'label' => BackendStrings::getTemplateStrings()['duration_2_hours'],
334 'value' => '2_hours',
335 'isDefault' => false,
336 'position' => 4
337 ],
338 ]
339 ],
340 ];
341 }
342
343 /**
344 * Health and goals fields (health notes, equipment, fitness goals)
345 *
346 * @return array<int, array<string, mixed>>
347 */
348 private static function getHealthAndGoalsFields(): array
349 {
350 return [
351 // Health Notes / Injuries
352 [
353 'id' => 27,
354 'fieldIndex' => 7,
355 'type' => 'textarea',
356 'label' => BackendStrings::getTemplateStrings()['health_notes_injuries'],
357 'placeholder' => BackendStrings::getTemplateStrings()[
358 'describe_health_conditions_injuries'
359 ],
360 'parentId' => null,
361 'defaultValue' => '',
362 'position' => 7,
363 'required' => false,
364 'rows' => 3,
365 ],
366 // Require Equipment? (radio)
367 [
368 'id' => 30,
369 'fieldIndex' => 8,
370 'type' => 'radio',
371 'label' => BackendStrings::getTemplateStrings()['require_equipment'],
372 'parentId' => null,
373 'position' => 8,
374 'required' => false,
375 'defaultValue' => '',
376 'placeholder' => '',
377 'fieldOptions' => [
378 [
379 'id' => 28,
380 'label' => BackendStrings::getTemplateStrings()['yes'],
381 'value' => 'yes',
382 'isDefault' => false,
383 'position' => 1
384 ],
385 [
386 'id' => 29,
387 'label' => BackendStrings::getTemplateStrings()['no'],
388 'value' => 'no',
389 'isDefault' => false,
390 'position' => 2
391 ],
392 ],
393 ],
394 // Fitness Goals
395 [
396 'id' => 31,
397 'fieldIndex' => 10,
398 'type' => 'textarea',
399 'label' => BackendStrings::getTemplateStrings()['fitness_goals'],
400 'placeholder' => BackendStrings::getTemplateStrings()[
401 'fitness_goals_placeholder'
402 ],
403 'parentId' => null,
404 'defaultValue' => '',
405 'position' => 10,
406 'required' => false,
407 'rows' => 3,
408 ],
409 ];
410 }
411
412 /**
413 * Additional options fields (personal training interest, trainer preference, updates)
414 *
415 * @return array<int, array<string, mixed>>
416 */
417 private static function getAdditionalOptionsFields(): array
418 {
419 return [
420 // Interested in Personal Training? (radio)
421 [
422 'id' => 34,
423 'fieldIndex' => 12,
424 'type' => 'radio',
425 'label' => BackendStrings::getTemplateStrings()[
426 'interested_personal_training'
427 ],
428 'parentId' => null,
429 'position' => 12,
430 'required' => false,
431 'defaultValue' => '',
432 'placeholder' => '',
433 'fieldOptions' => [
434 [
435 'id' => 32,
436 'label' => BackendStrings::getTemplateStrings()['yes'],
437 'value' => 'yes',
438 'isDefault' => false,
439 'position' => 1
440 ],
441 [
442 'id' => 33,
443 'label' => BackendStrings::getTemplateStrings()['no'],
444 'value' => 'no',
445 'isDefault' => false,
446 'position' => 2
447 ],
448 ],
449 ],
450 // Trainer Preference
451 [
452 'id' => 35,
453 'fieldIndex' => 13,
454 'type' => 'text',
455 'label' => BackendStrings::getTemplateStrings()['trainer_preference'],
456 'placeholder' => BackendStrings::getTemplateStrings()[
457 'enter_trainer_name_if_any'
458 ],
459 'required' => false,
460 'parentId' => null,
461 'defaultValue' => '',
462 'position' => 13,
463 ],
464 // Receive updates about future classes? (radio)
465 [
466 'id' => 38,
467 'fieldIndex' => 14,
468 'type' => 'radio',
469 'label' => BackendStrings::getTemplateStrings()['receive_updates_future_classes'],
470 'parentId' => null,
471 'position' => 14,
472 'required' => false,
473 'defaultValue' => '',
474 'placeholder' => '',
475 'fieldOptions' => [
476 [
477 'id' => 36,
478 'label' => BackendStrings::getTemplateStrings()['yes'],
479 'value' => 'yes',
480 'isDefault' => false,
481 'position' => 1
482 ],
483 [
484 'id' => 37,
485 'label' => BackendStrings::getTemplateStrings()['no'],
486 'value' => 'no',
487 'isDefault' => false,
488 'position' => 2
489 ],
490 ],
491 ],
492 ];
493 }
494 }
495