|
- <?php
-
- namespace Lc\SovBundle\Definition\Field\Ticket;
-
-
- use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
- use Lc\SovBundle\Field\Filter\Ticket\EmailTicketFilter;
- use Lc\SovBundle\Field\Filter\Ticket\FirstnameTicketFilter;
- use Lc\SovBundle\Field\Filter\Ticket\LastnameTicketFilter;
- use Lc\SovBundle\Solver\Ticket\TicketSolver;
-
- class TicketFieldDefinition extends AbstractFieldDefinition
- {
-
- public function configureIndex(): array
- {
- return [
- 'id',
- 'createdAt',
- 'visitorFirstname',
- 'visitorLastname',
- 'visitorEmail',
- 'subject',
- 'updatedAt',
- 'type',
- 'status'
- ];
- }
-
- public function configureForm(): array
- {
- return [
- 'user',
- 'subject'
- ];
- }
-
- public function configurePanels(): array
- {
- return [];
- }
-
- public function configureFields(): array
- {
- return [
- 'id' => IdField::new('id')
- ->setSortable(true)
- ->hideOnForm(),
- 'createdAt' => DateTimeField::new('createdAt')
- ->setSortable(true)
- ->hideOnForm(),
- 'visitorFirstname' => TextField::new('visitorFirstname')
- ->setTemplatePath('@LcSov/admin/ticket/field/firstname.html.twig')
- ->setCustomOption('filter_fqcn', FirstnameTicketFilter::class)
- ->setSortable(true)
- ->hideOnForm(),
- 'visitorLastname' => TextField::new('visitorLastname')
- ->setTemplatePath('@LcSov/admin/ticket/field/lastname.html.twig')
- ->setCustomOption('filter_fqcn', LastnameTicketFilter::class)
- ->setSortable(true)
- ->hideOnForm(),
- 'visitorEmail' => TextField::new('visitorEmail')
- ->setTemplatePath('@LcSov/admin/ticket/field/email.html.twig')
- ->setCustomOption('filter_fqcn', EmailTicketFilter::class)
- ->setSortable(true)
- ->hideOnForm(),
- 'user' => AssociationField::new('user')
- ->hideOnIndex(),
- 'subject' => TextField::new('subject')
- ->setSortable(true),
- 'updatedAt' => DateTimeField::new('updatedAt')
- ->setTemplatePath('@LcSov/admin/ticket/field/lastmessage.html.twig')
- ->setSortable(true)
- ->hideOnForm(),
- 'type' => ChoiceField::new('type')
- ->autocomplete()
- ->setSortable(true)
- ->setChoices(
- $this->translatorAdmin->transChoices(
- TicketSolver::getTypeChoices(),
- 'Ticket',
- 'type'
- )
- ),
- 'status' => ChoiceField::new('status')
- ->autocomplete()
- ->setSortable(true)
- ->setChoices(
- $this->translatorAdmin->transChoices(
- TicketSolver::getStatusChoices(),
- 'Ticket',
- 'status'
- )
-
- )
- ->setTemplatePath('@LcSov/admin/ticket/field/status.html.twig')
- ->hideOnForm(),
- ];
- }
-
- }
|