Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

46 lines
1.6KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Ticket;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
  4. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  5. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  6. use Lc\CaracoleBundle\Definition\ActionDefinition;
  7. use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController;
  8. abstract class TicketAdminController extends SovTicketAdminController
  9. {
  10. use AdminControllerTrait;
  11. public function createEntity(string $entityFqcn)
  12. {
  13. return $this->getTicketContainer()
  14. ->getFactory()
  15. ->setSection($this->getSectionCurrent())
  16. ->setMerchant($this->getMerchantCurrent())
  17. ->create();
  18. }
  19. public function configureFields(string $pageName): iterable
  20. {
  21. return $this->getTicketContainer()->getFieldDefinition()
  22. ->setMerchant($this->getMerchantCurrent())
  23. ->setSection($this->getSectionCurrent())
  24. ->getFields($pageName);
  25. }
  26. public function configureActions(Actions $actions): Actions
  27. {
  28. $actions = parent::configureActions($actions);
  29. if(!$this->getSectionCurrent()) {
  30. $actions->disable(ActionDefinition::NEW, ActionDefinition::EDIT, ActionDefinition::DUPLICATE,ActionDefinition::DUPLICATE_TO_OTHER_SECTION, ActionDefinition::DELETE);
  31. }else{
  32. $actions->disable( ActionDefinition::EDIT, ActionDefinition::DUPLICATE,ActionDefinition::DUPLICATE_TO_OTHER_SECTION, ActionDefinition::DELETE);
  33. }
  34. return $actions;
  35. }
  36. }