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

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

379 lines 13.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 RentalApplicationFormTemplate
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' => 'rental_application_form',
18 'name' => BackendStrings::getTemplateStrings()['rental_application_form'],
19 'description' => BackendStrings::getTemplateStrings()['rental_application_form_desc'],
20 'category' => 'application-forms',
21 'subcategory' => 'tenant-application-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . '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()['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 ),
48 'settings' => [],
49 ],
50 ]
51 );
52 }
53
54 /**
55 * Get applicant information fields
56 *
57 * @return array<int, array<string, mixed>>
58 */
59 private static function getApplicantInformationFields(): array
60 {
61 return [
62 [
63 'id' => 1,
64 'fieldIndex' => 1,
65 'type' => 'name',
66 'label' => BackendStrings::getTemplateStrings()['name'],
67 'parentId' => null,
68 'defaultValue' => '',
69 'placeholder' => '',
70 'required' => true,
71 'readonly' => false,
72 'position' => 1,
73 ],
74 [
75 'id' => 2,
76 'type' => 'text',
77 'label' => BackendStrings::getNewFormStrings()['first_name'],
78 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
79 'required' => true,
80 'parentId' => 1,
81 'fieldIndex' => 1,
82 'defaultValue' => '',
83 'position' => 1,
84 'optionHide' => false,
85 'description' => '',
86 'settings' => json_encode(['nameFieldType' => 'nameField1']),
87 ],
88 [
89 'id' => 3,
90 'type' => 'text',
91 'label' => BackendStrings::getNewFormStrings()['last_name'],
92 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
93 'required' => true,
94 'parentId' => 1,
95 'fieldIndex' => 1,
96 'defaultValue' => '',
97 'position' => 2,
98 'optionHide' => false,
99 'description' => '',
100 'settings' => json_encode(['nameFieldType' => 'nameField2']),
101 ],
102 [
103 'id' => 4,
104 'fieldIndex' => 2,
105 'type' => 'email',
106 'label' => BackendStrings::getTemplateStrings()['email_address'],
107 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email_address'],
108 'required' => true,
109 'parentId' => null,
110 'defaultValue' => '',
111 'position' => 2,
112 ],
113 [
114 'id' => 5,
115 'fieldIndex' => 3,
116 'type' => 'phone',
117 'label' => BackendStrings::getTemplateStrings()['phone_number'],
118 'placeholder' => '+1 (_) _-_',
119 'required' => true,
120 'parentId' => null,
121 'defaultValue' => '',
122 'position' => 3,
123 'phoneAutoDetect' => true,
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' => 'file-upload',
348 'label' => BackendStrings::getTemplateStrings()['proof_of_income'],
349 'placeholder' => BackendStrings::getCommonStrings()['file_upload_placeholder_drag_here'],
350 'required' => true,
351 'parentId' => null,
352 'defaultValue' => '',
353 'position' => 6,
354 'maxFileSizeMb' => 999,
355 'saveUploadsTo' => 'ivyforms',
356 'allowedFileExtensions' => [],
357 'allowMultiple' => false,
358 'maxUploadCount' => 0,
359 ],
360 [
361 'id' => 19,
362 'fieldIndex' => 7,
363 'type' => 'file-upload',
364 'label' => BackendStrings::getTemplateStrings()['id_document_upload'],
365 'placeholder' => BackendStrings::getCommonStrings()['file_upload_placeholder_drag_here'],
366 'required' => true,
367 'parentId' => null,
368 'defaultValue' => '',
369 'position' => 7,
370 'maxFileSizeMb' => 999,
371 'saveUploadsTo' => 'ivyforms',
372 'allowedFileExtensions' => [],
373 'allowMultiple' => false,
374 'maxUploadCount' => 0,
375 ],
376 ];
377 }
378 }
379