1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Controller\Admin; |
4
|
|
|
|
5
|
|
|
use App\Entity\BankAccount; |
6
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Action; |
7
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions; |
8
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; |
9
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; |
10
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; |
11
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; |
12
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; |
13
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; |
14
|
|
|
|
15
|
|
|
class BankAccountCrudController extends AbstractCrudController |
16
|
|
|
{ |
17
|
|
|
public static function getEntityFqcn(): string |
18
|
|
|
{ |
19
|
|
|
return BankAccount::class; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function configureCrud(Crud $crud): Crud |
23
|
|
|
{ |
24
|
|
|
return $crud |
25
|
|
|
->setEntityLabelInSingular('bank_account.label') |
26
|
|
|
->setSearchFields(['name', 'iban', 'bic', 'comment', 'account_name']) |
27
|
|
|
->setEntityLabelInPlural('bank_account.labelp'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function configureActions(Actions $actions): Actions |
31
|
|
|
{ |
32
|
|
|
$actions->setPermissions([ |
33
|
|
|
Action::EDIT => 'ROLE_EDIT_BANK_ACCOUNTS', |
34
|
|
|
Action::DELETE => 'ROLE_EDIT_BANK_ACCOUNTS', |
35
|
|
|
Action::NEW => 'ROLE_EDIT_BANK_ACCOUNTS', |
36
|
|
|
Action::INDEX => 'ROLE_READ_BANK_ACCOUNTS', |
37
|
|
|
Action::DETAIL => 'ROLE_READ_BANK_ACCOUNTS', |
38
|
|
|
]); |
39
|
|
|
|
40
|
|
|
return $actions->add(Crud::PAGE_INDEX, Action::DETAIL); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function configureFields(string $pageName): iterable |
44
|
|
|
{ |
45
|
|
|
return [ |
46
|
|
|
IdField::new('id', 'bank_account.id.label')->hideOnForm(), |
47
|
|
|
TextField::new('name', 'bank_account.name.label'), |
48
|
|
|
TextField::new('iban', 'bank_account.iban.label'), |
49
|
|
|
TextField::new('bic', 'bank_account.bic.label'), |
50
|
|
|
TextField::new('account_name', 'bank_account.account_name.label') |
51
|
|
|
->setRequired(false) |
52
|
|
|
->setFormTypeOption('empty_data', '') |
53
|
|
|
->setHelp('bank_account.account_name.help'), |
54
|
|
|
|
55
|
|
|
DateTimeField::new('last_modified', 'last_modified')->onlyOnDetail(), |
56
|
|
|
DateTimeField::new('creation_date', 'creation_date')->onlyOnDetail(), |
57
|
|
|
|
58
|
|
|
TextEditorField::new('comment', 'bank_account.comment.label') |
59
|
|
|
->setRequired(false) |
60
|
|
|
->setFormTypeOption('empty_data', '') |
61
|
|
|
->hideOnIndex(), |
62
|
|
|
]; |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|