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.

50 lines
1.9KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Product;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  7. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  8. use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
  9. use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer;
  10. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  11. use Lc\SovBundle\Controller\AbstractAdminController;
  12. use Lc\SovBundle\Field\CKEditorField;
  13. use Lc\SovBundle\Field\StatusField;
  14. use Lc\SovBundle\Field\ToggleField;
  15. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  16. abstract class ProductCategoryAdminController extends AbstractAdminController
  17. {
  18. use AdminControllerTrait;
  19. public function getRepositoryQuery() :RepositoryQueryInterface
  20. {
  21. return $this->get(ProductCategoryContainer::class)->getRepositoryQuery();
  22. }
  23. public function configureFields(string $pageName): iterable
  24. {
  25. return array_merge(
  26. [
  27. FormField::addPanel('general'),
  28. IntegerField::new('id')->onlyOnIndex()->setSortable(true),
  29. TextField::new('title')->setSortable(true),
  30. NumberField::new('position')->hideOnForm()->setSortable(true),
  31. AssociationField::new('parent')->hideOnIndex(),
  32. DateTimeField::new('createdAt')->setFormat('short')->setSortable(true),
  33. CKEditorField::new('description')->hideOnIndex(),
  34. StatusField::new('status')->setSortable(true),
  35. ToggleField::new('saleStatus')->setSortable(true),
  36. ToggleField::new('isEligibleTicketRestaurant')->setSortable(true),
  37. ],
  38. $this->getSeoPanel(),
  39. $this->getConfPanel()
  40. );
  41. }
  42. }