1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerFeature\Yves\SelfServicePortal; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\ItemTransfer; |
11
|
|
|
use Generated\Shared\Transfer\SspAssetTransfer; |
12
|
|
|
use Spryker\Client\CompanyBusinessUnit\CompanyBusinessUnitClientInterface; |
13
|
|
|
use Spryker\Client\CompanyUser\CompanyUserClientInterface; |
14
|
|
|
use Spryker\Client\Customer\CustomerClientInterface; |
15
|
|
|
use Spryker\Client\GlossaryStorage\GlossaryStorageClientInterface; |
16
|
|
|
use Spryker\Client\Permission\PermissionClientInterface; |
17
|
|
|
use Spryker\Client\ProductOfferStorage\ProductOfferStorageClientInterface; |
18
|
|
|
use Spryker\Client\ProductStorage\ProductStorageClientInterface; |
19
|
|
|
use Spryker\Client\Sales\SalesClientInterface; |
20
|
|
|
use Spryker\Client\ServicePointSearch\ServicePointSearchClientInterface; |
21
|
|
|
use Spryker\Client\ShipmentTypeStorage\ShipmentTypeStorageClientInterface; |
22
|
|
|
use Spryker\Client\Store\StoreClientInterface; |
23
|
|
|
use Spryker\Service\FileManager\FileManagerServiceInterface; |
24
|
|
|
use Spryker\Shared\Twig\TwigExtension; |
25
|
|
|
use Spryker\Yves\Kernel\AbstractFactory; |
26
|
|
|
use Spryker\Yves\Router\Router\RouterInterface; |
27
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Expander\SspAssetExpander; |
28
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Expander\SspAssetExpanderInterface; |
29
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Form\DataProvider\SspAssetFormDataProvider; |
30
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Form\DataProvider\SspAssetSearchFormDataProvider; |
31
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Form\SspAssetBusinessUnitRelationsForm; |
32
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Form\SspAssetForm; |
33
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Form\SspAssetSearchForm; |
34
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Handler\SspAssetSearchFormHandler; |
35
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Handler\SspAssetSearchFormHandlerInterface; |
36
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Mapper\SspAssetFormDataToTransferMapper; |
37
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Mapper\SspAssetFormDataToTransferMapperInterface; |
38
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Permission\SspAssetCustomerPermissionChecker; |
39
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Permission\SspAssetCustomerPermissionCheckerInterface; |
40
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Reader\SspAssetReader; |
41
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Asset\Reader\SspAssetReaderInterface; |
42
|
|
|
use SprykerFeature\Yves\SelfServicePortal\CompanyFile\Form\DataProvider\FileSearchFilterFormDataProvider; |
43
|
|
|
use SprykerFeature\Yves\SelfServicePortal\CompanyFile\Form\FileSearchFilterForm; |
44
|
|
|
use SprykerFeature\Yves\SelfServicePortal\CompanyFile\Form\Handler\FileSearchFilterFormHandler; |
45
|
|
|
use SprykerFeature\Yves\SelfServicePortal\CompanyFile\Form\Handler\FileSearchFilterFormHandlerInterface; |
46
|
|
|
use SprykerFeature\Yves\SelfServicePortal\CompanyFile\Formatter\TimeZoneFormatter; |
47
|
|
|
use SprykerFeature\Yves\SelfServicePortal\CompanyFile\Formatter\TimeZoneFormatterInterface; |
48
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Dashboard\Handler\SspDashboardRestrictionHandler; |
49
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Dashboard\Handler\SspDashboardRestrictionHandlerInterface; |
50
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\DataProvider\SspInquiryFormDataProvider; |
51
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\DataProvider\SspInquirySearchFormDataProvider; |
52
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\Expander\CreateGeneralSspInquiryFormExpander; |
53
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\Expander\CreateOrderSspInquiryFormExpander; |
54
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\Expander\CreateSspAssetSspInquiryFormExpander; |
55
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\Expander\CreateSspInquiryFormExpanderInterface; |
56
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\SspInquiryCancelForm; |
57
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\SspInquiryForm; |
58
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\SspInquirySearchForm; |
59
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Handler\SspInquiryRestrictionHandler; |
60
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Handler\SspInquiryRestrictionHandlerInterface; |
61
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Handler\SspInquirySearchFormHandler; |
62
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Handler\SspInquirySearchFormHandlerInterface; |
63
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Mapper\CreateSspInquiryFormDataToTransferMapper; |
64
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Mapper\CreateSspInquiryFormDataToTransferMapperInterface; |
65
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Reader\SspInquiryReader; |
66
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Inquiry\Reader\SspInquiryReaderInterface; |
67
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Reader\CompanyUserReader; |
68
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Reader\CompanyUserReaderInterface; |
69
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Checker\ShipmentTypeChecker; |
70
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Checker\ShipmentTypeCheckerInterface; |
71
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ProductOfferExpander; |
72
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ProductOfferExpanderInterface; |
73
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ServiceDateTimeEnabledExpander; |
74
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ServiceDateTimeEnabledExpanderInterface; |
75
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ServiceDateTimeExpander; |
76
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ServiceDateTimeExpanderInterface; |
77
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ServicePointExpander; |
78
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ServicePointExpanderInterface; |
79
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ShipmentTypeExpander; |
80
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Expander\ShipmentTypeExpanderInterface; |
81
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Form\DataProvider\ServiceSearchFormDataProvider; |
82
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Form\DataProvider\SspServiceCancelFormDataProvider; |
83
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Form\ServiceItemSchedulerForm; |
84
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Form\ServiceSearchForm; |
85
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Form\SspServiceCancelForm; |
86
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Grouper\AddressFormItemShipmentTypeGrouper; |
87
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Grouper\AddressFormItemShipmentTypeGrouperInterface; |
88
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Grouper\ItemShipmentTypeGrouper; |
89
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Grouper\ItemShipmentTypeGrouperInterface; |
90
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Handler\ServiceSearchFormHandler; |
91
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Handler\ServiceSearchFormHandlerInterface; |
92
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Provider\ShipmentTypeOptionsProvider; |
93
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Provider\ShipmentTypeOptionsProviderInterface; |
94
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Reader\OrderReader; |
95
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Reader\OrderReaderInterface; |
96
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Reader\ProductOfferReader; |
97
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Reader\ProductOfferReaderInterface; |
98
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Reader\ServicePointReader; |
99
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Reader\ServicePointReaderInterface; |
100
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Reader\ShipmentTypeReader; |
101
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Reader\ShipmentTypeReaderInterface; |
102
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Resolver\ShopContextResolver; |
103
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Resolver\ShopContextResolverInterface; |
104
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Sorter\ShipmentTypeGroupSorter; |
105
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Service\Sorter\ShipmentTypeGroupSorterInterface; |
106
|
|
|
use SprykerFeature\Yves\SelfServicePortal\Twig\FileSizeFormatterExtension; |
107
|
|
|
use Symfony\Component\Form\FormFactoryInterface; |
108
|
|
|
use Symfony\Component\Form\FormInterface; |
109
|
|
|
use Symfony\Component\HttpFoundation\RequestStack; |
110
|
|
|
use Symfony\Component\HttpFoundation\Response; |
111
|
|
|
use Twig\Environment; |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @method \SprykerFeature\Yves\SelfServicePortal\SelfServicePortalConfig getConfig() |
115
|
|
|
* @method \SprykerFeature\Client\SelfServicePortal\SelfServicePortalClientInterface getClient() |
116
|
|
|
*/ |
117
|
|
|
class SelfServicePortalFactory extends AbstractFactory |
118
|
|
|
{ |
119
|
|
|
/** |
120
|
|
|
* @var string |
121
|
|
|
*/ |
122
|
|
|
protected const FORM_FACTORY = 'FORM_FACTORY'; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @param \Generated\Shared\Transfer\ItemTransfer|null $itemTransfer |
126
|
|
|
* |
127
|
|
|
* @return \Symfony\Component\Form\FormInterface |
128
|
|
|
*/ |
129
|
|
|
public function getSspServiceCancelForm(?ItemTransfer $itemTransfer = null): FormInterface |
130
|
|
|
{ |
131
|
|
|
$dataProvider = $this->createSspServiceCancelFormDataProvider(); |
132
|
|
|
$data = $dataProvider->getData($itemTransfer); |
133
|
|
|
|
134
|
|
|
return $this->getFormFactory()->create(SspServiceCancelForm::class, $data); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Form\DataProvider\SspServiceCancelFormDataProvider |
139
|
|
|
*/ |
140
|
|
|
public function createSspServiceCancelFormDataProvider(): SspServiceCancelFormDataProvider |
141
|
|
|
{ |
142
|
|
|
return new SspServiceCancelFormDataProvider(); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @return \Symfony\Component\Form\FormInterface |
147
|
|
|
*/ |
148
|
|
|
public function getServiceSearchForm(): FormInterface |
149
|
|
|
{ |
150
|
|
|
$dataProvider = $this->createServiceSearchFormDataProvider(); |
151
|
|
|
|
152
|
|
|
return $this->getFormFactory()->create( |
153
|
|
|
ServiceSearchForm::class, |
154
|
|
|
$dataProvider->getData(), |
155
|
|
|
$dataProvider->getOptions(), |
156
|
|
|
); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Form\DataProvider\ServiceSearchFormDataProvider |
161
|
|
|
*/ |
162
|
|
|
public function createServiceSearchFormDataProvider(): ServiceSearchFormDataProvider |
163
|
|
|
{ |
164
|
|
|
return new ServiceSearchFormDataProvider( |
165
|
|
|
$this->getCustomerClient(), |
166
|
|
|
$this->getCompanyBusinessUnitClient(), |
167
|
|
|
$this->getPermissionClient(), |
168
|
|
|
); |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Handler\ServiceSearchFormHandlerInterface |
173
|
|
|
*/ |
174
|
|
|
public function createServiceSearchFormHandler(): ServiceSearchFormHandlerInterface |
175
|
|
|
{ |
176
|
|
|
return new ServiceSearchFormHandler( |
177
|
|
|
$this->getCustomerClient(), |
178
|
|
|
$this->getConfig(), |
179
|
|
|
); |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @return \Symfony\Component\Form\FormFactoryInterface |
184
|
|
|
*/ |
185
|
|
|
protected function getFormFactory(): FormFactoryInterface |
186
|
|
|
{ |
187
|
|
|
$container = $this->createContainerWithProvidedDependencies(); |
188
|
|
|
|
189
|
|
|
return $container->get(static::FORM_FACTORY); |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Reader\ShipmentTypeReaderInterface |
194
|
|
|
*/ |
195
|
|
|
public function createShipmentTypeReader(): ShipmentTypeReaderInterface |
196
|
|
|
{ |
197
|
|
|
return new ShipmentTypeReader( |
198
|
|
|
$this->getShipmentTypeStorageClient(), |
199
|
|
|
$this->getConfig(), |
200
|
|
|
); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Checker\ShipmentTypeCheckerInterface |
205
|
|
|
*/ |
206
|
|
|
public function createShipmentTypeChecker(): ShipmentTypeCheckerInterface |
207
|
|
|
{ |
208
|
|
|
return new ShipmentTypeChecker( |
209
|
|
|
$this->getConfig(), |
210
|
|
|
); |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Provider\ShipmentTypeOptionsProviderInterface |
215
|
|
|
*/ |
216
|
|
|
public function createShipmentTypeOptionsProvider(): ShipmentTypeOptionsProviderInterface |
217
|
|
|
{ |
218
|
|
|
return new ShipmentTypeOptionsProvider( |
219
|
|
|
$this->getConfig(), |
220
|
|
|
$this->createShipmentTypeGroupSorter(), |
221
|
|
|
); |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Expander\ShipmentTypeExpanderInterface |
226
|
|
|
*/ |
227
|
|
|
public function createShipmentTypeExpander(): ShipmentTypeExpanderInterface |
228
|
|
|
{ |
229
|
|
|
return new ShipmentTypeExpander( |
230
|
|
|
$this->createShipmentTypeReader(), |
231
|
|
|
$this->getStoreClient(), |
232
|
|
|
); |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Expander\ProductOfferExpanderInterface |
237
|
|
|
*/ |
238
|
|
|
public function createProductOfferExpander(): ProductOfferExpanderInterface |
239
|
|
|
{ |
240
|
|
|
return new ProductOfferExpander( |
241
|
|
|
$this->getProductOfferStorageClient(), |
242
|
|
|
); |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Expander\ServicePointExpanderInterface |
247
|
|
|
*/ |
248
|
|
|
public function createServicePointExpander(): ServicePointExpanderInterface |
249
|
|
|
{ |
250
|
|
|
return new ServicePointExpander( |
251
|
|
|
$this->getProductOfferStorageClient(), |
252
|
|
|
); |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Expander\ServiceDateTimeExpanderInterface |
257
|
|
|
*/ |
258
|
|
|
public function createServiceDateTimeExpander(): ServiceDateTimeExpanderInterface |
259
|
|
|
{ |
260
|
|
|
return new ServiceDateTimeExpander(); |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Expander\ServiceDateTimeEnabledExpanderInterface |
265
|
|
|
*/ |
266
|
|
|
public function createServiceDateTimeEnabledExpander(): ServiceDateTimeEnabledExpanderInterface |
267
|
|
|
{ |
268
|
|
|
return new ServiceDateTimeEnabledExpander( |
269
|
|
|
$this->getProductStorageClient(), |
270
|
|
|
); |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
/** |
274
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Sorter\ShipmentTypeGroupSorterInterface |
275
|
|
|
*/ |
276
|
|
|
public function createShipmentTypeGroupSorter(): ShipmentTypeGroupSorterInterface |
277
|
|
|
{ |
278
|
|
|
return new ShipmentTypeGroupSorter($this->getConfig()); |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
/** |
282
|
|
|
* @return \Spryker\Shared\Twig\TwigExtension |
283
|
|
|
*/ |
284
|
|
|
public function createFileSizeFormatterExtension(): TwigExtension |
285
|
|
|
{ |
286
|
|
|
return new FileSizeFormatterExtension(); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Grouper\ItemShipmentTypeGrouperInterface |
291
|
|
|
*/ |
292
|
|
|
public function createItemShipmentTypeGrouper(): ItemShipmentTypeGrouperInterface |
293
|
|
|
{ |
294
|
|
|
return new ItemShipmentTypeGrouper( |
295
|
|
|
$this->getConfig(), |
296
|
|
|
$this->createShipmentTypeGroupSorter(), |
297
|
|
|
); |
298
|
|
|
} |
299
|
|
|
|
300
|
|
|
/** |
301
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Grouper\AddressFormItemShipmentTypeGrouperInterface |
302
|
|
|
*/ |
303
|
|
|
public function createAddressFormItemShipmentTypeGrouper(): AddressFormItemShipmentTypeGrouperInterface |
304
|
|
|
{ |
305
|
|
|
return new AddressFormItemShipmentTypeGrouper( |
306
|
|
|
$this->getConfig(), |
307
|
|
|
$this->createShipmentTypeGroupSorter(), |
308
|
|
|
); |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* @param \Generated\Shared\Transfer\ItemTransfer $itemTransfer |
313
|
|
|
* |
314
|
|
|
* @return \Symfony\Component\Form\FormInterface |
315
|
|
|
*/ |
316
|
|
|
public function createServiceItemSchedulerForm(ItemTransfer $itemTransfer): FormInterface |
317
|
|
|
{ |
318
|
|
|
return $this->getFormFactory()->create( |
319
|
|
|
ServiceItemSchedulerForm::class, |
320
|
|
|
$itemTransfer, |
321
|
|
|
); |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Reader\ServicePointReaderInterface |
326
|
|
|
*/ |
327
|
|
|
public function createServicePointReader(): ServicePointReaderInterface |
328
|
|
|
{ |
329
|
|
|
return new ServicePointReader( |
330
|
|
|
$this->getServicePointSearchClient(), |
331
|
|
|
$this->getTwigEnvironment(), |
332
|
|
|
); |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* @param string $searchResults |
337
|
|
|
* |
338
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
339
|
|
|
*/ |
340
|
|
|
public function createResponse(string $searchResults): Response |
341
|
|
|
{ |
342
|
|
|
return new Response($searchResults); |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Reader\OrderReaderInterface |
347
|
|
|
*/ |
348
|
|
|
public function createOrderReader(): OrderReaderInterface |
349
|
|
|
{ |
350
|
|
|
return new OrderReader( |
351
|
|
|
$this->getSalesClient(), |
352
|
|
|
$this->getCustomerClient(), |
353
|
|
|
$this->getGlossaryStorageClient(), |
354
|
|
|
$this->getLocale(), |
355
|
|
|
); |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Resolver\ShopContextResolverInterface |
360
|
|
|
*/ |
361
|
|
|
public function createShopContextResolver(): ShopContextResolverInterface |
362
|
|
|
{ |
363
|
|
|
return new ShopContextResolver( |
364
|
|
|
$this->getContainer(), |
365
|
|
|
); |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Service\Reader\ProductOfferReaderInterface |
370
|
|
|
*/ |
371
|
|
|
public function createProductOfferReader(): ProductOfferReaderInterface |
372
|
|
|
{ |
373
|
|
|
return new ProductOfferReader( |
374
|
|
|
$this->getProductOfferStorageClient(), |
375
|
|
|
$this->createShopContextResolver(), |
376
|
|
|
); |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
/** |
380
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Reader\CompanyUserReaderInterface |
381
|
|
|
*/ |
382
|
|
|
public function createCompanyUserReader(): CompanyUserReaderInterface |
383
|
|
|
{ |
384
|
|
|
return new CompanyUserReader($this->getCompanyUserClient()); |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\CompanyFile\Formatter\TimeZoneFormatterInterface |
389
|
|
|
*/ |
390
|
|
|
public function createTimeZoneFormatter(): TimeZoneFormatterInterface |
391
|
|
|
{ |
392
|
|
|
return new TimeZoneFormatter($this->getConfig()); |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\CompanyFile\Form\Handler\FileSearchFilterFormHandlerInterface |
397
|
|
|
*/ |
398
|
|
|
public function createFileSearchFilterHandler(): FileSearchFilterFormHandlerInterface |
399
|
|
|
{ |
400
|
|
|
return new FileSearchFilterFormHandler( |
401
|
|
|
$this->createCompanyUserReader(), |
402
|
|
|
$this->getClient(), |
403
|
|
|
$this->createTimeZoneFormatter(), |
404
|
|
|
$this->getConfig(), |
405
|
|
|
); |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\CompanyFile\Form\DataProvider\FileSearchFilterFormDataProvider |
410
|
|
|
*/ |
411
|
|
|
public function createFileSearchFilterFormDataProvider(): FileSearchFilterFormDataProvider |
412
|
|
|
{ |
413
|
|
|
return new FileSearchFilterFormDataProvider($this->getConfig(), $this->getGlossaryStorageClient()); |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
/** |
417
|
|
|
* @param array<string, mixed> $data |
418
|
|
|
* @param string $localeName |
419
|
|
|
* |
420
|
|
|
* @return \Symfony\Component\Form\FormInterface |
421
|
|
|
*/ |
422
|
|
|
public function createFileSearchFilterForm(array $data, string $localeName): FormInterface |
423
|
|
|
{ |
424
|
|
|
return $this->getFormFactory()->create( |
425
|
|
|
FileSearchFilterForm::class, |
426
|
|
|
$data, |
427
|
|
|
$this->createFileSearchFilterFormDataProvider()->getOptions($localeName), |
428
|
|
|
); |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
/** |
432
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Inquiry\Reader\SspInquiryReaderInterface |
433
|
|
|
*/ |
434
|
|
|
public function createSspInquiryReader(): SspInquiryReaderInterface |
435
|
|
|
{ |
436
|
|
|
return new SspInquiryReader( |
437
|
|
|
$this->getClient(), |
438
|
|
|
$this->getConfig(), |
439
|
|
|
$this->getStoreClient(), |
440
|
|
|
); |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Inquiry\Handler\SspInquirySearchFormHandlerInterface |
445
|
|
|
*/ |
446
|
|
|
public function createSspInquirySearchFormHandler(): SspInquirySearchFormHandlerInterface |
447
|
|
|
{ |
448
|
|
|
return new SspInquirySearchFormHandler(); |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Inquiry\Mapper\CreateSspInquiryFormDataToTransferMapperInterface |
453
|
|
|
*/ |
454
|
|
|
public function createCreateSspInquiryFormDataToTransferMapper(): CreateSspInquiryFormDataToTransferMapperInterface |
455
|
|
|
{ |
456
|
|
|
return new CreateSspInquiryFormDataToTransferMapper( |
457
|
|
|
$this->getCompanyUserClient(), |
458
|
|
|
$this->getStoreClient(), |
459
|
|
|
$this->getCustomerClient(), |
460
|
|
|
); |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
/** |
464
|
|
|
* @return \Symfony\Component\Form\FormInterface |
465
|
|
|
*/ |
466
|
|
|
public function getSspInquiryCancelForm(): FormInterface |
467
|
|
|
{ |
468
|
|
|
return $this->getFormFactory()->create(SspInquiryCancelForm::class); |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* @param array<mixed> $formOptions |
473
|
|
|
* |
474
|
|
|
* @return \Symfony\Component\Form\FormInterface |
475
|
|
|
*/ |
476
|
|
|
public function getSspInquiryForm(array $formOptions = []): FormInterface |
477
|
|
|
{ |
478
|
|
|
return $this->getFormFactory()->create(SspInquiryForm::class, [], $formOptions); |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
/** |
482
|
|
|
* @return array<\SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\Expander\CreateSspInquiryFormExpanderInterface> |
483
|
|
|
*/ |
484
|
|
|
public function getSspInquiryFormExpanders(): array |
485
|
|
|
{ |
486
|
|
|
return [ |
487
|
|
|
$this->createCreateGeneralSspInquiryFormExpander(), |
488
|
|
|
$this->createCreateOrderSspInquiryFormExpander(), |
489
|
|
|
$this->createCreateSspAssetSspInquiryFormExpander(), |
490
|
|
|
]; |
491
|
|
|
} |
492
|
|
|
|
493
|
|
|
/** |
494
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\Expander\CreateSspInquiryFormExpanderInterface |
495
|
|
|
*/ |
496
|
|
|
public function createCreateGeneralSspInquiryFormExpander(): CreateSspInquiryFormExpanderInterface |
497
|
|
|
{ |
498
|
|
|
return new CreateGeneralSspInquiryFormExpander($this->getRequestStack()); |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
/** |
502
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\Expander\CreateSspInquiryFormExpanderInterface |
503
|
|
|
*/ |
504
|
|
|
public function createCreateOrderSspInquiryFormExpander(): CreateSspInquiryFormExpanderInterface |
505
|
|
|
{ |
506
|
|
|
return new CreateOrderSspInquiryFormExpander($this->getRequestStack()); |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
/** |
510
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\Expander\CreateSspAssetSspInquiryFormExpander |
511
|
|
|
*/ |
512
|
|
|
public function createCreateSspAssetSspInquiryFormExpander(): CreateSspInquiryFormExpanderInterface |
513
|
|
|
{ |
514
|
|
|
return new CreateSspAssetSspInquiryFormExpander($this->getRequestStack()); |
515
|
|
|
} |
516
|
|
|
|
517
|
|
|
/** |
518
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\DataProvider\SspInquiryFormDataProvider |
519
|
|
|
*/ |
520
|
|
|
public function getSspInquiryFormDataProvider(): SspInquiryFormDataProvider |
521
|
|
|
{ |
522
|
|
|
return new SspInquiryFormDataProvider($this->getConfig()); |
523
|
|
|
} |
524
|
|
|
|
525
|
|
|
/** |
526
|
|
|
* @param array<mixed> $formOptions |
527
|
|
|
* |
528
|
|
|
* @return \Symfony\Component\Form\FormInterface |
529
|
|
|
*/ |
530
|
|
|
public function getSspInquirySearchForm(array $formOptions = []): FormInterface |
531
|
|
|
{ |
532
|
|
|
return $this->getFormFactory()->create( |
533
|
|
|
SspInquirySearchForm::class, |
534
|
|
|
[], |
535
|
|
|
$formOptions, |
536
|
|
|
); |
537
|
|
|
} |
538
|
|
|
|
539
|
|
|
/** |
540
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Inquiry\Form\DataProvider\SspInquirySearchFormDataProvider |
541
|
|
|
*/ |
542
|
|
|
public function getSspInquirySearchFormDataProvider(): SspInquirySearchFormDataProvider |
543
|
|
|
{ |
544
|
|
|
return new SspInquirySearchFormDataProvider($this->getConfig(), $this->getStoreClient()->getCurrentStore()->getTimezone()); |
545
|
|
|
} |
546
|
|
|
|
547
|
|
|
/** |
548
|
|
|
* @return \Symfony\Component\HttpFoundation\RequestStack |
549
|
|
|
*/ |
550
|
|
|
public function getRequestStack(): RequestStack |
551
|
|
|
{ |
552
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::SERVICE_REQUEST_STACK); |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
/** |
556
|
|
|
* @return \Spryker\Client\ShipmentTypeStorage\ShipmentTypeStorageClientInterface |
557
|
|
|
*/ |
558
|
|
|
public function getShipmentTypeStorageClient(): ShipmentTypeStorageClientInterface |
559
|
|
|
{ |
560
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_SHIPMENT_TYPE_STORAGE); |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
/** |
564
|
|
|
* @return \Spryker\Client\ProductOfferStorage\ProductOfferStorageClientInterface |
565
|
|
|
*/ |
566
|
|
|
public function getProductOfferStorageClient(): ProductOfferStorageClientInterface |
567
|
|
|
{ |
568
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_PRODUCT_OFFER_STORAGE); |
569
|
|
|
} |
570
|
|
|
|
571
|
|
|
/** |
572
|
|
|
* @return \Spryker\Client\Store\StoreClientInterface |
573
|
|
|
*/ |
574
|
|
|
public function getStoreClient(): StoreClientInterface |
575
|
|
|
{ |
576
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_STORE); |
577
|
|
|
} |
578
|
|
|
|
579
|
|
|
/** |
580
|
|
|
* @return \Spryker\Client\ServicePointSearch\ServicePointSearchClientInterface |
581
|
|
|
*/ |
582
|
|
|
public function getServicePointSearchClient(): ServicePointSearchClientInterface |
583
|
|
|
{ |
584
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_SERVICE_POINT_SEARCH); |
585
|
|
|
} |
586
|
|
|
|
587
|
|
|
/** |
588
|
|
|
* @return \Twig\Environment |
589
|
|
|
*/ |
590
|
|
|
public function getTwigEnvironment(): Environment |
591
|
|
|
{ |
592
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::TWIG_ENVIRONMENT); |
593
|
|
|
} |
594
|
|
|
|
595
|
|
|
/** |
596
|
|
|
* @return \Spryker\Client\GlossaryStorage\GlossaryStorageClientInterface |
597
|
|
|
*/ |
598
|
|
|
public function getGlossaryStorageClient(): GlossaryStorageClientInterface |
599
|
|
|
{ |
600
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_GLOSSARY_STORAGE); |
601
|
|
|
} |
602
|
|
|
|
603
|
|
|
/** |
604
|
|
|
* @return string |
605
|
|
|
*/ |
606
|
|
|
public function getLocale(): string |
607
|
|
|
{ |
608
|
|
|
return $this->getTwigEnvironment()->getGlobals()['app']['locale']; |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
/** |
612
|
|
|
* @return \Spryker\Client\ProductStorage\ProductStorageClientInterface |
613
|
|
|
*/ |
614
|
|
|
public function getProductStorageClient(): ProductStorageClientInterface |
615
|
|
|
{ |
616
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_PRODUCT_STORAGE); |
617
|
|
|
} |
618
|
|
|
|
619
|
|
|
/** |
620
|
|
|
* @return \Spryker\Client\Customer\CustomerClientInterface |
621
|
|
|
*/ |
622
|
|
|
public function getCustomerClient(): CustomerClientInterface |
623
|
|
|
{ |
624
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_CUSTOMER); |
625
|
|
|
} |
626
|
|
|
|
627
|
|
|
/** |
628
|
|
|
* @return \Spryker\Client\CompanyBusinessUnit\CompanyBusinessUnitClientInterface |
629
|
|
|
*/ |
630
|
|
|
public function getCompanyBusinessUnitClient(): CompanyBusinessUnitClientInterface |
631
|
|
|
{ |
632
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_COMPANY_BUSINESS_UNIT); |
633
|
|
|
} |
634
|
|
|
|
635
|
|
|
/** |
636
|
|
|
* @return \Spryker\Client\Permission\PermissionClientInterface |
637
|
|
|
*/ |
638
|
|
|
public function getPermissionClient(): PermissionClientInterface |
639
|
|
|
{ |
640
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_PERMISSION); |
641
|
|
|
} |
642
|
|
|
|
643
|
|
|
/** |
644
|
|
|
* @return \Spryker\Client\Sales\SalesClientInterface |
645
|
|
|
*/ |
646
|
|
|
public function getSalesClient(): SalesClientInterface |
647
|
|
|
{ |
648
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_SALES); |
649
|
|
|
} |
650
|
|
|
|
651
|
|
|
/** |
652
|
|
|
* @return \Spryker\Client\CompanyUser\CompanyUserClientInterface |
653
|
|
|
*/ |
654
|
|
|
public function getCompanyUserClient(): CompanyUserClientInterface |
655
|
|
|
{ |
656
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::CLIENT_COMPANY_USER); |
657
|
|
|
} |
658
|
|
|
|
659
|
|
|
/** |
660
|
|
|
* @return \Spryker\Service\FileManager\FileManagerServiceInterface |
661
|
|
|
*/ |
662
|
|
|
public function getFileManagerService(): FileManagerServiceInterface |
663
|
|
|
{ |
664
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::SERVICE_FILE_MANAGER); |
665
|
|
|
} |
666
|
|
|
|
667
|
|
|
/** |
668
|
|
|
* @return \Spryker\Yves\Router\Router\RouterInterface |
669
|
|
|
*/ |
670
|
|
|
public function getRouter(): RouterInterface |
671
|
|
|
{ |
672
|
|
|
return $this->getProvidedDependency(SelfServicePortalDependencyProvider::SERVICE_ROUTER); |
673
|
|
|
} |
674
|
|
|
|
675
|
|
|
/** |
676
|
|
|
* @param \Generated\Shared\Transfer\SspAssetTransfer|null $sspAssetTransfer |
677
|
|
|
* @param array<mixed> $options |
678
|
|
|
* |
679
|
|
|
* @return \Symfony\Component\Form\FormInterface |
680
|
|
|
*/ |
681
|
|
|
public function createAssetForm(?SspAssetTransfer $sspAssetTransfer = null, array $options = []): FormInterface |
682
|
|
|
{ |
683
|
|
|
return $this->getFormFactory()->create(SspAssetForm::class, $sspAssetTransfer, $options); |
684
|
|
|
} |
685
|
|
|
|
686
|
|
|
/** |
687
|
|
|
* @param array<mixed> $formData |
688
|
|
|
* |
689
|
|
|
* @return \Symfony\Component\Form\FormInterface |
690
|
|
|
*/ |
691
|
|
|
public function createSspAssetBusinessUnitRelationsForm(array $formData = []): FormInterface |
692
|
|
|
{ |
693
|
|
|
return $this->getFormFactory()->create(SspAssetBusinessUnitRelationsForm::class, $formData); |
694
|
|
|
} |
695
|
|
|
|
696
|
|
|
/** |
697
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Asset\Form\DataProvider\SspAssetFormDataProvider |
698
|
|
|
*/ |
699
|
|
|
public function createSspAssetFormDataProvider(): SspAssetFormDataProvider |
700
|
|
|
{ |
701
|
|
|
return new SspAssetFormDataProvider($this->getClient(), $this->getConfig()); |
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
/** |
705
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Asset\Mapper\SspAssetFormDataToTransferMapperInterface |
706
|
|
|
*/ |
707
|
|
|
public function createSspAssetFormDataToTransferMapper(): SspAssetFormDataToTransferMapperInterface |
708
|
|
|
{ |
709
|
|
|
return new SspAssetFormDataToTransferMapper(); |
710
|
|
|
} |
711
|
|
|
|
712
|
|
|
/** |
713
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Asset\Permission\SspAssetCustomerPermissionCheckerInterface |
714
|
|
|
*/ |
715
|
|
|
public function createSspAssetCustomerPermissionChecker(): SspAssetCustomerPermissionCheckerInterface |
716
|
|
|
{ |
717
|
|
|
return new SspAssetCustomerPermissionChecker(); |
718
|
|
|
} |
719
|
|
|
|
720
|
|
|
/** |
721
|
|
|
* @param array<mixed> $options |
722
|
|
|
* |
723
|
|
|
* @return \Symfony\Component\Form\FormInterface |
724
|
|
|
*/ |
725
|
|
|
public function createSspAssetSearchForm(array $options): FormInterface |
726
|
|
|
{ |
727
|
|
|
return $this->getFormFactory()->create(SspAssetSearchForm::class, [], $options); |
728
|
|
|
} |
729
|
|
|
|
730
|
|
|
/** |
731
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Asset\Form\DataProvider\SspAssetSearchFormDataProvider |
732
|
|
|
*/ |
733
|
|
|
public function createSspAssetSearchFormDataProvider(): SspAssetSearchFormDataProvider |
734
|
|
|
{ |
735
|
|
|
return new SspAssetSearchFormDataProvider(); |
736
|
|
|
} |
737
|
|
|
|
738
|
|
|
/** |
739
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Asset\Handler\SspAssetSearchFormHandlerInterface |
740
|
|
|
*/ |
741
|
|
|
public function createSspAssetSearchFormHandler(): SspAssetSearchFormHandlerInterface |
742
|
|
|
{ |
743
|
|
|
return new SspAssetSearchFormHandler(); |
744
|
|
|
} |
745
|
|
|
|
746
|
|
|
/** |
747
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Asset\Reader\SspAssetReaderInterface |
748
|
|
|
*/ |
749
|
|
|
public function createSspAssetReader(): SspAssetReaderInterface |
750
|
|
|
{ |
751
|
|
|
return new SspAssetReader( |
752
|
|
|
$this->getClient(), |
753
|
|
|
$this->getConfig(), |
754
|
|
|
); |
755
|
|
|
} |
756
|
|
|
|
757
|
|
|
/** |
758
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Asset\Expander\SspAssetExpanderInterface |
759
|
|
|
*/ |
760
|
|
|
public function createSspAssetExpander(): SspAssetExpanderInterface |
761
|
|
|
{ |
762
|
|
|
return new SspAssetExpander(); |
763
|
|
|
} |
764
|
|
|
|
765
|
|
|
/** |
766
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Inquiry\Handler\SspInquiryRestrictionHandlerInterface |
767
|
|
|
*/ |
768
|
|
|
public function createSspInquiryRestrictionHandler(): SspInquiryRestrictionHandlerInterface |
769
|
|
|
{ |
770
|
|
|
return new SspInquiryRestrictionHandler( |
771
|
|
|
$this->getCustomerClient(), |
772
|
|
|
$this->getRouter(), |
773
|
|
|
); |
774
|
|
|
} |
775
|
|
|
|
776
|
|
|
/** |
777
|
|
|
* @return \SprykerFeature\Yves\SelfServicePortal\Dashboard\Handler\SspDashboardRestrictionHandlerInterface |
778
|
|
|
*/ |
779
|
|
|
public function createSspDashboardRestrictionHandler(): SspDashboardRestrictionHandlerInterface |
780
|
|
|
{ |
781
|
|
|
return new SspDashboardRestrictionHandler( |
782
|
|
|
$this->getCustomerClient(), |
783
|
|
|
$this->getRouter(), |
784
|
|
|
); |
785
|
|
|
} |
786
|
|
|
} |
787
|
|
|
|