PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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 / MaterialPurchaseOrderFormTemplate.php

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

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