PluginProbe
The Innovative Form Builder – IvyForms / 0.9.1
The Innovative Form Builder – IvyForms v0.9.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 0.9.1, at backend/src/Services/Template/InstallationWorkOrderFormTemplate.php

284 lines 10.1 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 // phpcs:disable PSR1.Files.SideEffects
6 if (!defined('ABSPATH')) {
7 exit; // Exit if accessed directly
8 }
9
10 use IvyForms\Services\Translations\BackendStrings;
11
12 class InstallationWorkOrderFormTemplate
13 {
14 /**
15 * Get the installation work order form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'installation_work_order_form',
23 'name' => BackendStrings::getTemplateStrings()['installation_work_order_form'],
24 'description' => BackendStrings::getTemplateStrings()['installation_work_order_form_desc'],
25 'category' => 'order-forms',
26 'subcategory' => 'work-order-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'installation-work-order-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['installation_work_order_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getContactInformationFields(),
37 self::getInstallationDetailsFields(),
38 self::getAdditionalInformationFields()
39 ),
40 'settings' => []
41 ]
42 ];
43 }
44
45 /**
46 * Get contact information fields
47 *
48 * @return array<int, array<string, mixed>>
49 */
50 private static function getContactInformationFields(): array
51 {
52 return [
53 // Full Name
54 [
55 'id' => 1,
56 'fieldIndex' => 1,
57 'type' => 'name',
58 'label' => BackendStrings::getTemplateStrings()['full_name'],
59 'parentId' => null,
60 'defaultValue' => '',
61 'placeholder' => '',
62 'required' => true,
63 'readonly' => false,
64 'position' => 1,
65 ],
66 // First Name - Child of Name Field
67 [
68 'id' => 2,
69 'type' => 'text',
70 'label' => BackendStrings::getNewFormStrings()['first_name'],
71 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_name'],
72 'required' => true,
73 'parentId' => 1,
74 'fieldIndex' => 1,
75 'defaultValue' => '',
76 'position' => 1,
77 'optionHide' => false,
78 'description' => '',
79 'settings' => json_encode(['nameFieldType' => 'nameField1']),
80 ],
81 // Last Name - Child of Name Field
82 [
83 'id' => 3,
84 'type' => 'text',
85 'label' => BackendStrings::getNewFormStrings()['last_name'],
86 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
87 'required' => true,
88 'parentId' => 1,
89 'fieldIndex' => 1,
90 'defaultValue' => '',
91 'position' => 2,
92 'optionHide' => false,
93 'description' => '',
94 'settings' => json_encode(['nameFieldType' => 'nameField2']),
95 ],
96 // Email Address
97 [
98 'id' => 4,
99 'fieldIndex' => 2,
100 'type' => 'email',
101 'label' => BackendStrings::getTemplateStrings()['email_address'],
102 'placeholder' => '[email protected]',
103 'required' => true,
104 'parentId' => null,
105 'defaultValue' => '',
106 'position' => 2,
107 'validation' => [
108 'required' => true,
109 'email' => true
110 ],
111 ],
112 ];
113 }
114
115 /**
116 * Get installation details fields
117 *
118 * @return array<int, array<string, mixed>>
119 */
120 private static function getInstallationDetailsFields(): array
121 {
122 return [
123 // Equipment/Device Name
124 [
125 'id' => 5,
126 'fieldIndex' => 3,
127 'type' => 'text',
128 'label' => BackendStrings::getTemplateStrings()['equipment_device_name'],
129 'placeholder' => BackendStrings::getTemplateStrings()['enter_device_name'],
130 'required' => true,
131 'parentId' => null,
132 'defaultValue' => '',
133 'position' => 3,
134 ],
135 // Room/Area
136 [
137 'id' => 6,
138 'fieldIndex' => 4,
139 'type' => 'text',
140 'label' => BackendStrings::getTemplateStrings()['room_area'],
141 'placeholder' => BackendStrings::getTemplateStrings()['specify_installation_location'],
142 'required' => true,
143 'parentId' => null,
144 'defaultValue' => '',
145 'position' => 4,
146 ],
147 // Installation Type Radio
148 [
149 'id' => 10,
150 'fieldIndex' => 5,
151 'type' => 'radio',
152 'label' => BackendStrings::getTemplateStrings()['installation_type'],
153 'placeholder' => '',
154 'required' => true,
155 'parentId' => null,
156 'defaultValue' => '',
157 'position' => 5,
158 'fieldOptions' => [
159 [
160 'id' => 7,
161 'label' => BackendStrings::getTemplateStrings()['standard'],
162 'value' => 'standard',
163 'isDefault' => false,
164 'position' => 1,
165 ],
166 [
167 'id' => 8,
168 'label' => BackendStrings::getTemplateStrings()['custom'],
169 'value' => 'custom',
170 'isDefault' => false,
171 'position' => 2,
172 ],
173 [
174 'id' => 9,
175 'label' => BackendStrings::getTemplateStrings()['scheduled'],
176 'value' => 'scheduled',
177 'isDefault' => false,
178 'position' => 3,
179 ],
180 ],
181 ],
182 // Requested Installation Date
183 [
184 'id' => 11,
185 'fieldIndex' => 6,
186 'type' => 'date',
187 'label' => BackendStrings::getTemplateStrings()['requested_installation_date'],
188 'placeholder' => BackendStrings::getTemplateStrings()['enter_requested_installation_date'],
189 'required' => true,
190 'parentId' => null,
191 'defaultValue' => '',
192 'position' => 6,
193 ],
194 // Installer Required Dropdown
195 [
196 'id' => 15,
197 'fieldIndex' => 7,
198 'type' => 'select',
199 'label' => BackendStrings::getTemplateStrings()['installer_required'],
200 'placeholder' => BackendStrings::getTemplateStrings()['select_installer'],
201 'required' => false,
202 'parentId' => null,
203 'defaultValue' => '',
204 'position' => 7,
205 'fieldOptions' => [
206 [
207 'id' => 12,
208 'label' => BackendStrings::getTemplateStrings()['internal_team'],
209 'value' => 'internal_team',
210 'isDefault' => false,
211 'position' => 1,
212 ],
213 [
214 'id' => 13,
215 'label' => BackendStrings::getTemplateStrings()['external_vendor'],
216 'value' => 'external_vendor',
217 'isDefault' => false,
218 'position' => 2,
219 ],
220 [
221 'id' => 14,
222 'label' => BackendStrings::getTemplateStrings()['both'],
223 'value' => 'both',
224 'isDefault' => false,
225 'position' => 3,
226 ],
227 ],
228 ],
229 ];
230 }
231
232 /**
233 * Get additional information fields
234 *
235 * @return array<int, array<string, mixed>>
236 */
237 private static function getAdditionalInformationFields(): array
238 {
239 return [
240 // Installation Instructions
241 [
242 'id' => 16,
243 'fieldIndex' => 8,
244 'type' => 'textarea',
245 'label' => BackendStrings::getTemplateStrings()['installation_instructions'],
246 'placeholder' => BackendStrings::getTemplateStrings()['provide_special_requirements'],
247 'required' => false,
248 'parentId' => null,
249 'defaultValue' => '',
250 'position' => 8,
251 'rows' => 4,
252 ],
253 // Mark as Urgent
254 [
255 'id' => 19,
256 'fieldIndex' => 9,
257 'type' => 'checkbox',
258 'label' => BackendStrings::getTemplateStrings()['mark_as_urgent'],
259 'placeholder' => '',
260 'required' => false,
261 'parentId' => null,
262 'defaultValue' => '',
263 'position' => 9,
264 'fieldOptions' => [
265 [
266 'id' => 17,
267 'label' => BackendStrings::getTemplateStrings()['yes'],
268 'value' => 'yes',
269 'isDefault' => false,
270 'position' => 1,
271 ],
272 [
273 'id' => 18,
274 'label' => BackendStrings::getTemplateStrings()['no'],
275 'value' => 'no',
276 'isDefault' => false,
277 'position' => 2,
278 ],
279 ],
280 ],
281 ];
282 }
283 }
284