1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* WellCommerce Open-Source E-Commerce Platform |
4
|
|
|
* |
5
|
|
|
* This file is part of the WellCommerce package. |
6
|
|
|
* |
7
|
|
|
* (c) Adam Piotrowski <[email protected]> |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, |
10
|
|
|
* please view the LICENSE file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace WellCommerce\Bundle\CatalogBundle\DataGrid; |
14
|
|
|
|
15
|
|
|
use WellCommerce\Bundle\CoreBundle\DataGrid\AbstractDataGrid; |
16
|
|
|
use WellCommerce\Component\DataGrid\Column\Column; |
17
|
|
|
use WellCommerce\Component\DataGrid\Column\ColumnCollection; |
18
|
|
|
use WellCommerce\Component\DataGrid\Column\Options\Appearance; |
19
|
|
|
use WellCommerce\Component\DataGrid\Column\Options\Filter; |
20
|
|
|
use WellCommerce\Component\DataGrid\Column\Options\Sorting; |
21
|
|
|
use WellCommerce\Component\DataGrid\Configuration\EventHandler\UpdateRowEventHandler; |
22
|
|
|
use WellCommerce\Component\DataGrid\Options\OptionsInterface; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Class ProducerDataGrid |
26
|
|
|
* |
27
|
|
|
* @author Adam Piotrowski <[email protected]> |
28
|
|
|
*/ |
29
|
|
|
class ProducerDataGrid extends AbstractDataGrid |
30
|
|
|
{ |
31
|
|
|
public function configureColumns(ColumnCollection $collection) |
32
|
|
|
{ |
33
|
|
|
$collection->add(new Column([ |
34
|
|
|
'id' => 'id', |
35
|
|
|
'caption' => 'common.label.id', |
36
|
|
|
'sorting' => new Sorting([ |
37
|
|
|
'default_order' => Sorting::SORT_DIR_DESC, |
38
|
|
|
]), |
39
|
|
|
'appearance' => new Appearance([ |
40
|
|
|
'width' => 90, |
41
|
|
|
'visible' => false, |
42
|
|
|
]), |
43
|
|
|
'filter' => new Filter([ |
44
|
|
|
'type' => Filter::FILTER_BETWEEN, |
45
|
|
|
]), |
46
|
|
|
])); |
47
|
|
|
|
48
|
|
|
$collection->add(new Column([ |
49
|
|
|
'id' => 'name', |
50
|
|
|
'caption' => 'common.label.name', |
51
|
|
|
])); |
52
|
|
|
|
53
|
|
|
$collection->add(new Column([ |
54
|
|
|
'id' => 'hierarchy', |
55
|
|
|
'caption' => 'common.label.hierarchy', |
56
|
|
|
'editable' => true, |
57
|
|
|
'filter' => new Filter([ |
58
|
|
|
'type' => Filter::FILTER_BETWEEN, |
59
|
|
|
]), |
60
|
|
|
])); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function configureOptions(OptionsInterface $options) |
64
|
|
|
{ |
65
|
|
|
parent::configureOptions($options); |
66
|
|
|
|
67
|
|
|
$eventHandlers = $options->getEventHandlers(); |
68
|
|
|
|
69
|
|
|
$eventHandlers->add(new UpdateRowEventHandler([ |
70
|
|
|
'function' => $this->getJavascriptFunctionName('update'), |
71
|
|
|
'route' => $this->getActionUrl('update'), |
72
|
|
|
])); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function getIdentifier(): string |
76
|
|
|
{ |
77
|
|
|
return 'producer'; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|