use App\Resolver\OrderResolver; | use App\Resolver\OrderResolver; | ||||
use Lc\CaracoleBundle\Builder\Order\OrderShopBuilder; | use Lc\CaracoleBundle\Builder\Order\OrderShopBuilder; | ||||
use Lc\CaracoleBundle\Definition\Field\Order\OrderShopFieldDefinition; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderShopFactory; | use Lc\CaracoleBundle\Factory\Order\OrderShopFactory; | ||||
use Lc\CaracoleBundle\Repository\Order\OrderShopRepositoryQuery; | use Lc\CaracoleBundle\Repository\Order\OrderShopRepositoryQuery; | ||||
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | ||||
protected OrderShopBuilder $builder; | protected OrderShopBuilder $builder; | ||||
protected OrderResolver $resolver; | protected OrderResolver $resolver; | ||||
protected OrderShopTransformer $transformer; | protected OrderShopTransformer $transformer; | ||||
protected OrderShopFieldDefinition $fieldDefinition; | |||||
public function __construct( | public function __construct( | ||||
OrderShopFactory $factory, | OrderShopFactory $factory, | ||||
OrderShopStore $store, | OrderShopStore $store, | ||||
OrderResolver $resolver, | OrderResolver $resolver, | ||||
OrderShopBuilder $builder, | OrderShopBuilder $builder, | ||||
OrderShopTransformer $transformer | |||||
OrderShopTransformer $transformer, | |||||
OrderShopFieldDefinition $fieldDefinition | |||||
) { | ) { | ||||
$this->factory = $factory; | $this->factory = $factory; | ||||
$this->solver = $solver; | $this->solver = $solver; | ||||
$this->resolver = $resolver; | $this->resolver = $resolver; | ||||
$this->builder = $builder; | $this->builder = $builder; | ||||
$this->transformer = $transformer; | $this->transformer = $transformer; | ||||
$this->fieldDefinition = $fieldDefinition; | |||||
} | } | ||||
public function getFactory(): OrderShopFactory | public function getFactory(): OrderShopFactory | ||||
return $this->transformer; | return $this->transformer; | ||||
} | } | ||||
public function getFieldDefinition(): OrderShopFieldDefinition | |||||
{ | |||||
return $this->fieldDefinition; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Container\Product; | namespace Lc\CaracoleBundle\Container\Product; | ||||
use App\Definition\Field\Product\ProductFamilyFieldDefinition; | |||||
use Lc\CaracoleBundle\Builder\Product\ProductFamilyBuilder; | use Lc\CaracoleBundle\Builder\Product\ProductFamilyBuilder; | ||||
use Lc\CaracoleBundle\Factory\Product\ProductFamilyFactory; | use Lc\CaracoleBundle\Factory\Product\ProductFamilyFactory; | ||||
use Lc\CaracoleBundle\Repository\Product\ProductFamilyRepositoryQuery; | use Lc\CaracoleBundle\Repository\Product\ProductFamilyRepositoryQuery; | ||||
protected ProductFamilyStore $store; | protected ProductFamilyStore $store; | ||||
protected ProductFamilyBuilder $builder; | protected ProductFamilyBuilder $builder; | ||||
protected ProductFamilyResolver $resolver; | protected ProductFamilyResolver $resolver; | ||||
protected ProductFamilyFieldDefinition $fieldDefinition; | |||||
public function __construct( | public function __construct( | ||||
ProductFamilyFactory $factory, | ProductFamilyFactory $factory, | ||||
ProductFamilyRepositoryQuery $repositoryQuery, | ProductFamilyRepositoryQuery $repositoryQuery, | ||||
ProductFamilyStore $store, | ProductFamilyStore $store, | ||||
ProductFamilyBuilder $builder, | ProductFamilyBuilder $builder, | ||||
ProductFamilyResolver $resolver | |||||
ProductFamilyResolver $resolver, | |||||
ProductFamilyFieldDefinition $fieldDefinition | |||||
) { | ) { | ||||
$this->factory = $factory; | $this->factory = $factory; | ||||
$this->solver = $solver; | $this->solver = $solver; | ||||
$this->store = $store; | $this->store = $store; | ||||
$this->builder = $builder; | $this->builder = $builder; | ||||
$this->resolver = $resolver; | $this->resolver = $resolver; | ||||
$this->fieldDefinition = $fieldDefinition; | |||||
} | } | ||||
public function getFactory(): ProductFamilyFactory | public function getFactory(): ProductFamilyFactory | ||||
return $this->builder; | return $this->builder; | ||||
} | } | ||||
public function getFieldDefinition(): ProductFamilyFieldDefinition | |||||
{ | |||||
return $this->fieldDefinition; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Container\Reduction; | namespace Lc\CaracoleBundle\Container\Reduction; | ||||
use App\Definition\Field\Reduction\ReductionCreditFieldDefinition; | |||||
use Lc\CaracoleBundle\Factory\Reduction\ReductionCreditFactory; | use Lc\CaracoleBundle\Factory\Reduction\ReductionCreditFactory; | ||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditRepositoryQuery; | use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditRepositoryQuery; | ||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditStore; | use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditStore; | ||||
protected ReductionCreditFactory $factory; | protected ReductionCreditFactory $factory; | ||||
protected ReductionCreditRepositoryQuery $repositoryQuery; | protected ReductionCreditRepositoryQuery $repositoryQuery; | ||||
protected ReductionCreditStore $store; | protected ReductionCreditStore $store; | ||||
protected ReductionCreditFieldDefinition $fieldDefinition; | |||||
public function __construct( | public function __construct( | ||||
ReductionCreditFactory $factory, | ReductionCreditFactory $factory, | ||||
ReductionCreditRepositoryQuery $repositoryQuery, | ReductionCreditRepositoryQuery $repositoryQuery, | ||||
ReductionCreditStore $store | |||||
ReductionCreditStore $store, | |||||
ReductionCreditFieldDefinition $fieldDefinition | |||||
) { | ) { | ||||
$this->factory = $factory; | $this->factory = $factory; | ||||
$this->repositoryQuery = $repositoryQuery; | $this->repositoryQuery = $repositoryQuery; | ||||
$this->store = $store; | $this->store = $store; | ||||
$this->fieldDefinition = $fieldDefinition; | |||||
} | } | ||||
public function getFactory(): ReductionCreditFactory | public function getFactory(): ReductionCreditFactory | ||||
return $this->store; | return $this->store; | ||||
} | } | ||||
public function getFieldDefinition(): ReductionCreditFieldDefinition | |||||
{ | |||||
return $this->fieldDefinition; | |||||
} | |||||
} | } |
<?php | <?php | ||||
namespace Lc\CaracoleBundle\Factory; | |||||
namespace Lc\CaracoleBundle\Context; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
trait MerchantFactoryTrait | |||||
trait MerchantContextTrait | |||||
{ | { | ||||
protected MerchantInterface $merchant; | protected MerchantInterface $merchant; | ||||
<?php | <?php | ||||
namespace Lc\CaracoleBundle\Factory; | |||||
namespace Lc\CaracoleBundle\Context; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
trait SectionFactoryTrait | |||||
trait SectionContextTrait | |||||
{ | { | ||||
protected SectionInterface $section; | protected SectionInterface $section; | ||||
} | } | ||||
} | } | ||||
public function buildIndexActions(Actions $actions): void | public function buildIndexActions(Actions $actions): void | ||||
{ | { | ||||
parent::buildIndexActions($actions); | parent::buildIndexActions($actions); |
<?php | |||||
namespace Lc\CaracoleBundle\Definition\Field\Order; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\Field; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Field\AssociationField; | |||||
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition; | |||||
class OrderShopFieldDefinition extends AbstractFieldDefinition | |||||
{ | |||||
use MerchantContextTrait; | |||||
public function configurePanels(): array | |||||
{ | |||||
return []; | |||||
} | |||||
public function configureFields(): array | |||||
{ | |||||
return [ | |||||
'id' => IntegerField::new('id', 'ID'), | |||||
'userLastname' => TextareaField::new('user.lastname', 'field.default.lastname'), | |||||
//->setTemplatePath('@LcShop/backend/default/field/textorempty.html.twig'), | |||||
'userFirstname' => TextareaField::new('user.firstname', 'field.default.firstname'), | |||||
//->setTemplatePath('@LcShop/backend/default/field/textorempty.html.twig'), | |||||
'userEmail' => TextareaField::new('user.email', 'field.default.email'), | |||||
//->setTemplatePath('@LcShop/backend/default/field/user.html.twig'), | |||||
'total' => NumberField::new('total') | |||||
->setTemplatePath('@LcCaracole/admin/order/field/total.html.twig'), | |||||
'orderStatus' => AssociationField::new('orderStatus') | |||||
->setTemplatePath('@LcCaracole/admin/order/field/order_status.html.twig'), | |||||
'createdAt' => DateTimeField::new('createdAt', 'field.OrderShop.createdAt'), | |||||
'updatedAt' => DateTimeField::new('updatedAt', 'field.OrderShop.updatedAt'), | |||||
'orderShopCreatedAt' => DateTimeField::new('orderShopCreatedAt', 'field.OrderShop.createdAt'), | |||||
'cycleNumber' => IntegerField::new('cycleNumber'), | |||||
'cycleDeliveryId' => IntegerField::new('cycleDeliveryId'), | |||||
'cycleId' => IntegerField::new('cycleId'), | |||||
'deliveryType' => Field::new('deliveryType'), | |||||
//->setTemplatePath('@LcShop/backend/default/field/options_translatable.html.twig'), | |||||
'reference' => TextField::new('reference'), | |||||
'complementaryOrderShops' => AssociationField::new('complementaryOrderShops')->setFormTypeOption('mapped', false) | |||||
->setTemplatePath('@LcCaracole/admin/order/field/complementary.html.twig'), | |||||
'orderPayments' => AssociationField::new('orderPayments') | |||||
->setTemplatePath('@LcCaracole/admin/order/field/order_payment.html.twig') | |||||
]; | |||||
} | |||||
} |
namespace Lc\CaracoleBundle\Factory\Address; | namespace Lc\CaracoleBundle\Factory\Address; | ||||
use App\Entity\Address\Address; | use App\Entity\Address\Address; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | use Lc\CaracoleBundle\Model\Address\AddressInterface; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; |
namespace Lc\CaracoleBundle\Factory\File; | namespace Lc\CaracoleBundle\Factory\File; | ||||
use App\Entity\File\Document; | use App\Entity\File\Document; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | use Lc\CaracoleBundle\Model\Address\AddressInterface; | ||||
use Lc\CaracoleBundle\Model\File\DocumentInterface; | use Lc\CaracoleBundle\Model\File\DocumentInterface; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; |
namespace Lc\CaracoleBundle\Factory\Newsletter; | namespace Lc\CaracoleBundle\Factory\Newsletter; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\SovBundle\Model\Newsletter\NewsletterInterface; | use Lc\SovBundle\Model\Newsletter\NewsletterInterface; | ||||
use Lc\SovBundle\Factory\Newsletter\NewsletterFactory as SovNewsletterFactory; | use Lc\SovBundle\Factory\Newsletter\NewsletterFactory as SovNewsletterFactory; | ||||
class NewsletterFactory extends SovNewsletterFactory | class NewsletterFactory extends SovNewsletterFactory | ||||
{ | { | ||||
use SectionFactoryTrait; | |||||
use SectionContextTrait; | |||||
public function create(): NewsletterInterface | public function create(): NewsletterInterface | ||||
{ | { |
use App\Entity\Order\OrderShop; | use App\Entity\Order\OrderShop; | ||||
use Lc\CaracoleBundle\Event\Order\OrderShopChangeStatusEvent; | use Lc\CaracoleBundle\Event\Order\OrderShopChangeStatusEvent; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderStatusModel; | use Lc\CaracoleBundle\Model\Order\OrderStatusModel; |
namespace Lc\CaracoleBundle\Factory\PointSale; | namespace Lc\CaracoleBundle\Factory\PointSale; | ||||
use App\Entity\PointSale\PointSale; | use App\Entity\PointSale\PointSale; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; |
namespace Lc\CaracoleBundle\Factory\Product; | namespace Lc\CaracoleBundle\Factory\Product; | ||||
use App\Entity\Product\ProductCategory; | use App\Entity\Product\ProductCategory; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; |
namespace Lc\CaracoleBundle\Factory\Product; | namespace Lc\CaracoleBundle\Factory\Product; | ||||
use App\Entity\Product\ProductFamily; | use App\Entity\Product\ProductFamily; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; |
namespace Lc\CaracoleBundle\Factory\Reduction; | namespace Lc\CaracoleBundle\Factory\Reduction; | ||||
use App\Entity\Reduction\ReductionCart; | use App\Entity\Reduction\ReductionCart; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; |
namespace Lc\CaracoleBundle\Factory\Reduction; | namespace Lc\CaracoleBundle\Factory\Reduction; | ||||
use App\Entity\Reduction\ReductionCatalog; | use App\Entity\Reduction\ReductionCatalog; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; |
namespace Lc\CaracoleBundle\Factory\Reduction; | namespace Lc\CaracoleBundle\Factory\Reduction; | ||||
use App\Entity\Reduction\ReductionCredit; | use App\Entity\Reduction\ReductionCredit; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; |
namespace Lc\CaracoleBundle\Factory\Reminder; | namespace Lc\CaracoleBundle\Factory\Reminder; | ||||
use App\Entity\Merchant\Merchant; | use App\Entity\Merchant\Merchant; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Factory\Reminder\ReminderFactory as SovReminderFactory; | use Lc\SovBundle\Factory\Reminder\ReminderFactory as SovReminderFactory; | ||||
class ReminderFactory extends SovReminderFactory | class ReminderFactory extends SovReminderFactory | ||||
{ | { | ||||
use MerchantFactoryTrait; | |||||
use SectionFactoryTrait; | |||||
use MerchantContextTrait; | |||||
use SectionContextTrait; | |||||
public function create( | public function create( | ||||
string $crudAction = null, | string $crudAction = null, |
namespace Lc\CaracoleBundle\Factory\Section; | namespace Lc\CaracoleBundle\Factory\Section; | ||||
use App\Entity\Section\Opening; | use App\Entity\Section\Opening; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; | ||||
use Lc\SovBundle\Model\User\GroupUserInterface; | use Lc\SovBundle\Model\User\GroupUserInterface; |
namespace Lc\CaracoleBundle\Factory\Section; | namespace Lc\CaracoleBundle\Factory\Section; | ||||
use App\Entity\Section\Section; | use App\Entity\Section\Section; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; |
namespace Lc\CaracoleBundle\Factory\Setting; | namespace Lc\CaracoleBundle\Factory\Setting; | ||||
use App\Entity\Setting\MerchantSetting; | use App\Entity\Setting\MerchantSetting; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; | ||||
use Lc\SovBundle\Model\File\FileInterface; | use Lc\SovBundle\Model\File\FileInterface; |
namespace Lc\CaracoleBundle\Factory\Setting; | namespace Lc\CaracoleBundle\Factory\Setting; | ||||
use App\Entity\Setting\SectionSetting; | use App\Entity\Setting\SectionSetting; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; | ||||
use Lc\SovBundle\Model\File\FileInterface; | use Lc\SovBundle\Model\File\FileInterface; |
namespace Lc\CaracoleBundle\Factory\Site; | namespace Lc\CaracoleBundle\Factory\Site; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\SovBundle\Factory\Site\NewsFactory as SovNewsFactory; | use Lc\SovBundle\Factory\Site\NewsFactory as SovNewsFactory; | ||||
use Lc\SovBundle\Model\Site\NewsInterface; | use Lc\SovBundle\Model\Site\NewsInterface; | ||||
class NewsFactory extends SovNewsFactory | class NewsFactory extends SovNewsFactory | ||||
{ | { | ||||
use SectionFactoryTrait; | |||||
use SectionContextTrait; | |||||
public function create(): NewsInterface | public function create(): NewsInterface | ||||
{ | { |
namespace Lc\CaracoleBundle\Factory\Site; | namespace Lc\CaracoleBundle\Factory\Site; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Factory\Site\PageFactory as SovPageFactory; | use Lc\SovBundle\Factory\Site\PageFactory as SovPageFactory; | ||||
use Lc\SovBundle\Model\Site\PageInterface; | use Lc\SovBundle\Model\Site\PageInterface; | ||||
class PageFactory extends SovPageFactory | class PageFactory extends SovPageFactory | ||||
{ | { | ||||
use SectionFactoryTrait; | |||||
use SectionContextTrait; | |||||
public function create(): PageInterface | public function create(): PageInterface | ||||
{ | { |
namespace Lc\CaracoleBundle\Factory\Ticket; | namespace Lc\CaracoleBundle\Factory\Ticket; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Context\SectionContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\SovBundle\Factory\Ticket\TicketFactory as SovTicketFactory; | use Lc\SovBundle\Factory\Ticket\TicketFactory as SovTicketFactory; | ||||
use Lc\SovBundle\Model\Ticket\TicketInterface; | use Lc\SovBundle\Model\Ticket\TicketInterface; | ||||
class TicketFactory extends SovTicketFactory | class TicketFactory extends SovTicketFactory | ||||
{ | { | ||||
use MerchantFactoryTrait; | |||||
use MerchantContextTrait; | |||||
public function create(): TicketInterface | public function create(): TicketInterface | ||||
{ | { |
namespace Lc\CaracoleBundle\Factory\User; | namespace Lc\CaracoleBundle\Factory\User; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\SovBundle\Model\User\GroupUserInterface; | use Lc\SovBundle\Model\User\GroupUserInterface; | ||||
use Lc\SovBundle\Factory\User\GroupUserFactory as SovGroupUserFactory; | use Lc\SovBundle\Factory\User\GroupUserFactory as SovGroupUserFactory; | ||||
class GroupUserFactory extends SovGroupUserFactory | class GroupUserFactory extends SovGroupUserFactory | ||||
{ | { | ||||
use MerchantFactoryTrait; | |||||
use MerchantContextTrait; | |||||
public function create(): GroupUserInterface | public function create(): GroupUserInterface | ||||
{ | { |
namespace Lc\CaracoleBundle\Factory\User; | namespace Lc\CaracoleBundle\Factory\User; | ||||
use App\Entity\User\UserMerchant; | use App\Entity\User\UserMerchant; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Context\MerchantContextTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\User\UserMerchantInterface; | use Lc\CaracoleBundle\Model\User\UserMerchantInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; |
{ | { | ||||
$arrayComplementaryOrderShops = new ArrayCollection(); | $arrayComplementaryOrderShops = new ArrayCollection(); | ||||
foreach ($this->complementaryOrderShops as $complementaryOrderShop) { | foreach ($this->complementaryOrderShops as $complementaryOrderShop) { | ||||
if ($complementaryOrderShop->isValid()) { | |||||
$arrayComplementaryOrderShops[] = $complementaryOrderShop; | |||||
} | |||||
$arrayComplementaryOrderShops[] = $complementaryOrderShop; | |||||
} | } | ||||
return $arrayComplementaryOrderShops; | return $arrayComplementaryOrderShops; | ||||
} | } |
{% set value = field.value %} | |||||
{% if value|length > 0 %} | |||||
<span class="badge badge-success"> | |||||
{{ value|length }} compléments | |||||
</span> | |||||
{% else %} | |||||
<span class="badge badge-danger"> | |||||
non | |||||
</span> | |||||
{% endif %} |
{% set value = field.value %} | |||||
{% set item = entity.instance %} | |||||
{% for val in value %} | |||||
<span class="badge badge-success"> | |||||
{% set trad = 'field.default.meanPaymentChoices.'~val.meanPayment %} | |||||
{{ trad|trans({}, 'lcshop') }} | |||||
</span> | |||||
{% endfor %} | |||||
{% set is_paid = order_shop_container.resolver.isPaid(item) %} | |||||
{% if not is_paid %} | |||||
<br /> | |||||
<span class="badge badge-danger">Non soldée</span> | |||||
{% endif %} |
{% set value = field.value %} | |||||
<span class="badge badge-{{ value.color is defined ? value.color : entity.instance.orderStatus.color }}">{{ value }}</span> |
{{ price_solver.getTotalWithTax(entity.instance, true)|format_price|raw }}<br /> |
namespace Lc\CaracoleBundle\Solver\Order; | namespace Lc\CaracoleBundle\Solver\Order; | ||||
use App\Entity\Order\OrderShop; | use App\Entity\Order\OrderShop; | ||||
use Doctrine\Common\Collections\ArrayCollection; | |||||
use Doctrine\Common\Collections\Collection; | |||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Lc\CaracoleBundle\Model\File\DocumentInterface; | use Lc\CaracoleBundle\Model\File\DocumentInterface; | ||||
use Lc\CaracoleBundle\Model\File\DocumentModel; | use Lc\CaracoleBundle\Model\File\DocumentModel; | ||||
protected ProductSolver $productSolver; | protected ProductSolver $productSolver; | ||||
public function __construct( | public function __construct( | ||||
EntityManagerInterface $entityManager, | |||||
ProductSolver $productSolver | |||||
) { | |||||
EntityManagerInterface $entityManager, | |||||
ProductSolver $productSolver | |||||
) | |||||
{ | |||||
$this->entityManager = $entityManager; | $this->entityManager = $entityManager; | ||||
$this->productSolver = $productSolver; | $this->productSolver = $productSolver; | ||||
} | } | ||||
// getOrderProductsByProductFamily | // getOrderProductsByProductFamily | ||||
public function getOrderProductsByProductFamily( | public function getOrderProductsByProductFamily( | ||||
OrderShopInterface $orderShop, | |||||
ProductFamilyInterface $productFamily | |||||
): array { | |||||
OrderShopInterface $orderShop, | |||||
ProductFamilyInterface $productFamily | |||||
): array | |||||
{ | |||||
$arrayOrderProducts = []; | $arrayOrderProducts = []; | ||||
foreach ($orderShop->getOrderProducts() as $orderProduct) { | foreach ($orderShop->getOrderProducts() as $orderProduct) { | ||||
} | } | ||||
public function getQuantityOrderByProduct( | public function getQuantityOrderByProduct( | ||||
OrderShopInterface $orderShop, | |||||
ProductInterface $product, | |||||
$byWeight = false | |||||
): int { | |||||
OrderShopInterface $orderShop, | |||||
ProductInterface $product, | |||||
$byWeight = false | |||||
): int | |||||
{ | |||||
$quantity = 0; | $quantity = 0; | ||||
$productFamily = $product->getProductFamily(); | $productFamily = $product->getProductFamily(); | ||||
$behaviorCountStock = $productFamily->getBehaviorCountStock(); | $behaviorCountStock = $productFamily->getBehaviorCountStock(); | ||||
foreach ($orderShop->getOrderProducts() as $orderProduct) { | foreach ($orderShop->getOrderProducts() as $orderProduct) { | ||||
if ($orderProduct->getProduct()->getId() == $product->getId() | if ($orderProduct->getProduct()->getId() == $product->getId() | ||||
|| (($behaviorCountStock == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY || $behaviorCountStock == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE) | |||||
&& $orderProduct->getProduct()->getProductFamily()->getId() == $productFamily->getId())) { | |||||
|| (($behaviorCountStock == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY || $behaviorCountStock == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE) | |||||
&& $orderProduct->getProduct()->getProductFamily()->getId() == $productFamily->getId())) { | |||||
if ($byWeight) { | if ($byWeight) { | ||||
$quantity += $orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct( | |||||
) / $orderProduct->getProduct()->getUnitInherited()->getCoefficient()); | |||||
$quantity += $orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct() / $orderProduct->getProduct()->getUnitInherited()->getCoefficient()); | |||||
} else { | } else { | ||||
$quantity += $orderProduct->getQuantityOrder(); | $quantity += $orderProduct->getQuantityOrder(); | ||||
} | } | ||||
// isProductAvailable | // isProductAvailable | ||||
public function isProductAvailable( | public function isProductAvailable( | ||||
ProductInterface $product, | |||||
$quantityOrder = 0, | |||||
$checkCart = false, | |||||
$orderShop = null | |||||
) { | |||||
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus( | |||||
) != 1 || !$this->productSolver->isProductSaleStatusOn($product)) { | |||||
ProductInterface $product, | |||||
$quantityOrder = 0, | |||||
$checkCart = false, | |||||
$orderShop = null | |||||
) | |||||
{ | |||||
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1 || !$this->productSolver->isProductSaleStatusOn($product)) { | |||||
return false; | return false; | ||||
} | } | ||||
$quantityAsked = $this->getQuantityOrderByProduct($orderShop, $product, true); | $quantityAsked = $this->getQuantityOrderByProduct($orderShop, $product, true); | ||||
} else { | } else { | ||||
$quantityAsked = ($this->productSolver->getQuantityInherited( | $quantityAsked = ($this->productSolver->getQuantityInherited( | ||||
$product | |||||
) / $this->productSolver->getUnitInherited($product)->getCoefficient( | |||||
)) * $quantityOrder; | |||||
$product | |||||
) / $this->productSolver->getUnitInherited($product)->getCoefficient()) * $quantityOrder; | |||||
} | } | ||||
if ($checkCart) { | if ($checkCart) { | ||||
} | } | ||||
if (($productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY | if (($productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY | ||||
|| $productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT)) { | |||||
|| $productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT)) { | |||||
if (!$quantityOrder) { | if (!$quantityOrder) { | ||||
$quantityAsked = $this->getQuantityOrderByProduct($orderShop, $product); | $quantityAsked = $this->getQuantityOrderByProduct($orderShop, $product); | ||||
} | } | ||||
} | } | ||||
if ($this->productSolver->getAvailableQuantityInherited($product) >= $quantityAsked | if ($this->productSolver->getAvailableQuantityInherited($product) >= $quantityAsked | ||||
|| $productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED) { | |||||
|| $productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED) { | |||||
return true; | return true; | ||||
} else { | } else { | ||||
return false; | return false; | ||||
public function isOrderProductAvailableAddCart(OrderProductInterface $orderProduct, OrderShopInterface $orderShop) | public function isOrderProductAvailableAddCart(OrderProductInterface $orderProduct, OrderShopInterface $orderShop) | ||||
{ | { | ||||
return $this->isProductAvailable( | return $this->isProductAvailable( | ||||
$orderProduct->getProduct(), | |||||
$orderProduct->getQuantityOrder(), | |||||
true, | |||||
$orderShop | |||||
$orderProduct->getProduct(), | |||||
$orderProduct->getQuantityOrder(), | |||||
true, | |||||
$orderShop | |||||
); | ); | ||||
} | } | ||||
} | } | ||||
if ($mergeComplementaryOrderShop) { | if ($mergeComplementaryOrderShop) { | ||||
foreach ($orderShop->getComplementaryOrderShops() as $complementaryOrderShop) { | |||||
foreach ($this->getValidComplementaryOrderShops($orderShop) as $complementaryOrderShop) { | |||||
foreach ($complementaryOrderShop->getOrderPayments() as $orderPayment) { | foreach ($complementaryOrderShop->getOrderPayments() as $orderPayment) { | ||||
$totalAmount = $orderPayment->getAmount() + $totalAmount; | $totalAmount = $orderPayment->getAmount() + $totalAmount; | ||||
} | } | ||||
return $totalAmount; | return $totalAmount; | ||||
} | } | ||||
public function getValidComplementaryOrderShops(OrderShopInterface $orderShop): Collection | |||||
{ | |||||
$arrayComplementaryOrderShops = new ArrayCollection(); | |||||
foreach ($orderShop->getComplementaryOrderShops() as $complementaryOrderShop) { | |||||
if ($this->isValid($complementaryOrderShop)) { | |||||
$arrayComplementaryOrderShops[] = $complementaryOrderShop; | |||||
} | |||||
} | |||||
return $arrayComplementaryOrderShops; | |||||
} | |||||
public function getOrderStatusHistory(OrderShopInterface $orderShop, OrderStatusInterface $status) | public function getOrderStatusHistory(OrderShopInterface $orderShop, OrderStatusInterface $status) | ||||
{ | { | ||||
$orderStatusHistories = $orderShop->getOrderStatusHistories(); | $orderStatusHistories = $orderShop->getOrderStatusHistories(); | ||||
} | } | ||||
public function mergeComplentaryOrderShops( | public function mergeComplentaryOrderShops( | ||||
OrderShopInterface $orderShop, | |||||
bool $combineProducts = true | |||||
): OrderShopInterface { | |||||
OrderShopInterface $orderShop, | |||||
bool $combineProducts = true | |||||
): OrderShopInterface | |||||
{ | |||||
$this->entityManager->refresh($orderShop); | $this->entityManager->refresh($orderShop); | ||||
if ($orderShop->getComplementaryOrderShops()) { | |||||
foreach ($orderShop->getComplementaryOrderShops() as $complementaryOrderShop) { | |||||
if ($this->getValidComplementaryOrderShops($orderShop)) { | |||||
foreach ($this->getValidComplementaryOrderShops($orderShop) as $complementaryOrderShop) { | |||||
foreach ($complementaryOrderShop->getOrderProducts() as $orderProductAdd) { | foreach ($complementaryOrderShop->getOrderProducts() as $orderProductAdd) { | ||||
$updated = false; | $updated = false; | ||||
foreach ($orderShop->getOrderProducts() as $orderProduct) { | foreach ($orderShop->getOrderProducts() as $orderProduct) { | ||||
if ($combineProducts && $orderProduct->getProduct()->getId() == $orderProductAdd->getProduct( | |||||
)->getId() | |||||
&& (string)$orderProduct->getPrice() == (string)$orderProductAdd->getPrice() | |||||
if ($combineProducts && $orderProduct->getProduct()->getId() == $orderProductAdd->getProduct()->getId() | |||||
&& (string)$orderProduct->getPrice() == (string)$orderProductAdd->getPrice() | |||||
) { | ) { | ||||
$orderProduct->setUpdatedOnMergeComplementaryOrderShop(true); | $orderProduct->setUpdatedOnMergeComplementaryOrderShop(true); | ||||
$orderProduct->setQuantityOrder( | $orderProduct->setQuantityOrder( | ||||
$orderProduct->getQuantityOrder() + $orderProductAdd->getQuantityOrder() | |||||
$orderProduct->getQuantityOrder() + $orderProductAdd->getQuantityOrder() | |||||
); | ); | ||||
$updated = true; | $updated = true; | ||||
} | } | ||||
public function isReductionCreditAddedToOrder( | public function isReductionCreditAddedToOrder( | ||||
OrderShopInterface $orderShop, | |||||
ReductionCreditInterface $reductionCredit | |||||
) { | |||||
OrderShopInterface $orderShop, | |||||
ReductionCreditInterface $reductionCredit | |||||
) | |||||
{ | |||||
foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) { | foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) { | ||||
if ($orderReductionCredit->getReductionCredit() == $reductionCredit) { | if ($orderReductionCredit->getReductionCredit() == $reductionCredit) { | ||||
return true; | return true; | ||||
public function hasOrderProductAlreadyInCart( | public function hasOrderProductAlreadyInCart( | ||||
OrderShopInterface $orderShop, | |||||
OrderProductInterface $orderProductTest | |||||
): ?OrderProductInterface { | |||||
OrderShopInterface $orderShop, | |||||
OrderProductInterface $orderProductTest | |||||
): ?OrderProductInterface | |||||
{ | |||||
foreach ($orderShop->getOrderProducts() as $orderProduct) { | foreach ($orderShop->getOrderProducts() as $orderProduct) { | ||||
if ($orderProduct->getProduct() == $orderProductTest->getProduct()) { | if ($orderProduct->getProduct() == $orderProductTest->getProduct()) { | ||||
return $orderProduct; | return $orderProduct; | ||||
public function isValid(OrderShopInterface $orderShop): bool | public function isValid(OrderShopInterface $orderShop): bool | ||||
{ | { | ||||
if ($orderShop->getOrderStatus() && in_array( | if ($orderShop->getOrderStatus() && in_array( | ||||
$orderShop->getOrderStatus()->getAlias(), | |||||
OrderStatusModel::$statusAliasAsValid | |||||
) > 0) { | |||||
$orderShop->getOrderStatus()->getAlias(), | |||||
OrderStatusModel::$statusAliasAsValid | |||||
) > 0) { | |||||
return true; | return true; | ||||
} | } | ||||
public function isCart(OrderShopInterface $orderShop): bool | public function isCart(OrderShopInterface $orderShop): bool | ||||
{ | { | ||||
if ($orderShop->getOrderStatus() && in_array( | if ($orderShop->getOrderStatus() && in_array( | ||||
$orderShop->getOrderStatus()->getAlias(), | |||||
OrderStatusModel::$statusAliasAsCart | |||||
) > 0) { | |||||
$orderShop->getOrderStatus()->getAlias(), | |||||
OrderStatusModel::$statusAliasAsCart | |||||
) > 0) { | |||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
return $this->productSolver->getAvailableQuantityInherited($product) - $this->getQuantityOrderByProduct( | return $this->productSolver->getAvailableQuantityInherited($product) - $this->getQuantityOrderByProduct( | ||||
$orderShop, | |||||
$product, | |||||
$byWeight | |||||
); | |||||
$orderShop, | |||||
$product, | |||||
$byWeight | |||||
); | |||||
} | } | ||||
public function hasMakeAChoiceAboutComplementaryOrder(OrderShop $orderShop): bool | public function hasMakeAChoiceAboutComplementaryOrder(OrderShop $orderShop): bool |