PluginProbe
The Innovative Form Builder – IvyForms / 0.8.2
The Innovative Form Builder – IvyForms v0.8.2
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 0.8.2, at backend/src/Services/Template/DoctorAppointmentBookingFormTemplate.php

365 lines 12.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 // 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 class DoctorAppointmentBookingFormTemplate
13 {
14 /**
15 * Get the doctor appointment booking form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'doctor_appointment_booking_form',
23 'name' => BackendStrings::getTemplateStrings()['doctor_appointment_booking_form'],
24 'description' => BackendStrings::getTemplateStrings()['doctor_appointment_booking_form_desc'],
25 'category' => 'booking-forms',
26 'subcategory' => 'appointment-booking-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'doctor-appointment-booking-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['doctor_appointment_booking_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getPatientInformationFields(),
37 self::getAppointmentDetailsFields(),
38 self::getAdditionalInformationFields()
39 ),
40 'settings' => []
41 ]
42 ];
43 }
44
45 /**
46 * Get patient information fields
47 *
48 * @return array<int, array<string, mixed>>
49 */
50 private static function getPatientInformationFields(): array
51 {
52 return [
53 // Name Field - Parent
54 [
55 'id' => 0,
56 'fieldIndex' => 1,
57 'type' => 'name',
58 'label' => BackendStrings::getTemplateStrings()['full_name'],
59 'parentId' => null,
60 'defaultValue' => '',
61 'placeholder' => '',
62 'required' => true,
63 'readonly' => false,
64 'position' => 1,
65 ],
66 // First Name - Child of Name Field
67 [
68 'id' => 0,
69 'type' => 'text',
70 'label' => BackendStrings::getNewFormStrings()['first_name'],
71 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
72 'required' => true,
73 'parentId' => 0,
74 'fieldIndex' => 1,
75 'defaultValue' => '',
76 'position' => 1,
77 'optionHide' => false,
78 'description' => '',
79 'settings' => json_encode(['nameFieldType' => 'nameField1']),
80 ],
81 // Last Name - Child of Name Field
82 [
83 'id' => 0,
84 'type' => 'text',
85 'label' => BackendStrings::getNewFormStrings()['last_name'],
86 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
87 'required' => true,
88 'parentId' => 0,
89 'fieldIndex' => 1,
90 'defaultValue' => '',
91 'position' => 2,
92 'optionHide' => false,
93 'description' => '',
94 'settings' => json_encode(['nameFieldType' => 'nameField2']),
95 ],
96 // Email Address
97 [
98 'id' => 0,
99 'fieldIndex' => 2,
100 'type' => 'email',
101 'label' => BackendStrings::getTemplateStrings()['email_address'],
102 'placeholder' => '[email protected]',
103 'required' => true,
104 'parentId' => null,
105 'defaultValue' => '',
106 'position' => 2,
107 ],
108 // Phone Number
109 [
110 'id' => 0,
111 'fieldIndex' => 3,
112 'type' => 'phone',
113 'label' => BackendStrings::getTemplateStrings()['phone_number'],
114 'placeholder' => '+1 (_) _-_',
115 'required' => true,
116 'parentId' => null,
117 'defaultValue' => '',
118 'position' => 3,
119 'phoneAutoDetect' => true,
120 ],
121 ];
122 }
123
124 /**
125 * Get appointment details fields
126 *
127 * @return array<int, array<string, mixed>>
128 */
129 private static function getAppointmentDetailsFields(): array
130 {
131 return array_merge(
132 self::getDoctorSpecialistField(),
133 self::getPreferredAppointmentDateField(),
134 self::getPreferredTimeSlotField()
135 );
136 }
137
138 /**
139 * Get doctor/specialist field
140 *
141 * @return array<int, array<string, mixed>>
142 */
143 private static function getDoctorSpecialistField(): array
144 {
145 return [
146 [
147 'id' => 0,
148 'fieldIndex' => 4,
149 'type' => 'select',
150 'label' => BackendStrings::getTemplateStrings()['doctor_specialist'],
151 'placeholder' => BackendStrings::getTemplateStrings()['select_doctor_or_specialist'],
152 'required' => true,
153 'parentId' => null,
154 'defaultValue' => '',
155 'position' => 4,
156 'fieldOptions' => [
157 [
158 'id' => 0,
159 'label' => BackendStrings::getTemplateStrings()['general_practitioner'],
160 'value' => 'general_practitioner',
161 'isDefault' => false,
162 'position' => 1
163 ],
164 [
165 'id' => 0,
166 'label' => BackendStrings::getTemplateStrings()['dermatologist'],
167 'value' => 'dermatologist',
168 'isDefault' => false,
169 'position' => 2
170 ],
171 [
172 'id' => 0,
173 'label' => BackendStrings::getTemplateStrings()['pediatrician'],
174 'value' => 'pediatrician',
175 'isDefault' => false,
176 'position' => 3
177 ],
178 [
179 'id' => 0,
180 'label' => BackendStrings::getTemplateStrings()['cardiologist'],
181 'value' => 'cardiologist',
182 'isDefault' => false,
183 'position' => 4
184 ],
185 [
186 'id' => 0,
187 'label' => BackendStrings::getTemplateStrings()['other'],
188 'value' => 'other',
189 'isDefault' => false,
190 'position' => 5
191 ],
192 ]
193 ],
194 ];
195 }
196
197 /**
198 * Get preferred appointment date field
199 *
200 * @return array<int, array<string, mixed>>
201 */
202 private static function getPreferredAppointmentDateField(): array
203 {
204 return [
205 [
206 'id' => 0,
207 'fieldIndex' => 5,
208 'type' => 'date',
209 'label' => BackendStrings::getTemplateStrings()['preferred_appointment_date'],
210 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_date'],
211 'required' => true,
212 'parentId' => null,
213 'defaultValue' => '',
214 'position' => 5,
215 'dateFieldType' => 'picker',
216 'dateFormat' => 'MM/DD/YYYY',
217 ],
218 ];
219 }
220
221 /**
222 * Get preferred time slot field
223 *
224 * @return array<int, array<string, mixed>>
225 */
226 private static function getPreferredTimeSlotField(): array
227 {
228 return [
229 [
230 'id' => 0,
231 'fieldIndex' => 6,
232 'type' => 'time',
233 'label' => BackendStrings::getTemplateStrings()['preferred_time_slot'],
234 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_time'],
235 'required' => true,
236 'parentId' => null,
237 'defaultValue' => '',
238 'position' => 6,
239 'timeFieldType' => 'time-picker',
240 'timeFormat' => 'ampm',
241 ],
242 ];
243 }
244
245 /**
246 * Get additional information fields
247 *
248 * @return array<int, array<string, mixed>>
249 */
250 private static function getAdditionalInformationFields(): array
251 {
252 return array_merge(
253 self::getReasonForVisitField(),
254 self::getNeedTelemedicineField(),
255 self::getInsuranceProviderField()
256 );
257 }
258
259 /**
260 * Get reason for visit field
261 *
262 * @return array<int, array<string, mixed>>
263 */
264 private static function getReasonForVisitField(): array
265 {
266 return [
267 [
268 'id' => 0,
269 'fieldIndex' => 7,
270 'type' => 'textarea',
271 'label' => BackendStrings::getTemplateStrings()['reason_for_visit'],
272 'placeholder' => BackendStrings::getTemplateStrings()['describe_symptoms_or_reason'],
273 'parentId' => null,
274 'defaultValue' => '',
275 'position' => 7,
276 'required' => true,
277 'rows' => 4,
278 ],
279 ];
280 }
281
282 /**
283 * Get need telemedicine field
284 *
285 * @return array<int, array<string, mixed>>
286 */
287 private static function getNeedTelemedicineField(): array
288 {
289 return [
290 [
291 'id' => 0,
292 'fieldIndex' => 8,
293 'type' => 'checkbox',
294 'label' => BackendStrings::getTemplateStrings()['need_telemedicine'],
295 'parentId' => null,
296 'position' => 8,
297 'required' => false,
298 'defaultValue' => '',
299 'placeholder' => '',
300 'fieldOptions' => [
301 [
302 'id' => 0,
303 'label' => BackendStrings::getTemplateStrings()['yes'],
304 'value' => 'yes',
305 'isDefault' => false,
306 'position' => 1
307 ],
308 [
309 'id' => 0,
310 'label' => BackendStrings::getTemplateStrings()['no'],
311 'value' => 'no',
312 'isDefault' => false,
313 'position' => 2
314 ],
315 ]
316 ],
317 ];
318 }
319
320 /**
321 * Get insurance provider field
322 *
323 * @return array<int, array<string, mixed>>
324 */
325 private static function getInsuranceProviderField(): array
326 {
327 return [
328 [
329 'id' => 0,
330 'fieldIndex' => 9,
331 'type' => 'select',
332 'label' => BackendStrings::getTemplateStrings()['insurance_provider'],
333 'placeholder' => BackendStrings::getTemplateStrings()['select_insurance_provider'],
334 'required' => false,
335 'parentId' => null,
336 'defaultValue' => '',
337 'position' => 9,
338 'fieldOptions' => [
339 [
340 'id' => 0,
341 'label' => BackendStrings::getTemplateStrings()['provider_1'],
342 'value' => 'provider_1',
343 'isDefault' => false,
344 'position' => 1
345 ],
346 [
347 'id' => 0,
348 'label' => BackendStrings::getTemplateStrings()['provider_2'],
349 'value' => 'provider_2',
350 'isDefault' => false,
351 'position' => 2
352 ],
353 [
354 'id' => 0,
355 'label' => BackendStrings::getTemplateStrings()['other'],
356 'value' => 'other',
357 'isDefault' => false,
358 'position' => 3
359 ],
360 ]
361 ],
362 ];
363 }
364 }
365