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 satır
2.0KB

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