|
- <?php
-
- namespace Lc\CaracoleBundle\Definition\Field\User;
-
- use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\CaracoleBundle\Context\MerchantContextTrait;
- use Lc\CaracoleBundle\Field\AssociationField;
- use Lc\CaracoleBundle\Field\Filter\User\UserMerchantEmailFilter;
- use Lc\CaracoleBundle\Field\Filter\User\UserMerchantFirstnameFilter;
- use Lc\CaracoleBundle\Field\Filter\User\UserMerchantLastnameFilter;
- use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
-
-
- class UserMerchantFieldDefinition extends AbstractFieldDefinition
- {
- use MerchantContextTrait;
-
- public function configureIndex(): array
- {
- return [
- 'id',
- 'lastname',
- 'firstname',
- 'email',
- 'credit',
- ];
- }
-
- public function configureForm(): array
- {
- return [
- 'user',
- ];
- }
-
- public function configureFields(): array
- {
- return [
- 'id' => IntegerField::new('id')->onlyOnIndex()->setSortable(true),
- 'lastname' => TextField::new('user.lastname')
- ->setCustomOption('filter_fqcn', UserMerchantLastnameFilter::class),
- 'firstname' => TextField::new('user.firstname')
- ->setCustomOption('filter_fqcn', UserMerchantFirstnameFilter::class),
- 'email' => TextField::new('user.email')
- ->setCustomOption('filter_fqcn', UserMerchantEmailFilter::class),
- 'credit' => NumberField::new('credit')->setSortable(true)
- ->setTemplatePath('@LcSov/adminlte/crud/field/amount.html.twig')
- ->setCustomOption('appendHtml', '€'),
- 'user' => AssociationField::new('user'),
-
- ];
- }
-
- }
|