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

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

293 lines 10.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 InstallationWorkOrderFormTemplate
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' => 'installation_work_order_form',
18 'name' => BackendStrings::getTemplateStrings()['installation_work_order_form'],
19 'description' => BackendStrings::getTemplateStrings()['installation_work_order_form_desc'],
20 'category' => 'order-forms',
21 'subcategory' => 'work-order-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'installation-work-order-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()['installation_work_order_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getContactInformationFields(),
45 self::getInstallationDetailsFields(),
46 self::getAdditionalInformationFields()
47 ),
48 'settings' => []
49 ]
50 ]
51 );
52 }
53
54 /**
55 * Get contact information fields
56 *
57 * @return array<int, array<string, mixed>>
58 */
59 private static function getContactInformationFields(): array
60 {
61 return [
62 // Full Name
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_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 'validation' => [
117 'required' => true,
118 'email' => true
119 ],
120 ],
121 ];
122 }
123
124 /**
125 * Get installation details fields
126 *
127 * @return array<int, array<string, mixed>>
128 */
129 private static function getInstallationDetailsFields(): array
130 {
131 return [
132 // Equipment/Device Name
133 [
134 'id' => 5,
135 'fieldIndex' => 3,
136 'type' => 'text',
137 'label' => BackendStrings::getTemplateStrings()['equipment_device_name'],
138 'placeholder' => BackendStrings::getTemplateStrings()['enter_device_name'],
139 'required' => true,
140 'parentId' => null,
141 'defaultValue' => '',
142 'position' => 3,
143 ],
144 // Room/Area
145 [
146 'id' => 6,
147 'fieldIndex' => 4,
148 'type' => 'text',
149 'label' => BackendStrings::getTemplateStrings()['room_area'],
150 'placeholder' => BackendStrings::getTemplateStrings()['specify_installation_location'],
151 'required' => true,
152 'parentId' => null,
153 'defaultValue' => '',
154 'position' => 4,
155 ],
156 // Installation Type Radio
157 [
158 'id' => 10,
159 'fieldIndex' => 5,
160 'type' => 'radio',
161 'label' => BackendStrings::getTemplateStrings()['installation_type'],
162 'placeholder' => '',
163 'required' => true,
164 'parentId' => null,
165 'defaultValue' => '',
166 'position' => 5,
167 'fieldOptions' => [
168 [
169 'id' => 7,
170 'label' => BackendStrings::getTemplateStrings()['standard'],
171 'value' => 'standard',
172 'isDefault' => false,
173 'position' => 1,
174 ],
175 [
176 'id' => 8,
177 'label' => BackendStrings::getTemplateStrings()['custom'],
178 'value' => 'custom',
179 'isDefault' => false,
180 'position' => 2,
181 ],
182 [
183 'id' => 9,
184 'label' => BackendStrings::getTemplateStrings()['scheduled'],
185 'value' => 'scheduled',
186 'isDefault' => false,
187 'position' => 3,
188 ],
189 ],
190 ],
191 // Requested Installation Date
192 [
193 'id' => 11,
194 'fieldIndex' => 6,
195 'type' => 'date',
196 'label' => BackendStrings::getTemplateStrings()['requested_installation_date'],
197 'placeholder' => BackendStrings::getTemplateStrings()['enter_requested_installation_date'],
198 'required' => true,
199 'parentId' => null,
200 'defaultValue' => '',
201 'position' => 6,
202 ],
203 // Installer Required Dropdown
204 [
205 'id' => 15,
206 'fieldIndex' => 7,
207 'type' => 'select',
208 'label' => BackendStrings::getTemplateStrings()['installer_required'],
209 'placeholder' => BackendStrings::getTemplateStrings()['select_installer'],
210 'required' => false,
211 'parentId' => null,
212 'defaultValue' => '',
213 'position' => 7,
214 'fieldOptions' => [
215 [
216 'id' => 12,
217 'label' => BackendStrings::getTemplateStrings()['internal_team'],
218 'value' => 'internal_team',
219 'isDefault' => false,
220 'position' => 1,
221 ],
222 [
223 'id' => 13,
224 'label' => BackendStrings::getTemplateStrings()['external_vendor'],
225 'value' => 'external_vendor',
226 'isDefault' => false,
227 'position' => 2,
228 ],
229 [
230 'id' => 14,
231 'label' => BackendStrings::getTemplateStrings()['both'],
232 'value' => 'both',
233 'isDefault' => false,
234 'position' => 3,
235 ],
236 ],
237 ],
238 ];
239 }
240
241 /**
242 * Get additional information fields
243 *
244 * @return array<int, array<string, mixed>>
245 */
246 private static function getAdditionalInformationFields(): array
247 {
248 return [
249 // Installation Instructions
250 [
251 'id' => 16,
252 'fieldIndex' => 8,
253 'type' => 'textarea',
254 'label' => BackendStrings::getTemplateStrings()['installation_instructions'],
255 'placeholder' => BackendStrings::getTemplateStrings()['provide_special_requirements'],
256 'required' => false,
257 'parentId' => null,
258 'defaultValue' => '',
259 'position' => 8,
260 'rows' => 4,
261 ],
262 // Mark as Urgent
263 [
264 'id' => 19,
265 'fieldIndex' => 9,
266 'type' => 'checkbox',
267 'label' => BackendStrings::getTemplateStrings()['mark_as_urgent'],
268 'placeholder' => '',
269 'required' => false,
270 'parentId' => null,
271 'defaultValue' => '',
272 'position' => 9,
273 'fieldOptions' => [
274 [
275 'id' => 17,
276 'label' => BackendStrings::getTemplateStrings()['yes'],
277 'value' => 'yes',
278 'isDefault' => false,
279 'position' => 1,
280 ],
281 [
282 'id' => 18,
283 'label' => BackendStrings::getTemplateStrings()['no'],
284 'value' => 'no',
285 'isDefault' => false,
286 'position' => 2,
287 ],
288 ],
289 ],
290 ];
291 }
292 }
293