PluginProbe
The Innovative Form Builder – IvyForms / 1.1.1
The Innovative Form Builder – IvyForms v1.1.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 / ConsultationAppointmentFormTemplate.php

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

374 lines 12.3 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 ConsultationAppointmentFormTemplate
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' => 'consultation_appointment_form',
18 'name' => BackendStrings::getTemplateStrings()['consultation_appointment_form'],
19 'description' => BackendStrings::getTemplateStrings()['consultation_appointment_form_desc'],
20 'category' => 'booking-forms',
21 'subcategory' => 'appointment-booking-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'consultation-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()['consultation_appointment_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getClientInformationFields(),
45 self::getConsultationDetailsFields(),
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 consultation details fields
135 *
136 * @return array<int, array<string, mixed>>
137 */
138 private static function getConsultationDetailsFields(): array
139 {
140 return array_merge(
141 self::getConsultationTypeField(),
142 self::getAdvisorPreferenceField(),
143 self::getPreferredDateField(),
144 self::getPreferredTimeField()
145 );
146 }
147
148 /**
149 * Get consultation type field
150 *
151 * @return array<int, array<string, mixed>>
152 */
153 private static function getConsultationTypeField(): array
154 {
155 return [
156 [
157 'id' => 11,
158 'fieldIndex' => 4,
159 'type' => 'select',
160 'label' => BackendStrings::getTemplateStrings()['consultation_type'],
161 'placeholder' => BackendStrings::getTemplateStrings()['select_consultation_type'],
162 'required' => true,
163 'parentId' => null,
164 'defaultValue' => '',
165 'position' => 4,
166 'fieldOptions' => [
167 [
168 'id' => 6,
169 'label' => BackendStrings::getTemplateStrings()['business'],
170 'value' => 'business',
171 'isDefault' => false,
172 'position' => 1
173 ],
174 [
175 'id' => 7,
176 'label' => BackendStrings::getTemplateStrings()['legal'],
177 'value' => 'legal',
178 'isDefault' => false,
179 'position' => 2
180 ],
181 [
182 'id' => 8,
183 'label' => BackendStrings::getTemplateStrings()['financial'],
184 'value' => 'financial',
185 'isDefault' => false,
186 'position' => 3
187 ],
188 [
189 'id' => 9,
190 'label' => BackendStrings::getTemplateStrings()['personal'],
191 'value' => 'personal',
192 'isDefault' => false,
193 'position' => 4
194 ],
195 [
196 'id' => 10,
197 'label' => BackendStrings::getTemplateStrings()['other'],
198 'value' => 'other',
199 'isDefault' => false,
200 'position' => 5
201 ],
202 ]
203 ],
204 ];
205 }
206
207 /**
208 * Get advisor preference field
209 *
210 * @return array<int, array<string, mixed>>
211 */
212 private static function getAdvisorPreferenceField(): array
213 {
214 return [
215 [
216 'id' => 15,
217 'fieldIndex' => 5,
218 'type' => 'select',
219 'label' => BackendStrings::getTemplateStrings()['preferred_advisor'],
220 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_advisor'],
221 'required' => false,
222 'parentId' => null,
223 'defaultValue' => '',
224 'position' => 5,
225 'fieldOptions' => [
226 [
227 'id' => 12,
228 'label' => BackendStrings::getTemplateStrings()['advisor_a'],
229 'value' => 'advisor_a',
230 'isDefault' => false,
231 'position' => 1
232 ],
233 [
234 'id' => 13,
235 'label' => BackendStrings::getTemplateStrings()['advisor_b'],
236 'value' => 'advisor_b',
237 'isDefault' => false,
238 'position' => 2
239 ],
240 [
241 'id' => 14,
242 'label' => BackendStrings::getTemplateStrings()['no_preference'],
243 'value' => 'no_preference',
244 'isDefault' => true,
245 'position' => 3
246 ],
247 ]
248 ],
249 ];
250 }
251
252 /**
253 * Get preferred date field
254 *
255 * @return array<int, array<string, mixed>>
256 */
257 private static function getPreferredDateField(): array
258 {
259 return [
260 [
261 'id' => 16,
262 'fieldIndex' => 6,
263 'type' => 'date',
264 'label' => BackendStrings::getTemplateStrings()['preferred_appointment_date'],
265 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_date'],
266 'required' => true,
267 'parentId' => null,
268 'defaultValue' => '',
269 'position' => 6,
270 'dateFieldType' => 'picker',
271 'dateFormat' => 'MM/DD/YYYY',
272 ],
273 ];
274 }
275
276 /**
277 * Get preferred time field
278 *
279 * @return array<int, array<string, mixed>>
280 */
281 private static function getPreferredTimeField(): array
282 {
283 return [
284 [
285 'id' => 17,
286 'fieldIndex' => 7,
287 'type' => 'time',
288 'label' => BackendStrings::getTemplateStrings()['preferred_time_slot'],
289 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_time'],
290 'required' => true,
291 'parentId' => null,
292 'defaultValue' => '',
293 'position' => 7,
294 'timeFieldType' => 'time-picker',
295 'timeFormat' => 'ampm',
296 ],
297 ];
298 }
299
300 /**
301 * Get additional preferences fields
302 *
303 * @return array<int, array<string, mixed>>
304 */
305 private static function getAdditionalPreferencesFields(): array
306 {
307 return array_merge(
308 self::getTopicsQuestionsField(),
309 self::getVirtualMeetingField()
310 );
311 }
312
313 /**
314 * Get topics/questions field
315 *
316 * @return array<int, array<string, mixed>>
317 */
318 private static function getTopicsQuestionsField(): array
319 {
320 return [
321 [
322 'id' => 18,
323 'fieldIndex' => 8,
324 'type' => 'textarea',
325 'label' => BackendStrings::getTemplateStrings()['topics_questions_to_discuss'],
326 'placeholder' => BackendStrings::getTemplateStrings()['list_topics_questions_consultation'],
327 'parentId' => null,
328 'defaultValue' => '',
329 'position' => 8,
330 'required' => false,
331 'rows' => 4,
332 ],
333 ];
334 }
335
336 /**
337 * Get virtual meeting field
338 *
339 * @return array<int, array<string, mixed>>
340 */
341 private static function getVirtualMeetingField(): array
342 {
343 return [
344 [
345 'id' => 21,
346 'fieldIndex' => 9,
347 'type' => 'radio',
348 'label' => BackendStrings::getTemplateStrings()['virtual_meeting'],
349 'parentId' => null,
350 'position' => 9,
351 'required' => false,
352 'defaultValue' => '',
353 'placeholder' => '',
354 'fieldOptions' => [
355 [
356 'id' => 19,
357 'label' => BackendStrings::getTemplateStrings()['yes'],
358 'value' => 'yes',
359 'isDefault' => false,
360 'position' => 1
361 ],
362 [
363 'id' => 20,
364 'label' => BackendStrings::getTemplateStrings()['no'],
365 'value' => 'no',
366 'isDefault' => false,
367 'position' => 2
368 ],
369 ]
370 ],
371 ];
372 }
373 }
374