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.

54 lines
2.0KB

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