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.

пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Section;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  4. use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
  7. use EasyCorp\Bundle\EasyAdminBundle\Field\TimeField;
  8. use Lc\CaracoleBundle\Container\Section\OpeningContainer;
  9. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  10. use Lc\CaracoleBundle\Factory\Section\OpeningFactory;
  11. use Lc\CaracoleBundle\Resolver\SectionResolver;
  12. use Lc\SovBundle\Controller\AbstractAdminController;
  13. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  14. abstract class OpeningAdminController extends AbstractAdminController
  15. {
  16. use AdminControllerTrait;
  17. public function createEntity(string $entityFqcn)
  18. {
  19. return $this->getOpeningContainer()
  20. ->getFactory()
  21. ->create($this->getSectionCurrent());
  22. }
  23. public function getRepositoryQuery() :RepositoryQueryInterface
  24. {
  25. return $this->get(OpeningContainer::class)->getRepositoryQuery();
  26. }
  27. public function configureCrud(Crud $crud): Crud
  28. {
  29. $crud = parent::configureCrud($crud);
  30. $crud->setDefaultSort(['day' => 'ASC']);
  31. return $crud;
  32. }
  33. public function configureFields(string $pageName): iterable
  34. {
  35. return [
  36. ChoiceField::new('day')
  37. ->setRequired(true)
  38. ->setChoices(
  39. [
  40. 'Lundi' => 1,
  41. 'Mardi' => 2,
  42. 'Mercredi' => 3,
  43. 'Jeudi' => 4,
  44. 'Vendredi' => 5,
  45. 'Samedi' => 6,
  46. 'Dimanche' => 7,
  47. ]
  48. ),
  49. TimeField::new('timeStart')
  50. ->setRequired(false)
  51. ->setFormat('H:mm'),
  52. TimeField::new('timeEnd')
  53. ->setRequired(false)
  54. ->setFormat('H:mm'),
  55. AssociationField::new('groupUser'),
  56. ];
  57. }
  58. public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
  59. {
  60. $responseParameters = parent::configureResponseParameters($responseParameters);
  61. $this->configureResponseParametersFilterSection($responseParameters);
  62. $this->configureResponseParametersDisableShowAllSections($responseParameters);
  63. return $responseParameters;
  64. }
  65. }