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

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

374 lines 12.3 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 DoctorAppointmentBookingFormTemplate
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' => 'doctor_appointment_booking_form',
18 'name' => BackendStrings::getTemplateStrings()['doctor_appointment_booking_form'],
19 'description' => BackendStrings::getTemplateStrings()['doctor_appointment_booking_form_desc'],
20 'category' => 'booking-forms',
21 'subcategory' => 'appointment-booking-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'doctor-appointment-booking-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()['doctor_appointment_booking_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getPatientInformationFields(),
45 self::getAppointmentDetailsFields(),
46 self::getAdditionalInformationFields()
47 ),
48 'settings' => []
49 ]
50 ]
51 );
52 }
53
54 /**
55 * Get patient information fields
56 *
57 * @return array<int, array<string, mixed>>
58 */
59 private static function getPatientInformationFields(): 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::getNewFormStrings()['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::getNewFormStrings()['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' => '[email protected]',
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' => '+1 (_) _-_',
124 'required' => true,
125 'parentId' => null,
126 'defaultValue' => '',
127 'position' => 3,
128 'phoneAutoDetect' => true,
129 ],
130 ];
131 }
132
133 /**
134 * Get appointment details fields
135 *
136 * @return array<int, array<string, mixed>>
137 */
138 private static function getAppointmentDetailsFields(): array
139 {
140 return array_merge(
141 self::getDoctorSpecialistField(),
142 self::getPreferredAppointmentDateField(),
143 self::getPreferredTimeSlotField()
144 );
145 }
146
147 /**
148 * Get doctor/specialist field
149 *
150 * @return array<int, array<string, mixed>>
151 */
152 private static function getDoctorSpecialistField(): array
153 {
154 return [
155 [
156 'id' => 11,
157 'fieldIndex' => 4,
158 'type' => 'select',
159 'label' => BackendStrings::getTemplateStrings()['doctor_specialist'],
160 'placeholder' => BackendStrings::getTemplateStrings()['select_doctor_or_specialist'],
161 'required' => true,
162 'parentId' => null,
163 'defaultValue' => '',
164 'position' => 4,
165 'fieldOptions' => [
166 [
167 'id' => 6,
168 'label' => BackendStrings::getTemplateStrings()['general_practitioner'],
169 'value' => 'general_practitioner',
170 'isDefault' => false,
171 'position' => 1
172 ],
173 [
174 'id' => 7,
175 'label' => BackendStrings::getTemplateStrings()['dermatologist'],
176 'value' => 'dermatologist',
177 'isDefault' => false,
178 'position' => 2
179 ],
180 [
181 'id' => 8,
182 'label' => BackendStrings::getTemplateStrings()['pediatrician'],
183 'value' => 'pediatrician',
184 'isDefault' => false,
185 'position' => 3
186 ],
187 [
188 'id' => 9,
189 'label' => BackendStrings::getTemplateStrings()['cardiologist'],
190 'value' => 'cardiologist',
191 'isDefault' => false,
192 'position' => 4
193 ],
194 [
195 'id' => 10,
196 'label' => BackendStrings::getTemplateStrings()['other'],
197 'value' => 'other',
198 'isDefault' => false,
199 'position' => 5
200 ],
201 ]
202 ],
203 ];
204 }
205
206 /**
207 * Get preferred appointment date field
208 *
209 * @return array<int, array<string, mixed>>
210 */
211 private static function getPreferredAppointmentDateField(): array
212 {
213 return [
214 [
215 'id' => 12,
216 'fieldIndex' => 5,
217 'type' => 'date',
218 'label' => BackendStrings::getTemplateStrings()['preferred_appointment_date'],
219 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_date'],
220 'required' => true,
221 'parentId' => null,
222 'defaultValue' => '',
223 'position' => 5,
224 'dateFieldType' => 'picker',
225 'dateFormat' => 'MM/DD/YYYY',
226 ],
227 ];
228 }
229
230 /**
231 * Get preferred time slot field
232 *
233 * @return array<int, array<string, mixed>>
234 */
235 private static function getPreferredTimeSlotField(): array
236 {
237 return [
238 [
239 'id' => 13,
240 'fieldIndex' => 6,
241 'type' => 'time',
242 'label' => BackendStrings::getTemplateStrings()['preferred_time_slot'],
243 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_time'],
244 'required' => true,
245 'parentId' => null,
246 'defaultValue' => '',
247 'position' => 6,
248 'timeFieldType' => 'time-picker',
249 'timeFormat' => 'ampm',
250 ],
251 ];
252 }
253
254 /**
255 * Get additional information fields
256 *
257 * @return array<int, array<string, mixed>>
258 */
259 private static function getAdditionalInformationFields(): array
260 {
261 return array_merge(
262 self::getReasonForVisitField(),
263 self::getNeedTelemedicineField(),
264 self::getInsuranceProviderField()
265 );
266 }
267
268 /**
269 * Get reason for visit field
270 *
271 * @return array<int, array<string, mixed>>
272 */
273 private static function getReasonForVisitField(): array
274 {
275 return [
276 [
277 'id' => 14,
278 'fieldIndex' => 7,
279 'type' => 'textarea',
280 'label' => BackendStrings::getTemplateStrings()['reason_for_visit'],
281 'placeholder' => BackendStrings::getTemplateStrings()['describe_symptoms_or_reason'],
282 'parentId' => null,
283 'defaultValue' => '',
284 'position' => 7,
285 'required' => true,
286 'rows' => 4,
287 ],
288 ];
289 }
290
291 /**
292 * Get need telemedicine field
293 *
294 * @return array<int, array<string, mixed>>
295 */
296 private static function getNeedTelemedicineField(): array
297 {
298 return [
299 [
300 'id' => 17,
301 'fieldIndex' => 8,
302 'type' => 'checkbox',
303 'label' => BackendStrings::getTemplateStrings()['need_telemedicine'],
304 'parentId' => null,
305 'position' => 8,
306 'required' => false,
307 'defaultValue' => '',
308 'placeholder' => '',
309 'fieldOptions' => [
310 [
311 'id' => 15,
312 'label' => BackendStrings::getTemplateStrings()['yes'],
313 'value' => 'yes',
314 'isDefault' => false,
315 'position' => 1
316 ],
317 [
318 'id' => 16,
319 'label' => BackendStrings::getTemplateStrings()['no'],
320 'value' => 'no',
321 'isDefault' => false,
322 'position' => 2
323 ],
324 ]
325 ],
326 ];
327 }
328
329 /**
330 * Get insurance provider field
331 *
332 * @return array<int, array<string, mixed>>
333 */
334 private static function getInsuranceProviderField(): array
335 {
336 return [
337 [
338 'id' => 21,
339 'fieldIndex' => 9,
340 'type' => 'select',
341 'label' => BackendStrings::getTemplateStrings()['insurance_provider'],
342 'placeholder' => BackendStrings::getTemplateStrings()['select_insurance_provider'],
343 'required' => false,
344 'parentId' => null,
345 'defaultValue' => '',
346 'position' => 9,
347 'fieldOptions' => [
348 [
349 'id' => 18,
350 'label' => BackendStrings::getTemplateStrings()['provider_1'],
351 'value' => 'provider_1',
352 'isDefault' => false,
353 'position' => 1
354 ],
355 [
356 'id' => 19,
357 'label' => BackendStrings::getTemplateStrings()['provider_2'],
358 'value' => 'provider_2',
359 'isDefault' => false,
360 'position' => 2
361 ],
362 [
363 'id' => 20,
364 'label' => BackendStrings::getTemplateStrings()['other'],
365 'value' => 'other',
366 'isDefault' => false,
367 'position' => 3
368 ],
369 ]
370 ],
371 ];
372 }
373 }
374