PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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 / PostPurchaseFeedbackFormTemplate.php

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

272 lines 8.8 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 PostPurchaseFeedbackFormTemplate
8 {
9 /**
10 * Get the Post-Purchase Feedback template
11 *
12 * @return array<string, mixed>
13 */
14 public static function getTemplate(): array
15 {
16 return [
17 'id' => 'post_purchase_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['post_purchase_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['post_purchase_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'customer-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'post-purchase-feedback-form.svg',
24 'form_data' => [
25 'name' => BackendStrings::getTemplateStrings()['post_purchase_feedback_form'],
26 'published' => 1,
27 'showTitle' => 1,
28 'storeEntries' => 1,
29 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
30 'fields' => array_merge(
31 self::getOrderNumberField(),
32 self::getDeliveryStatusField(),
33 self::getCheckoutRatingField(),
34 self::getDeliveryRatingField(),
35 self::getInfluencedPurchaseCheckboxField(),
36 self::getAdditionalCommentsTextareaField()
37 ),
38 'settings' => []
39 ]
40 ];
41 }
42
43 /**
44 * Order number (optional)
45 *
46 * @return array<int, array<string, mixed>>
47 */
48 private static function getOrderNumberField(): array
49 {
50 return [[
51 'id' => 1,
52 'fieldIndex' => 1,
53 'type' => 'number',
54 'label' => BackendStrings::getTemplateStrings()['order_number'],
55 'placeholder' => 'e.g. 123456',
56 'required' => false,
57 'parentId' => null,
58 'defaultValue' => '',
59 'position' => 1,
60 ]];
61 }
62
63 /**
64 * Delivery status (radio, required)
65 *
66 * @return array<int, array<string, mixed>>
67 */
68 private static function getDeliveryStatusField(): array
69 {
70 return [[
71 'id' => 5,
72 'fieldIndex' => 2,
73 'type' => 'radio',
74 'label' => BackendStrings::getTemplateStrings()['delivery_status'],
75 'required' => true,
76 'parentId' => null,
77 'defaultValue' => '',
78 'placeholder' => '',
79 'position' => 2,
80 'fieldOptions' => [
81 [
82 'label' => BackendStrings::getTemplateStrings()['delivered_on_time'],
83 'value' => 'delivered_on_time',
84 'position' => 1,
85 ],
86 [
87 'label' => BackendStrings::getTemplateStrings()['slightly_delayed'],
88 'value' => 'slightly_delayed',
89 'position' => 2,
90 ],
91 [
92 'label' => BackendStrings::getTemplateStrings()['significantly_delayed'],
93 'value' => 'significantly_delayed',
94 'position' => 3,
95 ],
96 ]
97 ]];
98 }
99
100 /**
101 * Checkout experience rating (required)
102 *
103 * @return array<int, array<string, mixed>>
104 */
105 private static function getCheckoutRatingField(): array
106 {
107 return [[
108 'id' => 6,
109 'fieldIndex' => 3,
110 'type' => 'rating',
111 'label' => BackendStrings::getTemplateStrings()['checkout_experience'],
112 'required' => true,
113 'defaultValue' => '',
114 'placeholder' => '',
115 'position' => 3,
116 'labelPosition' => 'default',
117 'ratingIcon' => 'star',
118 'fieldOptions' => self::getStandardRatingOptions(1),
119 'showValues' => false,
120 'showRatingText' => true,
121 ]];
122 }
123
124 /**
125 * Delivery experience rating (required)
126 *
127 * @return array<int, array<string, mixed>>
128 */
129 private static function getDeliveryRatingField(): array
130 {
131 return [[
132 'id' => 7,
133 'fieldIndex' => 4,
134 'type' => 'rating',
135 'label' => BackendStrings::getTemplateStrings()['delivery_experience'],
136 'required' => true,
137 'defaultValue' => '',
138 'placeholder' => '',
139 'position' => 4,
140 'labelPosition' => 'default',
141 'ratingIcon' => 'star',
142 'fieldOptions' => self::getStandardRatingOptions(6),
143 'showValues' => false,
144 'showRatingText' => true,
145 ]];
146 }
147
148 /**
149 * What influenced your purchase experience? (checkbox, optional)
150 *
151 * @return array<int, array<string, mixed>>
152 */
153 private static function getInfluencedPurchaseCheckboxField(): array
154 {
155 return [[
156 'id' => 13,
157 'fieldIndex' => 5,
158 'type' => 'checkbox',
159 'label' => BackendStrings::getTemplateStrings()['what_influenced_purchase_experience'],
160 'required' => false,
161 'parentId' => null,
162 'defaultValue' => '',
163 'placeholder' => '',
164 'position' => 5,
165 'fieldOptions' => [
166 [
167 'id' => 8,
168 'label' => BackendStrings::getTemplateStrings()['pricing'],
169 'value' => 'pricing',
170 'isDefault' => false,
171 'position' => 1,
172 ],
173 [
174 'id' => 9,
175 'label' => BackendStrings::getTemplateStrings()['payment_options'],
176 'value' => 'payment_options',
177 'isDefault' => false,
178 'position' => 2,
179 ],
180 [
181 'id' => 10,
182 'label' => BackendStrings::getTemplateStrings()['shipping_cost'],
183 'value' => 'shipping_cost',
184 'isDefault' => false,
185 'position' => 3,
186 ],
187 [
188 'id' => 11,
189 'label' => BackendStrings::getTemplateStrings()['delivery_speed'],
190 'value' => 'delivery_speed',
191 'isDefault' => false,
192 'position' => 4,
193 ],
194 [
195 'id' => 12,
196 'label' => BackendStrings::getTemplateStrings()['packaging'],
197 'value' => 'packaging',
198 'isDefault' => false,
199 'position' => 5,
200 ],
201 ]
202 ]];
203 }
204
205 /**
206 * Additional comments (optional)
207 *
208 * @return array<int, array<string, mixed>>
209 */
210 private static function getAdditionalCommentsTextareaField(): array
211 {
212 return [[
213 'id' => 14,
214 'fieldIndex' => 6,
215 'type' => 'textarea',
216 'label' => BackendStrings::getTemplateStrings()['additional_comments'],
217 'placeholder' => BackendStrings::getTemplateStrings()['additional_comments_placeholder'],
218 'required' => false,
219 'parentId' => null,
220 'defaultValue' => '',
221 'position' => 6,
222 'labelPosition' => 'default',
223 ]];
224 }
225
226 /**
227 * Standard rating options (1-5)
228 *
229 * @return array<int, array<string, mixed>>
230 */
231 private static function getStandardRatingOptions(int $startId): array
232 {
233 return [
234 [
235 'id' => $startId,
236 'label' => BackendStrings::getNewFormStrings()['good'],
237 'value' => '1',
238 'isDefault' => false,
239 'position' => 1,
240 ],
241 [
242 'id' => $startId + 1,
243 'label' => BackendStrings::getNewFormStrings()['nice'],
244 'value' => '2',
245 'isDefault' => false,
246 'position' => 2,
247 ],
248 [
249 'id' => $startId + 2,
250 'label' => BackendStrings::getNewFormStrings()['very_good'],
251 'value' => '3',
252 'isDefault' => false,
253 'position' => 3,
254 ],
255 [
256 'id' => $startId + 3,
257 'label' => BackendStrings::getNewFormStrings()['awesome'],
258 'value' => '4',
259 'isDefault' => false,
260 'position' => 4,
261 ],
262 [
263 'id' => $startId + 4,
264 'label' => BackendStrings::getNewFormStrings()['amazing'],
265 'value' => '5',
266 'isDefault' => false,
267 'position' => 5,
268 ],
269 ];
270 }
271 }
272