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

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

246 lines 8.6 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 PrivateDiningReservationFormTemplate
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' => 'private_dining_reservation_form',
18 'name' => BackendStrings::getTemplateStrings()['private_dining_reservation_form'],
19 'description' => BackendStrings::getTemplateStrings()['private_dining_reservation_form_desc'],
20 'category' => 'booking-forms',
21 'subcategory' => 'reservation-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'private-dining-reservation-form.svg'
24 ];
25 }
26
27 /**
28 * Get the full template including form data
29 *
30 * @return array<string, mixed>
31 */
32 public static function getTemplate(): array
33 {
34 return array_merge(
35 self::getTemplateMeta(),
36 [
37 'form_data' => [
38 'name' => BackendStrings::getTemplateStrings()['private_dining_reservation_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getGuestInformationFields(),
45 self::getReservationDetailsFields(),
46 self::getAdditionalFields()
47 ),
48 'settings' => []
49 ]
50 ]
51 );
52 }
53
54 /**
55 * Guest information fields (name, email, phone)
56 *
57 * @return array<int, array<string, mixed>>
58 */
59 private static function getGuestInformationFields(): array
60 {
61 return [
62 // Name Field - Parent
63 [
64 'id' => 1,
65 'fieldIndex' => 1,
66 'type' => 'name',
67 'label' => BackendStrings::getTemplateStrings()['full_name'],
68 'parentId' => null,
69 'defaultValue' => '',
70 'placeholder' => '',
71 'required' => true,
72 'readonly' => false,
73 'position' => 1,
74 ],
75 // First Name - Child of Name Field
76 [
77 'id' => 2,
78 'type' => 'text',
79 'label' => BackendStrings::getTemplateStrings()['first_name'],
80 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
81 'required' => true,
82 'parentId' => 1,
83 'fieldIndex' => 1,
84 'defaultValue' => '',
85 'position' => 1,
86 'optionHide' => false,
87 'description' => '',
88 'settings' => json_encode(['nameFieldType' => 'nameField1']),
89 ],
90 // Last Name - Child of Name Field
91 [
92 'id' => 3,
93 'type' => 'text',
94 'label' => BackendStrings::getTemplateStrings()['last_name'],
95 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
96 'required' => true,
97 'parentId' => 1,
98 'fieldIndex' => 1,
99 'defaultValue' => '',
100 'position' => 2,
101 'optionHide' => false,
102 'description' => '',
103 'settings' => json_encode(['nameFieldType' => 'nameField2']),
104 ],
105 // Email Address
106 [
107 'id' => 4,
108 'fieldIndex' => 2,
109 'type' => 'email',
110 'label' => BackendStrings::getTemplateStrings()['email_address'],
111 'placeholder' => BackendStrings::getTemplateStrings()['name_placeholder'],
112 'required' => true,
113 'parentId' => null,
114 'defaultValue' => '',
115 'position' => 2,
116 ],
117 // Phone Number
118 [
119 'id' => 5,
120 'fieldIndex' => 3,
121 'type' => 'phone',
122 'label' => BackendStrings::getTemplateStrings()['phone_number'],
123 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
124 'required' => true,
125 'parentId' => null,
126 'defaultValue' => '',
127 'position' => 3,
128 'phoneAutoDetect' => true,
129 ],
130 ];
131 }
132
133 /**
134 * Reservation detail fields (guests, room preference, date, time)
135 *
136 * @return array<int, array<string, mixed>>
137 */
138 private static function getReservationDetailsFields(): array
139 {
140 return [
141 // Number of Guests
142 [
143 'id' => 6,
144 'fieldIndex' => 4,
145 'type' => 'number',
146 'label' => BackendStrings::getTemplateStrings()['number_of_guests'],
147 'placeholder' => BackendStrings::getTemplateStrings()['enter_total_guests'],
148 'required' => true,
149 'parentId' => null,
150 'defaultValue' => '',
151 'position' => 4,
152 'minValue' => 1,
153 ],
154 // Room Preference
155 [
156 'id' => 10,
157 'fieldIndex' => 5,
158 'type' => 'select',
159 'label' => BackendStrings::getTemplateStrings()['room_preference'],
160 'placeholder' => BackendStrings::getTemplateStrings()['select_room_preference'],
161 'required' => false,
162 'parentId' => null,
163 'defaultValue' => '',
164 'position' => 5,
165 'fieldOptions' => [
166 [
167 'id' => 7,
168 'label' => BackendStrings::getTemplateStrings()['private_room_a'],
169 'value' => 'private_room_a',
170 'isDefault' => false,
171 'position' => 1
172 ],
173 [
174 'id' => 8,
175 'label' => BackendStrings::getTemplateStrings()['private_room_b'],
176 'value' => 'private_room_b',
177 'isDefault' => false,
178 'position' => 2
179 ],
180 [
181 'id' => 9,
182 'label' => BackendStrings::getTemplateStrings()['no_preference'],
183 'value' => 'no_preference',
184 'isDefault' => false,
185 'position' => 3
186 ],
187 ]
188 ],
189 // Reservation Date
190 [
191 'id' => 11,
192 'fieldIndex' => 6,
193 'type' => 'date',
194 'label' => BackendStrings::getTemplateStrings()['reservation_date'],
195 'placeholder' => BackendStrings::getTemplateStrings()['select_reservation_date'],
196 'required' => true,
197 'parentId' => null,
198 'defaultValue' => '',
199 'position' => 6,
200 'dateFieldType' => 'picker',
201 'dateFormat' => 'MM/DD/YYYY',
202 ],
203 // Reservation Time
204 [
205 'id' => 12,
206 'fieldIndex' => 7,
207 'type' => 'time',
208 'label' => BackendStrings::getTemplateStrings()['reservation_time'],
209 'placeholder' => BackendStrings::getTemplateStrings()['select_reservation_time'],
210 'required' => true,
211 'parentId' => null,
212 'defaultValue' => '',
213 'position' => 7,
214 'timeFieldType' => 'time-picker',
215 'timeFormat' => 'ampm',
216 ],
217 ];
218 }
219
220 /**
221 * Additional information fields (special instructions)
222 *
223 * @return array<int, array<string, mixed>>
224 */
225 private static function getAdditionalFields(): array
226 {
227 return [
228 // Special Instructions
229 [
230 'id' => 13,
231 'fieldIndex' => 8,
232 'type' => 'textarea',
233 'label' => BackendStrings::getTemplateStrings()['special_instructions'],
234 'placeholder' => BackendStrings::getTemplateStrings()[
235 'private_dining_special_instructions_placeholder'
236 ],
237 'parentId' => null,
238 'defaultValue' => '',
239 'position' => 8,
240 'required' => false,
241 'rows' => 4,
242 ],
243 ];
244 }
245 }
246