@@ -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; | |||
} |
@@ -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() ; |
@@ -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); |
@@ -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, |
@@ -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() |
@@ -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(), | |||
] |
@@ -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 | |||
) |
@@ -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); | |||
} | |||
} |
@@ -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); | |||
} | |||
} |
@@ -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); | |||
} | |||
} |
@@ -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); | |||
} | |||
} |
@@ -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); | |||
} | |||
} |
@@ -0,0 +1,9 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Repository\Credit; | |||
interface CreditHistoryRepositoryInterface | |||
{ | |||
} | |||
@@ -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); | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Repository\Merchant; | |||
interface MerchantRepositoryInterface | |||
{ | |||
} |
@@ -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); | |||
} | |||
} |
@@ -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); | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Repository\PointSale; | |||
interface PointSaleRepositoryInterface | |||
{ | |||
} |
@@ -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; | |||
} |
@@ -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); | |||
} | |||
} |
@@ -0,0 +1,9 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Repository\Section; | |||
interface SectionRepositoryInterface | |||
{ | |||
} | |||
@@ -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; | |||
} |
@@ -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); | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Repository\User; | |||
interface UserMerchantRepositoryInterface | |||
{ | |||
} |
@@ -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; | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Repository\User; | |||
interface UserPointSaleRepositoryInterface | |||
{ | |||
} |
@@ -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); | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Repository\User; | |||
interface VisitorRepositoryInterface | |||
{ | |||
} |
@@ -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, |
@@ -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 |
@@ -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 %} |
@@ -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> |
@@ -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 %} |
@@ -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 %} |
@@ -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) }} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |