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
|
|
|
namespace WellCommerce\Bundle\OrderBundle\DataGrid; |
13
|
|
|
|
14
|
|
|
use WellCommerce\Bundle\CoreBundle\DataGrid\AbstractDataGrid; |
15
|
|
|
use WellCommerce\Component\DataGrid\Column\Column; |
16
|
|
|
use WellCommerce\Component\DataGrid\Column\ColumnCollection; |
17
|
|
|
use WellCommerce\Component\DataGrid\Column\Options\Appearance; |
18
|
|
|
use WellCommerce\Component\DataGrid\Column\Options\Filter; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class OrderStatusDataGrid |
22
|
|
|
* |
23
|
|
|
* @author Adam Piotrowski <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
class OrderStatusDataGrid extends AbstractDataGrid |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* @var OrderStatusGroupFilter |
29
|
|
|
*/ |
30
|
|
|
protected $orderStatusGroupFilter; |
31
|
|
|
|
32
|
|
|
public function __construct(OrderStatusGroupFilter $orderStatusGroupFilter) |
33
|
|
|
{ |
34
|
|
|
$this->orderStatusGroupFilter = $orderStatusGroupFilter; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function configureColumns(ColumnCollection $collection) |
38
|
|
|
{ |
39
|
|
|
$collection->add(new Column([ |
40
|
|
|
'id' => 'id', |
41
|
|
|
'caption' => 'common.label.id', |
42
|
|
|
'appearance' => new Appearance([ |
43
|
|
|
'width' => 90, |
44
|
|
|
'visible' => false, |
45
|
|
|
]), |
46
|
|
|
'filter' => new Filter([ |
47
|
|
|
'type' => Filter::FILTER_BETWEEN, |
48
|
|
|
]), |
49
|
|
|
])); |
50
|
|
|
|
51
|
|
|
$collection->add(new Column([ |
52
|
|
|
'id' => 'name', |
53
|
|
|
'caption' => 'common.label.name', |
54
|
|
|
'appearance' => new Appearance([ |
55
|
|
|
'width' => 340, |
56
|
|
|
]), |
57
|
|
|
])); |
58
|
|
|
|
59
|
|
|
$collection->add(new Column([ |
60
|
|
|
'id' => 'groupName', |
61
|
|
|
'caption' => 'common.label.group', |
62
|
|
|
'filter' => new Filter([ |
63
|
|
|
'type' => Filter::FILTER_TREE, |
64
|
|
|
'filtered_column' => 'groupId', |
65
|
|
|
'options' => $this->orderStatusGroupFilter->getOptions(), |
66
|
|
|
]), |
67
|
|
|
'appearance' => new Appearance([ |
68
|
|
|
'width' => 140, |
69
|
|
|
'align' => Appearance::ALIGN_CENTER, |
70
|
|
|
]), |
71
|
|
|
])); |
72
|
|
|
|
73
|
|
|
$collection->add(new Column([ |
74
|
|
|
'id' => 'createdAt', |
75
|
|
|
'caption' => 'common.label.created_at', |
76
|
|
|
'filter' => new Filter([ |
77
|
|
|
'type' => Filter::FILTER_BETWEEN, |
78
|
|
|
]), |
79
|
|
|
'appearance' => new Appearance([ |
80
|
|
|
'width' => 40, |
81
|
|
|
'align' => Appearance::ALIGN_CENTER, |
82
|
|
|
]), |
83
|
|
|
])); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function getIdentifier(): string |
87
|
|
|
{ |
88
|
|
|
return 'order_status'; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|