Browse Source

Merge branch 'develop' of https://forge.laclic.fr/Laclic/CaracoleBundle into develop

packProduct
Fabien Normand 3 years ago
parent
commit
751eccedfd
98 changed files with 647 additions and 240 deletions
  1. +0
    -1
      Builder/Order/OrderShopBuilder.php
  2. +2
    -0
      Container/Address/AddressContainer.php
  3. +2
    -0
      Container/Config/TaxRateContainer.php
  4. +2
    -0
      Container/Credit/CreditHistoryContainer.php
  5. +2
    -0
      Container/File/DocumentContainer.php
  6. +2
    -0
      Container/Order/OrderShopContainer.php
  7. +2
    -0
      Container/PointSale/PointSaleContainer.php
  8. +12
    -1
      Container/Product/ProductCategoryContainer.php
  9. +2
    -0
      Container/Product/ProductContainer.php
  10. +2
    -0
      Container/Product/ProductFamilyContainer.php
  11. +2
    -0
      Container/Product/ProductFamilySectionPropertyContainer.php
  12. +11
    -1
      Container/Reduction/ReductionCartContainer.php
  13. +12
    -1
      Container/Reduction/ReductionCatalogContainer.php
  14. +2
    -0
      Container/Section/OpeningContainer.php
  15. +2
    -0
      Container/Section/SectionContainer.php
  16. +2
    -0
      Container/Setting/MerchantSettingContainer.php
  17. +2
    -0
      Container/Setting/SectionSettingContainer.php
  18. +2
    -0
      Container/User/UserMerchantContainer.php
  19. +2
    -2
      Context/SectionContextTrait.php
  20. +17
    -84
      Controller/AdminControllerTrait.php
  21. +8
    -1
      Controller/ControllerTrait.php
  22. +9
    -3
      Controller/Newsletter/NewsletterAdminController.php
  23. +4
    -17
      Controller/Product/ProductCategoryAdminController.php
  24. +22
    -11
      Controller/Section/OpeningAdminController.php
  25. +0
    -1
      Controller/Section/SectionAdminController.php
  26. +9
    -3
      Controller/Section/SwitchSectionAdminController.php
  27. +19
    -18
      Controller/Setting/SettingAdminController.php
  28. +2
    -2
      Controller/Site/NewsAdminController.php
  29. +3
    -3
      Controller/Site/PageAdminController.php
  30. +10
    -0
      Definition/Field/AbstractFieldDefinition.php
  31. +46
    -0
      Definition/Field/FieldDefinitionTrait.php
  32. +36
    -0
      Definition/Field/Newsletter/NewsletterFieldDefinition.php
  33. +11
    -1
      Definition/Field/Order/OrderShopFieldDefinition.php
  34. +79
    -0
      Definition/Field/Product/ProductCategoryFieldDefinition.php
  35. +27
    -0
      Definition/Field/Reduction/ReductionCartFieldDefinition.php
  36. +27
    -0
      Definition/Field/Reduction/ReductionCatalogFieldDefinition.php
  37. +31
    -0
      Definition/Field/Site/NewsFieldDefinition.php
  38. +30
    -0
      Definition/Field/Site/PageFieldDefinition.php
  39. +2
    -0
      Factory/Site/PageFactory.php
  40. +3
    -0
      Field/AssociationField.php
  41. +10
    -7
      Form/Section/SwitchSectionFormType.php
  42. +21
    -3
      Model/Site/PageModel.php
  43. +10
    -0
      Repository/AbstractStore.php
  44. +1
    -1
      Repository/Address/AddressStore.php
  45. +1
    -3
      Repository/Config/TaxRateStore.php
  46. +1
    -1
      Repository/Config/UnitStore.php
  47. +1
    -1
      Repository/Credit/CreditHistoryStore.php
  48. +1
    -3
      Repository/Distribution/DistributionStore.php
  49. +1
    -1
      Repository/File/DocumentStore.php
  50. +1
    -2
      Repository/Merchant/MerchantStore.php
  51. +2
    -2
      Repository/MerchantStoreTrait.php
  52. +2
    -0
      Repository/Newsletter/NewsletterStore.php
  53. +1
    -1
      Repository/Order/OrderPaymentStore.php
  54. +1
    -1
      Repository/Order/OrderProductReductionCatalogStore.php
  55. +1
    -1
      Repository/Order/OrderProductRefundStore.php
  56. +1
    -1
      Repository/Order/OrderProductStore.php
  57. +1
    -1
      Repository/Order/OrderReductionCartStore.php
  58. +1
    -1
      Repository/Order/OrderReductionCreditStore.php
  59. +1
    -1
      Repository/Order/OrderRefundStore.php
  60. +1
    -1
      Repository/Order/OrderShopStore.php
  61. +1
    -1
      Repository/Order/OrderStatusHistoryStore.php
  62. +1
    -1
      Repository/Order/OrderStatusStore.php
  63. +1
    -1
      Repository/PointSale/PointSaleStore.php
  64. +1
    -1
      Repository/Product/ProductCategoryStore.php
  65. +1
    -1
      Repository/Product/ProductFamilySectionPropertyStore.php
  66. +1
    -1
      Repository/Product/ProductFamilyStore.php
  67. +3
    -2
      Repository/Product/ProductStore.php
  68. +1
    -1
      Repository/Product/QualityLabelStore.php
  69. +1
    -5
      Repository/Reduction/ReductionCartStore.php
  70. +1
    -1
      Repository/Reduction/ReductionCatalogStore.php
  71. +1
    -5
      Repository/Reduction/ReductionCreditStore.php
  72. +2
    -1
      Repository/Reminder/ReminderStore.php
  73. +1
    -2
      Repository/Section/OpeningStore.php
  74. +1
    -2
      Repository/Section/SectionStore.php
  75. +1
    -1
      Repository/SectionStoreTrait.php
  76. +1
    -1
      Repository/Setting/MerchantSettingStore.php
  77. +1
    -1
      Repository/Setting/SectionSettingStore.php
  78. +3
    -1
      Repository/Site/NewsStore.php
  79. +2
    -1
      Repository/Site/PageRepositoryQuery.php
  80. +7
    -3
      Repository/Site/PageStore.php
  81. +17
    -0
      Repository/StoreTrait.php
  82. +3
    -2
      Repository/Ticket/TicketStore.php
  83. +3
    -2
      Repository/User/GroupUserStore.php
  84. +1
    -2
      Repository/User/UserMerchantStore.php
  85. +1
    -1
      Repository/User/UserPointSaleStore.php
  86. +4
    -2
      Repository/User/UserStore.php
  87. +1
    -1
      Repository/User/VisitorStore.php
  88. +12
    -3
      Resolver/SectionResolver.php
  89. +2
    -0
      Resources/translations/admin.fr.yaml
  90. +3
    -1
      Resources/views/admin/product/field/product_family_sales.html.twig
  91. +7
    -0
      Resources/views/admin/product/field/product_family_section_properties.html.twig
  92. +7
    -0
      Resources/views/admin/section/field/section.html.twig
  93. +7
    -0
      Resources/views/admin/section/field/sections.html.twig
  94. +4
    -0
      Resources/views/admin/section/macros.html.twig
  95. +2
    -2
      Resources/views/admin/setting/edit_section.html.twig
  96. +14
    -8
      Resources/views/adminlte/layout.html.twig
  97. +6
    -0
      Solver/Section/SectionSolver.php
  98. +1
    -1
      Twig/StoreTwigExtension.php

+ 0
- 1
Builder/Order/OrderShopBuilder.php View File

$orderShop->setDeclineComplementaryOrderShop(false); $orderShop->setDeclineComplementaryOrderShop(false);
} }



public function getProductsSalesStatistic(SectionInterface $section, $entity, $nbWeek = 2) public function getProductsSalesStatistic(SectionInterface $section, $entity, $nbWeek = 2)
{ {
$productsSalesStatistic = new ProductsSalesStatistic( $productsSalesStatistic = new ProductsSalesStatistic(

+ 2
- 0
Container/Address/AddressContainer.php View File



public function getStore(): AddressStore public function getStore(): AddressStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 2
- 0
Container/Config/TaxRateContainer.php View File



public function getStore(): TaxRateStore public function getStore(): TaxRateStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }
} }

+ 2
- 0
Container/Credit/CreditHistoryContainer.php View File



public function getStore(): CreditHistoryStore public function getStore(): CreditHistoryStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 2
- 0
Container/File/DocumentContainer.php View File



public function getStore(): DocumentStore public function getStore(): DocumentStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }
} }

+ 2
- 0
Container/Order/OrderShopContainer.php View File



public function getStore(): OrderShopStore public function getStore(): OrderShopStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 2
- 0
Container/PointSale/PointSaleContainer.php View File



public function getStore(): PointSaleStore public function getStore(): PointSaleStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }
} }

+ 12
- 1
Container/Product/ProductCategoryContainer.php View File



namespace Lc\CaracoleBundle\Container\Product; namespace Lc\CaracoleBundle\Container\Product;


use Lc\CaracoleBundle\Definition\Field\Product\ProductCategoryFieldDefinition;
use Lc\CaracoleBundle\Factory\Product\ProductCategoryFactory; use Lc\CaracoleBundle\Factory\Product\ProductCategoryFactory;
use Lc\CaracoleBundle\Repository\Product\ProductCategoryRepositoryQuery; use Lc\CaracoleBundle\Repository\Product\ProductCategoryRepositoryQuery;
use Lc\CaracoleBundle\Repository\Product\ProductCategoryStore; use Lc\CaracoleBundle\Repository\Product\ProductCategoryStore;
protected ProductCategorySolver $solver; protected ProductCategorySolver $solver;
protected ProductCategoryRepositoryQuery $repositoryQuery; protected ProductCategoryRepositoryQuery $repositoryQuery;
protected ProductCategoryStore $store; protected ProductCategoryStore $store;
protected ProductCategoryFieldDefinition $fieldDefinition;


public function __construct( public function __construct(
ProductCategoryFactory $factory, ProductCategoryFactory $factory,
ProductCategorySolver $solver, ProductCategorySolver $solver,
ProductCategoryRepositoryQuery $repositoryQuery, ProductCategoryRepositoryQuery $repositoryQuery,
ProductCategoryStore $store
ProductCategoryStore $store,
ProductCategoryFieldDefinition $fieldDefinition
) { ) {
$this->factory = $factory; $this->factory = $factory;
$this->solver = $solver; $this->solver = $solver;
$this->repositoryQuery = $repositoryQuery; $this->repositoryQuery = $repositoryQuery;
$this->store = $store; $this->store = $store;
$this->fieldDefinition = $fieldDefinition;
} }


public function getFactory(): ProductCategoryFactory public function getFactory(): ProductCategoryFactory


public function getStore(): ProductCategoryStore public function getStore(): ProductCategoryStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }


public function getFieldDefinition(): ProductCategoryFieldDefinition
{
return $this->fieldDefinition;
}

} }

+ 2
- 0
Container/Product/ProductContainer.php View File



public function getStore(): ProductStore public function getStore(): ProductStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 2
- 0
Container/Product/ProductFamilyContainer.php View File



public function getStore(): ProductFamilyStore public function getStore(): ProductFamilyStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 2
- 0
Container/Product/ProductFamilySectionPropertyContainer.php View File



public function getStore(): ProductFamilySectionPropertyStore public function getStore(): ProductFamilySectionPropertyStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 11
- 1
Container/Reduction/ReductionCartContainer.php View File



namespace Lc\CaracoleBundle\Container\Reduction; namespace Lc\CaracoleBundle\Container\Reduction;


use Lc\CaracoleBundle\Definition\Field\Reduction\ReductionCartFieldDefinition;
use Lc\CaracoleBundle\Factory\Reduction\ReductionCartFactory; use Lc\CaracoleBundle\Factory\Reduction\ReductionCartFactory;
use Lc\CaracoleBundle\Repository\Reduction\ReductionCartRepositoryQuery; use Lc\CaracoleBundle\Repository\Reduction\ReductionCartRepositoryQuery;
use Lc\CaracoleBundle\Repository\Reduction\ReductionCartStore; use Lc\CaracoleBundle\Repository\Reduction\ReductionCartStore;
protected ReductionCartFactory $factory; protected ReductionCartFactory $factory;
protected ReductionCartRepositoryQuery $repositoryQuery; protected ReductionCartRepositoryQuery $repositoryQuery;
protected ReductionCartStore $store; protected ReductionCartStore $store;
protected ReductionCartFieldDefinition $fieldDefinition;


public function __construct( public function __construct(
ReductionCartFactory $factory, ReductionCartFactory $factory,
ReductionCartRepositoryQuery $repositoryQuery, ReductionCartRepositoryQuery $repositoryQuery,
ReductionCartStore $store
ReductionCartStore $store,
ReductionCartFieldDefinition $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(): ReductionCartFactory public function getFactory(): ReductionCartFactory


public function getStore(): ReductionCartStore public function getStore(): ReductionCartStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }


public function getFieldDefinition(): ReductionCartFieldDefinition
{
return $this->fieldDefinition;
}
} }

+ 12
- 1
Container/Reduction/ReductionCatalogContainer.php View File



namespace Lc\CaracoleBundle\Container\Reduction; namespace Lc\CaracoleBundle\Container\Reduction;


use Lc\CaracoleBundle\Definition\Field\Reduction\ReductionCatalogFieldDefinition;
use Lc\CaracoleBundle\Factory\Reduction\ReductionCatalogFactory; use Lc\CaracoleBundle\Factory\Reduction\ReductionCatalogFactory;
use Lc\CaracoleBundle\Repository\Reduction\ReductionCatalogRepositoryQuery; use Lc\CaracoleBundle\Repository\Reduction\ReductionCatalogRepositoryQuery;
use Lc\CaracoleBundle\Repository\Reduction\ReductionCatalogStore; use Lc\CaracoleBundle\Repository\Reduction\ReductionCatalogStore;
protected ReductionCatalogFactory $factory; protected ReductionCatalogFactory $factory;
protected ReductionCatalogRepositoryQuery $repositoryQuery; protected ReductionCatalogRepositoryQuery $repositoryQuery;
protected ReductionCatalogStore $store; protected ReductionCatalogStore $store;
protected ReductionCatalogFieldDefinition $fieldDefinition;


public function __construct( public function __construct(
ReductionCatalogFactory $factory, ReductionCatalogFactory $factory,
ReductionCatalogRepositoryQuery $repositoryQuery, ReductionCatalogRepositoryQuery $repositoryQuery,
ReductionCatalogStore $store
ReductionCatalogStore $store,
ReductionCatalogFieldDefinition $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(): ReductionCatalogFactory public function getFactory(): ReductionCatalogFactory


public function getStore(): ReductionCatalogStore public function getStore(): ReductionCatalogStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }


public function getFieldDefinition(): ReductionCatalogFieldDefinition
{
return $this->fieldDefinition;
}

} }

+ 2
- 0
Container/Section/OpeningContainer.php View File



public function getStore(): OpeningStore public function getStore(): OpeningStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 2
- 0
Container/Section/SectionContainer.php View File



public function getStore(): SectionStore public function getStore(): SectionStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }
} }

+ 2
- 0
Container/Setting/MerchantSettingContainer.php View File



public function getStore(): MerchantSettingStore public function getStore(): MerchantSettingStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 2
- 0
Container/Setting/SectionSettingContainer.php View File



public function getStore(): SectionSettingStore public function getStore(): SectionSettingStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 2
- 0
Container/User/UserMerchantContainer.php View File



public function getStore(): UserMerchantStore public function getStore(): UserMerchantStore
{ {
$this->store->resetContext();

return $this->store; return $this->store;
} }



+ 2
- 2
Context/SectionContextTrait.php View File



trait SectionContextTrait trait SectionContextTrait
{ {
protected SectionInterface $section;
protected ?SectionInterface $section;


public function setSection(SectionInterface $section)
public function setSection(?SectionInterface $section)
{ {
$this->section = $section; $this->section = $section;



+ 17
- 84
Controller/AdminControllerTrait.php View File

namespace Lc\CaracoleBundle\Controller; namespace Lc\CaracoleBundle\Controller;


use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
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 EasyCorp\Bundle\EasyAdminBundle\Config\Action; use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException; use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use EasyCorp\Bundle\EasyAdminBundle\Security\Permission; use EasyCorp\Bundle\EasyAdminBundle\Security\Permission;
use Lc\CaracoleBundle\Container\Address\AddressContainer;
use Lc\CaracoleBundle\Container\Config\TaxRateContainer;
use Lc\CaracoleBundle\Container\Config\UnitContainer;
use Lc\CaracoleBundle\Container\Credit\CreditHistoryContainer;
use Lc\CaracoleBundle\Container\File\DocumentContainer;
use Lc\CaracoleBundle\Container\Merchant\MerchantContainer;
use Lc\CaracoleBundle\Container\Order\OrderPaymentContainer;
use Lc\CaracoleBundle\Container\Order\OrderProductContainer;
use Lc\CaracoleBundle\Container\Order\OrderProductReductionCatalogContainer;
use Lc\CaracoleBundle\Container\Order\OrderProductRefundContainer;
use Lc\CaracoleBundle\Container\Order\OrderReductionCartContainer;
use Lc\CaracoleBundle\Container\Order\OrderReductionCreditContainer;
use Lc\CaracoleBundle\Container\Order\OrderRefundContainer;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
use Lc\CaracoleBundle\Container\Order\OrderStatusContainer;
use Lc\CaracoleBundle\Container\Order\OrderStatusHistoryContainer;
use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer;
use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer;
use Lc\CaracoleBundle\Container\Product\ProductContainer;
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer;
use Lc\CaracoleBundle\Container\Reduction\ReductionCartContainer;
use Lc\CaracoleBundle\Container\Reduction\ReductionCatalogContainer;
use Lc\CaracoleBundle\Container\Reduction\ReductionCreditContainer;
use Lc\CaracoleBundle\Container\Section\OpeningContainer;
use Lc\CaracoleBundle\Container\Section\SectionContainer;
use Lc\CaracoleBundle\Container\Setting\MerchantSettingContainer;
use Lc\CaracoleBundle\Container\Setting\SectionSettingContainer;
use Lc\CaracoleBundle\Container\User\UserMerchantContainer;
use Lc\CaracoleBundle\Container\User\UserPointSaleContainer;
use Lc\CaracoleBundle\Container\User\VisitorContainer;
use Lc\CaracoleBundle\Definition\ActionDefinition; use Lc\CaracoleBundle\Definition\ActionDefinition;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface; use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface;


trait AdminControllerTrait trait AdminControllerTrait
{ {

use ControllerTrait; use ControllerTrait;


//TODO doit implementer ControllerTrait
/*public static function getSubscribedServices()
{
return array_merge(
parent::getSubscribedServices(),
self::getSubscribedServicesList()
);
}

public static function getSubscribedServicesList()
{
return [
MerchantResolver::class => MerchantResolver::class,
SectionResolver::class => SectionResolver::class,
AddressContainer::class => AddressContainer::class,
TaxRateContainer::class => TaxRateContainer::class,
UnitContainer::class => UnitContainer::class,
CreditHistoryContainer::class => CreditHistoryContainer::class,
DocumentContainer::class => DocumentContainer::class,
MerchantContainer::class => MerchantContainer::class,
OrderPaymentContainer::class => OrderPaymentContainer::class,
OrderProductContainer::class => OrderProductContainer::class,
OrderProductReductionCatalogContainer::class => OrderProductReductionCatalogContainer::class,
OrderProductRefundContainer::class => OrderProductRefundContainer::class,
OrderReductionCartContainer::class => OrderReductionCartContainer::class,
OrderReductionCreditContainer::class => OrderReductionCreditContainer::class,
OrderRefundContainer::class => OrderRefundContainer::class,
OrderShopContainer::class => OrderShopContainer::class,
OrderStatusContainer::class => OrderStatusContainer::class,
OrderStatusHistoryContainer::class => OrderStatusHistoryContainer::class,
PointSaleContainer::class => PointSaleContainer::class,
ProductCategoryContainer::class => ProductCategoryContainer::class,
ProductContainer::class => ProductContainer::class,
ProductFamilyContainer::class => ProductFamilyContainer::class,
ReductionCartContainer::class => ReductionCartContainer::class,
ReductionCatalogContainer::class => ReductionCatalogContainer::class,
ReductionCreditContainer::class => ReductionCreditContainer::class,
OpeningContainer::class => OpeningContainer::class,
SectionContainer::class => SectionContainer::class,
MerchantSettingContainer::class => MerchantSettingContainer::class,
SectionSettingContainer::class => SectionSettingContainer::class,
UserMerchantContainer::class => UserMerchantContainer::class,
UserPointSaleContainer::class => UserPointSaleContainer::class,
VisitorContainer::class => VisitorContainer::class
];
}*/

public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
{ {
$responseParameters = parent::configureResponseParameters($responseParameters); $responseParameters = parent::configureResponseParameters($responseParameters);


// affichage du filtre sur section
$this->configureResponseParametersFilterSection($responseParameters);

return $responseParameters;
}

public function configureResponseParametersFilterSection(KeyValueStore $responseParameters)
{
if ($this->isInstanceOf(FilterSectionInterface::class)) { if ($this->isInstanceOf(FilterSectionInterface::class)) {
$responseParameters->set('display_switch_section', true); $responseParameters->set('display_switch_section', true);
} }
}


return $responseParameters;
public function configureResponseParametersDisableShowAllSections(KeyValueStore $responseParameters)
{
$responseParameters->set('replace_content_with_message', "Vous devez sélectionner une section pour afficher ces données.");
} }


public function createIndexRepositoryQuery( public function createIndexRepositoryQuery(
$filters $filters
); );


if ($this->isInstanceOf(FilterMerchantInterface::class) || $this->isInstanceOf(FilterMultipleMerchantsInterface::class)) {
$sectionCurrent = $this->get(SectionResolver::class)->getCurrent();

if ($this->isInstanceOf(FilterMerchantInterface::class)
|| $this->isInstanceOf(FilterMultipleMerchantsInterface::class)) {
$repositoryQuery->filterByMerchant($this->get(MerchantResolver::class)->getCurrent()); $repositoryQuery->filterByMerchant($this->get(MerchantResolver::class)->getCurrent());
} }


if ($this->isInstanceOf(FilterSectionInterface::class)) {
$repositoryQuery->filterBySection($this->get(SectionResolver::class)->getCurrent());
if ($sectionCurrent && $this->isInstanceOf(FilterSectionInterface::class)) {
$repositoryQuery->filterBySection($sectionCurrent);
} }


return $repositoryQuery; return $repositoryQuery;

+ 8
- 1
Controller/ControllerTrait.php View File

use Lc\CaracoleBundle\Model\Section\SectionInterface; use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Model\User\UserMerchantInterface; use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
use Lc\CaracoleBundle\Model\User\VisitorInterface; use Lc\CaracoleBundle\Model\User\VisitorInterface;
use Lc\CaracoleBundle\Notification\MailMailjetNotification;
use Lc\CaracoleBundle\Resolver\MerchantResolver; use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver; use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\CaracoleBundle\Solver\Price\PriceSolver; use Lc\CaracoleBundle\Solver\Price\PriceSolver;
return array_merge( return array_merge(
parent::getSubscribedServices(), parent::getSubscribedServices(),
[ [
MailMailjetNotification::class => MailMailjetNotification::class,
PriceSolver::class => PriceSolver::class, PriceSolver::class => PriceSolver::class,
MerchantResolver::class => MerchantResolver::class, MerchantResolver::class => MerchantResolver::class,
SectionResolver::class => SectionResolver::class, SectionResolver::class => SectionResolver::class,
); );
} }


public function getMailMailjetNotification()
{
return $this->get(MailMailjetNotification::class);
}

public function getMerchantSettingCurrent(string $settingName) public function getMerchantSettingCurrent(string $settingName)
{ {
return $this->getSettingValue($this->getMerchantCurrent(), $settingName); return $this->getSettingValue($this->getMerchantCurrent(), $settingName);
return $this->get(MerchantResolver::class)->getMerchantUser($this->getUserCurrent()); return $this->get(MerchantResolver::class)->getMerchantUser($this->getUserCurrent());
} }


public function getSectionCurrent(): SectionInterface
public function getSectionCurrent(): ?SectionInterface
{ {
return $this->get(SectionResolver::class)->getCurrent(); return $this->get(SectionResolver::class)->getCurrent();
} }

+ 9
- 3
Controller/Newsletter/NewsletterAdminController.php View File

namespace Lc\CaracoleBundle\Controller\Newsletter; namespace Lc\CaracoleBundle\Controller\Newsletter;


use Lc\CaracoleBundle\Controller\AdminControllerTrait; use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Container\Newsletter\NewsletterContainer; use Lc\SovBundle\Container\Newsletter\NewsletterContainer;
use Lc\SovBundle\Controller\Newsletter\NewsletterAdminController as SovNewsletterAdminController; use Lc\SovBundle\Controller\Newsletter\NewsletterAdminController as SovNewsletterAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;


abstract class NewsletterAdminController extends SovNewsletterAdminController abstract class NewsletterAdminController extends SovNewsletterAdminController
{ {
{ {
return $this->get(NewsletterContainer::class) return $this->get(NewsletterContainer::class)
->getFactory() ->getFactory()
->setSection($this->get(SectionResolver::class)->getCurrent())
->setSection($this->getSectionCurrent())
->create(); ->create();
} }

public function configureFields(string $pageName): iterable
{
return $this->getNewsletterContainer()->getFieldDefinition()
->setMerchant($this->getMerchantCurrent())
->setSection($this->getSectionCurrent())
->getFields($pageName);
}
} }

+ 4
- 17
Controller/Product/ProductCategoryAdminController.php View File



public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {
return array_merge(
[
FormField::addPanel('general'),
IntegerField::new('id')->onlyOnIndex()->setSortable(true),
TextField::new('title')->setSortable(true),
NumberField::new('position')->hideOnForm()->setSortable(true),
AssociationField::new('parent')->hideOnIndex(),
DateTimeField::new('createdAt')->setFormat('short')->setSortable(true),
CKEditorField::new('description')->hideOnIndex(),
StatusField::new('status')->setSortable(true),
ToggleField::new('saleStatus')->setSortable(true),
ToggleField::new('isEligibleTicketRestaurant')->setSortable(true),

],
$this->getSeoPanel(),
$this->getConfPanel()
);
return $this->getProductCategoryContainer()->getFieldDefinition()
->setMerchant($this->getMerchantCurrent())
->setSection($this->getSectionCurrent())
->getFields($pageName);
} }


} }

+ 22
- 11
Controller/Section/OpeningAdminController.php View File

namespace Lc\CaracoleBundle\Controller\Section; namespace Lc\CaracoleBundle\Controller\Section;


use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\TimeField;
{ {
use AdminControllerTrait; use AdminControllerTrait;


public function createEntity(string $entityFqcn)
{
return $this->getOpeningContainer()
->getFactory()
->create($this->getSectionCurrent());
}

public function getRepositoryQuery() :RepositoryQueryInterface public function getRepositoryQuery() :RepositoryQueryInterface
{ {
return $this->get(OpeningContainer::class)->getRepositoryQuery(); return $this->get(OpeningContainer::class)->getRepositoryQuery();
} }


public function configureCrud(Crud $crud): Crud
{
$crud = parent::configureCrud($crud);

$crud->setDefaultSort(['day' => 'ASC']);

return $crud;
}

public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {
return [ return [
]; ];
} }


public function configureCrud(Crud $crud): Crud
public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
{ {
$crud = parent::configureCrud($crud);
$responseParameters = parent::configureResponseParameters($responseParameters);


$crud->setDefaultSort(['day' => 'ASC']);
$this->configureResponseParametersFilterSection($responseParameters);
$this->configureResponseParametersDisableShowAllSections($responseParameters);


return $crud;
}

public function createEntity(string $entityFqcn)
{
return $this->getOpeningContainer()
->getFactory()
->create($this->getSectionCurrent());
return $responseParameters;
} }
} }

+ 0
- 1
Controller/Section/SectionAdminController.php View File



abstract class SectionAdminController extends AbstractAdminController abstract class SectionAdminController extends AbstractAdminController
{ {

public function getRepositoryQuery() :RepositoryQueryInterface public function getRepositoryQuery() :RepositoryQueryInterface
{ {
return $this->get(SectionContainer::class)->getRepositoryQuery(); return $this->get(SectionContainer::class)->getRepositoryQuery();

+ 9
- 3
Controller/Section/SwitchSectionAdminController.php View File

$form->handleRequest($request); $form->handleRequest($request);


if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {

// valeur par défaut de $section : Tout afficher
$section = null;
$idSection = $form->get('id_section')->getData(); $idSection = $form->get('id_section')->getData();
$section = $sectionContainer->getStore()->getOneById($idSection);
$userMerchant = $merchantResolver->getUserMerchant(); $userMerchant = $merchantResolver->getUserMerchant();


if ($section && $userMerchant) {
if($userMerchant) {
if($idSection) {
$section = $sectionContainer->getStore()->getOneById($idSection);
}

$userMerchant->setCurrentAdminSection($section); $userMerchant->setCurrentAdminSection($section);
$entityManager->update($section);
$entityManager->update($userMerchant);
$entityManager->flush(); $entityManager->flush();
} }
} }

+ 19
- 18
Controller/Setting/SettingAdminController.php View File



namespace Lc\CaracoleBundle\Controller\Setting; namespace Lc\CaracoleBundle\Controller\Setting;


use Lc\CaracoleBundle\Container\Setting\MerchantSettingContainer;
use Lc\CaracoleBundle\Container\Setting\SectionSettingContainer;
use Lc\CaracoleBundle\Controller\ControllerTrait; use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Container\Setting\SiteSettingContainer;
use Lc\SovBundle\Container\Site\SiteContainer;
use Lc\SovBundle\Controller\Setting\SettingAdminController as SovSettingController; use Lc\SovBundle\Controller\Setting\SettingAdminController as SovSettingController;
use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Form\Setting\MerchantSettingsFormType; use Lc\CaracoleBundle\Form\Setting\MerchantSettingsFormType;
use Lc\CaracoleBundle\Form\Setting\SectionSettingsFormType; use Lc\CaracoleBundle\Form\Setting\SectionSettingsFormType;
use Lc\SovBundle\Form\Setting\SiteSettingsFormType; use Lc\SovBundle\Form\Setting\SiteSettingsFormType;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;


/** /**
* @Route("/admin/setting/merchant", name="carac_admin_setting_merchant") * @Route("/admin/setting/merchant", name="carac_admin_setting_merchant")
*/ */
public function manageMerchant(
Request $request
) {
public function manageMerchant(Request $request)
{
return $this->manage($request, 'merchant'); return $this->manage($request, 'merchant');
} }


/** /**
* @Route("/admin/setting/section", name="carac_admin_setting_section") * @Route("/admin/setting/section", name="carac_admin_setting_section")
*/ */
public function manageSection(
Request $request
) {
public function manageSection(Request $request)
{
return $this->manage($request, 'section'); return $this->manage($request, 'section');
} }


} }


$entity = $resolver->getCurrent(); $entity = $resolver->getCurrent();
$displaySwitchSection = ($type == 'section') ? true : false;
$view = '@LcCaracole/admin/setting/edit_' . $type . '.html.twig';


if ($entity) { if ($entity) {
$form = $this->createForm($formClass, $entity); $form = $this->createForm($formClass, $entity);
$entityManager->update($entity); $entityManager->update($entity);
$entityManager->flush(); $entityManager->flush();


$this->addFlashTranslator('success','updated');
$this->addFlashTranslator('success', 'updated');
} }


return $this->render( return $this->render(
'@LcCaracole/admin/setting/edit_' . $type . '.html.twig',
$view,
[ [
'display_switch_section' => ($type == 'section') ? true : false,
'display_switch_section' => $displaySwitchSection,
'resolver' => $resolver, 'resolver' => $resolver,
'setting_definition' => $settingDefinition, 'setting_definition' => $settingDefinition,
'form' => $form->createView() 'form' => $form->createView()
] ]
); );
} }
else {
return $this->render(
$view,
[
'display_switch_section' => $displaySwitchSection,
'replace_content_with_message' => "Vous devez sélectionner une section pour afficher ces données."
]
);
}
} }


/** /**
$entityManager->update($site); $entityManager->update($site);
$entityManager->flush(); $entityManager->flush();


$this->addFlashTranslator('success','updated');
$this->addFlashTranslator('success', 'updated');
} }


return $this->render( return $this->render(

+ 2
- 2
Controller/Site/NewsAdminController.php View File



namespace Lc\CaracoleBundle\Controller\Site; namespace Lc\CaracoleBundle\Controller\Site;


use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\SovBundle\Controller\Site\NewsAdminController as SovNewsAdminController; use Lc\SovBundle\Controller\Site\NewsAdminController as SovNewsAdminController;


abstract class NewsAdminController extends SovNewsAdminController abstract class NewsAdminController extends SovNewsAdminController
{ {
use ControllerTrait;
use AdminControllerTrait;


public function createEntity(string $entityFqcn) public function createEntity(string $entityFqcn)
{ {

+ 3
- 3
Controller/Site/PageAdminController.php View File



namespace Lc\CaracoleBundle\Controller\Site; namespace Lc\CaracoleBundle\Controller\Site;


use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\SovBundle\Controller\Site\PageAdminController as SovPageAdminController; use Lc\SovBundle\Controller\Site\PageAdminController as SovPageAdminController;


abstract class PageAdminController extends SovPageAdminController abstract class PageAdminController extends SovPageAdminController
{ {
use ControllerTrait;
use AdminControllerTrait;


public function createEntity(string $entityFqcn) public function createEntity(string $entityFqcn)
{ {
return $this->getPageContainer() return $this->getPageContainer()
->getFactory() ->getFactory()
->setMerchant($this->getMerchantCurrent())
->setSection($this->getSectionCurrent()) ->setSection($this->getSectionCurrent())
->create(); ->create();
} }

+ 10
- 0
Definition/Field/AbstractFieldDefinition.php View File

<?php

namespace Lc\CaracoleBundle\Definition\Field;

use Lc\SovBundle\Definition\Field\AbstractFieldDefinition as SovAbstractFieldDefinition;

abstract class AbstractFieldDefinition extends SovAbstractFieldDefinition
{
use FieldDefinitionTrait;
}

+ 46
- 0
Definition/Field/FieldDefinitionTrait.php View File

<?php

namespace Lc\CaracoleBundle\Definition\Field;

use Lc\CaracoleBundle\Context\MerchantContextTrait;
use Lc\CaracoleBundle\Context\SectionContextTrait;
use Lc\CaracoleBundle\Field\AssociationField;
use Lc\CaracoleBundle\Model\Section\SectionInterface;

trait FieldDefinitionTrait
{
use MerchantContextTrait;
use SectionContextTrait;

public function configureFieldsBase(): array
{
$sectionArray = $this->sectionStore->setMerchant($this->merchant)->get();

return array_merge(parent::configureFieldsBase(), [
'section' => AssociationField::new('section')
->setTemplatePath('@LcCaracole/admin/section/field/section.html.twig')
->setFormTypeOption('choices', $sectionArray)
]);
}

public function addSectionToFieldArrayIfOutOfSection(?SectionInterface $sectionCurrent, array $fieldArray)
{
$asObject = true;
if(is_string($fieldArray[array_key_first($fieldArray)])) {
$asObject = false;
}

$fieldSectionArray = [];
if($sectionCurrent == null) {
if($asObject) {
$allFieldArray = $this->getAllFields();
$fieldSectionArray = [$allFieldArray['section']];
}
else {
$fieldSectionArray = ['section'];
}
}

return array_merge($fieldSectionArray, $fieldArray);
}
}

+ 36
- 0
Definition/Field/Newsletter/NewsletterFieldDefinition.php View File

<?php

namespace Lc\CaracoleBundle\Definition\Field\Newsletter;

use Lc\CaracoleBundle\Definition\Field\FieldDefinitionTrait;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Definition\Field\Newsletter\NewsletterFieldDefinition as SovNewsletterFieldDefinition;
use Lc\SovBundle\Translation\TranslatorAdmin;

class NewsletterFieldDefinition extends SovNewsletterFieldDefinition
{
use FieldDefinitionTrait;

protected SectionStore $sectionStore;

public function __construct(TranslatorAdmin $translatorAdmin, SectionStore $sectionStore)
{
parent::__construct($translatorAdmin);
$this->sectionStore = $sectionStore;
}

public function configureIndex(): array
{
return $this->addSectionToFieldArrayIfOutOfSection($this->section, [
'id',
'title',
'isMain',
'status'
]);
}

public function configurePanelMain(): array
{
return array_merge(['section'], parent::configurePanelMain());
}
}

+ 11
- 1
Definition/Field/Order/OrderShopFieldDefinition.php View File

use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Context\MerchantContextTrait; use Lc\CaracoleBundle\Context\MerchantContextTrait;
use Lc\CaracoleBundle\Definition\Field\AbstractFieldDefinition;
use Lc\CaracoleBundle\Field\AssociationField; use Lc\CaracoleBundle\Field\AssociationField;
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;


class OrderShopFieldDefinition extends AbstractFieldDefinition class OrderShopFieldDefinition extends AbstractFieldDefinition
{ {
use MerchantContextTrait; use MerchantContextTrait;


protected SectionStore $sectionStore;

public function __construct(TranslatorAdmin $translatorAdmin, SectionStore $sectionStore)
{
parent::__construct($translatorAdmin);
$this->sectionStore = $sectionStore;
}

public function configureFieldsIndex(): array public function configureFieldsIndex(): array
{ {
return ['id']; return ['id'];

+ 79
- 0
Definition/Field/Product/ProductCategoryFieldDefinition.php View File

<?php

namespace Lc\CaracoleBundle\Definition\Field\Product;

use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Definition\Field\AbstractFieldDefinition;
use Lc\CaracoleBundle\Repository\Product\ProductCategoryStore;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\ToggleField;
use Lc\SovBundle\Translation\TranslatorAdmin;

class ProductCategoryFieldDefinition extends AbstractFieldDefinition
{
protected SectionStore $sectionStore;
protected ProductCategoryStore $productCategoryStore;

public function __construct(
TranslatorAdmin $translatorAdmin,
SectionStore $sectionStore,
ProductCategoryStore $productCategoryStore
) {
parent::__construct($translatorAdmin);
$this->sectionStore = $sectionStore;
$this->productCategoryStore = $productCategoryStore;
}

public function configureIndex(): array
{
$fieldArray = ($this->section == null) ? ['section'] : [];

return array_merge($fieldArray, [
'id',
'title',
'status'
]);
}

public function configurePanels(): array
{
return [
'main',
'seo',
'conf'
];
}

public function configurePanelMain()
{
return [
'section',
'title',
'parent',
'description',
'isEligibleTicketRestaurant',
'saleStatus',
'status',
];
}

public function configureFields(): array
{
$productCategoryArray = $this->productCategoryStore
->setSection($this->section)
->getParents();

return [
'title' => TextField::new('title')->setSortable(true),
'position' => NumberField::new('position')->setSortable(true),
'parent' => AssociationField::new('parent')
->setFormTypeOption('choices', $productCategoryArray),
'description' => CKEditorField::new('description'),
'saleStatus' => ToggleField::new('saleStatus')->setSortable(true),
'isEligibleTicketRestaurant' => ToggleField::new('isEligibleTicketRestaurant')->setSortable(true),
];
}
}

+ 27
- 0
Definition/Field/Reduction/ReductionCartFieldDefinition.php View File

<?php

namespace Lc\CaracoleBundle\Definition\Field\Reduction;

use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Definition\Field\AbstractFieldDefinition;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Translation\TranslatorAdmin;

class ReductionCartFieldDefinition extends AbstractFieldDefinition
{
protected SectionStore $sectionStore;

public function __construct(TranslatorAdmin $translatorAdmin, SectionStore $sectionStore)
{
parent::__construct($translatorAdmin);
$this->sectionStore = $sectionStore;
}

public function configureFields(): array
{
return [
'title' => TextField::new('title')->setSortable(true)
// @TODO : à faire
];
}
}

+ 27
- 0
Definition/Field/Reduction/ReductionCatalogFieldDefinition.php View File

<?php

namespace Lc\CaracoleBundle\Definition\Field\Reduction;

use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Definition\Field\AbstractFieldDefinition;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Translation\TranslatorAdmin;

class ReductionCatalogFieldDefinition extends AbstractFieldDefinition
{
protected SectionStore $sectionStore;

public function __construct(TranslatorAdmin $translatorAdmin, SectionStore $sectionStore)
{
parent::__construct($translatorAdmin);
$this->sectionStore = $sectionStore;
}

public function configureFields(): array
{
return [
'title' => TextField::new('title')->setSortable(true)
// @TODO : à faire
];
}
}

+ 31
- 0
Definition/Field/Site/NewsFieldDefinition.php View File

<?php

namespace Lc\CaracoleBundle\Definition\Field\Site;

use Lc\CaracoleBundle\Definition\Field\FieldDefinitionTrait;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Definition\Field\Site\NewsFieldDefinition as SovNewsFieldDefinition;
use Lc\SovBundle\Translation\TranslatorAdmin;

class NewsFieldDefinition extends SovNewsFieldDefinition
{
use FieldDefinitionTrait;

protected SectionStore $sectionStore;

public function __construct(TranslatorAdmin $translatorAdmin, SectionStore $sectionStore)
{
parent::__construct($translatorAdmin);
$this->sectionStore = $sectionStore;
}

public function configureIndex(): array
{
return $this->addSectionToFieldArrayIfOutOfSection($this->section, parent::configureIndex());
}

public function configurePanelMain(): array
{
return array_merge(['section'], parent::configurePanelMain());
}
}

+ 30
- 0
Definition/Field/Site/PageFieldDefinition.php View File

<?php

namespace Lc\CaracoleBundle\Definition\Field\Site;

use Lc\CaracoleBundle\Definition\Field\FieldDefinitionTrait;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Definition\Field\Site\PageFieldDefinition as SovPageFieldDefinition;
use Lc\SovBundle\Translation\TranslatorAdmin;

class PageFieldDefinition extends SovPageFieldDefinition
{
use FieldDefinitionTrait;

protected SectionStore $sectionStore;

public function __construct(TranslatorAdmin $translatorAdmin, SectionStore $sectionStore)
{
parent::__construct($translatorAdmin);
$this->sectionStore = $sectionStore;
}

public function configureIndex(): array
{
return [
'id',
'title',
'status'
];
}
}

+ 2
- 0
Factory/Site/PageFactory.php View File



class PageFactory extends SovPageFactory class PageFactory extends SovPageFactory
{ {
use MerchantContextTrait;
use SectionContextTrait; use SectionContextTrait;


public function create(): PageInterface public function create(): PageInterface
{ {
$page = parent::create(); $page = parent::create();


$page->setMerchant($this->merchant);
$page->setSection($this->section); $page->setSection($this->section);


return $page; return $page;

+ 3
- 0
Field/AssociationField.php View File

return $this; return $this;
} }


/**
* @deprecated Utiliser setFormTypeOption('choices', $choices) avec $choices issu d'un Store.
*/
public function initQueryBuilder(): self public function initQueryBuilder(): self
{ {
$param = $this->queryBuilderParameters; $param = $this->queryBuilderParameters;

+ 10
- 7
Form/Section/SwitchSectionFormType.php View File

use Lc\CaracoleBundle\Repository\Section\SectionRepository; use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Resolver\MerchantResolver; use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver; use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\CaracoleBundle\Solver\Section\SectionSolver;
use Lc\SovBundle\Doctrine\EntityManager; use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Translation\TranslatorAdmin; use Lc\SovBundle\Translation\TranslatorAdmin;


class SwitchSectionFormType extends AbstractType class SwitchSectionFormType extends AbstractType
{ {
protected $em;
protected $translatorAdmin;
protected $sectionResolver;
protected EntityManager $em;
protected TranslatorAdmin $translatorAdmin;
protected SectionResolver $sectionResolver;
protected SectionSolver $sectionSolver;


public function __construct( public function __construct(
EntityManager $em, EntityManager $em,
TranslatorAdmin $translatorAdmin, TranslatorAdmin $translatorAdmin,
SectionResolver $sectionResolver
SectionResolver $sectionResolver,
SectionSolver $sectionSolver
) { ) {
$this->em = $em; $this->em = $em;
$this->translatorAdmin = $translatorAdmin; $this->translatorAdmin = $translatorAdmin;
$this->sectionResolver = $sectionResolver; $this->sectionResolver = $sectionResolver;
$this->sectionSolver = $sectionSolver;
} }


public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
$styleButton = ''; $styleButton = '';
$classButton = 'btn-section'; $classButton = 'btn-section';
if ($section == $currentSection) { if ($section == $currentSection) {
$classButton .= ' btn-section-current section-'.$currentSection->getDevAlias();
//$styleButton = 'color: white; background-color: ' . $currentSection->getColor() . ';';
$classButton .= ' btn-section-current '.$this->sectionSolver->getHtmlClass($currentSection);
} }


$builder->add( $builder->add(
'submit', 'submit',
SubmitType::class, SubmitType::class,
[ [
'label' => $section ? $section->getTitle() : '',
'label' => $section ? $section->getTitle() : 'Tout afficher',
'attr' => [ 'attr' => [
'class' => $classButton, 'class' => $classButton,
'style' => $styleButton, 'style' => $styleButton,

+ 21
- 3
Model/Site/PageModel.php View File

namespace Lc\CaracoleBundle\Model\Site; namespace Lc\CaracoleBundle\Model\Site;


use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface; use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\SovBundle\Model\Site\PageModel as SovPageModel; use Lc\SovBundle\Model\Site\PageModel as SovPageModel;


/** /**
* @ORM\MappedSuperclass() * @ORM\MappedSuperclass()
*/ */
abstract class PageModel extends SovPageModel implements FilterSectionInterface
abstract class PageModel extends SovPageModel implements FilterMerchantInterface, FilterSectionInterface
{ {
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;


/** /**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="pages") * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="pages")
* @ORM\JoinColumn(nullable=false)
* @ORM\JoinColumn(nullable=true)
*/ */
protected $section; protected $section;


public function getMerchant(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getSection(): SectionInterface public function getSection(): SectionInterface
{ {
return $this->section; return $this->section;


return $this; return $this;
} }

} }

+ 10
- 0
Repository/AbstractStore.php View File

<?php

namespace Lc\CaracoleBundle\Repository;

Use Lc\SovBundle\Repository\AbstractStore as SovAbstractStore;

abstract class AbstractStore extends SovAbstractStore
{
use StoreTrait;
}

+ 1
- 1
Repository/Address/AddressStore.php View File



namespace Lc\CaracoleBundle\Repository\Address; namespace Lc\CaracoleBundle\Repository\Address;


use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class AddressStore extends AbstractStore class AddressStore extends AbstractStore

+ 1
- 3
Repository/Config/TaxRateStore.php View File



namespace Lc\CaracoleBundle\Repository\Config; namespace Lc\CaracoleBundle\Repository\Config;


use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class TaxRateStore extends AbstractStore class TaxRateStore extends AbstractStore

+ 1
- 1
Repository/Config/UnitStore.php View File



namespace Lc\CaracoleBundle\Repository\Config; namespace Lc\CaracoleBundle\Repository\Config;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class UnitStore extends AbstractStore class UnitStore extends AbstractStore

+ 1
- 1
Repository/Credit/CreditHistoryStore.php View File



use App\Entity\User\UserMerchant; use App\Entity\User\UserMerchant;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use DateTime; use DateTime;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;



+ 1
- 3
Repository/Distribution/DistributionStore.php View File

namespace Lc\CaracoleBundle\Repository\Distribution; namespace Lc\CaracoleBundle\Repository\Distribution;


use App\Entity\Distribution\Distribution; use App\Entity\Distribution\Distribution;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class DistributionStore extends AbstractStore class DistributionStore extends AbstractStore

+ 1
- 1
Repository/File/DocumentStore.php View File

use Lc\CaracoleBundle\Model\File\DocumentInterface; use Lc\CaracoleBundle\Model\File\DocumentInterface;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class DocumentStore extends AbstractStore class DocumentStore extends AbstractStore

+ 1
- 2
Repository/Merchant/MerchantStore.php View File



namespace Lc\CaracoleBundle\Repository\Merchant; namespace Lc\CaracoleBundle\Repository\Merchant;


use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class MerchantStore extends AbstractStore class MerchantStore extends AbstractStore

+ 2
- 2
Repository/MerchantStoreTrait.php View File



trait MerchantStoreTrait trait MerchantStoreTrait
{ {
protected MerchantInterface $merchant;
protected ?MerchantInterface $merchant = null;


public function setMerchant(MerchantInterface $merchant):self
public function setMerchant(?MerchantInterface $merchant):self
{ {
$this->merchant = $merchant; $this->merchant = $merchant;



+ 2
- 0
Repository/Newsletter/NewsletterStore.php View File



use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\CaracoleBundle\Repository\StoreTrait;
use Lc\SovBundle\Repository\Newsletter\NewsletterStore as SovNewsletterStore; use Lc\SovBundle\Repository\Newsletter\NewsletterStore as SovNewsletterStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class NewsletterStore extends SovNewsletterStore class NewsletterStore extends SovNewsletterStore
{ {
use StoreTrait;
use SectionStoreTrait; use SectionStoreTrait;


public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface

+ 1
- 1
Repository/Order/OrderPaymentStore.php View File



namespace Lc\CaracoleBundle\Repository\Order; namespace Lc\CaracoleBundle\Repository\Order;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OrderPaymentStore extends AbstractStore class OrderPaymentStore extends AbstractStore

+ 1
- 1
Repository/Order/OrderProductReductionCatalogStore.php View File



namespace Lc\CaracoleBundle\Repository\Order; namespace Lc\CaracoleBundle\Repository\Order;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OrderProductReductionCatalogStore extends AbstractStore class OrderProductReductionCatalogStore extends AbstractStore

+ 1
- 1
Repository/Order/OrderProductRefundStore.php View File



namespace Lc\CaracoleBundle\Repository\Order; namespace Lc\CaracoleBundle\Repository\Order;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OrderProductRefundStore extends AbstractStore class OrderProductRefundStore extends AbstractStore

+ 1
- 1
Repository/Order/OrderProductStore.php View File

use Lc\CaracoleBundle\Model\Order\OrderStatusModel; use Lc\CaracoleBundle\Model\Order\OrderStatusModel;
use Lc\CaracoleBundle\Model\Product\ProductInterface; use Lc\CaracoleBundle\Model\Product\ProductInterface;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OrderProductStore extends AbstractStore class OrderProductStore extends AbstractStore

+ 1
- 1
Repository/Order/OrderReductionCartStore.php View File



namespace Lc\CaracoleBundle\Repository\Order; namespace Lc\CaracoleBundle\Repository\Order;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OrderReductionCartStore extends AbstractStore class OrderReductionCartStore extends AbstractStore

+ 1
- 1
Repository/Order/OrderReductionCreditStore.php View File



namespace Lc\CaracoleBundle\Repository\Order; namespace Lc\CaracoleBundle\Repository\Order;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OrderReductionCreditStore extends AbstractStore class OrderReductionCreditStore extends AbstractStore

+ 1
- 1
Repository/Order/OrderRefundStore.php View File



namespace Lc\CaracoleBundle\Repository\Order; namespace Lc\CaracoleBundle\Repository\Order;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OrderRefundStore extends AbstractStore class OrderRefundStore extends AbstractStore

+ 1
- 1
Repository/Order/OrderShopStore.php View File

use Lc\CaracoleBundle\Solver\Price\PriceSolver; use Lc\CaracoleBundle\Solver\Price\PriceSolver;
use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver; use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver;
use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;

+ 1
- 1
Repository/Order/OrderStatusHistoryStore.php View File



namespace Lc\CaracoleBundle\Repository\Order; namespace Lc\CaracoleBundle\Repository\Order;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OrderStatusHistoryStore extends AbstractStore class OrderStatusHistoryStore extends AbstractStore

+ 1
- 1
Repository/Order/OrderStatusStore.php View File



namespace Lc\CaracoleBundle\Repository\Order; namespace Lc\CaracoleBundle\Repository\Order;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OrderStatusStore extends AbstractStore class OrderStatusStore extends AbstractStore

+ 1
- 1
Repository/PointSale/PointSaleStore.php View File

namespace Lc\CaracoleBundle\Repository\PointSale; namespace Lc\CaracoleBundle\Repository\PointSale;


use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class PointSaleStore extends AbstractStore class PointSaleStore extends AbstractStore

+ 1
- 1
Repository/Product/ProductCategoryStore.php View File



use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class ProductCategoryStore extends AbstractStore class ProductCategoryStore extends AbstractStore

+ 1
- 1
Repository/Product/ProductFamilySectionPropertyStore.php View File



use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class ProductFamilySectionPropertyStore extends AbstractStore class ProductFamilySectionPropertyStore extends AbstractStore

+ 1
- 1
Repository/Product/ProductFamilyStore.php View File

use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\CaracoleBundle\Solver\Price\PriceSolver; use Lc\CaracoleBundle\Solver\Price\PriceSolver;
use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class ProductFamilyStore extends AbstractStore class ProductFamilyStore extends AbstractStore

+ 3
- 2
Repository/Product/ProductStore.php View File

namespace Lc\CaracoleBundle\Repository\Product; namespace Lc\CaracoleBundle\Repository\Product;


use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class ProductStore extends AbstractStore class ProductStore extends AbstractStore


public function filtersDefault($query):RepositoryQueryInterface public function filtersDefault($query):RepositoryQueryInterface
{ {
$this->addFilterBySectionOptionnal($query);
$query->filterIsOnlineAndOffline(); $query->filterIsOnlineAndOffline();
$query->filterBySection($this->section);
return $query; return $query;
} }



+ 1
- 1
Repository/Product/QualityLabelStore.php View File



namespace Lc\CaracoleBundle\Repository\Product; namespace Lc\CaracoleBundle\Repository\Product;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class QualityLabelStore extends AbstractStore class QualityLabelStore extends AbstractStore

+ 1
- 5
Repository/Reduction/ReductionCartStore.php View File



namespace Lc\CaracoleBundle\Repository\Reduction; namespace Lc\CaracoleBundle\Repository\Reduction;


use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface;
use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\CaracoleBundle\Solver\Price\PriceSolver; use Lc\CaracoleBundle\Solver\Price\PriceSolver;
use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver; use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;


class ReductionCartStore extends AbstractStore class ReductionCartStore extends AbstractStore
{ {

+ 1
- 1
Repository/Reduction/ReductionCatalogStore.php View File



use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class ReductionCatalogStore extends AbstractStore class ReductionCatalogStore extends AbstractStore

+ 1
- 5
Repository/Reduction/ReductionCreditStore.php View File



namespace Lc\CaracoleBundle\Repository\Reduction; namespace Lc\CaracoleBundle\Repository\Reduction;


use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class ReductionCreditStore extends AbstractStore class ReductionCreditStore extends AbstractStore

+ 2
- 1
Repository/Reminder/ReminderStore.php View File



use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\CaracoleBundle\Repository\StoreTrait;
use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore; use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class ReminderStore extends SovReminderStore class ReminderStore extends SovReminderStore
{ {
use StoreTrait;
use SectionStoreTrait; use SectionStoreTrait;
use MerchantStoreTrait; use MerchantStoreTrait;



+ 1
- 2
Repository/Section/OpeningStore.php View File

namespace Lc\CaracoleBundle\Repository\Section; namespace Lc\CaracoleBundle\Repository\Section;


use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\CaracoleBundle\Solver\Section\OpeningSolver;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class OpeningStore extends AbstractStore class OpeningStore extends AbstractStore

+ 1
- 2
Repository/Section/SectionStore.php View File



namespace Lc\CaracoleBundle\Repository\Section; namespace Lc\CaracoleBundle\Repository\Section;


use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface; use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;



+ 1
- 1
Repository/SectionStoreTrait.php View File

{ {
protected ?SectionInterface $section = null; protected ?SectionInterface $section = null;


public function setSection(SectionInterface $section):self
public function setSection(?SectionInterface $section):self
{ {
$this->section = $section; $this->section = $section;



+ 1
- 1
Repository/Setting/MerchantSettingStore.php View File

namespace Lc\CaracoleBundle\Repository\Setting; namespace Lc\CaracoleBundle\Repository\Setting;


use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class MerchantSettingStore extends AbstractStore class MerchantSettingStore extends AbstractStore

+ 1
- 1
Repository/Setting/SectionSettingStore.php View File

namespace Lc\CaracoleBundle\Repository\Setting; namespace Lc\CaracoleBundle\Repository\Setting;


use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class SectionSettingStore extends AbstractStore class SectionSettingStore extends AbstractStore

+ 3
- 1
Repository/Site/NewsStore.php View File

namespace Lc\CaracoleBundle\Repository\Site; namespace Lc\CaracoleBundle\Repository\Site;


use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\CaracoleBundle\Repository\StoreTrait;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\Site\NewsStore as SovNewsStore; use Lc\SovBundle\Repository\Site\NewsStore as SovNewsStore;


class NewsStore extends SovNewsStore class NewsStore extends SovNewsStore
{ {
use StoreTrait;
use SectionStoreTrait; use SectionStoreTrait;


public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{ {
$query->filterBySection($this->section);
$this->addFilterBySectionOptionnal($query);
return parent::filtersDefault($query); return parent::filtersDefault($query);
} }



+ 2
- 1
Repository/Site/PageRepositoryQuery.php View File



namespace Lc\CaracoleBundle\Repository\Site; namespace Lc\CaracoleBundle\Repository\Site;


use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait; use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
use Lc\SovBundle\Repository\Site\PageRepositoryQuery as SovPageRepositoryQuery; use Lc\SovBundle\Repository\Site\PageRepositoryQuery as SovPageRepositoryQuery;


class PageRepositoryQuery extends SovPageRepositoryQuery class PageRepositoryQuery extends SovPageRepositoryQuery
{ {
use MerchantRepositoryQueryTrait;
use SectionRepositoryQueryTrait; use SectionRepositoryQueryTrait;

} }

+ 7
- 3
Repository/Site/PageStore.php View File



namespace Lc\CaracoleBundle\Repository\Site; namespace Lc\CaracoleBundle\Repository\Site;


use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Model\Site\PageInterface;
use Lc\CaracoleBundle\Repository\StoreTrait;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\Site\PageStore as SovPageStore; use Lc\SovBundle\Repository\Site\PageStore as SovPageStore;


class PageStore extends SovPageStore class PageStore extends SovPageStore
{ {
use StoreTrait;
use MerchantStoreTrait;
use SectionStoreTrait; use SectionStoreTrait;


public function __construct(PageRepositoryQuery $query) public function __construct(PageRepositoryQuery $query)


public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{ {
$query->filterBySection($this->section);
$this->addFilterByMerchantOptionnal($query);
$this->addFilterBySectionOptionnal($query);

return parent::filtersDefault($query); return parent::filtersDefault($query);
} }



+ 17
- 0
Repository/StoreTrait.php View File

<?php

namespace Lc\CaracoleBundle\Repository;

trait StoreTrait
{
public function resetContext(): void
{
if(method_exists($this, 'setMerchant')) {
$this->setMerchant(null);
}

if(method_exists($this, 'setSection')) {
$this->setSection(null);
}
}
}

+ 3
- 2
Repository/Ticket/TicketStore.php View File

namespace Lc\CaracoleBundle\Repository\Ticket; namespace Lc\CaracoleBundle\Repository\Ticket;


use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\CaracoleBundle\Repository\StoreTrait;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\Ticket\TicketStore as SovTicketStore; use Lc\SovBundle\Repository\Ticket\TicketStore as SovTicketStore;


class TicketStore extends SovTicketStore class TicketStore extends SovTicketStore
{ {
use StoreTrait;
use SectionStoreTrait; use SectionStoreTrait;


public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{ {
$query->filterBySection($this->section);
$this->addFilterBySectionOptionnal($query);
return $query; return $query;
} }



+ 3
- 2
Repository/User/GroupUserStore.php View File

namespace Lc\CaracoleBundle\Repository\User; namespace Lc\CaracoleBundle\Repository\User;


use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\StoreTrait;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\User\GroupUserStore as SovGroupUserStore; use Lc\SovBundle\Repository\User\GroupUserStore as SovGroupUserStore;


class GroupUserStore extends SovGroupUserStore class GroupUserStore extends SovGroupUserStore
{ {
use StoreTrait;
use MerchantStoreTrait; use MerchantStoreTrait;


public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{ {
$query->filterByMerchant($this->merchant);
$this->addFilterByMerchantOptionnal($query);
return parent::filtersDefault($query); return parent::filtersDefault($query);
} }

} }

+ 1
- 2
Repository/User/UserMerchantStore.php View File



namespace Lc\CaracoleBundle\Repository\User; namespace Lc\CaracoleBundle\Repository\User;


use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\User\UserMerchantInterface; use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Solver\User\UserMerchantSolver; use Lc\CaracoleBundle\Solver\User\UserMerchantSolver;
use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class UserMerchantStore extends AbstractStore class UserMerchantStore extends AbstractStore

+ 1
- 1
Repository/User/UserPointSaleStore.php View File



namespace Lc\CaracoleBundle\Repository\User; namespace Lc\CaracoleBundle\Repository\User;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class UserPointSaleStore extends AbstractStore class UserPointSaleStore extends AbstractStore

+ 4
- 2
Repository/User/UserStore.php View File



namespace Lc\CaracoleBundle\Repository\User; namespace Lc\CaracoleBundle\Repository\User;


use App\Entity\Newsletter\Newsletter;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\StoreTrait;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\User\UserStore as SovUserStore; use Lc\SovBundle\Repository\User\UserStore as SovUserStore;


class UserStore extends SovUserStore class UserStore extends SovUserStore
{ {
use StoreTrait;
use MerchantStoreTrait; use MerchantStoreTrait;


public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{ {
$query->filterByMerchant($this->merchant);
$this->addFilterByMerchantOptionnal($query);

return $query; return $query;
} }



+ 1
- 1
Repository/User/VisitorStore.php View File



namespace Lc\CaracoleBundle\Repository\User; namespace Lc\CaracoleBundle\Repository\User;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class VisitorStore extends AbstractStore class VisitorStore extends AbstractStore

+ 12
- 3
Resolver/SectionResolver.php View File



class SectionResolver class SectionResolver
{ {
protected bool $isCachedSection = false;
protected ?SectionInterface $section = null; protected ?SectionInterface $section = null;


protected EntityManagerInterface $entityManager; protected EntityManagerInterface $entityManager;


// admin // admin
if (isset($requestAttributesArray['easyadmin_context'])) { if (isset($requestAttributesArray['easyadmin_context'])) {
if ($this->section === null) {
if (!$this->isCachedSection) {
$currentAdminSection = null; $currentAdminSection = null;
$userMerchant = $this->merchantResolver->getUserMerchant(); $userMerchant = $this->merchantResolver->getUserMerchant();


$currentAdminSection = $userMerchant->getCurrentAdminSection(); $currentAdminSection = $userMerchant->getCurrentAdminSection();
} }


if ($currentAdminSection === null) {
/*if ($currentAdminSection === null) {
$currentAdminSection = $this->sectionStore $currentAdminSection = $this->sectionStore
->setMerchant($userMerchant->getMerchant()) ->setMerchant($userMerchant->getMerchant())
->getOneDefault(); ->getOneDefault();
if ($currentAdminSection === null) { if ($currentAdminSection === null) {
throw new \ErrorException('Aucune section par défaut définie pour ce merchant'); throw new \ErrorException('Aucune section par défaut définie pour ce merchant');
} }
}
}*/

$this->isCachedSection = true;
$this->section = $currentAdminSection; $this->section = $currentAdminSection;

return $currentAdminSection; return $currentAdminSection;
}else{ }else{
return $this->section; return $this->section;
} }
} }


public function isOutOfSection(): bool
{
return $this->getCurrent() == null;
}

public function getDefault(): SectionInterface public function getDefault(): SectionInterface
{ {
return $this->sectionStore->setMerchant($this->merchantResolver->getCurrent())->getOneDefault(); return $this->sectionStore->setMerchant($this->merchantResolver->getCurrent())->getOneDefault();

+ 2
- 0
Resources/translations/admin.fr.yaml View File

taxRate: Règle de taxe taxRate: Règle de taxe
merchants: Marchands merchants: Marchands
sections: Sections sections: Sections
section: Section
behaviorTaxRate: Avec ou sans TVA behaviorTaxRate: Avec ou sans TVA
behaviorTaxRateChoices: behaviorTaxRateChoices:
tax-excluded: TVA exclue tax-excluded: TVA exclue
priceWithTax: Prix de vente priceWithTax: Prix de vente
sales: Historique des ventes sales: Historique des ventes
propertyQualityLabelActive: Marquer le produit comme labellisé propertyQualityLabelActive: Marquer le produit comme labellisé
productFamilySectionProperties: Sections


QualityLabel: QualityLabel:
label: Label de qualité label: Label de qualité

+ 3
- 1
Resources/views/admin/product/field/product_family_sales.html.twig View File



{% import '@LcCaracole/admin/product/macro/product_family_macro.html.twig' as pfm %} {% import '@LcCaracole/admin/product/macro/product_family_macro.html.twig' as pfm %}
{% set section_current = section_container.resolver.getCurrent() %} {% set section_current = section_container.resolver.getCurrent() %}
{{ pfm.product_family_sales_statistic(order_shop_container.builder.getProductsSalesStatistic(section_current, entity.instance, 2), entity.instance) }}
{% if section_current %}
{{ pfm.product_family_sales_statistic(order_shop_container.builder.getProductsSalesStatistic(section_current, entity.instance, 2), entity.instance) }}
{% endif %}

+ 7
- 0
Resources/views/admin/product/field/product_family_section_properties.html.twig View File

{% import '@LcCaracole/admin/section/macros.html.twig' as macros_section %}
{% set item = entity.instance %}
{% for section_property in item.productFamilySectionProperties %}
{{ macros_section.section_badge(section_property.section) }}
{% else %}
<span class="badge badge-secondary">Aucune</span>
{% endfor %}

+ 7
- 0
Resources/views/admin/section/field/section.html.twig View File

{% import '@LcCaracole/admin/section/macros.html.twig' as macros_section %}
{% set item = entity.instance %}
{% if item.section %}
{{ macros_section.section_badge(item.section) }}
{% else %}
<span class="badge badge-secondary">Aucune</span>
{% endif %}

+ 7
- 0
Resources/views/admin/section/field/sections.html.twig View File

{% import '@LcCaracole/admin/section/macros.html.twig' as macros_section %}
{% set item = entity.instance %}
{% for section in item.sections %}
{{ macros_section.section_badge(section) }}
{% else %}
<span class="badge badge-secondary">Aucune</span>
{% endfor %}

+ 4
- 0
Resources/views/admin/section/macros.html.twig View File


{% macro section_badge(section) %}
<span class="badge badge-secondary {{ section_container.solver.getHtmlClass(section) }}">{{ section.title }}</span>
{% endmacro %}

+ 2
- 2
Resources/views/admin/setting/edit_section.html.twig View File

{% extends '@LcCaracole/adminlte/layout.html.twig' %} {% extends '@LcCaracole/adminlte/layout.html.twig' %}


{% block content_title %} {% block content_title %}
{% set current_section = resolver.getCurrent() %}
Paramètres section &gt; {{ current_section.title }}
{% if resolver is defined %}{% set current_section = resolver.getCurrent() %}{% endif %}
Paramètres section{% if current_section is defined and current_section %} &gt; {{ current_section.title }}{% endif %}
{% endblock %} {% endblock %}


{% block main %} {% block main %}

+ 14
- 8
Resources/views/adminlte/layout.html.twig View File

{% set section_current = section_current() %} {% set section_current = section_current() %}
{% set is_display_switch_section = display_switch_section is defined and display_switch_section %} {% set is_display_switch_section = display_switch_section is defined and display_switch_section %}


<nav class="carac navbar navbar-expand navbar-light main-header{% if is_display_switch_section %} display-section-switch section-{{ section_current.devAlias }}{% endif %}">
<nav class="carac navbar navbar-expand navbar-light main-header{% if is_display_switch_section %} display-section-switch {{ section_container.solver.getHtmlClass(section_current()) }}{% endif %}">


{% if is_display_switch_section %} {% if is_display_switch_section %}
<ul class="navbar-nav left"> <ul class="navbar-nav left">
<li class="nav-item d-none d-sm-inline-block">
{{ _self.form_switch_section(null) }}
</li>
{% for section in carac_sections() %} {% for section in carac_sections() %}
<li class="nav-item d-none d-sm-inline-block"> <li class="nav-item d-none d-sm-inline-block">
{% set form_switch_section = carac_form_switch_section(section) %}
{% form_theme form_switch_section '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form_switch_section) }}
{{ form(form_switch_section) }}
{{ form_end(form_switch_section) }}
{{ _self.form_switch_section(section) }}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% include '@LcSov/admin/reminder/block.html.twig' %} {% include '@LcSov/admin/reminder/block.html.twig' %}
{% endblock %} {% endblock %}



{% block append_body %} {% block append_body %}
{# modal switch merchant #} {# modal switch merchant #}
{% set user = app.user %} {% set user = app.user %}
{# modal affichée uniquement si la sessionStorage.visit_merchant n'est pas défini (js) #} {# modal affichée uniquement si la sessionStorage.visit_merchant n'est pas défini (js) #}
{% include '@LcCaracole/admin/merchant/modal/switch_merchant.html.twig' %} {% include '@LcCaracole/admin/merchant/modal/switch_merchant.html.twig' %}
{% endif %} {% endif %}
{% endblock %}
{% endblock %}

{% macro form_switch_section(section) %}
{% set form_switch_section = carac_form_switch_section(section) %}
{% form_theme form_switch_section '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form_switch_section) }}
{{ form(form_switch_section) }}
{{ form_end(form_switch_section) }}
{% endmacro %}

+ 6
- 0
Solver/Section/SectionSolver.php View File



class SectionSolver class SectionSolver
{ {
public function getHtmlClass(?SectionInterface $section): string
{
$htmlClass = 'section-';
$htmlClass .= $section ? $section->getDevAlias() : 'all';


return $htmlClass;
}
} }

+ 1
- 1
Twig/StoreTwigExtension.php View File

return $this->merchantStore->getOnline(); return $this->merchantStore->getOnline();
} }


public function getSectionCurrent(): SectionInterface
public function getSectionCurrent(): ?SectionInterface
{ {
return $this->sectionResolver->getCurrent(); return $this->sectionResolver->getCurrent();
} }

Loading…
Cancel
Save