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.

57 lines
1.9KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Section;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\TimeField;
  7. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  8. use Lc\SovBundle\Controller\AbstractAdminController;
  9. abstract class OpeningAdminController extends AbstractAdminController
  10. {
  11. use AdminControllerTrait;
  12. public function configureFields(string $pageName): iterable
  13. {
  14. $fields = parent::configureFields($pageName);
  15. return array_merge(
  16. [
  17. ChoiceField::new('day')
  18. ->setRequired(true)
  19. ->setChoices(
  20. [
  21. 'Lundi' => 1,
  22. 'Mardi' => 2,
  23. 'Mercredi' => 3,
  24. 'Jeudi' => 4,
  25. 'Vendredi' => 5,
  26. 'Samedi' => 6,
  27. 'Dimanche' => 7,
  28. ]
  29. ),
  30. TimeField::new('timeStart')
  31. ->setRequired(false)
  32. ->setFormat('H:mm'),
  33. TimeField::new('timeEnd')
  34. ->setRequired(false)
  35. ->setFormat('H:mm'),
  36. AssociationField::new('groupUser'),
  37. ],
  38. $fields
  39. );
  40. }
  41. public function configureCrud(Crud $crud): Crud
  42. {
  43. $crud = parent::configureCrud($crud);
  44. $crud->setDefaultSort(['day' => 'ASC']);
  45. return $crud;
  46. }
  47. }