*/ public static function getTemplate(): array { return [ 'id' => 'kitchen_upgrade_change_form', 'name' => BackendStrings::getTemplateStrings()['kitchen_upgrade_change_form'], 'description' => BackendStrings::getTemplateStrings()['kitchen_upgrade_change_form_desc'], 'category' => 'order-forms', 'subcategory' => 'change-order-forms', 'is_pro' => false, 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'kitchen-upgrade-change-form.svg', 'form_data' => [ 'name' => BackendStrings::getTemplateStrings()['kitchen_upgrade_change_form'], 'published' => 1, 'showTitle' => 1, 'storeEntries' => 1, 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(), 'fields' => array_merge( self::getContactInformationFields(), self::getChangeRequestFields(), self::getAdditionalInformationFields() ), 'settings' => [] ] ]; } /** * Get contact information fields * * @return array> */ private static function getContactInformationFields(): array { return array_merge( self::getNameAndContactFields(), self::getProjectAddressFields() ); } /** * Get name and contact fields * * @return array> */ private static function getNameAndContactFields(): array { return [ // Homeowner Name [ 'id' => 0, 'fieldIndex' => 1, 'type' => 'name', 'label' => BackendStrings::getTemplateStrings()['homeowner_name'], 'parentId' => null, 'defaultValue' => '', 'placeholder' => '', 'required' => true, 'readonly' => false, 'position' => 1, ], // First Name - Child of Name Field [ 'id' => 0, 'type' => 'text', 'label' => BackendStrings::getNewFormStrings()['first_name'], 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_name'], 'required' => true, 'parentId' => 0, 'fieldIndex' => 1, 'defaultValue' => '', 'position' => 1, 'optionHide' => false, 'description' => '', 'settings' => json_encode(['nameFieldType' => 'nameField1']), ], // Last Name - Child of Name Field [ 'id' => 0, 'type' => 'text', 'label' => BackendStrings::getNewFormStrings()['last_name'], 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'], 'required' => true, 'parentId' => 0, 'fieldIndex' => 1, 'defaultValue' => '', 'position' => 2, 'optionHide' => false, 'description' => '', 'settings' => json_encode(['nameFieldType' => 'nameField2']), ], // Email Address [ 'id' => 0, 'fieldIndex' => 2, 'type' => 'email', 'label' => BackendStrings::getTemplateStrings()['email_address'], 'placeholder' => 'name@example.com', 'required' => true, 'parentId' => null, 'defaultValue' => '', 'position' => 2, 'validation' => [ 'required' => true, 'email' => true ], ], // Contact Number [ 'id' => 0, 'fieldIndex' => 3, 'type' => 'phone', 'label' => BackendStrings::getTemplateStrings()['contact_number'], 'placeholder' => '+1 (_) _-_', 'required' => false, 'parentId' => null, 'defaultValue' => '', 'position' => 3, 'phoneAutoDetect' => true, ], ]; } /** * Get project address fields * * @return array> */ private static function getProjectAddressFields(): array { return [ // Project Address - Parent [ 'id' => 0, 'fieldIndex' => 4, 'type' => 'address', 'label' => BackendStrings::getTemplateStrings()['project_address'], 'placeholder' => '', 'required' => true, 'parentId' => null, 'defaultValue' => '', 'readonly' => false, 'position' => 4, ], // Address Line 1 - Child of Address Field [ 'id' => 0, 'type' => 'text', 'label' => BackendStrings::getTemplateStrings()['address_line_1'], 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'], 'required' => true, 'parentId' => 0, 'fieldIndex' => 4, 'defaultValue' => '', 'position' => 1, 'hideLabel' => false, 'description' => '', 'addressType' => 'streetAddress', 'settings' => json_encode([ 'type' => 'streetAddress', 'hideLabel' => false, 'description' => '', 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'], 'requiredMessage' => '', 'visible' => true, ]), ], // Address Line 2 - Child of Address Field [ 'id' => 0, 'type' => 'text', 'label' => BackendStrings::getTemplateStrings()['address_line_2'], 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'], 'required' => false, 'parentId' => 0, 'fieldIndex' => 4, 'defaultValue' => '', 'position' => 2, 'hideLabel' => false, 'description' => '', 'addressType' => 'addressLine2', 'settings' => json_encode([ 'type' => 'addressLine2', 'hideLabel' => false, 'description' => '', 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'], 'requiredMessage' => '', 'visible' => true, ]), ], // City - Child of Address Field [ 'id' => 0, 'type' => 'text', 'label' => BackendStrings::getTemplateStrings()['city'], 'placeholder' => '', 'required' => true, 'parentId' => 0, 'fieldIndex' => 4, 'defaultValue' => '', 'position' => 3, 'hideLabel' => false, 'description' => '', 'addressType' => 'city', 'settings' => json_encode([ 'type' => 'city', 'hideLabel' => false, 'description' => '', 'placeholder' => BackendStrings::getTemplateStrings()['city'], 'requiredMessage' => '', 'visible' => true, ]), ], // State/Province - Child of Address Field [ 'id' => 0, 'type' => 'text', 'label' => BackendStrings::getTemplateStrings()['state_province'], 'placeholder' => '', 'required' => true, 'parentId' => 0, 'fieldIndex' => 4, 'defaultValue' => '', 'position' => 4, 'hideLabel' => false, 'description' => '', 'addressType' => 'state', 'settings' => json_encode([ 'type' => 'state', 'hideLabel' => false, 'description' => '', 'placeholder' => BackendStrings::getTemplateStrings()['state'], 'requiredMessage' => '', 'visible' => true, ]), ], // Zip/Postal Code - Child of Address Field [ 'id' => 0, 'type' => 'text', 'label' => BackendStrings::getTemplateStrings()['zip_postal_code'], 'placeholder' => '', 'required' => true, 'parentId' => 0, 'fieldIndex' => 4, 'defaultValue' => '', 'position' => 5, 'hideLabel' => false, 'description' => '', 'addressType' => 'zip', 'settings' => json_encode([ 'type' => 'zip', 'hideLabel' => false, 'description' => '', 'placeholder' => BackendStrings::getTemplateStrings()['zip'], 'requiredMessage' => '', 'visible' => true, ]), ], // Country - Child of Address Field [ 'id' => 0, 'type' => 'text', 'label' => BackendStrings::getTemplateStrings()['country'], 'placeholder' => BackendStrings::getTemplateStrings()['select_country'], 'required' => true, 'parentId' => 0, 'fieldIndex' => 4, 'defaultValue' => '', 'position' => 6, 'hideLabel' => false, 'description' => '', 'addressType' => 'country', 'settings' => json_encode([ 'type' => 'country', 'hideLabel' => false, 'description' => '', 'placeholder' => BackendStrings::getTemplateStrings()['select_country'], 'requiredMessage' => '', 'visible' => true, ]), ], ]; } /** * Get change request fields * * @return array> */ private static function getChangeRequestFields(): array { return [ // Change Request Date [ 'id' => 0, 'fieldIndex' => 5, 'type' => 'date', 'label' => BackendStrings::getTemplateStrings()['change_request_date'], 'placeholder' => BackendStrings::getTemplateStrings()['select_change_request_date'], 'required' => true, 'parentId' => null, 'defaultValue' => '', 'position' => 5, ], // Upgrade Type Dropdown [ 'id' => 0, 'fieldIndex' => 6, 'type' => 'select', 'label' => BackendStrings::getTemplateStrings()['upgrade_type'], 'placeholder' => BackendStrings::getTemplateStrings()['select_upgrade_type'], 'required' => true, 'parentId' => null, 'defaultValue' => '', 'position' => 6, 'fieldOptions' => [ [ 'id' => 0, 'label' => BackendStrings::getTemplateStrings()['cabinets'], 'value' => 'cabinets', 'isDefault' => false, 'position' => 1, ], [ 'id' => 0, 'label' => BackendStrings::getTemplateStrings()['countertops'], 'value' => 'countertops', 'isDefault' => false, 'position' => 2, ], [ 'id' => 0, 'label' => BackendStrings::getTemplateStrings()['appliances'], 'value' => 'appliances', 'isDefault' => false, 'position' => 3, ], [ 'id' => 0, 'label' => BackendStrings::getTemplateStrings()['flooring'], 'value' => 'flooring', 'isDefault' => false, 'position' => 4, ], [ 'id' => 0, 'label' => BackendStrings::getTemplateStrings()['lighting'], 'value' => 'lighting', 'isDefault' => false, 'position' => 5, ], [ 'id' => 0, 'label' => BackendStrings::getTemplateStrings()['plumbing'], 'value' => 'plumbing', 'isDefault' => false, 'position' => 6, ], [ 'id' => 0, 'label' => BackendStrings::getTemplateStrings()['other'], 'value' => 'other', 'isDefault' => false, 'position' => 7, ], ], ], // Description of Change [ 'id' => 0, 'fieldIndex' => 7, 'type' => 'textarea', 'label' => BackendStrings::getTemplateStrings()['description_of_change'], 'placeholder' => BackendStrings::getTemplateStrings()['describe_the_change_requested'], 'required' => true, 'parentId' => null, 'defaultValue' => '', 'position' => 7, 'rows' => 4, ], // Estimated Cost [ 'id' => 0, 'fieldIndex' => 8, 'type' => 'number', 'label' => BackendStrings::getTemplateStrings()['estimated_cost'], 'placeholder' => BackendStrings::getTemplateStrings()['enter_estimated_cost'], 'required' => false, 'parentId' => null, 'defaultValue' => '', 'position' => 8, ], ]; } /** * Get additional information fields * * @return array> */ private static function getAdditionalInformationFields(): array { return [ // Requires Designer Approval? Radio [ 'id' => 0, 'fieldIndex' => 9, 'type' => 'radio', 'label' => BackendStrings::getTemplateStrings()['requires_designer_approval'], 'placeholder' => '', 'required' => false, 'parentId' => null, 'defaultValue' => '', 'position' => 9, 'fieldOptions' => [ [ 'id' => 0, 'label' => BackendStrings::getTemplateStrings()['yes'], 'value' => 'yes', 'isDefault' => false, 'position' => 1, ], [ 'id' => 0, 'label' => BackendStrings::getTemplateStrings()['no'], 'value' => 'no', 'isDefault' => false, 'position' => 2, ], ], ], // Additional Notes / Instructions [ 'id' => 0, 'fieldIndex' => 10, 'type' => 'textarea', 'label' => BackendStrings::getTemplateStrings()['additional_notes_instructions'], 'placeholder' => BackendStrings::getTemplateStrings()['enter_additional_notes_instructions'], 'required' => false, 'parentId' => null, 'defaultValue' => '', 'position' => 10, 'rows' => 4, ], ]; } }