public function configureCrud(Crud $crud): Crud | 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; | return $crud; | ||||
} | } |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||||
use Symfony\Component\HttpFoundation\Request; | use Symfony\Component\HttpFoundation\Request; | ||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
use Symfony\Component\Routing\Annotation\Route; | |||||
class FavoriteMerchantController extends AbstractController | class FavoriteMerchantController extends AbstractController | ||||
{ | { | ||||
/** | |||||
* @Route("/merchant/favorite", name="carac_merchant_favorite") | |||||
*/ | |||||
public function favoriteMerchant(Request $request, Security $security, EntityManagerInterface $em) | public function favoriteMerchant(Request $request, Security $security, EntityManagerInterface $em) | ||||
{ | { | ||||
$user = $security->getUser() ; | $user = $security->getUser() ; |
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository; | use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository; | ||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||||
use Symfony\Component\HttpFoundation\Request; | use Symfony\Component\HttpFoundation\Request; | ||||
use Symfony\Component\Routing\Annotation\Route; | |||||
class SwitchMerchantController extends AbstractController | class SwitchMerchantController extends AbstractController | ||||
{ | { | ||||
/** | |||||
* @Route("/merchant/switch", name="carac_merchant_switch") | |||||
*/ | |||||
public function switchMerchant(Request $request, MerchantRepository $merchantRepository) | public function switchMerchant(Request $request, MerchantRepository $merchantRepository) | ||||
{ | { | ||||
$form = $this->createForm(SwitchMerchantFormType::class); | $form = $this->createForm(SwitchMerchantFormType::class); |
use Lc\CaracoleBundle\Resolver\MerchantResolver; | use Lc\CaracoleBundle\Resolver\MerchantResolver; | ||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||||
use Symfony\Component\HttpFoundation\Request; | use Symfony\Component\HttpFoundation\Request; | ||||
use Symfony\Component\Routing\Annotation\Route; | |||||
class SwitchSectionAdminController extends AbstractController | class SwitchSectionAdminController extends AbstractController | ||||
{ | { | ||||
/** | |||||
* @Route("/section/switch", name="carac_section_switch") | |||||
*/ | |||||
public function switchSection( | public function switchSection( | ||||
Request $request, | Request $request, | ||||
EntityManagerInterface $em, | EntityManagerInterface $em, |
use Lc\CaracoleBundle\Definition\SectionSettingDefinitionInterface; | use Lc\CaracoleBundle\Definition\SectionSettingDefinitionInterface; | ||||
use Lc\SovBundle\Definition\SiteSettingDefinition; | use Lc\SovBundle\Definition\SiteSettingDefinition; | ||||
use Lc\SovBundle\Form\Setting\SiteSettingsFormType; | use Lc\SovBundle\Form\Setting\SiteSettingsFormType; | ||||
use Lc\SovBundle\Repository\Site\SiteRepository; | |||||
use Lc\SovBundle\Repository\Site\SiteRepositoryInterface; | |||||
use Lc\SovBundle\Translation\TranslatorAdmin; | use Lc\SovBundle\Translation\TranslatorAdmin; | ||||
use Symfony\Component\HttpFoundation\Request; | use Symfony\Component\HttpFoundation\Request; | ||||
use Symfony\Component\Routing\Annotation\Route; | |||||
class SettingAdminController extends SovSettingController | class SettingAdminController extends SovSettingController | ||||
{ | { | ||||
MerchantSettingDefinitionInterface $merchantSettingDefinition, | MerchantSettingDefinitionInterface $merchantSettingDefinition, | ||||
SectionSettingDefinitionInterface $sectionSettingDefinition, | SectionSettingDefinitionInterface $sectionSettingDefinition, | ||||
SiteSettingDefinition $siteSettingDefinition, | SiteSettingDefinition $siteSettingDefinition, | ||||
SiteRepository $siteRepository | |||||
SiteRepositoryInterface $siteRepository | |||||
) { | ) { | ||||
$this->em = $em; | $this->em = $em; | ||||
$this->translatorAdmin = $translatorAdmin; | $this->translatorAdmin = $translatorAdmin; | ||||
$this->siteRepository = $siteRepository; | $this->siteRepository = $siteRepository; | ||||
} | } | ||||
/** | |||||
* @Route("/admin/setting/merchant", name="carac_admin_setting_merchant") | |||||
*/ | |||||
public function manageMerchant(Request $request) | public function manageMerchant(Request $request) | ||||
{ | { | ||||
return $this->manage($request, 'merchant'); | return $this->manage($request, 'merchant'); | ||||
} | } | ||||
/** | |||||
* @Route("/admin/setting/section", name="carac_admin_setting_section") | |||||
*/ | |||||
public function manageSection(Request $request) | public function manageSection(Request $request) | ||||
{ | { | ||||
return $this->manage($request, 'section'); | return $this->manage($request, 'section'); | ||||
} | } | ||||
return $this->render( | return $this->render( | ||||
'@LcCaracole/admin/setting/' . $type . '.html.twig', | |||||
'@LcCaracole/admin/setting/edit_' . $type . '.html.twig', | |||||
[ | [ | ||||
'resolver' => $resolver, | 'resolver' => $resolver, | ||||
'setting_definition' => $settingDefinition, | 'setting_definition' => $settingDefinition, | ||||
} | } | ||||
} | } | ||||
/** | |||||
* @Route("/admin/setting/site", name="carac_admin_setting_site") | |||||
*/ | |||||
public function manageGlobal(Request $request) | public function manageGlobal(Request $request) | ||||
{ | { | ||||
$site = $this->siteRepository->findOneByDevAlias('default') ; | $site = $this->siteRepository->findOneByDevAlias('default') ; | ||||
} | } | ||||
return $this->render( | return $this->render( | ||||
'@LcCaracole/admin/setting/global.html.twig' , | |||||
'@LcCaracole/admin/setting/edit_site.html.twig' , | |||||
[ | [ | ||||
'setting_definition' => $this->siteSettingDefinition, | 'setting_definition' => $this->siteSettingDefinition, | ||||
'form' => $form->createView() | 'form' => $form->createView() |
} | } | ||||
return $this->render( | return $this->render( | ||||
'@LcCaracole/admin/user/usermerchant_new.html.twig', | |||||
'@LcCaracole/admin/user/new_usermerchant.html.twig', | |||||
[ | [ | ||||
'form' => $form->createView(), | 'form' => $form->createView(), | ||||
] | ] |
use Lc\CaracoleBundle\Definition\MerchantSettingDefinitionInterface; | use Lc\CaracoleBundle\Definition\MerchantSettingDefinitionInterface; | ||||
use Lc\CaracoleBundle\Factory\Setting\MerchantSettingFactory; | use Lc\CaracoleBundle\Factory\Setting\MerchantSettingFactory; | ||||
use Lc\CaracoleBundle\Factory\Setting\SectionSettingFactory; | use Lc\CaracoleBundle\Factory\Setting\SectionSettingFactory; | ||||
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository; | |||||
use Lc\CaracoleBundle\Definition\SectionSettingDefinitionInterface; | 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\EventDispatcher\EventSubscriberInterface; | ||||
use Symfony\Component\HttpKernel\KernelEvents; | use Symfony\Component\HttpKernel\KernelEvents; | ||||
use Symfony\Component\Security\Core\Security; | |||||
class SettingEventSubscriber implements EventSubscriberInterface | class SettingEventSubscriber implements EventSubscriberInterface | ||||
{ | { | ||||
EntityManagerInterface $em, | EntityManagerInterface $em, | ||||
MerchantSettingDefinitionInterface $merchantSettingDefinition, | MerchantSettingDefinitionInterface $merchantSettingDefinition, | ||||
SectionSettingDefinitionInterface $sectionSettingDefinition, | SectionSettingDefinitionInterface $sectionSettingDefinition, | ||||
MerchantRepository $merchantRepository, | |||||
SectionRepository $sectionRepository, | |||||
MerchantRepositoryInterface $merchantRepository, | |||||
SectionRepositoryInterface $sectionRepository, | |||||
MerchantSettingFactory $merchantSettingFactory, | MerchantSettingFactory $merchantSettingFactory, | ||||
SectionSettingFactory $sectionSettingFactory | SectionSettingFactory $sectionSettingFactory | ||||
) | ) |
return; | return; | ||||
} | } | ||||
if ($this->setUserRoles($event->getRequest())) { | 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); | $event->setResponse($response); | ||||
} | } | ||||
} | } |
<?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); | |||||
} | |||||
} |
namespace Lc\CaracoleBundle\Repository\Config; | 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\CaracoleBundle\Repository\RepositoryTrait; | ||||
use Lc\SovBundle\Repository\AbstractRepository; | 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 | class TaxRateRepository extends AbstractRepository | ||||
{ | { | ||||
use RepositoryTrait; | use RepositoryTrait; | ||||
public function getInterfaceClass() | |||||
public function __construct(ManagerRegistry $registry) | |||||
{ | { | ||||
return TaxRateInterface::class; | |||||
parent::__construct($registry, TaxRate::class); | |||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\Config; | 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\CaracoleBundle\Repository\RepositoryTrait; | ||||
use Lc\SovBundle\Repository\AbstractRepository; | 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 | class UnitRepository extends AbstractRepository | ||||
{ | { | ||||
use RepositoryTrait; | use RepositoryTrait; | ||||
public function getInterfaceClass() | |||||
public function __construct(ManagerRegistry $registry) | |||||
{ | { | ||||
return UnitInterface::class; | |||||
parent::__construct($registry, Unit::class); | |||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\Credit; | 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; | 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); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\Credit; | |||||
interface CreditHistoryRepositoryInterface | |||||
{ | |||||
} | |||||
namespace Lc\CaracoleBundle\Repository\Merchant; | 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; | 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); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\Merchant; | |||||
interface MerchantRepositoryInterface | |||||
{ | |||||
} |
<?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); | |||||
} | |||||
} |
namespace Lc\CaracoleBundle\Repository\PointSale; | namespace Lc\CaracoleBundle\Repository\PointSale; | ||||
use App\Entity\PointSale\PointSale; | |||||
use Doctrine\Persistence\ManagerRegistry; | |||||
use Lc\CaracoleBundle\Repository\RepositoryTrait; | use Lc\CaracoleBundle\Repository\RepositoryTrait; | ||||
use Lc\SovBundle\Repository\AbstractRepository; | 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; | use RepositoryTrait; | ||||
public function getInterfaceClass() | |||||
public function __construct(ManagerRegistry $registry) | |||||
{ | { | ||||
return PointSaleInterface::class; | |||||
parent::__construct($registry, PointSale::class); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\PointSale; | |||||
interface PointSaleRepositoryInterface | |||||
{ | |||||
} |
namespace Lc\CaracoleBundle\Repository; | namespace Lc\CaracoleBundle\Repository; | ||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Doctrine\Persistence\ManagerRegistry; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | use Lc\CaracoleBundle\Resolver\MerchantResolver; | ||||
protected $sectionResolver; | protected $sectionResolver; | ||||
public function __construct( | public function __construct( | ||||
EntityManagerInterface $entityManager, | |||||
ManagerRegistry $managerRegistry, | |||||
SectionResolver $sectionResolver, | SectionResolver $sectionResolver, | ||||
MerchantResolver $merchantResolver | MerchantResolver $merchantResolver | ||||
) { | ) { | ||||
parent::__construct($entityManager); | |||||
parent::__construct($managerRegistry); | |||||
$this->merchantResolver = $merchantResolver; | $this->merchantResolver = $merchantResolver; | ||||
$this->sectionResolver = $sectionResolver; | $this->sectionResolver = $sectionResolver; | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\Section; | 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; | 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); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\Section; | |||||
interface SectionRepositoryInterface | |||||
{ | |||||
} | |||||
namespace Lc\CaracoleBundle\Repository\User; | namespace Lc\CaracoleBundle\Repository\User; | ||||
use Lc\CaracoleBundle\Repository\RepositoryTrait; | use Lc\CaracoleBundle\Repository\RepositoryTrait; | ||||
use Lc\SovBundle\Model\User\GroupUserInterface; | |||||
use Lc\SovBundle\Repository\User\GroupUserRepository as SovGroupUserRepository; | 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 | class GroupUserRepository extends SovGroupUserRepository | ||||
{ | { | ||||
use RepositoryTrait; | use RepositoryTrait; | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\User; | 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; | 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); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\User; | |||||
interface UserMerchantRepositoryInterface | |||||
{ | |||||
} |
namespace Lc\CaracoleBundle\Repository\User; | namespace Lc\CaracoleBundle\Repository\User; | ||||
use Lc\CaracoleBundle\Model\User\UserPointSaleInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepository; | 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; | |||||
} | |||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\User; | |||||
interface UserPointSaleRepositoryInterface | |||||
{ | |||||
} |
namespace Lc\CaracoleBundle\Repository\User; | 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; | 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); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\User; | |||||
interface VisitorRepositoryInterface | |||||
{ | |||||
} |
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\User\UserMerchantInterface; | use Lc\CaracoleBundle\Model\User\UserMerchantInterface; | ||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository; | 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\Model\User\UserInterface; | ||||
use Lc\SovBundle\Resolver\UrlResolver; | use Lc\SovBundle\Resolver\UrlResolver; | ||||
use Symfony\Component\HttpFoundation\RequestStack; | use Symfony\Component\HttpFoundation\RequestStack; | ||||
protected $urlResolver; | protected $urlResolver; | ||||
protected $security; | protected $security; | ||||
protected $currentMerchant; | protected $currentMerchant; | ||||
protected $merchantRepository; | |||||
protected $userMerrchantRepository; | |||||
public function __construct( | public function __construct( | ||||
EntityManagerInterface $entityManager, | EntityManagerInterface $entityManager, | ||||
RequestStack $requestStack, | RequestStack $requestStack, | ||||
UrlResolver $urlResolver, | UrlResolver $urlResolver, | ||||
Security $security | |||||
Security $security, | |||||
MerchantRepositoryInterface $merchantRepository, | |||||
UserMerchantRepositoryInterface $userMerchantRepository | |||||
) { | ) { | ||||
$this->requestStack = $requestStack; | $this->requestStack = $requestStack; | ||||
$this->em = $entityManager; | $this->em = $entityManager; | ||||
$this->urlResolver = $urlResolver; | $this->urlResolver = $urlResolver; | ||||
$this->security = $security; | $this->security = $security; | ||||
$this->merchantRepository = $merchantRepository; | |||||
$this->userMerchantRepository = $userMerchantRepository; | |||||
} | } | ||||
public function getCurrent(): MerchantInterface | public function getCurrent(): MerchantInterface | ||||
$this->currentMerchant = false; | $this->currentMerchant = false; | ||||
$request = $this->requestStack->getCurrentRequest(); | $request = $this->requestStack->getCurrentRequest(); | ||||
$merchantRepository = $this->em->getRepository(MerchantInterface::class); | |||||
$merchants = $merchantRepository->findAll(); | |||||
$merchants = $this->merchantRepository->findAll(); | |||||
$isCli = php_sapi_name() === 'cli'; | $isCli = php_sapi_name() === 'cli'; | ||||
if ($request || $isCli) { | if ($request || $isCli) { | ||||
UserInterface $user = null, | UserInterface $user = null, | ||||
MerchantInterface $merchant = null | MerchantInterface $merchant = null | ||||
): ?UserMerchantInterface { | ): ?UserMerchantInterface { | ||||
$userMerchantRepository = $this->em->getRepository(UserMerchantInterface::class); | |||||
if ($user === null) { | if ($user === null) { | ||||
$user = $this->security->getUser(); | $user = $this->security->getUser(); | ||||
$merchant = $this->getCurrent(); | $merchant = $this->getCurrent(); | ||||
} | } | ||||
return $userMerchantRepository->findOneBy( | |||||
return $this->userMerchantRepository->findOneBy( | |||||
[ | [ | ||||
'user' => $user, | 'user' => $user, | ||||
'merchant' => $merchant, | 'merchant' => $merchant, |
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 |
{% extends '@LcSov/adminlte/crud/index.html.twig' %} | {% extends '@LcSov/adminlte/crud/index.html.twig' %} | ||||
{% block content_title %} | {% block content_title %} | ||||
{{ 'index'|lc_trans_admin_title(ea.getEntity().getFqcn()) }} | |||||
{{ 'index'|sov_trans_admin_title(ea.getEntity().getFqcn()) }} | |||||
Info de Fab | Info de Fab | ||||
{% endblock %} | {% endblock %} |
{% 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> |
{% extends '@LcCaracole/adminlte/layout.html.twig' %} | {% extends '@LcCaracole/adminlte/layout.html.twig' %} | ||||
{% block content_title %} | {% 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 %} | {% endblock %} | ||||
{% block main %} | {% block main %} |
{% extends '@LcCaracole/adminlte/layout.html.twig' %} | {% extends '@LcCaracole/adminlte/layout.html.twig' %} | ||||
{% block content_title %} | {% block content_title %} | ||||
{{ 'new'|lc_trans_admin_title(ea.getEntity().getFqcn()) }} | |||||
{{ 'new'|sov_trans_admin_title(ea.getEntity().getFqcn()) }} | |||||
{% endblock %} | {% endblock %} | ||||
{% block main %} | {% block main %} |
<nav class="carac navbar navbar-expand navbar-light main-header" style="border-color: {{ section_current.color }};"> | <nav class="carac navbar navbar-expand navbar-light main-header" style="border-color: {{ section_current.color }};"> | ||||
<ul class="navbar-nav left"> | <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"> | <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_theme form_switch_section '@LcSov/adminlte/crud/form_theme.html.twig' %} | ||||
{{ form_start(form_switch_section) }} | {{ form_start(form_switch_section) }} | ||||
{{ form(form_switch_section) }} | {{ form(form_switch_section) }} | ||||
<ul class="navbar-nav ml-auto right"> | <ul class="navbar-nav ml-auto right"> | ||||
<li class="nav-item nav-switch-merchant"> | <li class="nav-item nav-switch-merchant"> | ||||
<i class="fa fa-store"></i> | <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_theme form_switch_merchant '@LcSov/adminlte/crud/form_theme.html.twig' %} | ||||
{{ form_start(form_switch_merchant) }} | {{ form_start(form_switch_merchant) }} | ||||
{{ form(form_switch_merchant) }} | {{ form(form_switch_merchant) }} | ||||
comme marchand favoris ou simplement indiquer que vous visitez ce marchand pour aujourd'hui.</p> | comme marchand favoris ou simplement indiquer que vous visitez ce marchand pour aujourd'hui.</p> | ||||
{% endblock %} | {% endblock %} | ||||
{% block footer %} | {% 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_theme form_switch_merchant '@LcSov/adminlte/crud/form_theme.html.twig' %} | ||||
{{ form_start(form_switch_merchant) }} | {{ form_start(form_switch_merchant) }} | ||||
{{ form(form_switch_merchant) }} | {{ form(form_switch_merchant) }} |
<?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(); | |||||
} | |||||
} |
<?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(); | |||||
} | |||||
} |
namespace Lc\CaracoleBundle\Twig; | namespace Lc\CaracoleBundle\Twig; | ||||
use Doctrine\ORM\EntityManagerInterface; | |||||
use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantButtonAdminFormType; | use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantButtonAdminFormType; | ||||
use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType; | use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType; | ||||
use Lc\CaracoleBundle\Form\Section\SwitchSectionFormType; | 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\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\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\Component\Routing\Generator\UrlGeneratorInterface; | ||||
use Symfony\Contracts\Translation\TranslatorInterface; | |||||
use Twig\Extension\AbstractExtension; | use Twig\Extension\AbstractExtension; | ||||
use Twig\TwigFunction; | use Twig\TwigFunction; | ||||
class TwigExtension extends AbstractExtension | 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(); | |||||
} | |||||
} | } |