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.

47 lines
1.6KB

  1. <?php
  2. namespace Lc\SovBundle\Controller\Ticket;
  3. use App\Entity\Ticket\Ticket;
  4. use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
  7. use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
  8. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  9. use Lc\SovBundle\Field\StatusField;
  10. use Lc\SovBundle\Model\Ticket\TicketInterface;
  11. use Lc\SovBundle\Controller\AbstractAdminController;
  12. abstract class TicketAdminController extends AbstractAdminController
  13. {
  14. public static function getEntityFqcn(): string
  15. {
  16. return TicketInterface::class;
  17. }
  18. public function configureFields(string $pageName): iterable
  19. {
  20. return [
  21. TextField::new('id')->hideOnForm(),
  22. DateField::new('createdAt')->setFormat('short')->hideOnForm(),
  23. TextField::new('visitorFirstName')->hideOnForm(),
  24. TextField::new('visitorLastName')->hideOnForm(),
  25. TextField::new('visitorEmail')->hideOnForm(),
  26. AssociationField::new('user')
  27. ->hideOnIndex(),
  28. TextField::new('subject'),
  29. ChoiceField::new('type')
  30. ->autocomplete()
  31. ->setChoices(
  32. [
  33. 'entity.Ticket.fields.typeOptions.' . Ticket::TYPE_GENERAL_QUESTION => Ticket::TYPE_GENERAL_QUESTION,
  34. 'entity.Ticket.fields.typeOptions.' . Ticket::TYPE_TECHNICAL_PROBLEM => Ticket::TYPE_TECHNICAL_PROBLEM,
  35. ]
  36. ),
  37. StatusField::new('status')->setRequired(false)->hideOnForm(),
  38. ];
  39. }
  40. }