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

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

257 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 use IvyForms\Services\Translations\BackendStrings;
6
7 class SoftwarePurchaseOrderFormTemplate
8 {
9 /**
10 * Software 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' => 'software_purchase_order_form',
21 'name' => BackendStrings::getTemplateStrings()['software_purchase_order_form'],
22 'description' => BackendStrings::getTemplateStrings()[
23 'software_purchase_order_form_description'
24 ],
25 'category' => 'order-forms',
26 'subcategory' => 'product-order-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'software-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()['software_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::getSoftwareDetailsFields(),
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 * Software details fields (software name, number of licenses, license type)
151 *
152 * @return array<int, array<string, mixed>>
153 */
154 private static function getSoftwareDetailsFields(): array
155 {
156 return [
157 // Software Name
158 [
159 'id' => 7,
160 'fieldIndex' => 5,
161 'type' => 'text',
162 'label' => BackendStrings::getTemplateStrings()['software_name'],
163 'placeholder' => BackendStrings::getTemplateStrings()['enter_software_name'],
164 'required' => true,
165 'parentId' => null,
166 'defaultValue' => '',
167 'position' => 6,
168 ],
169 // Number of Licenses
170 [
171 'id' => 8,
172 'fieldIndex' => 6,
173 'type' => 'number',
174 'label' => BackendStrings::getTemplateStrings()['number_of_licenses'],
175 'placeholder' => BackendStrings::getTemplateStrings()['enter_number_of_licenses'],
176 'required' => true,
177 'parentId' => null,
178 'defaultValue' => '',
179 'position' => 7,
180 'minValue' => 1,
181 ],
182 // License Type
183 [
184 'id' => 12,
185 'fieldIndex' => 7,
186 'type' => 'select',
187 'label' => BackendStrings::getTemplateStrings()['license_type'],
188 'placeholder' => BackendStrings::getTemplateStrings()['select_license_type'],
189 'required' => false,
190 'parentId' => null,
191 'defaultValue' => '',
192 'position' => 8,
193 'fieldOptions' => [
194 [
195 'id' => 9,
196 'label' => BackendStrings::getTemplateStrings()['single_user'],
197 'value' => 'single_user',
198 'isDefault' => false,
199 'position' => 1
200 ],
201 [
202 'id' => 10,
203 'label' => BackendStrings::getTemplateStrings()['multi_user'],
204 'value' => 'multi_user',
205 'isDefault' => false,
206 'position' => 2
207 ],
208 [
209 'id' => 11,
210 'label' => BackendStrings::getTemplateStrings()['enterprise'],
211 'value' => 'enterprise',
212 'isDefault' => false,
213 'position' => 3
214 ],
215 ]
216 ],
217 ];
218 }
219
220 /**
221 * Additional information fields (notes, activation date)
222 *
223 * @return array<int, array<string, mixed>>
224 */
225 private static function getAdditionalInformationFields(): array
226 {
227 return [
228 // Additional Notes or Requirements
229 [
230 'id' => 13,
231 'fieldIndex' => 8,
232 'type' => 'textarea',
233 'label' => BackendStrings::getTemplateStrings()['additional_notes_or_requirements'],
234 'placeholder' => BackendStrings::getTemplateStrings()['enter_additional_notes_or_requirements'],
235 'required' => false,
236 'parentId' => null,
237 'defaultValue' => '',
238 'position' => 9,
239 ],
240 // Required Activation Date
241 [
242 'id' => 14,
243 'fieldIndex' => 9,
244 'type' => 'date',
245 'label' => BackendStrings::getTemplateStrings()['required_activation_date'],
246 'placeholder' => BackendStrings::getTemplateStrings()['select_required_activation_date'],
247 'required' => true,
248 'parentId' => null,
249 'defaultValue' => '',
250 'position' => 10,
251 'dateFieldType' => 'picker',
252 'dateFormat' => 'MM/DD/YYYY',
253 ],
254 ];
255 }
256 }
257