| 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 BirthdayTShirtOrderFormTemplate |
| 13 |
{ |
| 14 |
/** |
| 15 |
* Get the birthday t-shirt order form template |
| 16 |
* |
| 17 |
* @return array<string, mixed> |
| 18 |
*/ |
| 19 |
public static function getTemplate(): array |
| 20 |
{ |
| 21 |
return [ |
| 22 |
'id' => 'birthday_tshirt_order_form', |
| 23 |
'name' => BackendStrings::getTemplateStrings()['birthday_tshirt_order_form'], |
| 24 |
'description' => BackendStrings::getTemplateStrings()['birthday_tshirt_order_form_desc'], |
| 25 |
'category' => 'order-forms', |
| 26 |
'subcategory' => 'tshirt-order-forms', |
| 27 |
'is_pro' => false, |
| 28 |
'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'birthday-tshirt-order-form.svg', |
| 29 |
'form_data' => [ |
| 30 |
'name' => BackendStrings::getTemplateStrings()['birthday_tshirt_order_form'], |
| 31 |
'published' => 1, |
| 32 |
'showTitle' => 1, |
| 33 |
'storeEntries' => 1, |
| 34 |
'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(), |
| 35 |
'fields' => array_merge( |
| 36 |
self::getOrdererInformationFields(), |
| 37 |
self::getBirthdayDetailsFields(), |
| 38 |
self::getTShirtDetailsFields(), |
| 39 |
self::getDeliveryDetailsFields() |
| 40 |
), |
| 41 |
'settings' => [] |
| 42 |
] |
| 43 |
]; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Get orderer information fields |
| 48 |
* |
| 49 |
* @return array<int, array<string, mixed>> |
| 50 |
*/ |
| 51 |
private static function getOrdererInformationFields(): array |
| 52 |
{ |
| 53 |
return [ |
| 54 |
// Name Field - Parent |
| 55 |
[ |
| 56 |
'id' => 0, |
| 57 |
'fieldIndex' => 1, |
| 58 |
'type' => 'name', |
| 59 |
'label' => BackendStrings::getTemplateStrings()['orderer_name'], |
| 60 |
'parentId' => null, |
| 61 |
'defaultValue' => '', |
| 62 |
'placeholder' => '', |
| 63 |
'required' => true, |
| 64 |
'readonly' => false, |
| 65 |
'position' => 1, |
| 66 |
], |
| 67 |
// First Name - Child of Name Field |
| 68 |
[ |
| 69 |
'id' => 0, |
| 70 |
'type' => 'text', |
| 71 |
'label' => BackendStrings::getNewFormStrings()['first_name'], |
| 72 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'], |
| 73 |
'required' => true, |
| 74 |
'parentId' => 0, |
| 75 |
'fieldIndex' => 1, |
| 76 |
'defaultValue' => '', |
| 77 |
'position' => 1, |
| 78 |
'optionHide' => false, |
| 79 |
'description' => '', |
| 80 |
'settings' => json_encode(['nameFieldType' => 'nameField1']), |
| 81 |
], |
| 82 |
// Last Name - Child of Name Field |
| 83 |
[ |
| 84 |
'id' => 0, |
| 85 |
'type' => 'text', |
| 86 |
'label' => BackendStrings::getNewFormStrings()['last_name'], |
| 87 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'], |
| 88 |
'required' => true, |
| 89 |
'parentId' => 0, |
| 90 |
'fieldIndex' => 1, |
| 91 |
'defaultValue' => '', |
| 92 |
'position' => 2, |
| 93 |
'optionHide' => false, |
| 94 |
'description' => '', |
| 95 |
'settings' => json_encode(['nameFieldType' => 'nameField2']), |
| 96 |
], |
| 97 |
// Email Address |
| 98 |
[ |
| 99 |
'id' => 0, |
| 100 |
'fieldIndex' => 2, |
| 101 |
'type' => 'email', |
| 102 |
'label' => BackendStrings::getTemplateStrings()['email_address'], |
| 103 |
'placeholder' => '[email protected]', |
| 104 |
'required' => true, |
| 105 |
'parentId' => null, |
| 106 |
'defaultValue' => '', |
| 107 |
'position' => 2, |
| 108 |
], |
| 109 |
// Phone Number |
| 110 |
[ |
| 111 |
'id' => 0, |
| 112 |
'fieldIndex' => 3, |
| 113 |
'type' => 'phone', |
| 114 |
'label' => BackendStrings::getTemplateStrings()['phone_number'], |
| 115 |
'placeholder' => '+1 (_) _-_', |
| 116 |
'required' => false, |
| 117 |
'parentId' => null, |
| 118 |
'defaultValue' => '', |
| 119 |
'position' => 3, |
| 120 |
'phoneAutoDetect' => true, |
| 121 |
], |
| 122 |
]; |
| 123 |
} |
| 124 |
|
| 125 |
/** |
| 126 |
* Get birthday details fields |
| 127 |
* |
| 128 |
* @return array<int, array<string, mixed>> |
| 129 |
*/ |
| 130 |
private static function getBirthdayDetailsFields(): array |
| 131 |
{ |
| 132 |
return [ |
| 133 |
// Birthday Person's Name |
| 134 |
[ |
| 135 |
'id' => 0, |
| 136 |
'fieldIndex' => 4, |
| 137 |
'type' => 'text', |
| 138 |
'label' => BackendStrings::getTemplateStrings()['birthday_person_name'], |
| 139 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_birthday_person_name'], |
| 140 |
'required' => true, |
| 141 |
'parentId' => null, |
| 142 |
'defaultValue' => '', |
| 143 |
'position' => 4, |
| 144 |
], |
| 145 |
]; |
| 146 |
} |
| 147 |
|
| 148 |
/** |
| 149 |
* Get t-shirt details fields |
| 150 |
* |
| 151 |
* @return array<int, array<string, mixed>> |
| 152 |
*/ |
| 153 |
private static function getTShirtDetailsFields(): array |
| 154 |
{ |
| 155 |
return [ |
| 156 |
// T-Shirt Size |
| 157 |
[ |
| 158 |
'id' => 0, |
| 159 |
'fieldIndex' => 5, |
| 160 |
'type' => 'select', |
| 161 |
'label' => BackendStrings::getTemplateStrings()['tshirt_size'], |
| 162 |
'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_size'], |
| 163 |
'required' => true, |
| 164 |
'parentId' => null, |
| 165 |
'defaultValue' => '', |
| 166 |
'position' => 5, |
| 167 |
'fieldOptions' => [ |
| 168 |
[ |
| 169 |
'id' => 0, |
| 170 |
'label' => BackendStrings::getTemplateStrings()['xs'], |
| 171 |
'value' => 'XS', |
| 172 |
'position' => 1, |
| 173 |
'isDefault' => false, |
| 174 |
], |
| 175 |
[ |
| 176 |
'id' => 0, |
| 177 |
'label' => BackendStrings::getTemplateStrings()['s'], |
| 178 |
'value' => 'S', |
| 179 |
'position' => 2, |
| 180 |
'isDefault' => false, |
| 181 |
], |
| 182 |
[ |
| 183 |
'id' => 0, |
| 184 |
'label' => BackendStrings::getTemplateStrings()['m'], |
| 185 |
'value' => 'M', |
| 186 |
'position' => 3, |
| 187 |
'isDefault' => false, |
| 188 |
], |
| 189 |
[ |
| 190 |
'id' => 0, |
| 191 |
'label' => BackendStrings::getTemplateStrings()['l'], |
| 192 |
'value' => 'L', |
| 193 |
'position' => 4, |
| 194 |
'isDefault' => false, |
| 195 |
], |
| 196 |
[ |
| 197 |
'id' => 0, |
| 198 |
'label' => BackendStrings::getTemplateStrings()['xl'], |
| 199 |
'value' => 'XL', |
| 200 |
'position' => 5, |
| 201 |
'isDefault' => false, |
| 202 |
], |
| 203 |
[ |
| 204 |
'id' => 0, |
| 205 |
'label' => BackendStrings::getTemplateStrings()['xxl'], |
| 206 |
'value' => 'XXL', |
| 207 |
'position' => 6, |
| 208 |
'isDefault' => false, |
| 209 |
], |
| 210 |
] |
| 211 |
], |
| 212 |
// Quantity |
| 213 |
[ |
| 214 |
'id' => 0, |
| 215 |
'fieldIndex' => 6, |
| 216 |
'type' => 'number', |
| 217 |
'label' => BackendStrings::getTemplateStrings()['quantity'], |
| 218 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_quantity'], |
| 219 |
'required' => true, |
| 220 |
'parentId' => null, |
| 221 |
'position' => 6, |
| 222 |
'minValue' => 1, |
| 223 |
'maxValue' => 100, |
| 224 |
], |
| 225 |
// Message or Design Notes |
| 226 |
[ |
| 227 |
'id' => 0, |
| 228 |
'fieldIndex' => 7, |
| 229 |
'type' => 'textarea', |
| 230 |
'label' => BackendStrings::getTemplateStrings()['message_or_design_notes'], |
| 231 |
'placeholder' => BackendStrings::getTemplateStrings()['add_birthday_message_or_design_details'], |
| 232 |
'parentId' => null, |
| 233 |
'defaultValue' => '', |
| 234 |
'position' => 7, |
| 235 |
'required' => false, |
| 236 |
'rows' => 3, |
| 237 |
], |
| 238 |
// T-Shirt Color |
| 239 |
[ |
| 240 |
'id' => 0, |
| 241 |
'fieldIndex' => 8, |
| 242 |
'type' => 'select', |
| 243 |
'label' => BackendStrings::getTemplateStrings()['tshirt_color'], |
| 244 |
'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_color'], |
| 245 |
'required' => true, |
| 246 |
'parentId' => null, |
| 247 |
'defaultValue' => '', |
| 248 |
'position' => 8, |
| 249 |
'fieldOptions' => [ |
| 250 |
[ |
| 251 |
'id' => 0, |
| 252 |
'label' => BackendStrings::getTemplateStrings()['white'], |
| 253 |
'value' => 'White', |
| 254 |
'position' => 1, |
| 255 |
'isDefault' => false, |
| 256 |
], |
| 257 |
[ |
| 258 |
'id' => 0, |
| 259 |
'label' => BackendStrings::getTemplateStrings()['black'], |
| 260 |
'value' => 'Black', |
| 261 |
'position' => 2, |
| 262 |
'isDefault' => false, |
| 263 |
], |
| 264 |
[ |
| 265 |
'id' => 0, |
| 266 |
'label' => BackendStrings::getTemplateStrings()['red'], |
| 267 |
'value' => 'Red', |
| 268 |
'position' => 3, |
| 269 |
'isDefault' => false, |
| 270 |
], |
| 271 |
[ |
| 272 |
'id' => 0, |
| 273 |
'label' => BackendStrings::getTemplateStrings()['blue'], |
| 274 |
'value' => 'Blue', |
| 275 |
'position' => 4, |
| 276 |
'isDefault' => false, |
| 277 |
], |
| 278 |
[ |
| 279 |
'id' => 0, |
| 280 |
'label' => BackendStrings::getTemplateStrings()['green'], |
| 281 |
'value' => 'Green', |
| 282 |
'position' => 5, |
| 283 |
'isDefault' => false, |
| 284 |
], |
| 285 |
[ |
| 286 |
'id' => 0, |
| 287 |
'label' => BackendStrings::getTemplateStrings()['custom'], |
| 288 |
'value' => 'Custom', |
| 289 |
'position' => 6, |
| 290 |
'isDefault' => false, |
| 291 |
], |
| 292 |
] |
| 293 |
], |
| 294 |
]; |
| 295 |
} |
| 296 |
|
| 297 |
/** |
| 298 |
* Get delivery details fields |
| 299 |
* |
| 300 |
* @return array<int, array<string, mixed>> |
| 301 |
*/ |
| 302 |
private static function getDeliveryDetailsFields(): array |
| 303 |
{ |
| 304 |
return [ |
| 305 |
// Include Gift Packaging |
| 306 |
[ |
| 307 |
'id' => 0, |
| 308 |
'fieldIndex' => 9, |
| 309 |
'type' => 'radio', |
| 310 |
'label' => BackendStrings::getTemplateStrings()['include_gift_packaging'], |
| 311 |
'required' => false, |
| 312 |
'parentId' => null, |
| 313 |
'defaultValue' => '', |
| 314 |
'placeholder' => '', |
| 315 |
'position' => 9, |
| 316 |
'fieldOptions' => [ |
| 317 |
[ |
| 318 |
'id' => 0, |
| 319 |
'label' => BackendStrings::getTemplateStrings()['yes'], |
| 320 |
'value' => 'Yes', |
| 321 |
'position' => 1, |
| 322 |
'isDefault' => false, |
| 323 |
], |
| 324 |
[ |
| 325 |
'id' => 0, |
| 326 |
'label' => BackendStrings::getTemplateStrings()['no'], |
| 327 |
'value' => 'No', |
| 328 |
'position' => 2, |
| 329 |
'isDefault' => false, |
| 330 |
], |
| 331 |
] |
| 332 |
], |
| 333 |
// Required Delivery Date |
| 334 |
[ |
| 335 |
'id' => 0, |
| 336 |
'fieldIndex' => 10, |
| 337 |
'type' => 'date', |
| 338 |
'label' => BackendStrings::getTemplateStrings()['required_delivery_date'], |
| 339 |
'placeholder' => BackendStrings::getTemplateStrings()['select_delivery_date'], |
| 340 |
'required' => true, |
| 341 |
'parentId' => null, |
| 342 |
'defaultValue' => '', |
| 343 |
'position' => 10, |
| 344 |
'dateFieldType' => 'picker', |
| 345 |
'dateFormat' => 'MM/DD/YYYY', |
| 346 |
], |
| 347 |
]; |
| 348 |
} |
| 349 |
} |
| 350 |
|