PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
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 / AnniversaryDinnerReservationFormTemplate.php

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

237 lines 8.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 AnniversaryDinnerReservationFormTemplate
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' => 'anniversary_dinner_reservation_form',
18 'name' => BackendStrings::getTemplateStrings()['anniversary_dinner_reservation_form'],
19 'description' => BackendStrings::getTemplateStrings()['anniversary_dinner_reservation_form_desc'],
20 'category' => 'booking-forms',
21 'subcategory' => 'reservation-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'anniversary-dinner-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()['anniversary_dinner_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, 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 // Anniversary Date
155 [
156 'id' => 7,
157 'fieldIndex' => 5,
158 'type' => 'date',
159 'label' => BackendStrings::getTemplateStrings()['anniversary_date'],
160 'placeholder' => BackendStrings::getTemplateStrings()['select_anniversary_date'],
161 'required' => true,
162 'parentId' => null,
163 'defaultValue' => '',
164 'position' => 5,
165 'dateFieldType' => 'picker',
166 'dateFormat' => 'MM/DD/YYYY',
167 ],
168 // Reservation Time
169 [
170 'id' => 8,
171 'fieldIndex' => 6,
172 'type' => 'time',
173 'label' => BackendStrings::getTemplateStrings()['reservation_time'],
174 'placeholder' => BackendStrings::getTemplateStrings()['select_reservation_time'],
175 'required' => true,
176 'parentId' => null,
177 'defaultValue' => '',
178 'position' => 6,
179 'timeFieldType' => 'time-picker',
180 'timeFormat' => 'ampm',
181 ],
182 ];
183 }
184
185 /**
186 * Additional information fields (special requests, private room)
187 *
188 * @return array<int, array<string, mixed>>
189 */
190 private static function getAdditionalFields(): array
191 {
192 return [
193 // Special Requests
194 [
195 'id' => 9,
196 'fieldIndex' => 7,
197 'type' => 'textarea',
198 'label' => BackendStrings::getTemplateStrings()['special_requests'],
199 'placeholder' => BackendStrings::getTemplateStrings()['anniversary_special_requests_placeholder'],
200 'parentId' => null,
201 'defaultValue' => '',
202 'position' => 7,
203 'required' => false,
204 'rows' => 4,
205 ],
206 // Private Room Question
207 [
208 'id' => 12,
209 'fieldIndex' => 8,
210 'type' => 'radio',
211 'label' => BackendStrings::getTemplateStrings()['private_room_question'],
212 'parentId' => null,
213 'position' => 8,
214 'required' => false,
215 'defaultValue' => '',
216 'placeholder' => '',
217 'fieldOptions' => [
218 [
219 'id' => 10,
220 'label' => BackendStrings::getTemplateStrings()['yes'],
221 'value' => 'yes',
222 'isDefault' => false,
223 'position' => 1
224 ],
225 [
226 'id' => 11,
227 'label' => BackendStrings::getTemplateStrings()['no'],
228 'value' => 'no',
229 'isDefault' => false,
230 'position' => 2
231 ],
232 ],
233 ],
234 ];
235 }
236 }
237