@@ -6,6 +6,7 @@ use Doctrine\ORM\QueryBuilder; | |||
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; | |||
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection; | |||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | |||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface; | |||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | |||
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory; | |||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||
@@ -47,6 +48,11 @@ trait AdminControllerTrait | |||
$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)) { | |||
$queryBuilder->andWhere('entity.section = :section'); | |||
$queryBuilder->setParameter('section', $this->get('section_resolver')->getCurrent()); |
@@ -36,7 +36,7 @@ abstract class MerchantAdminController extends AbstractAdminController | |||
FormField::addPanel('address'), | |||
AddressField::new('address') | |||
->setRequired(true), | |||
], | |||
$panel | |||
); |
@@ -0,0 +1,37 @@ | |||
<?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 | |||
); | |||
} | |||
} |
@@ -2,7 +2,6 @@ | |||
namespace Lc\CaracoleBundle\Controller\Section; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; |
@@ -2,8 +2,8 @@ | |||
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; | |||
/** | |||
@@ -12,10 +12,12 @@ use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | |||
* @method PointSaleInterface[] findAll() | |||
* @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; | |||
} | |||
} |
@@ -1,5 +1,6 @@ | |||
menu: | |||
pointsale: Points de vente | |||
setting: Paramètres | |||
setting_merchant: Marchand | |||
setting_section: Section | |||
@@ -34,6 +35,12 @@ entity: | |||
address: Adresse | |||
merchant: Marchand | |||
taxRate: Règle de taxe | |||
PointSale: | |||
label: Point de vente | |||
label_plurial: Points de vente | |||
fields: | |||
orderAmountMin: Montant minimum de commande | |||
Address: | |||
fields: | |||
type: Type |