| 1 |
<?php |
| 2 |
|
| 3 |
namespace IvyForms\Services\Template; |
| 4 |
|
| 5 |
use IvyForms\Services\Translations\BackendStrings; |
| 6 |
|
| 7 |
class ConferenceRoomBookingFormTemplate |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Conference Room Booking Form Template |
| 11 |
*/ |
| 12 |
/** |
| 13 |
* Get template metadata (without form_data) |
| 14 |
* |
| 15 |
* @return array<string, mixed> |
| 16 |
*/ |
| 17 |
public static function getTemplateMeta(): array |
| 18 |
{ |
| 19 |
return [ |
| 20 |
'id' => 'conference_room_booking_form', |
| 21 |
'name' => BackendStrings::getTemplateStrings()['conference_room_booking_form'], |
| 22 |
'description' => BackendStrings::getTemplateStrings()[ |
| 23 |
'conference_room_booking_form_description' |
| 24 |
], |
| 25 |
'category' => 'booking-forms', |
| 26 |
'subcategory' => 'appointment-booking-forms', |
| 27 |
'is_pro' => false, |
| 28 |
'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'conference-room-booking-form.svg' |
| 29 |
]; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Get the full template including form data |
| 34 |
* |
| 35 |
* @return array<string, mixed> |
| 36 |
*/ |
| 37 |
public static function getTemplate(): array |
| 38 |
{ |
| 39 |
return array_merge( |
| 40 |
self::getTemplateMeta(), |
| 41 |
[ |
| 42 |
'form_data' => [ |
| 43 |
'name' => BackendStrings::getTemplateStrings()['conference_room_booking_form'], |
| 44 |
'published' => 1, |
| 45 |
'showTitle' => 1, |
| 46 |
'storeEntries' => 1, |
| 47 |
'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(), |
| 48 |
'fields' => array_merge( |
| 49 |
self::getContactInformationFields(), |
| 50 |
self::getBookingDetailsFields(), |
| 51 |
self::getAdditionalInformationFields() |
| 52 |
), |
| 53 |
'settings' => [] |
| 54 |
] |
| 55 |
] |
| 56 |
); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Contact information fields (name, email, phone) |
| 61 |
* |
| 62 |
* @return array<int, array<string, mixed>> |
| 63 |
*/ |
| 64 |
private static function getContactInformationFields(): array |
| 65 |
{ |
| 66 |
return [ |
| 67 |
// Full Name - Parent |
| 68 |
[ |
| 69 |
'id' => 1, |
| 70 |
'fieldIndex' => 1, |
| 71 |
'type' => 'name', |
| 72 |
'label' => BackendStrings::getTemplateStrings()['full_name'], |
| 73 |
'parentId' => null, |
| 74 |
'defaultValue' => '', |
| 75 |
'placeholder' => '', |
| 76 |
'required' => true, |
| 77 |
'readonly' => false, |
| 78 |
'position' => 1, |
| 79 |
], |
| 80 |
// First Name - Child of Name Field |
| 81 |
[ |
| 82 |
'id' => 2, |
| 83 |
'type' => 'text', |
| 84 |
'label' => BackendStrings::getTemplateStrings()['first_name'], |
| 85 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'], |
| 86 |
'required' => true, |
| 87 |
'parentId' => 1, |
| 88 |
'fieldIndex' => 1, |
| 89 |
'defaultValue' => '', |
| 90 |
'position' => 1, |
| 91 |
'optionHide' => false, |
| 92 |
'description' => '', |
| 93 |
'settings' => json_encode(['nameFieldType' => 'nameField1']), |
| 94 |
], |
| 95 |
// Last Name - Child of Name Field |
| 96 |
[ |
| 97 |
'id' => 3, |
| 98 |
'type' => 'text', |
| 99 |
'label' => BackendStrings::getTemplateStrings()['last_name'], |
| 100 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'], |
| 101 |
'required' => true, |
| 102 |
'parentId' => 1, |
| 103 |
'fieldIndex' => 1, |
| 104 |
'defaultValue' => '', |
| 105 |
'position' => 2, |
| 106 |
'optionHide' => false, |
| 107 |
'description' => '', |
| 108 |
'settings' => json_encode(['nameFieldType' => 'nameField2']), |
| 109 |
], |
| 110 |
// Email Address |
| 111 |
[ |
| 112 |
'id' => 4, |
| 113 |
'fieldIndex' => 2, |
| 114 |
'type' => 'email', |
| 115 |
'label' => BackendStrings::getTemplateStrings()['email_address'], |
| 116 |
'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'], |
| 117 |
'required' => true, |
| 118 |
'parentId' => null, |
| 119 |
'defaultValue' => '', |
| 120 |
'position' => 2, |
| 121 |
], |
| 122 |
// Phone Number |
| 123 |
[ |
| 124 |
'id' => 5, |
| 125 |
'fieldIndex' => 3, |
| 126 |
'type' => 'phone', |
| 127 |
'label' => BackendStrings::getTemplateStrings()['phone_number'], |
| 128 |
'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'], |
| 129 |
'required' => false, |
| 130 |
'parentId' => null, |
| 131 |
'defaultValue' => '', |
| 132 |
'position' => 3, |
| 133 |
], |
| 134 |
]; |
| 135 |
} |
| 136 |
|
| 137 |
/** |
| 138 |
* Booking details fields (department, date, time, attendees) |
| 139 |
* |
| 140 |
* @return array<int, array<string, mixed>> |
| 141 |
*/ |
| 142 |
private static function getBookingDetailsFields(): array |
| 143 |
{ |
| 144 |
return [ |
| 145 |
// Department/Organization |
| 146 |
[ |
| 147 |
'id' => 10, |
| 148 |
'fieldIndex' => 4, |
| 149 |
'type' => 'select', |
| 150 |
'label' => BackendStrings::getTemplateStrings()['department_organization'], |
| 151 |
'placeholder' => BackendStrings::getTemplateStrings()['select_department_organization'], |
| 152 |
'required' => true, |
| 153 |
'parentId' => null, |
| 154 |
'defaultValue' => '', |
| 155 |
'position' => 4, |
| 156 |
'fieldOptions' => [ |
| 157 |
[ |
| 158 |
'id' => 6, |
| 159 |
'label' => BackendStrings::getTemplateStrings()['hr'], |
| 160 |
'value' => 'hr', |
| 161 |
'isDefault' => false, |
| 162 |
'position' => 1 |
| 163 |
], |
| 164 |
[ |
| 165 |
'id' => 7, |
| 166 |
'label' => BackendStrings::getTemplateStrings()['marketing'], |
| 167 |
'value' => 'marketing', |
| 168 |
'isDefault' => false, |
| 169 |
'position' => 2 |
| 170 |
], |
| 171 |
[ |
| 172 |
'id' => 8, |
| 173 |
'label' => BackendStrings::getTemplateStrings()['it'], |
| 174 |
'value' => 'it', |
| 175 |
'isDefault' => false, |
| 176 |
'position' => 3 |
| 177 |
], |
| 178 |
[ |
| 179 |
'id' => 9, |
| 180 |
'label' => BackendStrings::getTemplateStrings()['other'], |
| 181 |
'value' => 'other', |
| 182 |
'isDefault' => false, |
| 183 |
'position' => 4 |
| 184 |
], |
| 185 |
] |
| 186 |
], |
| 187 |
// Booking Date |
| 188 |
[ |
| 189 |
'id' => 11, |
| 190 |
'fieldIndex' => 5, |
| 191 |
'type' => 'date', |
| 192 |
'label' => BackendStrings::getTemplateStrings()['booking_date'], |
| 193 |
'placeholder' => BackendStrings::getTemplateStrings()['select_booking_date'], |
| 194 |
'required' => true, |
| 195 |
'parentId' => null, |
| 196 |
'defaultValue' => '', |
| 197 |
'position' => 5, |
| 198 |
'dateFieldType' => 'picker', |
| 199 |
'dateFormat' => 'MM/DD/YYYY', |
| 200 |
], |
| 201 |
// Start Time |
| 202 |
[ |
| 203 |
'id' => 12, |
| 204 |
'fieldIndex' => 6, |
| 205 |
'type' => 'time', |
| 206 |
'label' => BackendStrings::getTemplateStrings()['start_time'], |
| 207 |
'placeholder' => BackendStrings::getTemplateStrings()['select_start_time'], |
| 208 |
'required' => true, |
| 209 |
'parentId' => null, |
| 210 |
'defaultValue' => '', |
| 211 |
'position' => 6, |
| 212 |
], |
| 213 |
// End Time |
| 214 |
[ |
| 215 |
'id' => 13, |
| 216 |
'fieldIndex' => 7, |
| 217 |
'type' => 'time', |
| 218 |
'label' => BackendStrings::getTemplateStrings()['end_time'], |
| 219 |
'placeholder' => BackendStrings::getTemplateStrings()['select_end_time'], |
| 220 |
'required' => true, |
| 221 |
'parentId' => null, |
| 222 |
'defaultValue' => '', |
| 223 |
'position' => 7, |
| 224 |
], |
| 225 |
// Number of Attendees |
| 226 |
[ |
| 227 |
'id' => 14, |
| 228 |
'fieldIndex' => 8, |
| 229 |
'type' => 'number', |
| 230 |
'label' => BackendStrings::getTemplateStrings()['number_of_attendees'], |
| 231 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_number_of_attendees'], |
| 232 |
'required' => true, |
| 233 |
'parentId' => null, |
| 234 |
'defaultValue' => '', |
| 235 |
'position' => 8, |
| 236 |
'minValue' => 1, |
| 237 |
'maxValue' => 100, |
| 238 |
], |
| 239 |
]; |
| 240 |
} |
| 241 |
|
| 242 |
/** |
| 243 |
* Additional information fields (equipment, special requests) |
| 244 |
* |
| 245 |
* @return array<int, array<string, mixed>> |
| 246 |
*/ |
| 247 |
private static function getAdditionalInformationFields(): array |
| 248 |
{ |
| 249 |
return [ |
| 250 |
// Equipment Needed |
| 251 |
[ |
| 252 |
'id' => 18, |
| 253 |
'fieldIndex' => 9, |
| 254 |
'type' => 'checkbox', |
| 255 |
'label' => BackendStrings::getTemplateStrings()['equipment_needed'], |
| 256 |
'placeholder' => '', |
| 257 |
'required' => false, |
| 258 |
'parentId' => null, |
| 259 |
'defaultValue' => '', |
| 260 |
'position' => 9, |
| 261 |
'fieldOptions' => [ |
| 262 |
[ |
| 263 |
'id' => 15, |
| 264 |
'label' => BackendStrings::getTemplateStrings()['projector'], |
| 265 |
'value' => 'projector', |
| 266 |
'isDefault' => false, |
| 267 |
'position' => 1 |
| 268 |
], |
| 269 |
[ |
| 270 |
'id' => 16, |
| 271 |
'label' => BackendStrings::getTemplateStrings()['microphone'], |
| 272 |
'value' => 'microphone', |
| 273 |
'isDefault' => false, |
| 274 |
'position' => 2 |
| 275 |
], |
| 276 |
[ |
| 277 |
'id' => 17, |
| 278 |
'label' => BackendStrings::getTemplateStrings()['whiteboard'], |
| 279 |
'value' => 'whiteboard', |
| 280 |
'isDefault' => false, |
| 281 |
'position' => 3 |
| 282 |
], |
| 283 |
] |
| 284 |
], |
| 285 |
// Special Requests / Notes |
| 286 |
[ |
| 287 |
'id' => 19, |
| 288 |
'fieldIndex' => 10, |
| 289 |
'type' => 'textarea', |
| 290 |
'label' => BackendStrings::getTemplateStrings()['special_requests_notes'], |
| 291 |
'placeholder' => BackendStrings::getTemplateStrings()[ |
| 292 |
'special_requests_notes_placeholder' |
| 293 |
], |
| 294 |
'required' => false, |
| 295 |
'parentId' => null, |
| 296 |
'defaultValue' => '', |
| 297 |
'position' => 10, |
| 298 |
], |
| 299 |
]; |
| 300 |
} |
| 301 |
} |
| 302 |
|