소스 검색

Gestion des stocks avancé

packProduct
Fabien Normand 3 년 전
부모
커밋
7028bd6bf7
25개의 변경된 파일225개의 추가작업 그리고 192개의 파일을 삭제
  1. +0
    -1
      Builder/Product/ProductFamilyBuilder.php
  2. +47
    -0
      Builder/Product/ProductFamilySectionPropertyBuilder.php
  3. +13
    -6
      Container/Product/ProductFamilySectionPropertyContainer.php
  4. +5
    -1
      Controller/Order/OrderStatusAdminController.php
  5. +7
    -6
      Controller/Product/ProductCategoryAdminController.php
  6. +9
    -4
      Controller/Product/ProductFamilyAdminController.php
  7. +7
    -12
      Controller/Reduction/ReductionCartAdminController.php
  8. +7
    -15
      Controller/Reduction/ReductionCatalogAdminController.php
  9. +6
    -12
      Controller/Reduction/ReductionCreditAdminController.php
  10. +2
    -3
      Controller/Section/OpeningAdminController.php
  11. +8
    -16
      Controller/Section/SectionAdminController.php
  12. +4
    -6
      Controller/Site/NewsAdminController.php
  13. +3
    -7
      Controller/Site/PageAdminController.php
  14. +4
    -10
      Controller/Ticket/TicketAdminController.php
  15. +4
    -7
      Controller/User/GroupUserAdminController.php
  16. +57
    -59
      Controller/User/UserMerchantAdminController.php
  17. +3
    -4
      EventSubscriber/MerchantSectionPropertyEventSubscriber.php
  18. +7
    -4
      Factory/Product/ProductFamilyFactory.php
  19. +2
    -2
      Factory/Ticket/TicketFactory.php
  20. +9
    -3
      Factory/User/UserMerchantFactory.php
  21. +2
    -2
      Form/Section/SwitchSectionFormType.php
  22. +5
    -1
      Repository/Product/ProductFamilySectionPropertyRepositoryQuery.php
  23. +11
    -2
      Repository/Product/ProductFamilySectionPropertyStore.php
  24. +2
    -8
      Repository/Reduction/ReductionCatalogStore.php
  25. +1
    -1
      Resources/views/adminlte/layout.html.twig

+ 0
- 1
Builder/Product/ProductFamilyBuilder.php 파일 보기

@@ -2,7 +2,6 @@

namespace Lc\CaracoleBundle\Builder\Product;


class ProductFamilyBuilder
{


+ 47
- 0
Builder/Product/ProductFamilySectionPropertyBuilder.php 파일 보기

@@ -0,0 +1,47 @@
<?php

namespace Lc\CaracoleBundle\Builder\Product;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Factory\Product\ProductFamilySectionPropertyFactory;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\Product\ProductFamilySectionPropertyStore;

class ProductFamilySectionPropertyBuilder
{
protected EntityManagerInterface $entityManager;
protected ProductFamilySectionPropertyFactory $productFamilySectionPropertyFactory;
protected ProductFamilySectionPropertyStore $productFamilySectionPropertyStore;

public function __construct(
EntityManagerInterface $entityManager,
ProductFamilySectionPropertyFactory $productFamilySectionPropertyFactory,
ProductFamilySectionPropertyStore $productFamilySectionPropertyStore
) {
$this->entityManager = $entityManager;
$this->productFamilySectionPropertyFactory = $productFamilySectionPropertyFactory;
$this->productFamilySectionPropertyStore = $productFamilySectionPropertyStore;
}

public function enable(ProductFamilyInterface $productFamily, SectionInterface $section): void
{
$productFamilySectionProperty = $this->productFamilySectionPropertyStore
->setSection($section)
->getOneByProductFamily($productFamily);

if ($productFamilySectionProperty) {
if (!$productFamilySectionProperty->getStatus()) {
$productFamilySectionProperty->setStatus(1);
$this->entityManager->update($productFamilySectionProperty);
}
} else {
$productFamilySectionProperty = $this->productFamilySectionPropertyFactory->create($section, $productFamily);
$productFamilySectionProperty->setStatus(1);
$this->entityManager->create($productFamilySectionProperty);
}

$this->entityManager->flush();
}

}

+ 13
- 6
Container/Product/ProductFamilySectionPropertyContainer.php 파일 보기

@@ -4,6 +4,7 @@ namespace Lc\CaracoleBundle\Container\Product;

use App\Definition\Field\Product\ProductFamilyFieldDefinition;
use Lc\CaracoleBundle\Builder\Product\ProductFamilyBuilder;
use Lc\CaracoleBundle\Builder\Product\ProductFamilySectionPropertyBuilder;
use Lc\CaracoleBundle\Factory\Product\ProductFamilyFactory;
use Lc\CaracoleBundle\Factory\Product\ProductFamilySectionPropertyFactory;
use Lc\CaracoleBundle\Repository\Product\ProductFamilyRepositoryQuery;
@@ -20,18 +21,20 @@ class ProductFamilySectionPropertyContainer
protected ProductFamilySectionPropertySolver $solver;
protected ProductFamilySectionPropertyRepositoryQuery $repositoryQuery;
protected ProductFamilySectionPropertyStore $store;
protected ProductFamilySectionPropertyBuilder $builder;

public function __construct(
ProductFamilySectionPropertyFactory $factory,
ProductFamilySectionPropertySolver $solver,
ProductFamilySectionPropertyRepositoryQuery $repositoryQuery,
ProductFamilySectionPropertyStore $store
)
{
ProductFamilySectionPropertyFactory $factory,
ProductFamilySectionPropertySolver $solver,
ProductFamilySectionPropertyRepositoryQuery $repositoryQuery,
ProductFamilySectionPropertyStore $store,
ProductFamilySectionPropertyBuilder $builder
) {
$this->factory = $factory;
$this->solver = $solver;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
$this->builder = $builder;
}

public function getFactory(): ProductFamilySectionPropertyFactory
@@ -54,4 +57,8 @@ class ProductFamilySectionPropertyContainer
return $this->store;
}

public function getBuilder(): ProductFamilySectionPropertyBuilder
{
return $this->builder;
}
}

+ 5
- 1
Controller/Order/OrderStatusAdminController.php 파일 보기

@@ -2,7 +2,6 @@

namespace Lc\CaracoleBundle\Controller\Order;


use Lc\CaracoleBundle\Container\Order\OrderStatusContainer;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
@@ -16,4 +15,9 @@ abstract class OrderStatusAdminController extends AbstractAdminController
{
return $this->get(OrderStatusContainer::class)->getRepositoryQuery();
}

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

+ 7
- 6
Controller/Product/ProductCategoryAdminController.php 파일 보기

@@ -8,9 +8,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Field\ToggleField;
@@ -18,11 +16,14 @@ use Lc\SovBundle\Repository\RepositoryQueryInterface;

abstract class ProductCategoryAdminController extends AbstractAdminController
{
use AdminControllerTrait;

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

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

public function configureFields(string $pageName): iterable

+ 9
- 4
Controller/Product/ProductFamilyAdminController.php 파일 보기

@@ -6,22 +6,27 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpFoundation\Response;

abstract class ProductFamilyAdminController extends AbstractAdminController
{
use AdminControllerTrait;


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

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


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

+ 7
- 12
Controller/Reduction/ReductionCartAdminController.php 파일 보기

@@ -2,26 +2,21 @@

namespace Lc\CaracoleBundle\Controller\Reduction;


use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\Reduction\ReductionCartContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Model\Config\TaxRateModel;
use Lc\CaracoleBundle\Model\Config\UnitModel;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Lc\CaracoleBundle\Controller\AbstractAdminController;

abstract class ReductionCartAdminController extends AbstractAdminController
{
use AdminControllerTrait;


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

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

}

+ 7
- 15
Controller/Reduction/ReductionCatalogAdminController.php 파일 보기

@@ -2,26 +2,18 @@

namespace Lc\CaracoleBundle\Controller\Reduction;


use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\Reduction\ReductionCatalogContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Model\Config\TaxRateModel;
use Lc\CaracoleBundle\Model\Config\UnitModel;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;

abstract class ReductionCatalogAdminController extends AbstractAdminController
{
use AdminControllerTrait;


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

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

+ 6
- 12
Controller/Reduction/ReductionCreditAdminController.php 파일 보기

@@ -2,25 +2,19 @@

namespace Lc\CaracoleBundle\Controller\Reduction;


use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\Reduction\ReductionCreditContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Model\Config\TaxRateModel;
use Lc\CaracoleBundle\Model\Config\UnitModel;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;

abstract class ReductionCreditAdminController extends AbstractAdminController
{
use AdminControllerTrait;


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

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

+ 2
- 3
Controller/Section/OpeningAdminController.php 파일 보기

@@ -64,9 +64,8 @@ abstract class OpeningAdminController extends AbstractAdminController

public function createEntity(string $entityFqcn)
{
return $this->get(OpeningContainer::class)
return $this->getOpeningContainer()
->getFactory()
->create($this->get(SectionResolver::class)->getCurrent());
->create($this->getSectionCurrent());
}

}

+ 8
- 16
Controller/Section/SectionAdminController.php 파일 보기

@@ -7,30 +7,29 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\Section\SectionContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Factory\Section\SectionFactory;
use Lc\CaracoleBundle\Form\Section\OpeningsFormType;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Model\Section\SectionModel;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionFactory;
use Symfony\Component\Routing\Annotation\Route;

abstract class SectionAdminController extends AbstractAdminController
{
use AdminControllerTrait;


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

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

public function configureFields(string $pageName): iterable
{
return array_merge(
@@ -63,11 +62,4 @@ abstract class SectionAdminController extends AbstractAdminController
);
}

public function createEntity(string $entityFqcn)
{
return $this->get(SectionContainer::class)
->getFactory()
->create($this->get(MerchantResolver::class)->getCurrent());
}

}

+ 4
- 6
Controller/Site/NewsAdminController.php 파일 보기

@@ -2,20 +2,18 @@

namespace Lc\CaracoleBundle\Controller\Site;

use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Container\Site\NewsContainer;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\SovBundle\Controller\Site\NewsAdminController as SovNewsAdminController;

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

public function createEntity(string $entityFqcn)
{
return $this->get(NewsContainer::class)
return $this->getNewsContainer()
->getFactory()
->setSection($this->get(SectionResolver::class)->getCurrent())
->setSection($this->getSectionCurrent())
->create();
}
}

+ 3
- 7
Controller/Site/PageAdminController.php 파일 보기

@@ -2,23 +2,19 @@

namespace Lc\CaracoleBundle\Controller\Site;

use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Factory\Site\PageFactory;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Container\Site\PageContainer;
use Lc\SovBundle\Controller\Site\PageAdminController as SovPageAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

abstract class PageAdminController extends SovPageAdminController
{
use AdminControllerTrait;

use ControllerTrait;

public function createEntity(string $entityFqcn)
{
return $this->getPageContainer()
->getFactory()
->setSection($this->get(SectionResolver::class)->getCurrent())
->setSection($this->getSectionCurrent())
->create();
}
}

+ 4
- 10
Controller/Ticket/TicketAdminController.php 파일 보기

@@ -2,24 +2,18 @@

namespace Lc\CaracoleBundle\Controller\Ticket;

use App\Entity\Ticket\Ticket;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Container\Ticket\TicketContainer;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController;
use Lc\CaracoleBundle\Factory\Ticket\TicketFactory;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

abstract class TicketAdminController extends SovTicketAdminController
{
use AdminControllerTrait;
use ControllerTrait;

public function createEntity(string $entityFqcn)
{
return $this->get(TicketContainer::class)
return $this->getTicketContainer()
->getFactory()
->setMerchant($this->get(MerchantResolver::class)->getCurrent())
->setSection($this->getSectionCurrent())
->create();
}

}

+ 4
- 7
Controller/User/GroupUserAdminController.php 파일 보기

@@ -2,21 +2,18 @@

namespace Lc\CaracoleBundle\Controller\User;

use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Factory\User\GroupUserFactory;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Container\User\GroupUserContainer;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\SovBundle\Controller\User\GroupUserAdminController as SovGroupUserAdminController;

abstract class GroupUserAdminController extends SovGroupUserAdminController
{
use AdminControllerTrait;
use ControllerTrait;

public function createEntity(string $entityFqcn)
{
return $this->get(GroupUserContainer::class)
return $this->getGroupUserContainer()
->getFactory()
->setMerchant($this->get(MerchantResolver::class)->getCurrent())
->setMerchant($this->getMerchantCurrent())
->create();
}
}

+ 57
- 59
Controller/User/UserMerchantAdminController.php 파일 보기

@@ -4,18 +4,14 @@ namespace Lc\CaracoleBundle\Controller\User;

use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Collection\EntityCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Event\AfterCrudActionEvent;
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeCrudActionEvent;
use EasyCorp\Bundle\EasyAdminBundle\Exception\ForbiddenActionException;
use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException;
use EasyCorp\Bundle\EasyAdminBundle\Factory\EntityFactory;
use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
@@ -25,10 +21,9 @@ use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use EasyCorp\Bundle\EasyAdminBundle\Security\Permission;
use Lc\CaracoleBundle\Container\User\UserMerchantContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\CaracoleBundle\Definition\ActionDefinition;
use Lc\CaracoleBundle\Factory\User\UserFactory;
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory;
use Lc\CaracoleBundle\Form\Credit\CreditHistoryFormType;
use Lc\CaracoleBundle\Form\User\UserMerchantFormType;
use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface;
@@ -36,28 +31,31 @@ use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Container\User\UserContainer;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\ToggleField;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\HttpFoundation\Response;

abstract class UserMerchantAdminController extends AbstractAdminController
{
use AdminControllerTrait;
use ControllerTrait;

public function getRepositoryQuery(): RepositoryQueryInterface
{
return $this->getUserMerchantContainer()->getRepositoryQuery();
}

public function getRepositoryQuery() :RepositoryQueryInterface
public function createEntity(string $entityFqcn)
{
return $this->get(UserMerchantContainer::class)->getRepositoryQuery();
return $this->getUserMerchantContainer()->getFactory()->createBase($this->getMerchantCurrent());
}

public function overrideEntitiesActions(?EntityCollection $entities): void
{
$context = $this->get(AdminContextProvider::class)->getContext();
$adminUrlGenerator = $this->get(AdminUrlGenerator::class);

$creditControllerFqcn = $context->getCrudControllers()->findCrudFqcnByEntityFqcn(
$this->get(EntityManagerInterface::class)->getEntityName(CreditHistoryInterface::class)
$this->get(EntityManagerInterface::class)->getEntityName(CreditHistoryInterface::class)
);

if ($entities) {
@@ -65,9 +63,9 @@ abstract class UserMerchantAdminController extends AbstractAdminController
foreach ($entity->getActions() as $action) {
if ($action->getName() == 'credit_history') {
$url = $adminUrlGenerator
->setController($creditControllerFqcn)
->set('userMerchantId', $entity->getInstance()->getId())
->generateUrl();
->setController($creditControllerFqcn)
->set('userMerchantId', $entity->getInstance()->getId())
->generateUrl();
$action->setLinkUrl($url);
}
}
@@ -80,14 +78,14 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$actions = parent::configureActions($actions);

$creditAction = Action::new('credit_history', false, 'fa fa-cash-register')
->linkToCrudAction('credit_history')
->setHtmlAttributes(
array(
'data-toggle' => 'tooltip',
'title' => $this->get(TranslatorAdmin::class)->transAction('credit'),
->linkToCrudAction('credit_history')
->setHtmlAttributes(
array(
'data-toggle' => 'tooltip',
'title' => $this->get(TranslatorAdmin::class)->transAction('credit'),
)
)
)
->setCssClass('btn btn-sm btn-success');
->setCssClass('btn btn-sm btn-success');
$actions->add(Crud::PAGE_INDEX, $creditAction);

return $actions;
@@ -96,13 +94,13 @@ abstract class UserMerchantAdminController extends AbstractAdminController
public function configureFields(string $pageName): iterable
{
$fields = [
IntegerField::new('id')->onlyOnIndex()->setSortable(true),
TextField::new('user.lastname')->setSortable(true),
TextField::new('user.firstname')->setSortable(true),
TextField::new('user.email')->setSortable(true),
BooleanField::new('active')->setSortable(true),
BooleanField::new('creditActive')->hideOnIndex(),
AssociationField::new('user'),
IntegerField::new('id')->onlyOnIndex()->setSortable(true),
TextField::new('user.lastname')->setSortable(true),
TextField::new('user.firstname')->setSortable(true),
TextField::new('user.email')->setSortable(true),
BooleanField::new('active')->setSortable(true),
BooleanField::new('creditActive')->hideOnIndex(),
AssociationField::new('user'),
];

if ($this->isGranted('ROLE_SUPER_ADMIN')) {
@@ -115,7 +113,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
public function configureFilters(Filters $filters): Filters
{
return $filters
->add(BooleanFilter::new('active'));
->add(BooleanFilter::new('active'));
}

public function new(AdminContext $context): Response
@@ -124,8 +122,8 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$merchantResolver = $this->get(MerchantResolver::class);

$userMerchant = $this->get(UserMerchantContainer::class)
->getFactory()
->create($merchantResolver->getCurrent());
->getFactory()
->create($merchantResolver->getCurrent());

$form = $this->createForm(UserMerchantFormType::class, $userMerchant);

@@ -150,7 +148,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$userMerchant->setUser($user);
$entityManager->create($userMerchant);
$entityManager->flush();
$this->addFlashTranslator('success','created');
$this->addFlashTranslator('success', 'created');
$url = $this->get(AdminUrlGenerator::class)->setAction(ActionDefinition::INDEX)->generateUrl();

return $this->redirect($url);
@@ -167,16 +165,16 @@ abstract class UserMerchantAdminController extends AbstractAdminController

return $this->redirect($url);
} else {
$this->addFlashTranslator('error','already_exist');
$this->addFlashTranslator('error', 'already_exist');
}
}
}

return $this->render(
'@LcCaracole/admin/user/new_usermerchant.html.twig',
[
'form' => $form->createView(),
]
'@LcCaracole/admin/user/new_usermerchant.html.twig',
[
'form' => $form->createView(),
]
);
}

@@ -212,10 +210,10 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

return $this->render(
'@LcCaracole/admin/user/edit_usermerchant.html.twig',
[
'form' => $form->createView(),
]
'@LcCaracole/admin/user/edit_usermerchant.html.twig',
[
'form' => $form->createView(),
]
);
}

@@ -228,8 +226,8 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

if (!$this->isGranted(
Permission::EA_EXECUTE_ACTION,
['action' => ActionDefinition::DETAIL, 'entity' => $context->getEntity()]
Permission::EA_EXECUTE_ACTION,
['action' => ActionDefinition::DETAIL, 'entity' => $context->getEntity()]
)) {
throw new ForbiddenActionException($context);
}
@@ -238,25 +236,25 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

$options['action'] = $adminUrlGenerator
->setController($context->getCrud()->getControllerFqcn())
->setAction('add_credit')
->setEntityId($context->getEntity()->getInstance()->getId())
->set('userMerchant', 'niche')
->generateUrl();
->setController($context->getCrud()->getControllerFqcn())
->setAction('add_credit')
->setEntityId($context->getEntity()->getInstance()->getId())
->set('userMerchant', 'niche')
->generateUrl();
$addCreditHistoryForm = $this->createForm(CreditHistoryFormType::class, null, $options)->createView();


return $this->render(
'@LcCaracole/admin/credit/credit_detail.html.twig',
[
'pageName' => Crud::PAGE_DETAIL,
'entity' => $context->getEntity(),
'batch_actions' => array(),
'entities' => array(),
'filters' => array(),
'paginator' => array(),
'add_credit_history_form' => $addCreditHistoryForm,
]
'@LcCaracole/admin/credit/credit_detail.html.twig',
[
'pageName' => Crud::PAGE_DETAIL,
'entity' => $context->getEntity(),
'batch_actions' => array(),
'entities' => array(),
'filters' => array(),
'paginator' => array(),
'add_credit_history_form' => $addCreditHistoryForm,
]
);
}


+ 3
- 4
EventSubscriber/MerchantSectionPropertyEventSubscriber.php 파일 보기

@@ -34,7 +34,8 @@ class MerchantSectionPropertyEventSubscriber implements EventSubscriberInterface

public function setMerchantAndSectionProperties(EntityManagerEvent $event)
{
$entity = $event->getEntity();
// @TODO : toujours d'actualité ?
/*$entity = $event->getEntity();
$entityRepository = $this->em->getRepository(get_class($entity));

if ($entity instanceof FilterSectionInterface) {
@@ -47,9 +48,7 @@ class MerchantSectionPropertyEventSubscriber implements EventSubscriberInterface

if ($entity instanceof FilterMultipleMerchantsInterface) {
$this->setMultipleMerchantProperty($entity, $entityRepository);
}


}*/
}

private function setSectionProperty($entity)

+ 7
- 4
Factory/Product/ProductFamilyFactory.php 파일 보기

@@ -11,14 +11,17 @@ use Lc\SovBundle\Factory\AbstractFactory;

class ProductFamilyFactory extends AbstractFactory
{

public function create(SectionInterface $section): ProductFamilyInterface
public function create(MerchantInterface $merchant): ProductFamilyInterface
{
$productFamily = new ProductFamily();

$productFamily->setSection($section);
$productFamilySectionPropertyFactory = new ProductFamilySectionPropertyFactory();

foreach($merchant->getSections() as $section) {
$productFamilySectionProperty = $productFamilySectionPropertyFactory->create($section, $productFamily);
$productFamily->addProductFamilySectionProperty($productFamilySectionProperty);
}

return $productFamily;
}

}

+ 2
- 2
Factory/Ticket/TicketFactory.php 파일 보기

@@ -10,13 +10,13 @@ use Lc\SovBundle\Model\Ticket\TicketInterface;

class TicketFactory extends SovTicketFactory
{
use MerchantContextTrait;
use SectionContextTrait;

public function create(): TicketInterface
{
$ticket = parent::create();

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

return $ticket;
}

+ 9
- 3
Factory/User/UserMerchantFactory.php 파일 보기

@@ -11,12 +11,18 @@ use Lc\SovBundle\Model\User\UserInterface;

class UserMerchantFactory extends AbstractFactory
{
// createUserMerchant
public function create(MerchantInterface $merchant, UserInterface $user = null): UserMerchantInterface
public function createBase(MerchantInterface $merchant): UserMerchantInterface
{
$userMerchant = new UserMerchant();

$userMerchant->setMerchant($merchant);

return $userMerchant;
}

// createUserMerchant
public function create(MerchantInterface $merchant, UserInterface $user = null): UserMerchantInterface
{
$userMerchant = $this->createBase($merchant);
$userMerchant->setUser($user);

return $userMerchant;

+ 2
- 2
Form/Section/SwitchSectionFormType.php 파일 보기

@@ -49,8 +49,8 @@ class SwitchSectionFormType extends AbstractType
$styleButton = '';
$classButton = 'btn-section';
if ($section == $currentSection) {
$classButton .= ' btn-section-current';
$styleButton = 'color: white; background-color: ' . $currentSection->getColor() . ';';
$classButton .= ' btn-section-current section-'.$currentSection->getDevAlias();
//$styleButton = 'color: white; background-color: ' . $currentSection->getColor() . ';';
}

$builder->add(

+ 5
- 1
Repository/Product/ProductFamilySectionPropertyRepositoryQuery.php 파일 보기

@@ -3,6 +3,7 @@
namespace Lc\CaracoleBundle\Repository\Product;

use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

@@ -15,6 +16,9 @@ class ProductFamilySectionPropertyRepositoryQuery extends AbstractRepositoryQuer
parent::__construct($repository, 'pfsp', $paginator);
}


public function filterByProductFamily(ProductFamilyInterface $productFamily): self
{
return $this->andWhereEqual('productFamily', $productFamily);
}

}

+ 11
- 2
Repository/Product/ProductFamilySectionPropertyStore.php 파일 보기

@@ -2,11 +2,12 @@

namespace Lc\CaracoleBundle\Repository\Product;

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

class ProductFamilySectionPropertyStore extends AbstractRepository
class ProductFamilySectionPropertyStore extends AbstractStore
{
use SectionStoreTrait;

@@ -24,6 +25,7 @@ class ProductFamilySectionPropertyStore extends AbstractRepository

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

@@ -31,4 +33,11 @@ class ProductFamilySectionPropertyStore extends AbstractRepository
{
return $query;
}

public function getOneByProductFamily(ProductFamilyInterface $productFamily, $query = null)
{
$query = $this->createDefaultQuery($query);
$query->filterByProductFamily($productFamily);
return $query->findOne();
}
}

+ 2
- 8
Repository/Reduction/ReductionCatalogStore.php 파일 보기

@@ -26,9 +26,7 @@ class ReductionCatalogStore extends AbstractStore

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
if($this->section) {
$query->filterBySection($this->section);
}
$this->addFilterBySectionOptionnal($query);
$query->filterIsOnlineAndOffline();
return $query;
}
@@ -38,14 +36,10 @@ class ReductionCatalogStore extends AbstractStore
return $query;
}


public function getByProductFamily(ProductFamilyInterface $productFamily, $query = null)
{
$query = $this->createDefaultQuery($query);

$query
->filterProductFamily($productFamily);

$query->filterProductFamily($productFamily);
return $query->findOne();
}
}

+ 1
- 1
Resources/views/adminlte/layout.html.twig 파일 보기

@@ -6,7 +6,7 @@
{% set section_current = section_current() %}
{% 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{% endif %}" {% if is_display_switch_section %}style="border-color: {{ section_current.color }};"{% endif %}>
<nav class="carac navbar navbar-expand navbar-light main-header{% if is_display_switch_section %} display-section-switch section-{{ section_current.devAlias }}{% endif %}">

{% if is_display_switch_section %}
<ul class="navbar-nav left">

Loading…
취소
저장