PluginProbe
The Innovative Form Builder – IvyForms / 1.1.1
The Innovative Form Builder – IvyForms v1.1.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Template / CustomerSupportFeedbackFormTemplate.php

CustomerSupportFeedbackFormTemplate.php in The Innovative Form Builder – IvyForms 1.1.1, at backend/src/Services/Template/CustomerSupportFeedbackFormTemplate.php

286 lines 9.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Services\Template;
4
5 use IvyForms\Services\Translations\BackendStrings;
6
7 class CustomerSupportFeedbackFormTemplate
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' => 'customer_support_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['customer_support_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['customer_support_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'customer-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'customer-support-feedback-form.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()['customer_support_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getIssueResolvedField(),
45 self::getAgentHelpfulnessRatingField(),
46 self::getResponseTimeRatingField(),
47 self::getImprovementsCheckboxField(),
48 self::getAdditionalCommentsTextareaField(),
49 self::getFollowUpEmailField()
50 ),
51 'settings' => []
52 ]
53 ]
54 );
55 }
56
57 /**
58 * Was your issue resolved? (radio, required)
59 *
60 * @return array<int, array<string, mixed>>
61 */
62 private static function getIssueResolvedField(): array
63 {
64 return [[
65 'id' => 4,
66 'fieldIndex' => 1,
67 'type' => 'radio',
68 'label' => BackendStrings::getTemplateStrings()['was_issue_resolved'],
69 'required' => true,
70 'parentId' => null,
71 'defaultValue' => '',
72 'placeholder' => '',
73 'position' => 1,
74 'fieldOptions' => [
75 [
76 'label' => BackendStrings::getTemplateStrings()['yes_fully'],
77 'value' => 'yes_fully',
78 'position' => 1,
79 ],
80 [
81 'label' => BackendStrings::getTemplateStrings()['partially'],
82 'value' => 'partially',
83 'position' => 2,
84 ],
85 [
86 'label' => BackendStrings::getComponentsStrings()['no'],
87 'value' => 'no',
88 'position' => 3,
89 ],
90 ]
91 ]];
92 }
93
94 /**
95 * Support agent helpfulness rating (required)
96 *
97 * @return array<int, array<string, mixed>>
98 */
99 private static function getAgentHelpfulnessRatingField(): array
100 {
101 return [[
102 'id' => 5,
103 'fieldIndex' => 2,
104 'type' => 'rating',
105 'label' => BackendStrings::getTemplateStrings()['support_agent_helpfulness'],
106 'required' => true,
107 'defaultValue' => '',
108 'placeholder' => '',
109 'position' => 2,
110 'labelPosition' => 'default',
111 'ratingIcon' => 'star',
112 'fieldOptions' => self::getStandardRatingOptions(1),
113 'showValues' => false,
114 'showRatingText' => true,
115 ]];
116 }
117
118 /**
119 * Response time rating (required)
120 *
121 * @return array<int, array<string, mixed>>
122 */
123 private static function getResponseTimeRatingField(): array
124 {
125 return [[
126 'id' => 6,
127 'fieldIndex' => 3,
128 'type' => 'rating',
129 'label' => BackendStrings::getTemplateStrings()['response_time'],
130 'required' => true,
131 'defaultValue' => '',
132 'placeholder' => '',
133 'position' => 3,
134 'labelPosition' => 'default',
135 'ratingIcon' => 'star',
136 'fieldOptions' => self::getStandardRatingOptions(6),
137 'showValues' => false,
138 'showRatingText' => true,
139 ]];
140 }
141
142 /**
143 * What could be improved? (checkbox, optional)
144 *
145 * @return array<int, array<string, mixed>>
146 */
147 private static function getImprovementsCheckboxField(): array
148 {
149 return [[
150 'id' => 12,
151 'fieldIndex' => 4,
152 'type' => 'checkbox',
153 'label' => BackendStrings::getTemplateStrings()['what_could_be_improved'],
154 'required' => false,
155 'parentId' => null,
156 'defaultValue' => '',
157 'placeholder' => '',
158 'position' => 4,
159 'fieldOptions' => [
160 [
161 'id' => 7,
162 'label' => BackendStrings::getTemplateStrings()['faster_response'],
163 'value' => 'faster_response',
164 'isDefault' => false,
165 'position' => 1,
166 ],
167 [
168 'id' => 8,
169 'label' => BackendStrings::getTemplateStrings()['clearer_communication'],
170 'value' => 'clearer_communication',
171 'isDefault' => false,
172 'position' => 2,
173 ],
174 [
175 'id' => 9,
176 'label' => BackendStrings::getTemplateStrings()['better_problem_resolution'],
177 'value' => 'better_problem_resolution',
178 'isDefault' => false,
179 'position' => 3,
180 ],
181 [
182 'id' => 10,
183 'label' => BackendStrings::getTemplateStrings()['friendliness'],
184 'value' => 'friendliness',
185 'isDefault' => false,
186 'position' => 4,
187 ],
188 [
189 'id' => 11,
190 'label' => BackendStrings::getTemplateStrings()['no_improvements_needed'],
191 'value' => 'no_improvements_needed',
192 'isDefault' => false,
193 'position' => 5,
194 ],
195 ]
196 ]];
197 }
198
199 /**
200 * Additional comments (textarea, optional)
201 *
202 * @return array<int, array<string, mixed>>
203 */
204 private static function getAdditionalCommentsTextareaField(): array
205 {
206 return [[
207 'id' => 13,
208 'fieldIndex' => 5,
209 'type' => 'textarea',
210 'label' => BackendStrings::getTemplateStrings()['additional_comments'],
211 'placeholder' => BackendStrings::getTemplateStrings()['additional_comments_placeholder'],
212 'required' => false,
213 'parentId' => null,
214 'defaultValue' => '',
215 'position' => 5,
216 'labelPosition' => 'default',
217 ]];
218 }
219
220 /**
221 * Follow-up email (email, optional)
222 *
223 * @return array<int, array<string, mixed>>
224 */
225 private static function getFollowUpEmailField(): array
226 {
227 return [[
228 'id' => 14,
229 'fieldIndex' => 6,
230 'type' => 'email',
231 'label' => BackendStrings::getTemplateStrings()['follow_up_email'],
232 'placeholder' => BackendStrings::getTemplateStrings()['follow_up_email_placeholder'],
233 'required' => false,
234 'parentId' => null,
235 'defaultValue' => '',
236 'position' => 6,
237 ]];
238 }
239
240 /**
241 * Standard rating options (1-5)
242 *
243 * @return array<int, array<string, mixed>>
244 */
245 private static function getStandardRatingOptions(int $startId): array
246 {
247 return [
248 [
249 'id' => $startId,
250 'label' => BackendStrings::getNewFormStrings()['good'],
251 'value' => '1',
252 'isDefault' => false,
253 'position' => 1
254 ],
255 [
256 'id' => $startId + 1,
257 'label' => BackendStrings::getNewFormStrings()['nice'],
258 'value' => '2',
259 'isDefault' => false,
260 'position' => 2
261 ],
262 [
263 'id' => $startId + 2,
264 'label' => BackendStrings::getNewFormStrings()['very_good'],
265 'value' => '3',
266 'isDefault' => false,
267 'position' => 3
268 ],
269 [
270 'id' => $startId + 3,
271 'label' => BackendStrings::getNewFormStrings()['awesome'],
272 'value' => '4',
273 'isDefault' => false,
274 'position' => 4
275 ],
276 [
277 'id' => $startId + 4,
278 'label' => BackendStrings::getNewFormStrings()['amazing'],
279 'value' => '5',
280 'isDefault' => false,
281 'position' => 5
282 ],
283 ];
284 }
285 }
286