|
- <?php
-
- namespace Lc\CaracoleBundle\Controller\Section;
-
- use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
- use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TimeField;
- use Lc\CaracoleBundle\Controller\AdminControllerTrait;
- use Lc\SovBundle\Controller\AbstractAdminController;
-
- abstract class OpeningAdminController extends AbstractAdminController
- {
- use AdminControllerTrait;
-
- public function configureFields(string $pageName): iterable
- {
- $fields = parent::configureFields($pageName);
-
- return array_merge(
- [
- ChoiceField::new('day')
- ->setRequired(true)
- ->setChoices(
- [
- 'Lundi' => 1,
- 'Mardi' => 2,
- 'Mercredi' => 3,
- 'Jeudi' => 4,
- 'Vendredi' => 5,
- 'Samedi' => 6,
- 'Dimanche' => 7,
- ]
- ),
- TimeField::new('timeStart')
- ->setRequired(false)
- ->setFormat('H:mm'),
- TimeField::new('timeEnd')
- ->setRequired(false)
- ->setFormat('H:mm'),
- AssociationField::new('groupUser'),
- ],
- $fields
- );
- }
-
- public function configureCrud(Crud $crud): Crud
- {
- $crud = parent::configureCrud($crud);
-
- $crud->setDefaultSort(['day' => 'ASC']);
-
- return $crud;
- }
-
- }
|