|
- <?php
-
- namespace Lc\CaracoleBundle\Controller\PointSale;
-
- use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\MoneyField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer;
- use Lc\CaracoleBundle\Controller\AdminControllerTrait;
- use Lc\CaracoleBundle\Factory\PointSale\PointSaleFactory;
- use Lc\CaracoleBundle\Field\Address\AddressField;
- use Lc\CaracoleBundle\Resolver\MerchantResolver;
- use Lc\SovBundle\Controller\AbstractAdminController;
- use Lc\SovBundle\Field\BooleanField;
- use Lc\SovBundle\Field\StatusField;
- use Lc\SovBundle\Field\ToggleField;
-
- abstract class PointSaleAdminController extends AbstractAdminController
- {
- use AdminControllerTrait;
-
- public function configureFields(string $pageName): iterable
- {
- return array_merge(
- [
- FormField::addPanel('general'),
- IntegerField::new('id')->onlyOnIndex()->setSortable(true),
- TextField::new('title')->setSortable(true),
- MoneyField::new('orderAmountMin')->setCurrency('EUR')->setSortable(true),
- NumberField::new('deliveryPrice')
- ->setCustomOption('appendHtml', '€')
- ->hideOnIndex(),
- StatusField::new('status')->setSortable(true),
- ToggleField::new('isPublic')->setSortable(true),
- ToggleField::new('isDepository')->setSortable(true),
- FormField::addPanel('address'),
- AddressField::new('address')
- ->setRequired(true)
- ],
- $this->getSeoPanel(),
- $this->getConfPanel(),
- );
- }
-
- public function createEntity(string $entityFqcn)
- {
- return $this->get(PointSaleContainer::class)
- ->getFactory()
- ->create($this->get(MerchantResolver::class)->getCurrent());
- }
- }
|