Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

52 lines
1.9KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\PointSale;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  6. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  7. use Lc\CaracoleBundle\Factory\PointSale\PointSaleFactory;
  8. use Lc\CaracoleBundle\Field\Address\AddressField;
  9. use Lc\SovBundle\Controller\AbstractAdminController;
  10. use Lc\SovBundle\Field\BooleanField;
  11. use Lc\SovBundle\Field\StatusField;
  12. abstract class PointSaleAdminController extends AbstractAdminController
  13. {
  14. use AdminControllerTrait;
  15. public function configureFields(string $pageName): iterable
  16. {
  17. return array_merge(
  18. [
  19. FormField::addPanel('general'),
  20. TextField::new('title'),
  21. NumberField::new('orderAmountMin')
  22. ->setCustomOption('appendHtml','€')
  23. ->hideOnIndex(),
  24. NumberField::new('deliveryPrice')
  25. ->setCustomOption('appendHtml','€')
  26. ->hideOnIndex(),
  27. BooleanField::new('isPublic'),
  28. BooleanField::new('isDepository'),
  29. StatusField::new('status')
  30. ->hideOnIndex(),
  31. FormField::addPanel('address'),
  32. AddressField::new('address')
  33. ->setRequired(true)
  34. ],
  35. $this->getSeoPanel(),
  36. $this->getConfPanel(),
  37. );
  38. }
  39. public function createEntity(string $entityFqcn)
  40. {
  41. $factory = new PointSaleFactory();
  42. $currentMerchant = $this->get('merchant_resolver')->getCurrent();
  43. return $factory->create($currentMerchant);
  44. }
  45. }