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

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

307 lines 10.8 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 FoodVendorRegistrationFormTemplate
8 {
9 /**
10 * Get template metadata (without form_data)
11 *
12 * @return array<string, mixed>
13 */
14 public static function getTemplateMeta(): array
15 {
16 return [
17 'id' => 'food_vendor_registration_form',
18 'name' => BackendStrings::getTemplateStrings()['food_vendor_registration_form'],
19 'description' => BackendStrings::getTemplateStrings()[
20 'food_vendor_registration_form_desc'
21 ],
22 'category' => 'registration-forms',
23 'subcategory' => 'vendor-registration-forms',
24 'is_pro' => false,
25 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'food-vendor-registration-form.svg'
26 ];
27 }
28
29 /**
30 * Get the full template including form data
31 *
32 * @return array<string, mixed>
33 */
34 public static function getTemplate(): array
35 {
36 return array_merge(
37 self::getTemplateMeta(),
38 [
39 'form_data' => [
40 'name' => BackendStrings::getTemplateStrings()['food_vendor_registration_form'],
41 'published' => 1,
42 'showTitle' => 1,
43 'storeEntries' => 1,
44 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
45 'fields' => array_merge(
46 self::getVendorInformationFields(),
47 self::getProductDetailsFields(),
48 self::getBoothDetailsFields(),
49 self::getAdditionalFields()
50 ),
51 'settings' => []
52 ]
53 ]
54 );
55 }
56
57 /**
58 * Vendor information fields
59 *
60 * @return array<int, array<string, mixed>>
61 */
62 private static function getVendorInformationFields(): array
63 {
64 return [
65 // Business / Vendor Name
66 [
67 'id' => 1,
68 'fieldIndex' => 1,
69 'type' => 'text',
70 'label' => BackendStrings::getTemplateStrings()['business_vendor_name'],
71 'placeholder' => BackendStrings::getTemplateStrings()['enter_business_name'],
72 'required' => true,
73 'parentId' => null,
74 'defaultValue' => '',
75 'position' => 1,
76 ],
77 // Owner / Contact Person
78 [
79 'id' => 2,
80 'fieldIndex' => 2,
81 'type' => 'text',
82 'label' => BackendStrings::getTemplateStrings()['owner_contact_person'],
83 'placeholder' => BackendStrings::getTemplateStrings()['enter_owner_contact_name'],
84 'required' => true,
85 'parentId' => null,
86 'defaultValue' => '',
87 'position' => 2,
88 ],
89 // Email Address
90 [
91 'id' => 3,
92 'fieldIndex' => 3,
93 'type' => 'email',
94 'label' => BackendStrings::getTemplateStrings()['email_address'],
95 'placeholder' => BackendStrings::getTemplateStrings()['name_placeholder'],
96 'required' => true,
97 'parentId' => null,
98 'defaultValue' => '',
99 'position' => 3,
100 ],
101 // Phone Number (optional)
102 [
103 'id' => 4,
104 'fieldIndex' => 4,
105 'type' => 'phone',
106 'label' => BackendStrings::getTemplateStrings()['phone_number'],
107 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
108 'required' => false,
109 'parentId' => null,
110 'defaultValue' => '',
111 'position' => 4,
112 'phoneAutoDetect' => true,
113 ],
114 ];
115 }
116
117 /**
118 * Product details fields (food type, menu offerings)
119 *
120 * @return array<int, array<string, mixed>>
121 */
122 private static function getProductDetailsFields(): array
123 {
124 return [
125 // Food Type (select)
126 [
127 'id' => 10,
128 'fieldIndex' => 5,
129 'type' => 'select',
130 'label' => BackendStrings::getTemplateStrings()['food_type'],
131 'placeholder' => BackendStrings::getTemplateStrings()['select_food_type'],
132 'required' => true,
133 'parentId' => null,
134 'defaultValue' => '',
135 'position' => 5,
136 'fieldOptions' => [
137 [
138 'id' => 5,
139 'label' => BackendStrings::getTemplateStrings()['baked_goods'],
140 'value' => 'baked_goods',
141 'isDefault' => false,
142 'position' => 1
143 ],
144 [
145 'id' => 6,
146 'label' => BackendStrings::getTemplateStrings()['beverages'],
147 'value' => 'beverages',
148 'isDefault' => false,
149 'position' => 2
150 ],
151 [
152 'id' => 7,
153 'label' => BackendStrings::getTemplateStrings()['snacks'],
154 'value' => 'snacks',
155 'isDefault' => false,
156 'position' => 3
157 ],
158 [
159 'id' => 8,
160 'label' => BackendStrings::getTemplateStrings()['full_meals'],
161 'value' => 'full_meals',
162 'isDefault' => false,
163 'position' => 4
164 ],
165 [
166 'id' => 9,
167 'label' => BackendStrings::getTemplateStrings()['other'],
168 'value' => 'other',
169 'isDefault' => false,
170 'position' => 5
171 ],
172 ]
173 ],
174 // Menu Items / Offerings (required textarea)
175 [
176 'id' => 11,
177 'fieldIndex' => 6,
178 'type' => 'textarea',
179 'label' => BackendStrings::getTemplateStrings()['menu_items_offerings'],
180 'placeholder' => BackendStrings::getTemplateStrings()['list_main_products_or_menu'],
181 'parentId' => null,
182 'defaultValue' => '',
183 'position' => 6,
184 'required' => true,
185 'rows' => 4,
186 ],
187 ];
188 }
189
190 /**
191 * Booth details fields (size, electricity)
192 *
193 * @return array<int, array<string, mixed>>
194 */
195 private static function getBoothDetailsFields(): array
196 {
197 return [
198 // Booth / Stall Size Needed (number, optional)
199 [
200 'id' => 12,
201 'fieldIndex' => 7,
202 'type' => 'number',
203 'label' => BackendStrings::getTemplateStrings()['booth_stall_size_needed'],
204 'placeholder' => BackendStrings::getTemplateStrings()['enter_size_sq_meters'],
205 'required' => false,
206 'parentId' => null,
207 'defaultValue' => '',
208 'position' => 7,
209 ],
210 // Require Electricity? (radio, optional)
211 [
212 'id' => 15,
213 'fieldIndex' => 8,
214 'type' => 'radio',
215 'label' => BackendStrings::getTemplateStrings()['require_electricity'],
216 'parentId' => null,
217 'position' => 8,
218 'required' => false,
219 'defaultValue' => '',
220 'placeholder' => '',
221 'fieldOptions' => [
222 [
223 'id' => 13,
224 'label' => BackendStrings::getTemplateStrings()['yes'],
225 'value' => 'yes',
226 'isDefault' => false,
227 'position' => 1
228 ],
229 [
230 'id' => 14,
231 'label' => BackendStrings::getTemplateStrings()['no'],
232 'value' => 'no',
233 'isDefault' => false,
234 'position' => 2
235 ],
236 ],
237 ],
238 ];
239 }
240
241 /**
242 * Additional fields (special requirements, available dates, terms agreement)
243 *
244 * @return array<int, array<string, mixed>>
245 */
246 private static function getAdditionalFields(): array
247 {
248 return [
249 // Special Requirements (optional textarea)
250 [
251 'id' => 16,
252 'fieldIndex' => 9,
253 'type' => 'textarea',
254 'label' => BackendStrings::getTemplateStrings()['special_requirements'],
255 'placeholder' => BackendStrings::getTemplateStrings()['special_requirements_placeholder'],
256 'parentId' => null,
257 'defaultValue' => '',
258 'position' => 9,
259 'required' => false,
260 'rows' => 3,
261 ],
262 // Available Dates (date picker, required)
263 [
264 'id' => 17,
265 'fieldIndex' => 10,
266 'type' => 'date',
267 'label' => BackendStrings::getTemplateStrings()['available_date'],
268 'placeholder' => BackendStrings::getTemplateStrings()['select_available_date'],
269 'required' => true,
270 'parentId' => null,
271 'defaultValue' => '',
272 'position' => 10,
273 'dateFieldType' => 'picker',
274 'dateFormat' => 'MM/DD/YYYY',
275 ],
276 // Agree to Vendor Terms & Conditions (radio, required)
277 [
278 'id' => 20,
279 'fieldIndex' => 11,
280 'type' => 'radio',
281 'label' => BackendStrings::getTemplateStrings()['agree_vendor_terms_conditions'],
282 'parentId' => null,
283 'position' => 11,
284 'required' => true,
285 'defaultValue' => '',
286 'placeholder' => '',
287 'fieldOptions' => [
288 [
289 'id' => 18,
290 'label' => BackendStrings::getTemplateStrings()['yes'],
291 'value' => 'yes',
292 'isDefault' => false,
293 'position' => 1
294 ],
295 [
296 'id' => 19,
297 'label' => BackendStrings::getTemplateStrings()['no'],
298 'value' => 'no',
299 'isDefault' => false,
300 'position' => 2
301 ],
302 ],
303 ],
304 ];
305 }
306 }
307