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.

41 lines
1.2KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Common;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  7. use Lc\ShopBundle\Context\TaxRateInterface;
  8. use Lc\SovBundle\Controller\Admin\AbstractCrudController;
  9. class TaxRateCrudController extends AbstractCrudController
  10. {
  11. public static function getEntityFqcn(): string
  12. {
  13. return TaxRateInterface::class;
  14. }
  15. public function configureCrud(Crud $crud): Crud
  16. {
  17. return $crud->setSearchFields(['id', 'title', 'value']);
  18. }
  19. public function configureFields(string $pageName): iterable
  20. {
  21. $id = IntegerField::new('id', 'ID');
  22. $title = TextField::new('title');
  23. $value = NumberField::new('value');
  24. if (Crud::PAGE_INDEX === $pageName) {
  25. return [$id, $title, $value];
  26. } elseif (Crud::PAGE_DETAIL === $pageName) {
  27. return [$id, $title, $value];
  28. } elseif (Crud::PAGE_NEW === $pageName) {
  29. return [$title, $value];
  30. } elseif (Crud::PAGE_EDIT === $pageName) {
  31. return [$title, $value];
  32. }
  33. }
  34. }