您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

PointSaleAdminController.php 2.0KB

3 年前
3 年前
3 年前
3 年前
3 年前
3 年前
3 年前
3 年前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. }