ivyforms
/
backend
/
src
/
Services
/
Template
/
ClientRelationshipCommunicationFeedbackTemplate.php
ClientRelationshipCommunicationFeedbackTemplate.php in The Innovative Form Builder – IvyForms 0.9, at backend/src/Services/Template/ClientRelationshipCommunicationFeedbackTemplate.php
| 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 ClientRelationshipCommunicationFeedbackTemplate |
| 13 | { |
| 14 | /** |
| 15 | * Get the Client Relationship & Communication Feedback template |
| 16 | * |
| 17 | * @return array<string, mixed> |
| 18 | */ |
| 19 | public static function getTemplate(): array |
| 20 | { |
| 21 | return [ |
| 22 | 'id' => 'client_relationship_communication_feedback', |
| 23 | 'name' => BackendStrings::getTemplateStrings()['client_relationship_communication_feedback'], |
| 24 | 'description' => BackendStrings::getTemplateStrings()['client_relationship_communication_feedback_desc'], |
| 25 | 'category' => 'feedback-forms', |
| 26 | 'subcategory' => 'client-feedback-forms', |
| 27 | 'is_pro' => false, |
| 28 | 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'client-relationship-communication-feedback.svg', |
| 29 | 'form_data' => [ |
| 30 | 'name' => BackendStrings::getTemplateStrings()['client_relationship_communication_feedback'], |
| 31 | 'published' => 1, |
| 32 | 'showTitle' => 1, |
| 33 | 'storeEntries' => 1, |
| 34 | 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(), |
| 35 | 'fields' => array_merge( |
| 36 | self::getContactRoleRadioField(), |
| 37 | self::getCommunicationClarityRatingField(), |
| 38 | self::getAvailabilityResponsivenessRatingField(), |
| 39 | self::getPreferredChannelsCheckboxField(), |
| 40 | self::getCommunicationImprovementTextareaField() |
| 41 | ), |
| 42 | 'settings' => [] |
| 43 | ] |
| 44 | ]; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Primary contact role radio field |
| 49 | * |
| 50 | * @return array<int, array<string, mixed>> |
| 51 | */ |
| 52 | private static function getContactRoleRadioField(): array |
| 53 | { |
| 54 | return [[ |
| 55 | 'id' => 6, |
| 56 | 'fieldIndex' => 1, |
| 57 | 'type' => 'radio', |
| 58 | 'label' => BackendStrings::getTemplateStrings()['primary_contact_role'], |
| 59 | 'required' => true, |
| 60 | 'parentId' => null, |
| 61 | 'defaultValue' => '', |
| 62 | 'placeholder' => '', |
| 63 | 'position' => 1, |
| 64 | 'fieldOptions' => [ |
| 65 | [ |
| 66 | 'id' => 1, |
| 67 | 'label' => BackendStrings::getTemplateStrings()['founder_ceo'], |
| 68 | 'value' => 'founder_ceo', |
| 69 | 'isDefault' => false, |
| 70 | 'position' => 1 |
| 71 | ], |
| 72 | [ |
| 73 | 'id' => 2, |
| 74 | 'label' => BackendStrings::getTemplateStrings()['manager'], |
| 75 | 'value' => 'manager', |
| 76 | 'isDefault' => false, |
| 77 | 'position' => 2 |
| 78 | ], |
| 79 | [ |
| 80 | 'id' => 3, |
| 81 | 'label' => BackendStrings::getTemplateStrings()['team_lead'], |
| 82 | 'value' => 'team_lead', |
| 83 | 'isDefault' => false, |
| 84 | 'position' => 3 |
| 85 | ], |
| 86 | [ |
| 87 | 'id' => 4, |
| 88 | 'label' => BackendStrings::getTemplateStrings()['individual_contributor'], |
| 89 | 'value' => 'individual_contributor', |
| 90 | 'isDefault' => false, |
| 91 | 'position' => 4 |
| 92 | ], |
| 93 | [ |
| 94 | 'id' => 5, |
| 95 | 'label' => BackendStrings::getTemplateStrings()['other'], |
| 96 | 'value' => 'other', |
| 97 | 'isDefault' => false, |
| 98 | 'position' => 5 |
| 99 | ], |
| 100 | ] |
| 101 | ]]; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Communication clarity rating field |
| 106 | * |
| 107 | * @return array<int, array<string, mixed>> |
| 108 | */ |
| 109 | private static function getCommunicationClarityRatingField(): array |
| 110 | { |
| 111 | return [[ |
| 112 | 'id' => 7, |
| 113 | 'fieldIndex' => 2, |
| 114 | 'type' => 'rating', |
| 115 | 'label' => BackendStrings::getTemplateStrings()['communication_clarity'], |
| 116 | 'required' => true, |
| 117 | 'defaultValue' => '', |
| 118 | 'placeholder' => '', |
| 119 | 'position' => 2, |
| 120 | 'labelPosition' => 'default', |
| 121 | 'ratingIcon' => 'star', |
| 122 | 'fieldOptions' => self::getStandardRatingOptions(6), |
| 123 | 'showValues' => false, |
| 124 | 'showRatingText' => true, |
| 125 | ]]; |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Availability & responsiveness rating field |
| 130 | * |
| 131 | * @return array<int, array<string, mixed>> |
| 132 | */ |
| 133 | private static function getAvailabilityResponsivenessRatingField(): array |
| 134 | { |
| 135 | return [[ |
| 136 | 'id' => 8, |
| 137 | 'fieldIndex' => 3, |
| 138 | 'type' => 'rating', |
| 139 | 'label' => BackendStrings::getTemplateStrings()['availability_responsiveness'], |
| 140 | 'required' => true, |
| 141 | 'defaultValue' => '', |
| 142 | 'placeholder' => '', |
| 143 | 'position' => 3, |
| 144 | 'labelPosition' => 'default', |
| 145 | 'ratingIcon' => 'star', |
| 146 | 'fieldOptions' => self::getStandardRatingOptions(11), |
| 147 | 'showValues' => false, |
| 148 | 'showRatingText' => true, |
| 149 | ]]; |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * Preferred communication channels checkbox field |
| 154 | * |
| 155 | * @return array<int, array<string, mixed>> |
| 156 | */ |
| 157 | private static function getPreferredChannelsCheckboxField(): array |
| 158 | { |
| 159 | return [[ |
| 160 | 'id' => 14, |
| 161 | 'fieldIndex' => 4, |
| 162 | 'type' => 'checkbox', |
| 163 | 'label' => BackendStrings::getTemplateStrings()['preferred_communication_channels'], |
| 164 | 'required' => false, |
| 165 | 'parentId' => null, |
| 166 | 'defaultValue' => '', |
| 167 | 'placeholder' => '', |
| 168 | 'position' => 4, |
| 169 | 'fieldOptions' => [ |
| 170 | [ |
| 171 | 'id' => 9, |
| 172 | 'label' => BackendStrings::getNewFormStrings()['email'], |
| 173 | 'value' => 'email', |
| 174 | 'isDefault' => false, |
| 175 | 'position' => 1 |
| 176 | ], |
| 177 | [ |
| 178 | 'id' => 10, |
| 179 | 'label' => BackendStrings::getTemplateStrings()['phone'], |
| 180 | 'value' => 'phone', |
| 181 | 'isDefault' => false, |
| 182 | 'position' => 2 |
| 183 | ], |
| 184 | [ |
| 185 | 'id' => 11, |
| 186 | 'label' => BackendStrings::getTemplateStrings()['video_calls'], |
| 187 | 'value' => 'video_calls', |
| 188 | 'isDefault' => false, |
| 189 | 'position' => 3 |
| 190 | ], |
| 191 | [ |
| 192 | 'id' => 12, |
| 193 | 'label' => BackendStrings::getTemplateStrings()['chat_messaging_tools'], |
| 194 | 'value' => 'chat_messaging_tools', |
| 195 | 'isDefault' => false, |
| 196 | 'position' => 4 |
| 197 | ], |
| 198 | [ |
| 199 | 'id' => 13, |
| 200 | 'label' => BackendStrings::getTemplateStrings()['project_management_tools'], |
| 201 | 'value' => 'project_management_tools', |
| 202 | 'isDefault' => false, |
| 203 | 'position' => 5 |
| 204 | ], |
| 205 | ] |
| 206 | ]]; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * Communication improvement suggestions textarea field |
| 211 | * |
| 212 | * @return array<int, array<string, mixed>> |
| 213 | */ |
| 214 | private static function getCommunicationImprovementTextareaField(): array |
| 215 | { |
| 216 | return [[ |
| 217 | 'id' => 15, |
| 218 | 'fieldIndex' => 5, |
| 219 | 'type' => 'textarea', |
| 220 | 'label' => BackendStrings::getTemplateStrings()['communication_improvement_suggestions'], |
| 221 | 'required' => false, |
| 222 | 'defaultValue' => '', |
| 223 | 'placeholder' => BackendStrings::getTemplateStrings()['communication_improvement_suggestions_placeholder'], |
| 224 | 'position' => 5, |
| 225 | 'labelPosition' => 'default', |
| 226 | ]]; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Standard rating options |
| 231 | * |
| 232 | * @return array<int, array<string, mixed>> |
| 233 | */ |
| 234 | private static function getStandardRatingOptions(int $startId): array |
| 235 | { |
| 236 | return [ |
| 237 | [ |
| 238 | 'id' => $startId, |
| 239 | 'label' => BackendStrings::getNewFormStrings()['good'], |
| 240 | 'value' => '1', |
| 241 | 'isDefault' => false, |
| 242 | 'position' => 1 |
| 243 | ], |
| 244 | [ |
| 245 | 'id' => $startId + 1, |
| 246 | 'label' => BackendStrings::getNewFormStrings()['nice'], |
| 247 | 'value' => '2', |
| 248 | 'isDefault' => false, |
| 249 | 'position' => 2 |
| 250 | ], |
| 251 | [ |
| 252 | 'id' => $startId + 2, |
| 253 | 'label' => BackendStrings::getNewFormStrings()['very_good'], |
| 254 | 'value' => '3', |
| 255 | 'isDefault' => false, |
| 256 | 'position' => 3 |
| 257 | ], |
| 258 | [ |
| 259 | 'id' => $startId + 3, |
| 260 | 'label' => BackendStrings::getNewFormStrings()['awesome'], |
| 261 | 'value' => '4', |
| 262 | 'isDefault' => false, |
| 263 | 'position' => 4 |
| 264 | ], |
| 265 | [ |
| 266 | 'id' => $startId + 4, |
| 267 | 'label' => BackendStrings::getNewFormStrings()['amazing'], |
| 268 | 'value' => '5', |
| 269 | 'isDefault' => false, |
| 270 | 'position' => 5 |
| 271 | ], |
| 272 | ]; |
| 273 | } |
| 274 | } |
| 275 |