PluginProbe
The Innovative Form Builder – IvyForms / 0.8.2
The Innovative Form Builder – IvyForms v0.8.2
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 / EquipmentPurchaseOrderFormTemplate.php

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

255 lines 9.0 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 /**
13 * Equipment Purchase Order Form Template
14 */
15 class EquipmentPurchaseOrderFormTemplate
16 {
17 /**
18 * Get the template configuration
19 *
20 * @return array<string, mixed>
21 */
22 public static function getTemplate(): array
23 {
24 return [
25 'id' => 'equipment_purchase_order_form',
26 'name' => BackendStrings::getTemplateStrings()['equipment_purchase_order_form'],
27 'description' => BackendStrings::getTemplateStrings()[
28 'equipment_purchase_order_form_description'
29 ],
30 'category' => 'order-forms',
31 'subcategory' => 'general-product-order-form',
32 'is_pro' => false,
33 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'equipment-purchase-order-form.svg',
34 'form_data' => [
35 'name' => BackendStrings::getTemplateStrings()['equipment_purchase_order_form'],
36 'published' => 1,
37 'showTitle' => 1,
38 'storeEntries' => 1,
39 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
40 'fields' => array_merge(
41 self::getRequestorInformationFields(),
42 self::getEquipmentDetailsFields(),
43 self::getAdditionalInformationFields()
44 ),
45 'settings' => []
46 ]
47 ];
48 }
49
50 /**
51 * Requestor information fields (name, email, phone, department)
52 *
53 * @return array<int, array<string, mixed>>
54 */
55 private static function getRequestorInformationFields(): array
56 {
57 return [
58 // Requestor Name
59 [
60 'id' => 0,
61 'fieldIndex' => 1,
62 'type' => 'name',
63 'label' => BackendStrings::getTemplateStrings()['requestor_name'],
64 'parentId' => null,
65 'defaultValue' => '',
66 'placeholder' => '',
67 'required' => true,
68 'readonly' => false,
69 'position' => 1,
70 ],
71 // First Name - Child of Name Field
72 [
73 'id' => 0,
74 'type' => 'text',
75 'label' => BackendStrings::getTemplateStrings()['first_name'],
76 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
77 'required' => true,
78 'parentId' => 0,
79 'fieldIndex' => 1,
80 'defaultValue' => '',
81 'position' => 1,
82 'optionHide' => false,
83 'description' => '',
84 'settings' => json_encode(['nameFieldType' => 'nameField1']),
85 ],
86 // Last Name - Child of Name Field
87 [
88 'id' => 0,
89 'type' => 'text',
90 'label' => BackendStrings::getTemplateStrings()['last_name'],
91 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
92 'required' => true,
93 'parentId' => 0,
94 'fieldIndex' => 1,
95 'defaultValue' => '',
96 'position' => 2,
97 'optionHide' => false,
98 'description' => '',
99 'settings' => json_encode(['nameFieldType' => 'nameField2']),
100 ],
101 // Email Address
102 [
103 'id' => 0,
104 'fieldIndex' => 2,
105 'type' => 'email',
106 'label' => BackendStrings::getTemplateStrings()['email_address'],
107 'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'],
108 'required' => true,
109 'parentId' => null,
110 'defaultValue' => '',
111 'position' => 3,
112 ],
113 // Phone Number
114 [
115 'id' => 0,
116 'fieldIndex' => 3,
117 'type' => 'phone',
118 'label' => BackendStrings::getTemplateStrings()['phone_number'],
119 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
120 'required' => false,
121 'parentId' => null,
122 'defaultValue' => '',
123 'position' => 4,
124 ],
125 // Department
126 [
127 'id' => 0,
128 'fieldIndex' => 4,
129 'type' => 'text',
130 'label' => BackendStrings::getTemplateStrings()['department'],
131 'placeholder' => BackendStrings::getTemplateStrings()['enter_department'],
132 'required' => true,
133 'parentId' => null,
134 'defaultValue' => '',
135 'position' => 5,
136 ],
137 ];
138 }
139
140 /**
141 * Equipment details fields (equipment name, quantity, equipment type)
142 *
143 * @return array<int, array<string, mixed>>
144 */
145 private static function getEquipmentDetailsFields(): array
146 {
147 return [
148 // Equipment Name
149 [
150 'id' => 0,
151 'fieldIndex' => 5,
152 'type' => 'text',
153 'label' => BackendStrings::getTemplateStrings()['equipment_name'],
154 'placeholder' => BackendStrings::getTemplateStrings()['enter_equipment_name'],
155 'required' => true,
156 'parentId' => null,
157 'defaultValue' => '',
158 'position' => 6,
159 ],
160 // Quantity
161 [
162 'id' => 0,
163 'fieldIndex' => 6,
164 'type' => 'number',
165 'label' => BackendStrings::getTemplateStrings()['quantity'],
166 'placeholder' => BackendStrings::getTemplateStrings()['enter_quantity'],
167 'required' => true,
168 'parentId' => null,
169 'defaultValue' => '',
170 'position' => 7,
171 'minValue' => 1,
172 ],
173 // Equipment Type
174 [
175 'id' => 0,
176 'fieldIndex' => 7,
177 'type' => 'select',
178 'label' => BackendStrings::getTemplateStrings()['equipment_type'],
179 'placeholder' => BackendStrings::getTemplateStrings()['select_equipment_type'],
180 'required' => true,
181 'parentId' => null,
182 'defaultValue' => '',
183 'position' => 8,
184 'fieldOptions' => [
185 [
186 'id' => 0,
187 'label' => BackendStrings::getTemplateStrings()['computer'],
188 'value' => 'computer',
189 'isDefault' => false,
190 'position' => 1
191 ],
192 [
193 'id' => 0,
194 'label' => BackendStrings::getTemplateStrings()['machinery'],
195 'value' => 'machinery',
196 'isDefault' => false,
197 'position' => 2
198 ],
199 [
200 'id' => 0,
201 'label' => BackendStrings::getTemplateStrings()['tools'],
202 'value' => 'tools',
203 'isDefault' => false,
204 'position' => 3
205 ],
206 [
207 'id' => 0,
208 'label' => BackendStrings::getTemplateStrings()['other'],
209 'value' => 'other',
210 'isDefault' => false,
211 'position' => 4
212 ],
213 ]
214 ],
215 ];
216 }
217
218 /**
219 * Additional information fields (notes, delivery date)
220 *
221 * @return array<int, array<string, mixed>>
222 */
223 private static function getAdditionalInformationFields(): array
224 {
225 return [
226 // Additional Notes
227 [
228 'id' => 0,
229 'fieldIndex' => 8,
230 'type' => 'textarea',
231 'label' => BackendStrings::getTemplateStrings()['additional_notes'],
232 'placeholder' => BackendStrings::getTemplateStrings()['enter_additional_notes'],
233 'required' => false,
234 'parentId' => null,
235 'defaultValue' => '',
236 'position' => 9,
237 ],
238 // Required Delivery Date
239 [
240 'id' => 0,
241 'fieldIndex' => 9,
242 'type' => 'date',
243 'label' => BackendStrings::getTemplateStrings()['required_delivery_date'],
244 'placeholder' => BackendStrings::getTemplateStrings()['select_required_delivery_date'],
245 'required' => true,
246 'parentId' => null,
247 'defaultValue' => '',
248 'position' => 10,
249 'dateFieldType' => 'picker',
250 'dateFormat' => 'MM/DD/YYYY',
251 ],
252 ];
253 }
254 }
255