|
- <?php
-
- namespace Lc\CaracoleBundle\Controller\Ticket;
-
- use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
- use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
- use Lc\CaracoleBundle\Controller\AdminControllerTrait;
- use Lc\CaracoleBundle\Definition\ActionDefinition;
- use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController;
-
- abstract class TicketAdminController extends SovTicketAdminController
- {
- use AdminControllerTrait;
-
- public function createEntity(string $entityFqcn)
- {
- return $this->getTicketContainer()
- ->getFactory()
- ->setSection($this->getSectionCurrent())
- ->setMerchant($this->getMerchantCurrent())
- ->create();
- }
-
- public function configureFields(string $pageName): iterable
- {
- return $this->getTicketContainer()->getFieldDefinition()
- ->setMerchant($this->getMerchantCurrent())
- ->setSection($this->getSectionCurrent())
- ->getFields($pageName);
- }
-
- public function configureActions(Actions $actions): Actions
- {
- $actions = parent::configureActions($actions);
-
- if(!$this->getSectionCurrent()) {
- $actions->disable(ActionDefinition::NEW, ActionDefinition::EDIT, ActionDefinition::DUPLICATE,ActionDefinition::DUPLICATE_TO_OTHER_SECTION, ActionDefinition::DELETE);
- }else{
- $actions->disable( ActionDefinition::EDIT, ActionDefinition::DUPLICATE,ActionDefinition::DUPLICATE_TO_OTHER_SECTION, ActionDefinition::DELETE);
- }
-
- return $actions;
- }
-
- }
|