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 / ApartmentRentalApplicationFormTemplate.php

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

473 lines 17.5 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 ApartmentRentalApplicationFormTemplate
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' => 'apartment_rental_application_form',
18 'name' => BackendStrings::getTemplateStrings()['apartment_rental_application_form'],
19 'description' => BackendStrings::getTemplateStrings()['apartment_rental_application_form_desc'],
20 'category' => 'application-forms',
21 'subcategory' => 'tenant-application-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'apartment-rental-application-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()['apartment_rental_application_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getApplicantInformationFields(),
45 self::getCurrentAddressFields(),
46 self::getEmploymentAndDocumentsFields(),
47 self::getRentalDetailsFields()
48 ),
49 'settings' => [],
50 ],
51 ]
52 );
53 }
54
55 /**
56 * Get applicant information fields
57 *
58 * @return array<int, array<string, mixed>>
59 */
60 private static function getApplicantInformationFields(): array
61 {
62 return [
63 [
64 'id' => 1,
65 'fieldIndex' => 1,
66 'type' => 'name',
67 'label' => BackendStrings::getTemplateStrings()['name'],
68 'parentId' => null,
69 'defaultValue' => '',
70 'placeholder' => '',
71 'required' => true,
72 'readonly' => false,
73 'position' => 1,
74 ],
75 [
76 'id' => 2,
77 'type' => 'text',
78 'label' => BackendStrings::getNewFormStrings()['first_name'],
79 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
80 'required' => true,
81 'parentId' => 1,
82 'fieldIndex' => 1,
83 'defaultValue' => '',
84 'position' => 1,
85 'optionHide' => false,
86 'description' => '',
87 'settings' => json_encode(['nameFieldType' => 'nameField1']),
88 ],
89 [
90 'id' => 3,
91 'type' => 'text',
92 'label' => BackendStrings::getNewFormStrings()['last_name'],
93 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
94 'required' => true,
95 'parentId' => 1,
96 'fieldIndex' => 1,
97 'defaultValue' => '',
98 'position' => 2,
99 'optionHide' => false,
100 'description' => '',
101 'settings' => json_encode(['nameFieldType' => 'nameField2']),
102 ],
103 [
104 'id' => 4,
105 'fieldIndex' => 2,
106 'type' => 'email',
107 'label' => BackendStrings::getTemplateStrings()['email_address'],
108 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email_address'],
109 'required' => true,
110 'parentId' => null,
111 'defaultValue' => '',
112 'position' => 2,
113 ],
114 [
115 'id' => 5,
116 'fieldIndex' => 3,
117 'type' => 'phone',
118 'label' => BackendStrings::getTemplateStrings()['phone_number'],
119 'placeholder' => '+1 (_) _-_',
120 'required' => true,
121 'parentId' => null,
122 'defaultValue' => '',
123 'position' => 3,
124 ],
125 ];
126 }
127
128 /**
129 * Get current address fields
130 *
131 * @return array<int, array<string, mixed>>
132 */
133 private static function getCurrentAddressFields(): array
134 {
135 return [
136 [
137 'id' => 6,
138 'fieldIndex' => 4,
139 'type' => 'address',
140 'label' => BackendStrings::getTemplateStrings()['current_address'],
141 'parentId' => null,
142 'defaultValue' => '',
143 'placeholder' => '',
144 'readonly' => false,
145 'position' => 4,
146 'required' => true,
147 ],
148 [
149 'id' => 7,
150 'type' => 'text',
151 'label' => BackendStrings::getTemplateStrings()['address_line_1'],
152 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
153 'required' => true,
154 'parentId' => 4,
155 'fieldIndex' => 4,
156 'defaultValue' => '',
157 'position' => 4,
158 'hideLabel' => false,
159 'description' => '',
160 'addressType' => 'streetAddress',
161 'settings' => json_encode(
162 [
163 'type' => 'streetAddress',
164 'hideLabel' => false,
165 'description' => '',
166 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
167 'requiredMessage' => '',
168 'visible' => true,
169 ]
170 ),
171 ],
172 [
173 'id' => 8,
174 'type' => 'text',
175 'label' => BackendStrings::getTemplateStrings()['address_line_2'],
176 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
177 'required' => false,
178 'parentId' => 4,
179 'fieldIndex' => 4,
180 'defaultValue' => '',
181 'position' => 4,
182 'hideLabel' => false,
183 'description' => '',
184 'addressType' => 'addressLine2',
185 'settings' => json_encode(
186 [
187 'type' => 'addressLine2',
188 'hideLabel' => false,
189 'description' => '',
190 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
191 'requiredMessage' => '',
192 'visible' => true,
193 ]
194 ),
195 ],
196 [
197 'id' => 9,
198 'type' => 'text',
199 'label' => BackendStrings::getTemplateStrings()['city'],
200 'placeholder' => BackendStrings::getTemplateStrings()['city'],
201 'required' => true,
202 'parentId' => 4,
203 'fieldIndex' => 4,
204 'defaultValue' => '',
205 'position' => 4,
206 'hideLabel' => false,
207 'description' => '',
208 'addressType' => 'city',
209 'settings' => json_encode(
210 [
211 'type' => 'city',
212 'hideLabel' => false,
213 'description' => '',
214 'placeholder' => BackendStrings::getTemplateStrings()['city'],
215 'requiredMessage' => '',
216 'visible' => true,
217 ]
218 ),
219 ],
220 [
221 'id' => 10,
222 'type' => 'text',
223 'label' => BackendStrings::getTemplateStrings()['state_province'],
224 'placeholder' => BackendStrings::getTemplateStrings()['state'],
225 'required' => true,
226 'parentId' => 4,
227 'fieldIndex' => 4,
228 'defaultValue' => '',
229 'position' => 4,
230 'hideLabel' => false,
231 'description' => '',
232 'addressType' => 'state',
233 'settings' => json_encode(
234 [
235 'type' => 'state',
236 'hideLabel' => false,
237 'description' => '',
238 'placeholder' => BackendStrings::getTemplateStrings()['state'],
239 'requiredMessage' => '',
240 'visible' => true,
241 ]
242 ),
243 ],
244 [
245 'id' => 11,
246 'type' => 'text',
247 'label' => BackendStrings::getTemplateStrings()['zip_postal_code'],
248 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
249 'required' => true,
250 'parentId' => 4,
251 'fieldIndex' => 4,
252 'defaultValue' => '',
253 'position' => 4,
254 'hideLabel' => false,
255 'description' => '',
256 'addressType' => 'zip',
257 'settings' => json_encode(
258 [
259 'type' => 'zip',
260 'hideLabel' => false,
261 'description' => '',
262 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
263 'requiredMessage' => '',
264 'visible' => true,
265 ]
266 ),
267 ],
268 [
269 'id' => 12,
270 'type' => 'text',
271 'label' => BackendStrings::getTemplateStrings()['country'],
272 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
273 'required' => true,
274 'parentId' => 4,
275 'fieldIndex' => 4,
276 'defaultValue' => '',
277 'position' => 4,
278 'hideLabel' => false,
279 'description' => '',
280 'addressType' => 'country',
281 'settings' => json_encode(
282 [
283 'type' => 'country',
284 'hideLabel' => false,
285 'description' => '',
286 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
287 'requiredMessage' => '',
288 'visible' => true,
289 ]
290 ),
291 ],
292 ];
293 }
294
295 /**
296 * Get employment status and document upload fields
297 *
298 * @return array<int, array<string, mixed>>
299 */
300 private static function getEmploymentAndDocumentsFields(): array
301 {
302 return [
303 [
304 'id' => 13,
305 'fieldIndex' => 5,
306 'type' => 'select',
307 'label' => BackendStrings::getTemplateStrings()['employment_status'],
308 'placeholder' => BackendStrings::getTemplateStrings()['select_employment_status'],
309 'required' => true,
310 'parentId' => null,
311 'defaultValue' => '',
312 'position' => 5,
313 'fieldOptions' => [
314 [
315 'id' => 14,
316 'label' => BackendStrings::getTemplateStrings()['employed'],
317 'value' => 'Employed',
318 'isDefault' => false,
319 'position' => 1,
320 ],
321 [
322 'id' => 15,
323 'label' => BackendStrings::getTemplateStrings()['self_employed'],
324 'value' => 'Self-employed',
325 'isDefault' => false,
326 'position' => 2,
327 ],
328 [
329 'id' => 16,
330 'label' => BackendStrings::getTemplateStrings()['unemployed'],
331 'value' => 'Unemployed',
332 'isDefault' => false,
333 'position' => 3,
334 ],
335 [
336 'id' => 17,
337 'label' => BackendStrings::getTemplateStrings()['student'],
338 'value' => 'Student',
339 'isDefault' => false,
340 'position' => 4,
341 ],
342 ],
343 ],
344 [
345 'id' => 18,
346 'fieldIndex' => 6,
347 'type' => 'number',
348 'label' => BackendStrings::getTemplateStrings()['monthly_income'],
349 'placeholder' => BackendStrings::getTemplateStrings()['enter_monthly_income'],
350 'required' => true,
351 'parentId' => null,
352 'defaultValue' => '',
353 'position' => 6,
354 ],
355 [
356 'id' => 19,
357 'fieldIndex' => 7,
358 'type' => 'file-upload',
359 'label' => BackendStrings::getTemplateStrings()['proof_of_income'],
360 'placeholder' => BackendStrings::getCommonStrings()['file_upload_placeholder_drag_here'],
361 'required' => true,
362 'parentId' => null,
363 'defaultValue' => '',
364 'position' => 7,
365 'maxFileSizeMb' => 999,
366 'saveUploadsTo' => 'ivyforms',
367 'allowedFileExtensions' => [],
368 'allowMultiple' => false,
369 'maxUploadCount' => 0,
370 ],
371 [
372 'id' => 20,
373 'fieldIndex' => 8,
374 'type' => 'file-upload',
375 'label' => BackendStrings::getTemplateStrings()['id_document_upload'],
376 'placeholder' => BackendStrings::getCommonStrings()['file_upload_placeholder_drag_here'],
377 'required' => true,
378 'parentId' => null,
379 'defaultValue' => '',
380 'position' => 8,
381 'maxFileSizeMb' => 999,
382 'saveUploadsTo' => 'ivyforms',
383 'allowedFileExtensions' => [],
384 'allowMultiple' => false,
385 'maxUploadCount' => 0,
386 ],
387 ];
388 }
389
390 /**
391 * Get rental history and move-in details fields
392 *
393 * @return array<int, array<string, mixed>>
394 */
395 private static function getRentalDetailsFields(): array
396 {
397 return [
398 [
399 'id' => 21,
400 'fieldIndex' => 9,
401 'type' => 'textarea',
402 'label' => BackendStrings::getTemplateStrings()['rental_history'],
403 'placeholder' => BackendStrings::getTemplateStrings()['enter_rental_history'],
404 'required' => true,
405 'parentId' => null,
406 'defaultValue' => '',
407 'position' => 9,
408 'rows' => 4,
409 ],
410 [
411 'id' => 22,
412 'fieldIndex' => 10,
413 'type' => 'textarea',
414 'label' => BackendStrings::getTemplateStrings()['reason_for_moving'],
415 'placeholder' => BackendStrings::getTemplateStrings()['enter_reason_for_moving'],
416 'required' => true,
417 'parentId' => null,
418 'defaultValue' => '',
419 'position' => 10,
420 'rows' => 3,
421 ],
422 [
423 'id' => 23,
424 'fieldIndex' => 11,
425 'type' => 'number',
426 'label' => BackendStrings::getTemplateStrings()['number_of_occupants'],
427 'placeholder' => BackendStrings::getTemplateStrings()['enter_number_of_occupants'],
428 'required' => true,
429 'parentId' => null,
430 'defaultValue' => '',
431 'position' => 11,
432 ],
433 [
434 'id' => 24,
435 'fieldIndex' => 12,
436 'type' => 'textarea',
437 'label' => BackendStrings::getTemplateStrings()['pets'],
438 'placeholder' => BackendStrings::getTemplateStrings()['enter_pets'],
439 'required' => false,
440 'parentId' => null,
441 'defaultValue' => '',
442 'position' => 12,
443 'rows' => 2,
444 ],
445 [
446 'id' => 25,
447 'fieldIndex' => 13,
448 'type' => 'textarea',
449 'label' => BackendStrings::getTemplateStrings()['emergency_contact'],
450 'placeholder' => BackendStrings::getTemplateStrings()['enter_emergency_contact'],
451 'required' => true,
452 'parentId' => null,
453 'defaultValue' => '',
454 'position' => 13,
455 'rows' => 3,
456 ],
457 [
458 'id' => 26,
459 'fieldIndex' => 14,
460 'type' => 'date',
461 'label' => BackendStrings::getTemplateStrings()['desired_move_in_date'],
462 'placeholder' => BackendStrings::getTemplateStrings()['select_desired_move_in_date'],
463 'required' => true,
464 'parentId' => null,
465 'defaultValue' => '',
466 'position' => 14,
467 'dateFieldType' => 'picker',
468 'dateFormat' => 'MM/DD/YYYY',
469 ],
470 ];
471 }
472 }
473