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