Parcourir la source

Structure views / webpack, twig extensions, routes

packProduct
Guillaume il y a 3 ans
Parent
révision
6d03e81657
46 fichiers modifiés avec 285 ajouts et 306 suppressions
  1. +1
    -1
      Controller/Credit/CreditHistoryAdminController.php
  2. +4
    -0
      Controller/Merchant/FavoriteMerchantController.php
  3. +4
    -1
      Controller/Merchant/SwitchMerchantController.php
  4. +4
    -0
      Controller/Section/SwitchSectionAdminController.php
  5. +14
    -4
      Controller/Setting/SettingAdminController.php
  6. +1
    -1
      Controller/User/UserMerchantAdminController.php
  7. +4
    -7
      EventSubscriber/SettingEventSubscriber.php
  8. +1
    -1
      EventSubscriber/User/UserRolesEventSubscriber.php
  9. +0
    -24
      Repository/AbstractRepositoryQuery.php
  10. +4
    -11
      Repository/Config/TaxRateRepository.php
  11. +4
    -11
      Repository/Config/UnitRepository.php
  12. +5
    -16
      Repository/Credit/CreditHistoryRepository.php
  13. +9
    -0
      Repository/Credit/CreditHistoryRepositoryInterface.php
  14. +5
    -11
      Repository/Merchant/MerchantRepository.php
  15. +8
    -0
      Repository/Merchant/MerchantRepositoryInterface.php
  16. +17
    -0
      Repository/Merchant/MerchantRepositoryQuery.php
  17. +5
    -10
      Repository/PointSale/PointSaleRepository.php
  18. +8
    -0
      Repository/PointSale/PointSaleRepositoryInterface.php
  19. +3
    -2
      Repository/RepositoryTrait.php
  20. +5
    -14
      Repository/Section/SectionRepository.php
  21. +9
    -0
      Repository/Section/SectionRepositoryInterface.php
  22. +2
    -7
      Repository/User/GroupUserRepository.php
  23. +5
    -12
      Repository/User/UserMerchantRepository.php
  24. +8
    -0
      Repository/User/UserMerchantRepositoryInterface.php
  25. +1
    -13
      Repository/User/UserPointSaleRepository.php
  26. +8
    -0
      Repository/User/UserPointSaleRepositoryInterface.php
  27. +5
    -12
      Repository/User/VisitorRepository.php
  28. +8
    -0
      Repository/User/VisitorRepositoryInterface.php
  29. +11
    -5
      Resolver/MerchantResolver.php
  30. +0
    -0
      Resources/assets/app/admin/switchmerchant/app.switchmerchant.js
  31. +0
    -0
      Resources/assets/app/admin/switchmerchant/switchmerchant.js
  32. +0
    -0
      Resources/assets/app/admin/switchmerchant/switchmerchant_admin.js
  33. +0
    -0
      Resources/assets/app/admin/switchmerchant/switchmerchant_admin.scss
  34. +3
    -30
      Resources/config/routes.yaml
  35. +1
    -1
      Resources/views/admin/credit/index_credithistory.html.twig
  36. +0
    -44
      Resources/views/admin/credit/modal_addcredithistory.html.twig
  37. +0
    -0
      Resources/views/admin/setting/edit_merchant.html.twig
  38. +0
    -0
      Resources/views/admin/setting/edit_section.html.twig
  39. +0
    -0
      Resources/views/admin/setting/edit_site.html.twig
  40. +0
    -0
      Resources/views/admin/ticket/detail.html.twig
  41. +1
    -1
      Resources/views/admin/user/edit_usermerchant.html.twig
  42. +1
    -1
      Resources/views/admin/user/new_usermerchant.html.twig
  43. +4
    -4
      Resources/views/adminlte/layout.html.twig
  44. +64
    -0
      Twig/FormTwigExtension.php
  45. +41
    -0
      Twig/StoreTwigExtension.php
  46. +7
    -62
      Twig/TwigExtension.php

+ 1
- 1
Controller/Credit/CreditHistoryAdminController.php Voir le fichier

@@ -84,7 +84,7 @@ abstract class CreditHistoryAdminController extends AbstractAdminController

public function configureCrud(Crud $crud): Crud
{
$crud->overrideTemplate('crud/index', '@LcCaracole/admin/credit/credit_history_index.html.twig');
$crud->overrideTemplate('crud/index', '@LcCaracole/admin/credit/index_credithistory.html.twig');

return $crud;
}

+ 4
- 0
Controller/Merchant/FavoriteMerchantController.php Voir le fichier

@@ -8,9 +8,13 @@ use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Routing\Annotation\Route;

class FavoriteMerchantController extends AbstractController
{
/**
* @Route("/merchant/favorite", name="carac_merchant_favorite")
*/
public function favoriteMerchant(Request $request, Security $security, EntityManagerInterface $em)
{
$user = $security->getUser() ;

+ 4
- 1
Controller/Merchant/SwitchMerchantController.php Voir le fichier

@@ -7,10 +7,13 @@ use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class SwitchMerchantController extends AbstractController
{

/**
* @Route("/merchant/switch", name="carac_merchant_switch")
*/
public function switchMerchant(Request $request, MerchantRepository $merchantRepository)
{
$form = $this->createForm(SwitchMerchantFormType::class);

+ 4
- 0
Controller/Section/SwitchSectionAdminController.php Voir le fichier

@@ -8,10 +8,14 @@ use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class SwitchSectionAdminController extends AbstractController
{

/**
* @Route("/section/switch", name="carac_section_switch")
*/
public function switchSection(
Request $request,
EntityManagerInterface $em,

+ 14
- 4
Controller/Setting/SettingAdminController.php Voir le fichier

@@ -12,9 +12,10 @@ use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\CaracoleBundle\Definition\SectionSettingDefinitionInterface;
use Lc\SovBundle\Definition\SiteSettingDefinition;
use Lc\SovBundle\Form\Setting\SiteSettingsFormType;
use Lc\SovBundle\Repository\Site\SiteRepository;
use Lc\SovBundle\Repository\Site\SiteRepositoryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class SettingAdminController extends SovSettingController
{
@@ -35,7 +36,7 @@ class SettingAdminController extends SovSettingController
MerchantSettingDefinitionInterface $merchantSettingDefinition,
SectionSettingDefinitionInterface $sectionSettingDefinition,
SiteSettingDefinition $siteSettingDefinition,
SiteRepository $siteRepository
SiteRepositoryInterface $siteRepository
) {
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
@@ -47,11 +48,17 @@ class SettingAdminController extends SovSettingController
$this->siteRepository = $siteRepository;
}

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

/**
* @Route("/admin/setting/section", name="carac_admin_setting_section")
*/
public function manageSection(Request $request)
{
return $this->manage($request, 'section');
@@ -86,7 +93,7 @@ class SettingAdminController extends SovSettingController
}

return $this->render(
'@LcCaracole/admin/setting/' . $type . '.html.twig',
'@LcCaracole/admin/setting/edit_' . $type . '.html.twig',
[
'resolver' => $resolver,
'setting_definition' => $settingDefinition,
@@ -96,6 +103,9 @@ class SettingAdminController extends SovSettingController
}
}

/**
* @Route("/admin/setting/site", name="carac_admin_setting_site")
*/
public function manageGlobal(Request $request)
{
$site = $this->siteRepository->findOneByDevAlias('default') ;
@@ -112,7 +122,7 @@ class SettingAdminController extends SovSettingController
}

return $this->render(
'@LcCaracole/admin/setting/global.html.twig' ,
'@LcCaracole/admin/setting/edit_site.html.twig' ,
[
'setting_definition' => $this->siteSettingDefinition,
'form' => $form->createView()

+ 1
- 1
Controller/User/UserMerchantAdminController.php Voir le fichier

@@ -150,7 +150,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

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

+ 4
- 7
EventSubscriber/SettingEventSubscriber.php Voir le fichier

@@ -6,15 +6,12 @@ use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Definition\MerchantSettingDefinitionInterface;
use Lc\CaracoleBundle\Factory\Setting\MerchantSettingFactory;
use Lc\CaracoleBundle\Factory\Setting\SectionSettingFactory;
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
use Lc\CaracoleBundle\Definition\SectionSettingDefinitionInterface;
use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryInterface;
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Security\Core\Security;

class SettingEventSubscriber implements EventSubscriberInterface
{
@@ -30,8 +27,8 @@ class SettingEventSubscriber implements EventSubscriberInterface
EntityManagerInterface $em,
MerchantSettingDefinitionInterface $merchantSettingDefinition,
SectionSettingDefinitionInterface $sectionSettingDefinition,
MerchantRepository $merchantRepository,
SectionRepository $sectionRepository,
MerchantRepositoryInterface $merchantRepository,
SectionRepositoryInterface $sectionRepository,
MerchantSettingFactory $merchantSettingFactory,
SectionSettingFactory $sectionSettingFactory
)

+ 1
- 1
EventSubscriber/User/UserRolesEventSubscriber.php Voir le fichier

@@ -50,7 +50,7 @@ class UserRolesEventSubscriber implements EventSubscriberInterface
return;
}
if ($this->setUserRoles($event->getRequest())) {
$response = new RedirectResponse($this->router->generate('admin_dashboard'));
$response = new RedirectResponse($this->router->generate('app_admin_dashboard'));
$event->setResponse($response);
}
}

+ 0
- 24
Repository/AbstractRepositoryQuery.php Voir le fichier

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

namespace Lc\CaracoleBundle\Repository;

use Lc\SovBundle\Repository\AbstractRepositoryQuery as BaseAbstractRepositoryQuery;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\QueryBuilder;
use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Container\MyContainer;

abstract class AbstractRepositoryQuery extends BaseAbstractRepositoryQuery
{
public function __construct(
MyContainer $container,
ServiceEntityRepository $repository,
string $id,
PaginatorInterface $paginator = null
)
{
$this->container = $container;

parent::__construct($repository, $id, $paginator);
}
}

+ 4
- 11
Repository/Config/TaxRateRepository.php Voir le fichier

@@ -2,24 +2,17 @@

namespace Lc\CaracoleBundle\Repository\Config;

use Lc\CaracoleBundle\Model\Config\TaxRateInterface;
use App\Entity\Config\TaxRate;
use Doctrine\Persistence\ManagerRegistry;
use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method TaxRateInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method TaxRateInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method TaxRateInterface[] findAll()
* @method TaxRateInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class TaxRateRepository extends AbstractRepository
{
use RepositoryTrait;

public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return TaxRateInterface::class;
parent::__construct($registry, TaxRate::class);
}


}

+ 4
- 11
Repository/Config/UnitRepository.php Voir le fichier

@@ -2,25 +2,18 @@

namespace Lc\CaracoleBundle\Repository\Config;

use Lc\CaracoleBundle\Model\Config\TaxRateInterface;
use Lc\CaracoleBundle\Model\Config\UnitInterface;
use App\Entity\Config\Unit;
use Doctrine\Persistence\ManagerRegistry;
use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method UnitInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method UnitInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method UnitInterface[] findAll()
* @method UnitInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class UnitRepository extends AbstractRepository
{
use RepositoryTrait;

public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return UnitInterface::class;
parent::__construct($registry, Unit::class);
}


}

+ 5
- 16
Repository/Credit/CreditHistoryRepository.php Voir le fichier

@@ -2,25 +2,14 @@

namespace Lc\CaracoleBundle\Repository\Credit;

use Lc\CaracoleBundle\Model\Config\TaxRateInterface;
use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface;
use Lc\CaracoleBundle\Repository\RepositoryTrait;
use App\Entity\Credit\CreditHistory;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method CreditHistoryInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method CreditHistoryInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method CreditHistoryInterface[] findAll()
* @method CreditHistoryInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class CreditHistoryRepository extends AbstractRepository
class CreditHistoryRepository extends AbstractRepository implements CreditHistoryRepositoryInterface
{
use RepositoryTrait;

public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return CreditHistoryInterface::class;
parent::__construct($registry, CreditHistory::class);
}


}

+ 9
- 0
Repository/Credit/CreditHistoryRepositoryInterface.php Voir le fichier

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

namespace Lc\CaracoleBundle\Repository\Credit;

interface CreditHistoryRepositoryInterface
{

}


+ 5
- 11
Repository/Merchant/MerchantRepository.php Voir le fichier

@@ -2,20 +2,14 @@

namespace Lc\CaracoleBundle\Repository\Merchant;

use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use App\Entity\Merchant\Merchant;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method MerchantInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method MerchantInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method MerchantInterface[] findAll()
* @method MerchantInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MerchantRepository extends AbstractRepository
class MerchantRepository extends AbstractRepository implements MerchantRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return MerchantInterface::class;
parent::__construct($registry, Merchant::class);
}

}

+ 8
- 0
Repository/Merchant/MerchantRepositoryInterface.php Voir le fichier

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

namespace Lc\CaracoleBundle\Repository\Merchant;

interface MerchantRepositoryInterface
{
}

+ 17
- 0
Repository/Merchant/MerchantRepositoryQuery.php Voir le fichier

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

namespace Lc\CaracoleBundle\Repository\Merchant;

use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Repository\RepositoryMerchantTrait;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class MerchantRepositoryQuery extends AbstractRepositoryQuery
{
use RepositoryMerchantTrait;

public function __construct(MerchantRepositoryInterface $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 5
- 10
Repository/PointSale/PointSaleRepository.php Voir le fichier

@@ -2,22 +2,17 @@

namespace Lc\CaracoleBundle\Repository\PointSale;

use App\Entity\PointSale\PointSale;
use Doctrine\Persistence\ManagerRegistry;
use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Repository\AbstractRepository;
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;

/**
* @method PointSaleInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method PointSaleInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method PointSaleInterface[] findAll()
* @method PointSaleInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class PointSaleRepository extends AbstractRepository
class PointSaleRepository extends AbstractRepository implements PointSaleRepositoryInterface
{
use RepositoryTrait;

public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return PointSaleInterface::class;
parent::__construct($registry, PointSale::class);
}
}

+ 8
- 0
Repository/PointSale/PointSaleRepositoryInterface.php Voir le fichier

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

namespace Lc\CaracoleBundle\Repository\PointSale;

interface PointSaleRepositoryInterface
{
}

+ 3
- 2
Repository/RepositoryTrait.php Voir le fichier

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

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
@@ -15,11 +16,11 @@ trait RepositoryTrait
protected $sectionResolver;

public function __construct(
EntityManagerInterface $entityManager,
ManagerRegistry $managerRegistry,
SectionResolver $sectionResolver,
MerchantResolver $merchantResolver
) {
parent::__construct($entityManager);
parent::__construct($managerRegistry);
$this->merchantResolver = $merchantResolver;
$this->sectionResolver = $sectionResolver;
}

+ 5
- 14
Repository/Section/SectionRepository.php Voir le fichier

@@ -2,23 +2,14 @@

namespace Lc\CaracoleBundle\Repository\Section;

use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\RepositoryTrait;
use App\Entity\Section\Section;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method SectionInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method SectionInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method SectionInterface[] findAll()
* @method SectionInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class SectionRepository extends AbstractRepository
class SectionRepository extends AbstractRepository implements SectionRepositoryInterface
{
use RepositoryTrait;

public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return SectionInterface::class;
parent::__construct($registry, Section::class);
}

}

+ 9
- 0
Repository/Section/SectionRepositoryInterface.php Voir le fichier

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

namespace Lc\CaracoleBundle\Repository\Section;

interface SectionRepositoryInterface
{

}


+ 2
- 7
Repository/User/GroupUserRepository.php Voir le fichier

@@ -3,16 +3,11 @@
namespace Lc\CaracoleBundle\Repository\User;

use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Model\User\GroupUserInterface;
use Lc\SovBundle\Repository\User\GroupUserRepository as SovGroupUserRepository;

/**
* @method GroupUserInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method GroupUserInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method GroupUserInterface[] findAll()
* @method GroupUserInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/

class GroupUserRepository extends SovGroupUserRepository
{
use RepositoryTrait;

}

+ 5
- 12
Repository/User/UserMerchantRepository.php Voir le fichier

@@ -2,21 +2,14 @@

namespace Lc\CaracoleBundle\Repository\User;

use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
use App\Entity\User\UserMerchant;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method UserMerchantInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method UserMerchantInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method UserMerchantInterface[] findAll()
* @method UserMerchantInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class UserMerchantRepository extends AbstractRepository
class UserMerchantRepository extends AbstractRepository implements UserMerchantRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return UserMerchantInterface::class;
parent::__construct($registry, UserMerchant::class);
}


}

+ 8
- 0
Repository/User/UserMerchantRepositoryInterface.php Voir le fichier

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

namespace Lc\CaracoleBundle\Repository\User;

interface UserMerchantRepositoryInterface
{

}

+ 1
- 13
Repository/User/UserPointSaleRepository.php Voir le fichier

@@ -2,21 +2,9 @@

namespace Lc\CaracoleBundle\Repository\User;

use Lc\CaracoleBundle\Model\User\UserPointSaleInterface;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method UserPointSaleInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method UserPointSaleInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method UserPointSaleInterface[] findAll()
* @method UserPointSaleInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class UserPointSaleRepository extends AbstractRepository
abstract class UserPointSaleRepository extends AbstractRepository implements UserPointSaleRepositoryInterface
{
public function getInterfaceClass()
{
return UserPointSaleInterface::class;
}


}

+ 8
- 0
Repository/User/UserPointSaleRepositoryInterface.php Voir le fichier

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

namespace Lc\CaracoleBundle\Repository\User;

interface UserPointSaleRepositoryInterface
{

}

+ 5
- 12
Repository/User/VisitorRepository.php Voir le fichier

@@ -2,21 +2,14 @@

namespace Lc\CaracoleBundle\Repository\User;

use Lc\CaracoleBundle\Model\User\VisitorInterface;
use App\Entity\User\Visitor;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method VisitorInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method VisitorInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method VisitorInterface[] findAll()
* @method VisitorInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class VisitorRepository extends AbstractRepository
class VisitorRepository extends AbstractRepository implements VisitorRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return VisitorInterface::class;
parent::__construct($registry, Visitor::class);
}


}

+ 8
- 0
Repository/User/VisitorRepositoryInterface.php Voir le fichier

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

namespace Lc\CaracoleBundle\Repository\User;

interface VisitorRepositoryInterface
{

}

+ 11
- 5
Resolver/MerchantResolver.php Voir le fichier

@@ -11,6 +11,8 @@ use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryInterface;
use Lc\CaracoleBundle\Repository\User\UserMerchantRepositoryInterface;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Resolver\UrlResolver;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -23,17 +25,23 @@ class MerchantResolver
protected $urlResolver;
protected $security;
protected $currentMerchant;
protected $merchantRepository;
protected $userMerrchantRepository;

public function __construct(
EntityManagerInterface $entityManager,
RequestStack $requestStack,
UrlResolver $urlResolver,
Security $security
Security $security,
MerchantRepositoryInterface $merchantRepository,
UserMerchantRepositoryInterface $userMerchantRepository
) {
$this->requestStack = $requestStack;
$this->em = $entityManager;
$this->urlResolver = $urlResolver;
$this->security = $security;
$this->merchantRepository = $merchantRepository;
$this->userMerchantRepository = $userMerchantRepository;
}

public function getCurrent(): MerchantInterface
@@ -44,8 +52,7 @@ class MerchantResolver

$this->currentMerchant = false;
$request = $this->requestStack->getCurrentRequest();
$merchantRepository = $this->em->getRepository(MerchantInterface::class);
$merchants = $merchantRepository->findAll();
$merchants = $this->merchantRepository->findAll();
$isCli = php_sapi_name() === 'cli';

if ($request || $isCli) {
@@ -86,7 +93,6 @@ class MerchantResolver
UserInterface $user = null,
MerchantInterface $merchant = null
): ?UserMerchantInterface {
$userMerchantRepository = $this->em->getRepository(UserMerchantInterface::class);

if ($user === null) {
$user = $this->security->getUser();
@@ -95,7 +101,7 @@ class MerchantResolver
$merchant = $this->getCurrent();
}

return $userMerchantRepository->findOneBy(
return $this->userMerchantRepository->findOneBy(
[
'user' => $user,
'merchant' => $merchant,

Resources/assets/app/switchmerchant/app.switchmerchant.js → Resources/assets/app/admin/switchmerchant/app.switchmerchant.js Voir le fichier


Resources/assets/app/switchmerchant/switchmerchant.js → Resources/assets/app/admin/switchmerchant/switchmerchant.js Voir le fichier


Resources/assets/app/switchmerchant/switchmerchant_admin.js → Resources/assets/app/admin/switchmerchant/switchmerchant_admin.js Voir le fichier


Resources/assets/app/switchmerchant/switchmerchant_admin.scss → Resources/assets/app/admin/switchmerchant/switchmerchant_admin.scss Voir le fichier


+ 3
- 30
Resources/config/routes.yaml Voir le fichier

@@ -1,31 +1,4 @@
carac_switch_merchant:
path: /switch-merchant
controller: Lc\CaracoleBundle\Controller\Merchant\SwitchMerchantController::switchMerchant

carac_favorite_merchant:
path: /favorite-merchant
controller: Lc\CaracoleBundle\Controller\Merchant\FavoriteMerchantController::favoriteMerchant

carac_switch_section:
path: /switch-section
controller: Lc\CaracoleBundle\Controller\Section\SwitchSectionAdminController::switchSection

carac_admin_setting_merchant:
path: /admin/setting/merchant
controller: Lc\CaracoleBundle\Controller\Setting\SettingAdminController::manageMerchant

carac_admin_setting_section:
path: /admin/setting/section
controller: Lc\CaracoleBundle\Controller\Setting\SettingAdminController::manageSection

carac_admin_setting_global:
path: /admin/setting/global2
controller: Lc\CaracoleBundle\Controller\Setting\SettingAdminController::manageGlobal

carac_admin_reminder_render_modal:
path: /admin/caracole/reminder/modal
controller: Lc\CaracoleBundle\Controller\Reminder\ReminderAdminController::renderModal

carac_admin_reminder_new:
path: /admin/caracole/reminder/new
controller: Lc\CaracoleBundle\Controller\Reminder\ReminderAdminController::new
lc_caracole_bundle:
resource: "@LcCaracoleBundle/Controller"
type: annotation

Resources/views/admin/credit/credit_history_index.html.twig → Resources/views/admin/credit/index_credithistory.html.twig Voir le fichier

@@ -1,6 +1,6 @@
{% extends '@LcSov/adminlte/crud/index.html.twig' %}

{% block content_title %}
{{ 'index'|lc_trans_admin_title(ea.getEntity().getFqcn()) }}
{{ 'index'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
Info de Fab
{% endblock %}

+ 0
- 44
Resources/views/admin/credit/modal_addcredithistory.html.twig Voir le fichier

@@ -1,44 +0,0 @@
{% trans_default_domain 'adin' %}

<div class="modal fade show" id="modal-add-credit-history">
{{ form_start(add_credit_history_form, {'attr': { 'id' : 'addCreditHistory'}}) }}
{% form_theme add_credit_history_form '@LcSov/adminlte/crud/form_theme.html.twig' %}
<div class="modal-dialog">

<div class="modal-content">
<div class="modal-header">
<h4>{{ "action.credit.add"|trans }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="col">
{{ form_row(add_credit_history_form.type) }}
</div>
<div class="col">
{{ form_row(add_credit_history_form.amount) }}
</div>

<div class="col">
{# {{ form_row(add_credit_history_form.meanPayment) }}#}
</div>
<div class="col">
{{ form_row(add_credit_history_form.paidAt) }}
</div>
<div class="col">
{{ form_row(add_credit_history_form.reference) }}
</div>
<div class="col">
{{ form_row(add_credit_history_form.comment) }}
</div>
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
{{ form_row(add_credit_history_form.add, {"attr": {'class' : 'btn btn-primary'}}) }}
</div>
</div>
<!-- /.modal-content -->
</div>
{{ form_end(add_credit_history_form) }}
</div>

Resources/views/admin/setting/merchant.html.twig → Resources/views/admin/setting/edit_merchant.html.twig Voir le fichier


Resources/views/admin/setting/section.html.twig → Resources/views/admin/setting/edit_section.html.twig Voir le fichier


Resources/views/admin/setting/global.html.twig → Resources/views/admin/setting/edit_site.html.twig Voir le fichier


Resources/views/admin/Ticket/detail.html.twig → Resources/views/admin/ticket/detail.html.twig Voir le fichier


Resources/views/admin/user/usermerchant_edit.html.twig → Resources/views/admin/user/edit_usermerchant.html.twig Voir le fichier

@@ -1,7 +1,7 @@
{% extends '@LcCaracole/adminlte/layout.html.twig' %}

{% block content_title %}
{{ 'edit'|lc_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{{ 'edit'|sov_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{% endblock %}

{% block main %}

Resources/views/admin/user/usermerchant_new.html.twig → Resources/views/admin/user/new_usermerchant.html.twig Voir le fichier

@@ -1,7 +1,7 @@
{% extends '@LcCaracole/adminlte/layout.html.twig' %}

{% block content_title %}
{{ 'new'|lc_trans_admin_title(ea.getEntity().getFqcn()) }}
{{ 'new'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %}

{% block main %}

+ 4
- 4
Resources/views/adminlte/layout.html.twig Voir le fichier

@@ -7,9 +7,9 @@

<nav class="carac navbar navbar-expand navbar-light main-header" style="border-color: {{ section_current.color }};">
<ul class="navbar-nav left">
{% for section in carac_get_sections() %}
{% for section in carac_sections() %}
<li class="nav-item d-none d-sm-inline-block">
{% set form_switch_section = carac_get_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) }}
@@ -20,7 +20,7 @@
<ul class="navbar-nav ml-auto right">
<li class="nav-item nav-switch-merchant">
<i class="fa fa-store"></i>
{% set form_switch_merchant = carac_get_form_switch_merchant('admin') %}
{% set form_switch_merchant = carac_form_switch_merchant('admin') %}
{% form_theme form_switch_merchant '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form_switch_merchant) }}
{{ form(form_switch_merchant) }}
@@ -54,7 +54,7 @@
comme marchand favoris ou simplement indiquer que vous visitez ce marchand pour aujourd'hui.</p>
{% endblock %}
{% block footer %}
{% set form_switch_merchant = carac_get_form_switch_merchant('admin', 'carac_favorite_merchant') %}
{% set form_switch_merchant = carac_form_switch_merchant('admin', 'carac_favorite_merchant') %}
{% form_theme form_switch_merchant '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form_switch_merchant) }}
{{ form(form_switch_merchant) }}

+ 64
- 0
Twig/FormTwigExtension.php Voir le fichier

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

namespace Lc\CaracoleBundle\Twig;

use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantButtonAdminFormType;
use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType;
use Lc\CaracoleBundle\Form\Section\SwitchSectionFormType;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery;
use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class FormTwigExtension extends AbstractExtension
{
protected FormFactoryInterface $formFactory;
protected UrlGeneratorInterface $urlGenerator;

public function __construct(
FormFactoryInterface $formFactory,
UrlGeneratorInterface $urlGenerator
) {
$this->formFactory = $formFactory;
$this->urlGenerator = $urlGenerator;
}

public function getFunctions()
{
return array(
new TwigFunction('carac_form_switch_merchant', [$this, 'getFormSwitchMerchant']),
new TwigFunction('carac_form_switch_section', [$this, 'getFormSwitchSection']),
);
}

public function getFormSwitchMerchant($context = 'front', $actionRoute = 'carac_merchant_switch')
{
$form = $this->formFactory->create(
SwitchMerchantFormType::class,
null,
[
'action' => $this->urlGenerator->generate($actionRoute),
'attr' => ['class' => 'switch-merchant'],
'context' => $context
]
);
return $form->createView();
}

public function getFormSwitchSection($section)
{
$form = $this->formFactory->create(
SwitchSectionFormType::class,
null,
[
'action' => $this->urlGenerator->generate('carac_section_switch'),
'attr' => ['class' => 'switch-section'],
'section' => $section,
]
);
return $form->createView();
}
}

+ 41
- 0
Twig/StoreTwigExtension.php Voir le fichier

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

namespace Lc\CaracoleBundle\Twig;

use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery;
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class StoreTwigExtension extends AbstractExtension
{
protected $merchantRepository;
protected $sectionRepository;

public function __construct(
MerchantRepositoryQuery $merchantRepository,
SectionRepositoryInterface $sectionRepository
) {
$this->merchantRepository = $merchantRepository;
$this->sectionRepository = $sectionRepository;
}

public function getFunctions()
{
return array(
new TwigFunction('carac_sections', [$this, 'getSections']),
new TwigFunction('carac_merchants', [$this, 'getMerchants']),
);
}

public function getSections()
{
return $this->sectionRepository->findAll();
}

public function getMerchants()
{
return $this->merchantRepository->findAll();
}

}

+ 7
- 62
Twig/TwigExtension.php Voir le fichier

@@ -2,87 +2,32 @@

namespace Lc\CaracoleBundle\Twig;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantButtonAdminFormType;
use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType;
use Lc\CaracoleBundle\Form\Section\SwitchSectionFormType;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery;
use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class TwigExtension extends AbstractExtension
{
protected $merchantRepository;
protected $sectionRepository;
protected $formFactory;
protected $urlGenerator;

public function __construct(
MerchantRepository $merchantRepository,
SectionRepository $sectionRepository,
FormFactoryInterface $formFactory,
UrlGeneratorInterface $urlGenerator
) {
$this->merchantRepository = $merchantRepository;
$this->sectionRepository = $sectionRepository;
$this->formFactory = $formFactory;
$this->urlGenerator = $urlGenerator;
}
public function __construct() {

public function getFunctions()
{
return array(
new TwigFunction('carac_get_sections', [$this, 'getSections']),
new TwigFunction('carac_get_form_switch_merchant', [$this, 'getFormSwitchMerchant']),
new TwigFunction('carac_get_form_switch_section', [$this, 'getFormSwitchSection']),
);
}

public function getSections()
public function getFilters()
{
return $this->sectionRepository->findAll();
return [];
}

public function getMerchants()
{
return $this->merchantRepository->findAll();
}

public function getFormSwitchMerchant($context = 'front', $actionRoute = 'carac_switch_merchant')
public function getFunctions()
{
$form = $this->formFactory->create(
SwitchMerchantFormType::class,
null,
[
'action' => $this->urlGenerator->generate($actionRoute),
'attr' => ['class' => 'switch-merchant'],
'context' => $context
]
);
return $form->createView();
return [];
}

public function getFormSwitchSection($section)
{
$form = $this->formFactory->create(
SwitchSectionFormType::class,
null,
[
'action' => $this->urlGenerator->generate('carac_switch_section'),
'attr' => ['class' => 'switch-section'],
'section' => $section,
]
);
return $form->createView();
}
}

Chargement…
Annuler
Enregistrer