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