use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; | use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection; | use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | ||||
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory; | use Lc\CaracoleBundle\Factory\User\UserMerchantFactory; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | use Lc\CaracoleBundle\Resolver\MerchantResolver; | ||||
$queryBuilder->setParameter('merchant', $this->get('merchant_resolver')->getCurrent()); | $queryBuilder->setParameter('merchant', $this->get('merchant_resolver')->getCurrent()); | ||||
} | } | ||||
if ($this->isInstanceOf(FilterMultipleMerchantsInterface::class)) { | |||||
$queryBuilder->andWhere(':merchant MEMBER OF entity.merchants'); | |||||
$queryBuilder->setParameter('merchant', $this->get('merchant_resolver')->getCurrent()); | |||||
} | |||||
if ($this->isInstanceOf(FilterSectionInterface::class)) { | if ($this->isInstanceOf(FilterSectionInterface::class)) { | ||||
$queryBuilder->andWhere('entity.section = :section'); | $queryBuilder->andWhere('entity.section = :section'); | ||||
$queryBuilder->setParameter('section', $this->get('section_resolver')->getCurrent()); | $queryBuilder->setParameter('section', $this->get('section_resolver')->getCurrent()); |
FormField::addPanel('address'), | FormField::addPanel('address'), | ||||
AddressField::new('address') | AddressField::new('address') | ||||
->setRequired(true), | |||||
], | ], | ||||
$panel | $panel | ||||
); | ); |
<?php | |||||
namespace Lc\CaracoleBundle\Controller\PointSale; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | |||||
use Lc\CaracoleBundle\Field\Address\AddressField; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | |||||
use Lc\SovBundle\Field\StatusField; | |||||
abstract class PointSaleAdminController extends AbstractAdminController | |||||
{ | |||||
use AdminControllerTrait; | |||||
public function configureFields(string $pageName): iterable | |||||
{ | |||||
$panel = parent::configureFields($pageName); | |||||
return array_merge( | |||||
[ | |||||
FormField::addPanel('general'), | |||||
TextField::new('title'), | |||||
NumberField::new('orderAmountMin') | |||||
->setCustomOption('appendHtml','€') | |||||
->hideOnIndex(), | |||||
StatusField::new('status'), | |||||
FormField::addPanel('address'), | |||||
AddressField::new('address') | |||||
->setRequired(true) | |||||
], | |||||
$panel | |||||
); | |||||
} | |||||
} |
namespace Lc\CaracoleBundle\Controller\Section; | namespace Lc\CaracoleBundle\Controller\Section; | ||||
use Doctrine\ORM\EntityManagerInterface; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; |
namespace Lc\CaracoleBundle\Repository\PointSale; | namespace Lc\CaracoleBundle\Repository\PointSale; | ||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | |||||
use Doctrine\Persistence\ManagerRegistry; | |||||
use Lc\CaracoleBundle\Repository\RepositoryTrait; | |||||
use Lc\SovBundle\Repository\AbstractRepository; | |||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | ||||
/** | /** | ||||
* @method PointSaleInterface[] findAll() | * @method PointSaleInterface[] findAll() | ||||
* @method PointSaleInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | * @method PointSaleInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | ||||
*/ | */ | ||||
class PointSaleRepository extends ServiceEntityRepository | |||||
class PointSaleRepository extends AbstractRepository | |||||
{ | { | ||||
public function __construct(ManagerRegistry $registry) | |||||
use RepositoryTrait; | |||||
public function getInterfaceClass() | |||||
{ | { | ||||
parent::__construct($registry, PointSaleInterface::class); | |||||
return PointSaleInterface::class; | |||||
} | } | ||||
} | } |
menu: | menu: | ||||
pointsale: Points de vente | |||||
setting: Paramètres | setting: Paramètres | ||||
setting_merchant: Marchand | setting_merchant: Marchand | ||||
setting_section: Section | setting_section: Section | ||||
address: Adresse | address: Adresse | ||||
merchant: Marchand | merchant: Marchand | ||||
taxRate: Règle de taxe | taxRate: Règle de taxe | ||||
PointSale: | |||||
label: Point de vente | |||||
label_plurial: Points de vente | |||||
fields: | |||||
orderAmountMin: Montant minimum de commande | |||||
Address: | Address: | ||||
fields: | fields: | ||||
type: Type | type: Type |