PluginProbe
The Innovative Form Builder – IvyForms / 0.9
The Innovative Form Builder – IvyForms v0.9
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 / OfficeSuppliesPurchaseOrderFormTemplate.php

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

248 lines 8.7 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 * Office Supplies Purchase Order Form Template
14 */
15 class OfficeSuppliesPurchaseOrderFormTemplate
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' => 'office_supplies_purchase_order_form',
26 'name' => BackendStrings::getTemplateStrings()['office_supplies_purchase_order_form'],
27 'description' => BackendStrings::getTemplateStrings()[
28 'office_supplies_purchase_order_form_description'
29 ],
30 'category' => 'order-forms',
31 'subcategory' => 'product-order-forms',
32 'is_pro' => false,
33 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'office-supplies-purchase-order-form.svg',
34 'form_data' => [
35 'name' => BackendStrings::getTemplateStrings()['office_supplies_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::getOrderDetailsFields(),
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' => 1,
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' => 2,
74 'type' => 'text',
75 'label' => BackendStrings::getTemplateStrings()['first_name'],
76 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
77 'required' => true,
78 'parentId' => 1,
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' => 3,
89 'type' => 'text',
90 'label' => BackendStrings::getTemplateStrings()['last_name'],
91 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
92 'required' => true,
93 'parentId' => 1,
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' => 4,
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' => 5,
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' => 6,
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 * Order details fields (item name, quantity, priority)
142 *
143 * @return array<int, array<string, mixed>>
144 */
145 private static function getOrderDetailsFields(): array
146 {
147 return [
148 // Item Name
149 [
150 'id' => 7,
151 'fieldIndex' => 5,
152 'type' => 'text',
153 'label' => BackendStrings::getTemplateStrings()['item_name'],
154 'placeholder' => BackendStrings::getTemplateStrings()['enter_item_name'],
155 'required' => true,
156 'parentId' => null,
157 'defaultValue' => '',
158 'position' => 6,
159 ],
160 // Quantity
161 [
162 'id' => 8,
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 // Priority
174 [
175 'id' => 12,
176 'fieldIndex' => 7,
177 'type' => 'select',
178 'label' => BackendStrings::getTemplateStrings()['priority'],
179 'placeholder' => BackendStrings::getTemplateStrings()['select_priority'],
180 'required' => false,
181 'parentId' => null,
182 'defaultValue' => '',
183 'position' => 8,
184 'fieldOptions' => [
185 [
186 'id' => 9,
187 'label' => BackendStrings::getTemplateStrings()['low'],
188 'value' => 'low',
189 'isDefault' => false,
190 'position' => 1
191 ],
192 [
193 'id' => 10,
194 'label' => BackendStrings::getTemplateStrings()['medium'],
195 'value' => 'medium',
196 'isDefault' => false,
197 'position' => 2
198 ],
199 [
200 'id' => 11,
201 'label' => BackendStrings::getTemplateStrings()['high'],
202 'value' => 'high',
203 'isDefault' => false,
204 'position' => 3
205 ],
206 ]
207 ],
208 ];
209 }
210
211 /**
212 * Additional information fields (special instructions, delivery date)
213 *
214 * @return array<int, array<string, mixed>>
215 */
216 private static function getAdditionalInformationFields(): array
217 {
218 return [
219 // Special Instructions
220 [
221 'id' => 13,
222 'fieldIndex' => 8,
223 'type' => 'textarea',
224 'label' => BackendStrings::getTemplateStrings()['special_instructions'],
225 'placeholder' => BackendStrings::getTemplateStrings()['enter_special_instructions'],
226 'required' => false,
227 'parentId' => null,
228 'defaultValue' => '',
229 'position' => 9,
230 ],
231 // Required Delivery Date
232 [
233 'id' => 14,
234 'fieldIndex' => 9,
235 'type' => 'date',
236 'label' => BackendStrings::getTemplateStrings()['required_delivery_date'],
237 'placeholder' => BackendStrings::getTemplateStrings()['select_required_delivery_date'],
238 'required' => true,
239 'parentId' => null,
240 'defaultValue' => '',
241 'position' => 10,
242 'dateFieldType' => 'picker',
243 'dateFormat' => 'MM/DD/YYYY',
244 ],
245 ];
246 }
247 }
248