You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserMerchantFieldDefinition.php 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace Lc\CaracoleBundle\Definition\Field\User;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  6. use Lc\CaracoleBundle\Context\MerchantContextTrait;
  7. use Lc\CaracoleBundle\Field\AssociationField;
  8. use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
  9. class UserMerchantFieldDefinition extends AbstractFieldDefinition
  10. {
  11. use MerchantContextTrait;
  12. public function configureIndex(): array
  13. {
  14. return [
  15. 'id',
  16. 'lastname',
  17. 'firstname',
  18. 'email',
  19. 'credit',
  20. ];
  21. }
  22. public function configureForm(): array
  23. {
  24. return [
  25. 'user',
  26. ];
  27. }
  28. public function configureFields(): array
  29. {
  30. return [
  31. 'id'=> IntegerField::new('id')->onlyOnIndex()->setSortable(true),
  32. 'lastname'=> TextField::new('user.lastname')->setSortable(true),
  33. 'firstname'=> TextField::new('user.firstname')->setSortable(true),
  34. 'email'=> TextField::new('user.email')->setSortable(true),
  35. 'credit'=> NumberField::new('credit')->setSortable(true)
  36. ->setTemplatePath('@LcSov/adminlte/crud/field/amount.html.twig')
  37. ->setCustomOption('appendHtml', '&euro;'),
  38. 'user'=> AssociationField::new('user'),
  39. ];
  40. }
  41. }