|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ProjetNormandie\ComptaBundle\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use Sonata\AdminBundle\Admin\AbstractAdmin; |
|
6
|
|
|
use Sonata\AdminBundle\Route\RouteCollectionInterface; |
|
7
|
|
|
use Sonata\AdminBundle\Show\ShowMapper; |
|
8
|
|
|
use Sonata\AdminBundle\Form\FormMapper; |
|
9
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper; |
|
10
|
|
|
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
|
11
|
|
|
use Sonata\AdminBundle\Route\RouteCollection; |
|
12
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Administration manager for the Compta Bundle. |
|
16
|
|
|
*/ |
|
17
|
|
|
class ComptaAdmin extends AbstractAdmin |
|
18
|
|
|
{ |
|
19
|
|
|
protected $baseRouteName = 'pncomptabundle_admin_compta'; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @param RouteCollection $collection |
|
23
|
|
|
*/ |
|
24
|
|
|
protected function configureRoutes(RouteCollectionInterface $collection): void |
|
25
|
|
|
{ |
|
26
|
|
|
$collection |
|
27
|
|
|
->remove('show') |
|
28
|
|
|
->remove('export') |
|
29
|
|
|
->remove('delete'); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param FormMapper $form |
|
34
|
|
|
*/ |
|
35
|
|
|
protected function configureFormFields(FormMapper $form): void |
|
36
|
|
|
{ |
|
37
|
|
|
$form |
|
38
|
|
|
->add('id', TextType::class, ['label' => 'label.id', 'attr' => ['readonly' => true]]) |
|
39
|
|
|
->add('month', TextType::class, ['label' => 'label.month']) |
|
40
|
|
|
->add('source', null, ['label' => 'label.source']) |
|
41
|
|
|
->add('type', null, ['label' => 'label.type']) |
|
42
|
|
|
->add('value', null, ['label' => 'label.value']); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param DatagridMapper $filter |
|
47
|
|
|
*/ |
|
48
|
|
|
protected function configureDatagridFilters(DatagridMapper $filter): void |
|
49
|
|
|
{ |
|
50
|
|
|
$filter |
|
51
|
|
|
->add('source', null, ['label' => 'label.source']) |
|
52
|
|
|
->add('type', null, ['label' => 'label.type']) |
|
53
|
|
|
->add('month', null, ['label' => 'label.month']); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param ListMapper $list |
|
58
|
|
|
*/ |
|
59
|
|
|
protected function configureListFields(ListMapper $list): void |
|
60
|
|
|
{ |
|
61
|
|
|
$list->addIdentifier('id', null, ['label' => 'label.id']) |
|
62
|
|
|
->add('month', null, ['label' => 'label.month']) |
|
63
|
|
|
->add('source', null, ['label' => 'label.source']) |
|
64
|
|
|
->add('type', null, ['label' => 'label.type']) |
|
65
|
|
|
->add('value', null, ['label' => 'label.value']) |
|
66
|
|
|
->add('_action', 'actions', [ |
|
67
|
|
|
'actions' => [ |
|
68
|
|
|
'show' => [], |
|
69
|
|
|
'edit' => [], |
|
70
|
|
|
] |
|
71
|
|
|
]); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @param ShowMapper $show |
|
76
|
|
|
*/ |
|
77
|
|
|
protected function configureShowFields(ShowMapper $show): void |
|
78
|
|
|
{ |
|
79
|
|
|
$show |
|
80
|
|
|
->add('id', null, ['label' => 'label.id']) |
|
81
|
|
|
->add('month', null, ['label' => 'label.month']) |
|
82
|
|
|
->add('source', null, ['label' => 'label.source']) |
|
83
|
|
|
->add('type', null, ['label' => 'label.type']); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|