Przeglądaj źródła

Merge branch 'develop'

master
Fab 2 lat temu
rodzic
commit
7ef4e4b2f1
100 zmienionych plików z 3485 dodań i 1571 usunięć
  1. +8
    -0
      ShopBundle/Context/SectionInterface.php
  2. +8
    -0
      ShopBundle/Context/SectionUtilsInterface.php
  3. +198
    -54
      ShopBundle/Controller/Backend/AdminController.php
  4. +4
    -3
      ShopBundle/Controller/Backend/DocumentController.php
  5. +78
    -69
      ShopBundle/Controller/Backend/NewsController.php
  6. +22
    -5
      ShopBundle/Controller/Backend/OrderController.php
  7. +24
    -12
      ShopBundle/Controller/Backend/ProductFamilyController.php
  8. +3
    -3
      ShopBundle/Controller/Backend/TicketController.php
  9. +43
    -0
      ShopBundle/Controller/Backend/UserController.php
  10. +4
    -2
      ShopBundle/Controller/Backend/UserMerchantController.php
  11. +4
    -0
      ShopBundle/Controller/Frontend/CartController.php
  12. +32
    -0
      ShopBundle/Event/EntityManager/EntityManagerEvent.php
  13. +35
    -0
      ShopBundle/Event/OrderShop/OrderShopChangeStatusEvent.php
  14. +17
    -0
      ShopBundle/Form/Backend/Common/EntityType.php
  15. +42
    -0
      ShopBundle/Form/Backend/Common/NewslettersType.php
  16. +2
    -1
      ShopBundle/Form/Backend/Filters/ListFilterType.php
  17. +14
    -9
      ShopBundle/Form/Backend/ProductFamily/ProductFamilyCategoriesType.php
  18. +17
    -17
      ShopBundle/Form/Backend/ProductFamily/ProductType.php
  19. +41
    -0
      ShopBundle/Form/DataTransformer/NewsletterSignupToBooleanTransformer.php
  20. +14
    -8
      ShopBundle/Form/Frontend/RegistrationType.php
  21. +19
    -0
      ShopBundle/Form/Frontend/TicketMessageType.php
  22. +143
    -70
      ShopBundle/Form/Frontend/TicketType.php
  23. +127
    -0
      ShopBundle/Manager/EntityManager.php
  24. +0
    -8
      ShopBundle/Model/AbstractDocumentEntity.php
  25. +6
    -2
      ShopBundle/Model/Merchant.php
  26. +17
    -0
      ShopBundle/Model/Newsletter.php
  27. +88
    -0
      ShopBundle/Model/OpenGraphTrait.php
  28. +33
    -4
      ShopBundle/Model/OrderShop.php
  29. +4
    -6
      ShopBundle/Model/OrderStatus.php
  30. +5
    -0
      ShopBundle/Model/PriceTrait.php
  31. +4
    -0
      ShopBundle/Model/Product.php
  32. +31
    -6
      ShopBundle/Model/ProductCategory.php
  33. +772
    -682
      ShopBundle/Model/ProductFamily.php
  34. +5
    -3
      ShopBundle/Model/ProductPropertyTrait.php
  35. +17
    -17
      ShopBundle/Model/ReductionCredit.php
  36. +172
    -0
      ShopBundle/Model/Section.php
  37. +17
    -0
      ShopBundle/Model/TicketMessage.php
  38. +36
    -1
      ShopBundle/Model/User.php
  39. +25
    -7
      ShopBundle/Repository/BaseRepository.php
  40. +270
    -254
      ShopBundle/Repository/OrderShopRepository.php
  41. +13
    -1
      ShopBundle/Repository/ProductCategoryRepository.php
  42. +19
    -1
      ShopBundle/Repository/ProductFamilyRepository.php
  43. +35
    -35
      ShopBundle/Repository/ProductRepository.php
  44. +4
    -3
      ShopBundle/Repository/ReductionCartRepository.php
  45. +3
    -0
      ShopBundle/Repository/ReductionCatalogRepository.php
  46. +50
    -0
      ShopBundle/Repository/SectionRepository.php
  47. +3
    -2
      ShopBundle/Repository/UserRepository.php
  48. +9
    -0
      ShopBundle/Repository/VisitorRepository.php
  49. +204
    -134
      ShopBundle/Resources/public/css/backend/custom.css
  50. +2
    -0
      ShopBundle/Resources/public/css/backend/ekko-lightbox/ekko-ligthbox.min.css
  51. +2
    -0
      ShopBundle/Resources/public/js/backend/plugin/ekko-lightbox/ekko-lightbox.min.js
  52. +71
    -1
      ShopBundle/Resources/public/js/backend/script/default/init-common.js
  53. +7
    -2
      ShopBundle/Resources/public/js/backend/script/default/init-list.js
  54. +4
    -0
      ShopBundle/Resources/public/js/backend/script/merchant/vuejs-merchant.js
  55. +2
    -2
      ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js
  56. +30
    -7
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  57. +43
    -5
      ShopBundle/Resources/public/sass/backend/custom.scss
  58. +50
    -6
      ShopBundle/Resources/translations/lcshop.fr.yaml
  59. +19
    -10
      ShopBundle/Resources/views/backend/default/block/actions.html.twig
  60. +11
    -0
      ShopBundle/Resources/views/backend/default/block/embed_figure_box.twig
  61. +27
    -0
      ShopBundle/Resources/views/backend/default/block/list_ordersgiftvoucher.html.twig
  62. +0
    -31
      ShopBundle/Resources/views/backend/default/block/list_tickets.html.twig
  63. +193
    -15
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  64. +103
    -0
      ShopBundle/Resources/views/backend/default/block/paginator.html.twig
  65. +34
    -0
      ShopBundle/Resources/views/backend/default/edit-ajax.html.twig
  66. +0
    -0
      ShopBundle/Resources/views/backend/default/field/association.html.twig
  67. +0
    -0
      ShopBundle/Resources/views/backend/default/field/association_users.html.twig
  68. +0
    -0
      ShopBundle/Resources/views/backend/default/field/badge.html.twig
  69. +0
    -0
      ShopBundle/Resources/views/backend/default/field/children.html.twig
  70. +0
    -0
      ShopBundle/Resources/views/backend/default/field/date.html.twig
  71. +5
    -1
      ShopBundle/Resources/views/backend/default/field/datetime.html.twig
  72. +0
    -0
      ShopBundle/Resources/views/backend/default/field/day.html.twig
  73. +0
    -0
      ShopBundle/Resources/views/backend/default/field/options_translatable.html.twig
  74. +0
    -0
      ShopBundle/Resources/views/backend/default/field/price.html.twig
  75. +0
    -0
      ShopBundle/Resources/views/backend/default/field/product_family_available_quantity.html.twig
  76. +2
    -0
      ShopBundle/Resources/views/backend/default/field/product_family_sales.html.twig
  77. +9
    -0
      ShopBundle/Resources/views/backend/default/field/status.html.twig
  78. +3
    -0
      ShopBundle/Resources/views/backend/default/field/supplier.html.twig
  79. +5
    -0
      ShopBundle/Resources/views/backend/default/field/textorempty.html.twig
  80. +0
    -0
      ShopBundle/Resources/views/backend/default/field/ticket_last_message.html.twig
  81. +0
    -0
      ShopBundle/Resources/views/backend/default/field/ticket_status.html.twig
  82. +9
    -0
      ShopBundle/Resources/views/backend/default/field/toggle.html.twig
  83. +1
    -0
      ShopBundle/Resources/views/backend/default/field/total.html.twig
  84. +7
    -0
      ShopBundle/Resources/views/backend/default/field/user.html.twig
  85. +24
    -1
      ShopBundle/Resources/views/backend/default/layout/layout-ajax.html.twig
  86. +0
    -2
      ShopBundle/Resources/views/backend/default/list-fields/field_product_family_total_product_ordered.html.twig
  87. +0
    -14
      ShopBundle/Resources/views/backend/default/list-fields/field_toggle.html.twig
  88. +0
    -1
      ShopBundle/Resources/views/backend/default/list-fields/field_total.html.twig
  89. +50
    -22
      ShopBundle/Resources/views/backend/default/list.html.twig
  90. +5
    -4
      ShopBundle/Resources/views/backend/default/sortable.html.twig
  91. +2
    -2
      ShopBundle/Resources/views/backend/form/custom_bootstrap_4.html.twig
  92. +3
    -1
      ShopBundle/Resources/views/backend/merchant/form.html.twig
  93. +18
    -0
      ShopBundle/Resources/views/backend/merchant/panel_lunch.html.twig
  94. +0
    -0
      ShopBundle/Resources/views/backend/order/field/complementary.html.twig
  95. +0
    -0
      ShopBundle/Resources/views/backend/order/field/hasreach.html.twig
  96. +0
    -0
      ShopBundle/Resources/views/backend/order/field/order-payment.html.twig
  97. +1
    -0
      ShopBundle/Resources/views/backend/order/field/order_status.html.twig
  98. +0
    -23
      ShopBundle/Resources/views/backend/order/macros.html.twig
  99. +1
    -1
      ShopBundle/Resources/views/backend/order/show-cart.html.twig
  100. +1
    -1
      ShopBundle/Resources/views/backend/order/show-order.html.twig

+ 8
- 0
ShopBundle/Context/SectionInterface.php Wyświetl plik

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

namespace Lc\ShopBundle\Context;

interface SectionInterface
{

}

+ 8
- 0
ShopBundle/Context/SectionUtilsInterface.php Wyświetl plik

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

namespace Lc\ShopBundle\Context;

interface SectionUtilsInterface
{

}

+ 198
- 54
ShopBundle/Controller/Backend/AdminController.php Wyświetl plik

@@ -29,6 +29,7 @@ use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;

@@ -41,13 +42,15 @@ class AdminController extends EasyAdminController
protected $merchantUtils;
protected $mailjetTransport;
protected $orderUtils;
protected $mailUtils ;
protected $mailUtils;
protected $translator;
protected $utilsProcess;
protected $session;
protected $sectionUtils;
protected $filtersForm = null;

public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em,
MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator)
MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session)
{
$this->security = $security;
$this->userManager = $userManager;
@@ -56,9 +59,11 @@ class AdminController extends EasyAdminController
$this->utils = $utilsManager->getUtils();
$this->merchantUtils = $utilsManager->getMerchantUtils();
$this->orderUtils = $utilsManager->getOrderUtils();;
$this->mailUtils = $utilsManager->getMailUtils() ;
$this->utilsProcess = $utilsManager->getUtilsProcess() ;
$this->mailUtils = $utilsManager->getMailUtils();
$this->utilsProcess = $utilsManager->getUtilsProcess();
$this->sectionUtils = $utilsManager->getSectionUtils();
$this->translator = $translator;
$this->session = $session;
}

public function createCustomForm($class, $action, $parameters, $data = true, $options = array())
@@ -88,7 +93,7 @@ class AdminController extends EasyAdminController

$response = array();
foreach ($values as $value) {
$response[] = $value[$field];
$response[] = $value[$this->utils->getFilterWithoutAssociationAlias($field, '_')];
}
return new JsonResponse($response);

@@ -131,6 +136,21 @@ class AdminController extends EasyAdminController
$dqlFilter = sprintf(str_replace('currentMerchant', $this->getUser()->getMerchant()->getId(), $dqlFilter));
}

if ($pos = strpos($dqlFilter, 'TODAYSTART')) {
$date = new \DateTime();
$dqlFilter = sprintf(str_replace('TODAYSTART', $date->format('Y-m-d') . ' 00:00:00', $dqlFilter));
}
if ($pos = strpos($dqlFilter, 'TODAYEND')) {
$date = new \DateTime();
$dqlFilter = sprintf(str_replace('TODAYEND', $date->format('Y-m-d') . ' 23:59:59', $dqlFilter));
}

if ($pos = strpos($dqlFilter, 'sectionLunch')) {
$dqlFilter = sprintf(str_replace('sectionLunch', $this->sectionUtils->getSection('lunch')->getId(), $dqlFilter));
} else if ($pos = strpos($dqlFilter, 'sectionMarket')) {
$dqlFilter = sprintf(str_replace('sectionMarket', $this->sectionUtils->getSection('market')->getId(), $dqlFilter));
}

if (new $entityClass instanceof StatusInterface && strpos($dqlFilter, 'entity.status') === false) {
if ($dqlFilter) $dqlFilter .= sprintf(' AND entity.status > = 0');
else $dqlFilter .= sprintf(' entity.status > = 0');
@@ -162,7 +182,6 @@ class AdminController extends EasyAdminController
$dqlFilter = $this->commonDqlFilterQueryBuilder($entityClass, $dqlFilter);
$queryBuilder = parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter);
$this->commonQueryFilter($entityClass, $queryBuilder);

$listFields = $this->entity['list']['fields'];

$this->filtersForm = $this->createForm(ListFilterType::class, null, array(
@@ -173,44 +192,68 @@ class AdminController extends EasyAdminController
'entity_class' => $this->entity['class']
));
$this->filtersForm->handleRequest($this->request);

if ($this->filtersForm->isSubmitted() && $this->filtersForm->isValid()) {
$easyadmin = $this->request->attributes->get('easyadmin');
$view = $easyadmin['view'];
if ($easyadmin['view'] == 'listChildren') $view = 'list';
if (($this->filtersForm->isSubmitted() && $this->filtersForm->isValid()) || $this->entity[$view]['filters'] !== false) {
foreach ($listFields as $field) {
if ($this->filtersForm->has($field['property'])) {
$field['initProperty'] = $field['property'];
$field['property'] = $this->utils->getFilterPropertyClean($field['property']);
//if ($this->filtersForm->has($field['property'])->getConfig()->getOption('AdminController')) {
if ($this->filtersForm->has($field['property'])) {
switch ($field['dataType']) {
case 'option':
case 'integer':
case 'text':
case 'string':
case 'toggle':
$filter = $this->filtersForm->get($field['property'])->getData();
$filter = $this->getListFilterParam($field['property']);
//$filter = $this->filtersForm->get($field['property'])->getData();
if ($filter !== null) {
if ($this->utils->hasFilterAssociation($field['initProperty'])) {
$aliasRelation = $this->utils->getFilterAssociationAlias($field['initProperty']);
if (array_search($aliasRelation, $queryBuilder->getAllAliases()) === false) {
$queryBuilder->innerJoin('entity.' . $aliasRelation, $aliasRelation);
}
$queryBuilder->andWhere($field['initProperty'] . ' LIKE :' . $field['property'] . '');
$queryBuilder->setParameter($field['property'], '%' . $filter . '%');
} else {
$queryBuilder->andWhere('entity.' . $field['property'] . ' LIKE :' . $field['property'] . '');
$queryBuilder->setParameter($field['property'], '%' . $filter . '%');

}

$queryBuilder->andWhere('entity.' . $field['property'] . ' LIKE :' . $field['property'] . '');
$queryBuilder->setParameter($field['property'], '%' . $filter . '%');
}
break;
case 'association' :

$filter = $this->filtersForm->get($field['property'])->getData();
$filter = $this->getListFilterParam($field['property']);
//$filter = $this->filtersForm->get($field['property'])->getData();
if ($filter !== null) {
if ($field['type_options']['multiple']) {
$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . '');
} else {
$queryBuilder->andWhere('entity.' . $field['property'] . ' = :' . $field['property'] . '');
}
if($filter instanceof TreeInterface && $filter->getParent() == null) {
$queryBuilder->setParameter($field['property'], array_merge(array($filter), $filter->getChildrens()->toArray()));
}else{

//TODO Faut généraliser avec TreeInterface, ça ne doit pas être ici
if ($field['property'] == 'productCategories') {

$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . ' OR product_categories.parent = :' . $field['property']);
$queryBuilder->setParameter($field['property'], $filter);
} else {
if ($field['type_options']['multiple']) {
$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . '');
} else {
$queryBuilder->andWhere('entity.' . $field['property'] . ' = :' . $field['property'] . '');
}

if ($filter instanceof TreeInterface && $filter->getParent() == null) {
$queryBuilder->setParameter($field['property'], array_merge(array($filter), $filter->getChildrens()->toArray()));
} else {
$queryBuilder->setParameter($field['property'], $filter);
}
}
}
break;
case 'datetime':
case 'date':
$dateStart = $this->filtersForm->get($field['property'])->get('dateStart')->getData();
$dateEnd = $this->filtersForm->get($field['property'])->get('dateEnd')->getData();

$dateStart = $this->getListFilterParam($field['property'], 'dateStart');
$dateEnd = $this->getListFilterParam($field['property'], 'dateEnd');

if ($dateStart) $queryBuilder->andWhere('entity.' . $field['property'] . ' >= :dateStart')->setParameter('dateStart', $dateStart);
if ($dateEnd) $queryBuilder->andWhere('entity.' . $field['property'] . ' <= :dateEnd')->setParameter('dateEnd', $dateEnd);
@@ -222,9 +265,63 @@ class AdminController extends EasyAdminController
}
}

//TODO déplacer dans LC
if ($this->entity['name'] == 'OrderShopLunch' || $this->entity['name'] == 'OrderShopLunchDay') {
$queryBuilder->addOrderBy('entity.user', 'asc');
}

return $queryBuilder;
}

//TODO finaliser la sauvegarde des filtres

protected function getListFilterParam($param, $extraParam = null)
{
$entityName = $this->entity['name'];
$sessionParam = $entityName . $param . $extraParam;
//CUSTOM
if ($extraParam) {
$value = $this->filtersForm->get($param)->get($extraParam)->getViewData();
} else {
$value = $this->filtersForm->get($param)->getViewData();
}

if ($this->request->query->get('filterClear')) {
$this->session->remove($sessionParam);
} else {
if ($value) {
$this->session->set($sessionParam, $value);
} else if ($this->session->get($sessionParam) && !$this->filtersForm->isSubmitted() && $this->filtersForm->get($param)) {
$value = $this->session->get($sessionParam);

if ($extraParam) {

if ($this->filtersForm->get($param)->get($extraParam)->getConfig()->getOption('input') == 'datetime') {

$this->filtersForm->get($param)->get($extraParam)->setData(new \DateTime($value));
} else {
$this->filtersForm->get($param)->get($extraParam)->setData($value);
}

} else {
//Champ association
if ($this->filtersForm->get($param)->getConfig()->getOption('class')) {
$valFormated = $this->em->getRepository($this->filtersForm->get($param)->getConfig()->getOption('class'))->find($value);
$this->filtersForm->get($param)->setData($valFormated);
} else {
//Champ noramux
$this->filtersForm->get($param)->setData($value);
}
}

}
}

if ($value !== "") return $value;
else return null;

}


public function renderTemplate($actionName, $templatePath, array $parameters = [])
{
@@ -303,6 +400,48 @@ class AdminController extends EasyAdminController
}


protected function getListParam($param, $default = null)
{
$entityName = $this->entity['name'];
$sessionParam = $entityName . $param;
//CUSTOM
if ($param == 'maxResults') {
$val = $this->entity['list']['max_results'];
} else {
$val = $this->request->query->get($param, $default);
}

if (isset($_GET[$param])) {
$val = $this->request->query->get($param);
$this->session->set($sessionParam, $val);
} else if ($this->session->get($sessionParam)) {
$val = $this->session->get($sessionParam);
$this->request->query->set($param, $val);
}

return $val;
}

protected function listAction()
{
$this->dispatch(EasyAdminEvents::PRE_LIST);

$fields = $this->entity['list']['fields'];

$paginator = $this->findAll($this->entity['class'], $this->getListParam('page', 1), $this->getListParam('maxResults'), $this->getListParam('sortField'), $this->getListParam('sortDirection'), $this->entity['list']['dql_filter']);

$this->dispatch(EasyAdminEvents::POST_LIST, ['paginator' => $paginator]);

$parameters = [
'paginator' => $paginator,
'fields' => $fields,
'batch_form' => $this->createBatchForm($this->entity['name'])->createView(),
'delete_form_template' => $this->createDeleteForm($this->entity['name'], '__id__')->createView(),
];

return $this->executeDynamicMethod('render<EntityName>Template', ['list', $this->entity['templates']['list'], $parameters]);
}

public function sortAction()
{

@@ -461,7 +600,8 @@ class AdminController extends EasyAdminController
$isFilterMerchantInterface = in_array('Lc\ShopBundle\Context\FilterMerchantInterface', $classImplements);
$isFilterMultipleMerchantsInterface = in_array('Lc\ShopBundle\Context\FilterMultipleMerchantsInterface', $classImplements);

if ($isFilterMerchantInterface || $isFilterMultipleMerchantsInterface) {
if (($isFilterMerchantInterface || $isFilterMultipleMerchantsInterface) && (!isset($passedOptions['merchant_filter']) || $passedOptions['merchant_filter'] === true)) {


if (in_array('Lc\ShopBundle\Context\StatusInterface', $classImplements)) {
$statusInterface = true;
@@ -477,6 +617,7 @@ class AdminController extends EasyAdminController
$form->add($child->getName(), EntityType::class, array(
'class' => $this->em->getClassMetadata($passedOptions['class'])->getName(),
'label' => $passedOptions['label'],
'expanded' => isset($passedOptions['expanded']) ? $passedOptions['expanded'] : false,
'multiple' => isset($passedOptions['multiple']) ? $passedOptions['multiple'] : false,
'placeholder' => '--',
'translation_domain' => 'lcshop',
@@ -527,7 +668,7 @@ class AdminController extends EasyAdminController

$id = $this->request->query->get('id');
$easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item'];
$entity = $easyadmin['item'];

if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) {
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue'));
@@ -572,65 +713,68 @@ class AdminController extends EasyAdminController
return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]);
}

/* public function createNewEntity(){
$idDuplicate = $this->request->query->get('duplicate', null);
if($idDuplicate){
$easyadmin = $this->request->attributes->get('easyadmin');
$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($idDuplicate);
/* public function createNewEntity(){
$idDuplicate = $this->request->query->get('duplicate', null);
if($idDuplicate){
$easyadmin = $this->request->attributes->get('easyadmin');
$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($idDuplicate);

$newProductFamily = clone $entity ;
$this->em->persist($newProductFamily) ;
$this->em->flush() ;
}else{
$entityFullyQualifiedClassName = $this->entity['class'];
$newProductFamily = clone $entity ;
$this->em->persist($newProductFamily) ;
$this->em->flush() ;
}else{
$entityFullyQualifiedClassName = $this->entity['class'];

return new $entityFullyQualifiedClassName();
}
return new $entityFullyQualifiedClassName();
}

}*/
}*/

public function duplicateAction(){
public function duplicateAction()
{

$id = $this->request->query->get('id');
$refererUrl = $this->request->query->get('referer', '');

$easyadmin = $this->request->attributes->get('easyadmin');

$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($id);
$entity = $this->em->getRepository($easyadmin['entity']['class'])->find($id);

$newEntity = $this->utilsProcess->duplicateEntity($entity);

return $this->redirectToRoute('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' =>$newEntity->getId(), 'referer' =>$refererUrl ]) ;
return $this->redirectToRoute('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' => $newEntity->getId(), 'referer' => $refererUrl]);
}

public function duplicateOtherHubAction(){
public function duplicateOtherHubAction()
{

$id = $this->request->query->get('id');
$hubAlias = $this->request->query->get('hub');
$refererUrl = $this->request->query->get('referer', '');
$user = $this->security->getUser() ;
$user = $this->security->getUser();

$easyadmin = $this->request->attributes->get('easyadmin');

$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($id);
$hub= $this->em->getRepository(MerchantInterface::class)->findOneByDevAlias($hubAlias);
$entity = $this->em->getRepository($easyadmin['entity']['class'])->find($id);
$hub = $this->em->getRepository(MerchantInterface::class)->findOneByDevAlias($hubAlias);

$newEntity = $this->utilsProcess->duplicateEntityToOtherHub($entity,$hub);
$newEntity = $this->utilsProcess->duplicateEntityToOtherHub($entity, $hub);

$user->setMerchant($hub);
$this->em->persist($user);
$this->em->flush();

$redirectUrl = $this->generateUrl('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' =>$newEntity->getId(), 'referer' =>$refererUrl ]).'&hubredirection=true';
$redirectUrl = $this->generateUrl('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' => $newEntity->getId(), 'referer' => $refererUrl]) . '&hubredirection=true';

return $this->redirectToOtherHub($hub, $redirectUrl) ;
return $this->redirectToOtherHub($hub, $redirectUrl);
}

public function redirectToOtherHub($hub, $url){
if(strpos($_SERVER['HTTP_HOST'], 'localhost')!==false){
public function redirectToOtherHub($hub, $url)
{
if (strpos($_SERVER['HTTP_HOST'], 'localhost') !== false) {
return $this->redirect($url);
}else{
return $this->redirect($hub->getMerchantConfig('url').substr($url,1));
} else {
return $this->redirect($hub->getMerchantConfig('url') . substr($url, 1));
}

}

+ 4
- 3
ShopBundle/Controller/Backend/DocumentController.php Wyświetl plik

@@ -11,6 +11,7 @@ use Lc\ShopBundle\Services\Utils;
use Lc\ShopBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Security;
@@ -20,9 +21,9 @@ class DocumentController extends AdminController
{
protected $documentRepository ;

public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator)
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session)
{
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator);
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session);
$this->documentRepository = $this->em->getRepository($this->em->getClassMetadata(DocumentInterface::class)->getName()) ;
}

@@ -47,4 +48,4 @@ class DocumentController extends AdminController
}
}

}
}

+ 78
- 69
ShopBundle/Controller/Backend/NewsController.php Wyświetl plik

@@ -11,6 +11,7 @@ use Lc\ShopBundle\Services\MailUtils;
use Lc\ShopBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
@@ -21,39 +22,40 @@ class NewsController extends AdminController
{
protected $parameterBag ;

public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em,
MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator,
ParameterBagInterface $parameterBag)
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session, ParameterBagInterface $parameterBag)
{
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session);
$this->parameterBag = $parameterBag ;
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator);
}

public function sendTestAction()
{
$newsletter = $this->getNewsletter() ;
$news = $this->getNews() ;

$merchantCurrent = $this->merchantUtils->getMerchantCurrent() ;
$merchantConfigEmailContact = $merchantCurrent->getMerchantConfig('email-contact');
if($newsletter) {
$news = $this->getNews() ;

$merchantCurrent = $this->merchantUtils->getMerchantCurrent() ;
$merchantConfigEmailContact = $merchantCurrent->getMerchantConfig('email-contact');

if($merchantConfigEmailContact && strlen($merchantConfigEmailContact)) {
if($merchantConfigEmailContact && strlen($merchantConfigEmailContact)) {
$this->mailUtils->send([
MailUtils::SUBJECT => $news->getTitle(),
MailUtils::TO_EMAIL => $merchantConfigEmailContact,
MailUtils::TO_NAME => $this->parameterBag->get('app.site_name'),
MailUtils::CONTENT_TEMPLATE => 'mail/news',
MailUtils::CONTENT_DATA => [
'news' => $news,
'newsletter' => $newsletter,
'user' => $this->security->getUser()
],
MailUtils::SUBJECT => $news->getTitle(),
MailUtils::TO_EMAIL => $merchantConfigEmailContact,
MailUtils::TO_NAME => $this->parameterBag->get('app.site_name'),
MailUtils::CONTENT_TEMPLATE => 'mail/news',
MailUtils::CONTENT_DATA => [
'news' => $news,
'newsletter' => $newsletter,
'user' => $this->security->getUser()
],
]);

$this->addFlash('success', 'Actualité de test envoyée à '.$merchantConfigEmailContact);
}
else {
}
else {
throw new \ErrorException("L'email de contact n'est pas défini pour ce Merchant.") ;
}
}

return $this->redirectToRoute('easyadmin', ['entity' => 'News', 'action' => 'list']) ;
@@ -66,77 +68,80 @@ class NewsController extends AdminController

$currentMerchant = $this->merchantUtils->getMerchantCurrent() ;
$newsletter = $this->getNewsletter() ;
$news = $this->getNews() ;
$users = $this->em->getRepository($this->em->getClassMetadata(UserInterface::class)->getName())->findAllByNewsletter($newsletter) ;
$countUsers = count($users) ;

$packageMessagesArray = [];
$packageMessageLimit = 50 ;
if($newsletter) {
$news = $this->getNews() ;
$users = $this->em->getRepository($this->em->getClassMetadata(UserInterface::class)->getName())->findAllByNewsletter($newsletter) ;

$countUsers = count($users) ;

$packageMessagesArray = [];
$packageMessageLimit = 50 ;

$paramsTemplate = [
$paramsTemplate = [
'news' => $news,
'newsletter' => $newsletter,
'user' => $this->security->getUser()
] ;
] ;

$i = 0 ;
$i = 0 ;

foreach ($users as $user) {
foreach ($users as $user) {
$paramsTemplate['user'] =$user;

if(!isset($packageMessagesArray[$i])) {
$packageMessagesArray[$i] = [] ;
$packageMessagesArray[$i] = [] ;
}

if($user->getEmail() && strlen($user->getEmail())) {
$packageMessagesArray[$i][] = [
'To' => [
[
'Email' => $user->getEmail(),
'Name' => $user->getFirstname().' '.$user->getLastname(),
]
],
'From' => [
'Email' => $this->getParameter('app.noreply_email'),
'Name' => $this->getParameter('app.site_name')
],
'Subject' => $currentMerchant->getMerchantConfig('email-subject-prefix').' '.$news->getTitle(),
'TextPart' => $this->renderView('mail/news-text.html.twig', $paramsTemplate),
'HTMLPart' => $this->renderView('mail/news-html.html.twig', $paramsTemplate),
'CustomCampaign' => $news->getTitle(),
'DeduplicateCampaign' => true
] ;
if(count($packageMessagesArray[$i]) >= $packageMessageLimit) {
$i ++ ;
}
$packageMessagesArray[$i][] = [
'To' => [
[
'Email' => $user->getEmail(),
'Name' => $user->getFirstname().' '.$user->getLastname(),
]
],
'From' => [
'Email' => $this->getParameter('app.noreply_email'),
'Name' => $this->getParameter('app.site_name')
],
'Subject' => $currentMerchant->getMerchantConfig('email-from-name').' - '.$news->getTitle(),
'TextPart' => $this->renderView('mail/news-text.html.twig', $paramsTemplate),
'HTMLPart' => $this->renderView('mail/news-html.html.twig', $paramsTemplate),
'CustomCampaign' => $news->getTitle(),
'DeduplicateCampaign' => true
] ;
if(count($packageMessagesArray[$i]) >= $packageMessageLimit) {
$i ++ ;
}
}
}
}

if($countUsers > 0) {
if($countUsers > 0) {
$mj = new \Mailjet\Client($this->mailjetTransport->getApiKey(), $this->mailjetTransport->getApiSecret(),true,['version' => 'v3.1']);

foreach($packageMessagesArray as $messagesArray) {
$body = [
'Messages' => $messagesArray
];
$response = $mj->post(Resources::$Email, ['body' => $body]);
$body = [
'Messages' => $messagesArray
];
$response = $mj->post(Resources::$Email, ['body' => $body]);
}

if(isset($response) && $response->success()) {
$this->addFlash('success', 'Actualité envoyée à '.$countUsers.' utilisateurs.');
$this->addFlash('success', 'Actualité envoyée à '.$countUsers.' utilisateurs.');

$news->setIsSent(true) ;
$this->em->persist($news);
$this->em->flush() ;
$news->setIsSent(true) ;
$this->em->persist($news);
$this->em->flush() ;
}
else {
$this->addFlash('error', "Une erreur est survenue lors de l'envoi de l'actualité.");
$this->addFlash('error', "Une erreur est survenue lors de l'envoi de l'actualité.");
}
}
else {
}
else {
$this->addFlash('error', 'Aucun utilisateur inscrit à la newsletter.');
}
}

return $this->redirectToRoute('easyadmin', ['entity' => 'News', 'action' => 'list']) ;
@@ -144,13 +149,17 @@ class NewsController extends AdminController

public function getNewsletter()
{
$newsletter = $this->merchantUtils->getMerchantCurrent()->getNewsletter() ;
$news = $this->getNews() ;

if($newsletter) {
return $newsletter ;
if($news) {
$newsletter = $news->getNewsletter() ;
}

if(isset($newsletter) && $newsletter) {
return $newsletter ;
}
else {
throw new \ErrorException('Aucune newsletter n\'est liée à ce Merchant.') ;
$this->utils->addFlash('error', 'Aucune newsletter n\'est liée à l\'actualité.');
}
}

@@ -167,4 +176,4 @@ class NewsController extends AdminController
}
}

}
}

+ 22
- 5
ShopBundle/Controller/Backend/OrderController.php Wyświetl plik

@@ -33,6 +33,7 @@ use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -43,11 +44,11 @@ class OrderController extends AdminController
protected $creditUtils;
protected $mailUtils;

public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator)
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session)
{
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session);
$this->creditUtils = $utilsManager->getCreditUtils();
$this->mailUtils = $utilsManager->getMailUtils();
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator);
}

protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null)
@@ -458,7 +459,7 @@ class OrderController extends AdminController
$parameters['form_order_send_payment_link'] = $this->createCustomForm(OrderSendPaymentLink::class, 'orderSendPaymentLink', $parameters)->createView();
break;
case OrderStatus::ALIAS_ERROR_PAYMENT_ONLINE :
case OrderStatus::ALIAS_WAITING_PAYMENT_CREDIT :
case OrderStatus::ALIAS_PARTIAL_PAYMENT :
case OrderStatus::ALIAS_WAITING_PAYMENT_ONLINE :
$parameters['form_order_send_payment_link'] = $this->createCustomForm(OrderSendPaymentLink::class, 'orderSendPaymentLink', $parameters)->createView();
$parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView();
@@ -466,8 +467,7 @@ class OrderController extends AdminController
$parameters['form_order_status'] = $this->createCustomForm(OrderStatusType::class, 'orderStatus', $parameters)->createView();
$parameters['form_order_invoice_address'] = $this->createCustomForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView();
break;
case OrderStatus::ALIAS_PAID_BY_CREDIT :
case OrderStatus::ALIAS_PAID_ONLINE :
case OrderStatus::ALIAS_PAID :
case OrderStatus::ALIAS_WAITING_DELIVERY :
case OrderStatus::ALIAS_WAITING_BANK_RETURN :
$parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView();
@@ -580,6 +580,23 @@ class OrderController extends AdminController
$id = $this->request->query->get('id');
$entity = $this->request->query->get('entity');

if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) {
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue'));
$fieldsMetadata = $this->entity['list']['fields'];
if($property == 'isGivenToCustomer'){
$orderShop =$this->getOrderShopEntity();
$orderShop->setIsGivenToCustomer($newValue);
$this->em->persist($orderShop);
$this->em->flush();
$this->utils->addFlash('success', 'success.common.fieldChange');
$response['flashMessages'] = $this->utils->getFlashMessages();
return new Response(json_encode($response));
}


}


return $this->redirectToRoute('easyadmin', [
'action' => 'show',
'entity' => $entity,

+ 24
- 12
ShopBundle/Controller/Backend/ProductFamilyController.php Wyświetl plik

@@ -2,8 +2,10 @@

namespace Lc\ShopBundle\Controller\Backend;

use App\Entity\DepositoryZone;
use App\Entity\Product;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use FOS\UserBundle\Model\UserManagerInterface;
use Lc\ShopBundle\Context\ImageInterface;
@@ -19,12 +21,14 @@ use Lc\ShopBundle\Form\Backend\ProductFamily\ProductType;
use Lc\ShopBundle\Model\ProductFamily;
use Lc\ShopBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
@@ -37,11 +41,9 @@ class ProductFamilyController extends AdminController
private $parameterBag ;
private $productFamilyUtils ;

public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em,
MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator,
ParameterBagInterface $parameterBag)
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session, ParameterBagInterface $parameterBag)
{
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator);
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session);
$this->parameterBag = $parameterBag ;
$this->productFamilyUtils = $utilsManager->getProductFamilyUtils() ;
}
@@ -98,6 +100,17 @@ class ProductFamilyController extends AdminController
'expanded' => true
));

$formBuilder->add('behaviorDisplaySale', ChoiceType::class, array(
'empty_data' => ProductFamily::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY,
'choices' => array(
'field.ProductFamily.behaviorDisplaySaleOptions.' . ProductFamily::BEHAVIOR_DISPLAY_SALE_BY_MEASURE => ProductFamily::BEHAVIOR_DISPLAY_SALE_BY_MEASURE,
'field.ProductFamily.behaviorDisplaySaleOptions.' . ProductFamily::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY => ProductFamily::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY,
),
'translation_domain' => 'lcshop',
'multiple' => false,
'expanded' => true
));

$formBuilder->add('behaviorAddToCart', ChoiceType::class, array(
'data' => $entity->getBehaviorAddToCart() ? $entity->getBehaviorAddToCart() : 'simple',
'choices' => array(
@@ -127,9 +140,10 @@ class ProductFamilyController extends AdminController

$formBuilder->add('propertyOrganicLabel', ChoiceType::class, array(
'choices' => array(
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_AB => ProductFamily::PROPERTY_ORGANIC_LABEL_AB,
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_NP => ProductFamily::PROPERTY_ORGANIC_LABEL_NP,
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_HVE => ProductFamily::PROPERTY_ORGANIC_LABEL_HVE
'field.ProductFamily.organicLabelOptions.' . ProductFamily::QUALITY_LABEL_AB => ProductFamily::QUALITY_LABEL_AB,
'field.ProductFamily.organicLabelOptions.' . ProductFamily::QUALITY_LABEL_NP => ProductFamily::QUALITY_LABEL_NP,
'field.ProductFamily.organicLabelOptions.' . ProductFamily::QUALITY_LABEL_HVE => ProductFamily::QUALITY_LABEL_HVE,
'field.ProductFamily.organicLabelOptions.' . ProductFamily::QUALITY_LABEL_TVVR => ProductFamily::QUALITY_LABEL_TVVR
),
'translation_domain' => 'lcshop',
'multiple' => false,
@@ -172,7 +186,6 @@ class ProductFamilyController extends AdminController
'required' => false
));


$formBuilder->add('products', CollectionType::class, array(
'label' => 'Déclinaisons',
'entry_type' => ProductType::class,
@@ -209,7 +222,6 @@ class ProductFamilyController extends AdminController

protected function editAction()
{

$this->dispatch(EasyAdminEvents::PRE_EDIT);

$id = $this->request->query->get('id');
@@ -266,7 +278,7 @@ class ProductFamilyController extends AdminController

if ($editForm->get('stayOnPage')->getData() != "false" || $this->request->get('submitAndStay') !== null) {
$refererUrl = $this->request->query->get('referer', '');
return $this->redirectToRoute('easyadmin', ['entity' => 'ProductFamily', 'action' => 'edit', 'id' => $id, 'referer' => $refererUrl]);
return $this->redirectToRoute('easyadmin', ['entity' => 'ProductFamily', 'action' => 'edit', 'id' => $id, 'referer' => $refererUrl, 'ajax' => $this->request->query->get('ajax')]);
} else {
return $this->redirectToReferrer();
}
@@ -281,7 +293,7 @@ class ProductFamilyController extends AdminController
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
'sortableProductsField' => $sortableProductsField,
'totalProductOrdered' => $this->orderUtils->getTotalProductOrderedLastWeeks($entity)
'productsSalesStatistic' => $this->orderUtils->getProductsSalesStatistic($entity)
];

return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]);
@@ -337,7 +349,7 @@ class ProductFamilyController extends AdminController
'entity' => $entity,
'categories' => $categories,
'sortableProductsField' => array(),
'totalProductOrdered' => array('total'=>0)
'productsSalesStatistic' => null
];

return $this->executeDynamicMethod('render<EntityName>Template', ['new', $this->entity['templates']['new'], $parameters]);

+ 3
- 3
ShopBundle/Controller/Backend/TicketController.php Wyświetl plik

@@ -13,6 +13,7 @@ use Lc\ShopBundle\Model\Ticket;
use Lc\ShopBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;

@@ -21,12 +22,11 @@ class TicketController extends AdminController
protected $ticketUtils;
protected $userUtils;

public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator)
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session)
{
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session);
$this->ticketUtils = $utilsManager->getTicketUtils();
$this->userUtils = $utilsManager->getUserUtils();
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator);

}

public function persistTicketEntity($entity, $form)

+ 43
- 0
ShopBundle/Controller/Backend/UserController.php Wyświetl plik

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

namespace Lc\ShopBundle\Controller\Backend;

use App\Entity\OrderShop;
use App\Form\Backend\Common\AddressType;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use FOS\UserBundle\Doctrine\UserManager;
use FOS\UserBundle\Model\UserManagerInterface ;
use Lc\ShopBundle\Context\AddressInterface;
@@ -11,6 +13,47 @@ use Lc\ShopBundle\Model\Address;
class UserController extends AdminController
{

public function showAction()
{

$id = $this->request->query->get('id');
$easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item'];
$this->orderShoprepo = $this->em->getRepository(OrderShop::class);

/* dump($this->orderUtils->getRankTotalOrder($entity));
die();
dump($this->orderUtils->getRankSumOrderByUser($entity));

dump($this->orderUtils->getRankTotalOrderByUser($entity));

dump($this->orderUtils->getTotalSpentByUser($entity));
dump($this->orderUtils->getAverageOrderByUser($entity));


die();*/
$this->dispatch(EasyAdminEvents::PRE_SHOW);



$fields = $this->entity['show']['fields'];
$deleteForm = $this->createDeleteForm($this->entity['name'], $id);

$this->dispatch(EasyAdminEvents::POST_SHOW, [
'deleteForm' => $deleteForm,
'fields' => $fields,
'entity' => $entity,
]);

$parameters = [
'entity' => $entity,
'fields' => $fields,
'delete_form' => $deleteForm->createView(),
];

return $this->executeDynamicMethod('render<EntityName>Template', ['show', $this->entity['templates']['show'], $parameters]);
}

public function createNewEntity()
{
return $this->userManager->createUser();

+ 4
- 2
ShopBundle/Controller/Backend/UserMerchantController.php Wyświetl plik

@@ -16,6 +16,7 @@ use Lc\ShopBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;

@@ -23,10 +24,11 @@ class UserMerchantController extends AdminController
{
protected $creditUtils;

public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator)
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session)
{
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator);
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session);
$this->creditUtils = $utilsManager->getCreditUtils();

}

public function addCreditHistoryAction(){

+ 4
- 0
ShopBundle/Controller/Frontend/CartController.php Wyświetl plik

@@ -27,6 +27,8 @@ class CartController extends BaseController
protected $orderUtils ;
protected $userUtils ;
protected $priceUtils ;
protected $sectionUtils ;
protected $mailUtils ;
protected $router ;
protected $productFamilyRepository ;
protected $orderProductRepository ;
@@ -42,6 +44,8 @@ class CartController extends BaseController
$this->orderUtils = $utilsManager->getOrderUtils() ;
$this->userUtils = $utilsManager->getUserUtils() ;
$this->priceUtils = $utilsManager->getPriceUtils() ;
$this->sectionUtils = $utilsManager->getSectionUtils() ;
$this->mailUtils = $utilsManager->getMailUtils() ;
$this->router = $router ;
$this->productFamilyRepository = $this->em->getRepository($this->em->getClassMetaData(ProductFamilyInterface::class)->getName()) ;
$this->orderProductRepository = $this->em->getRepository($this->em->getClassMetaData(OrderProductInterface::class)->getName()) ;

+ 32
- 0
ShopBundle/Event/EntityManager/EntityManagerEvent.php Wyświetl plik

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

namespace Lc\ShopBundle\Event\EntityManager;

use Symfony\Contracts\EventDispatcher\Event;

/**
* class EntityEvent.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class EntityManagerEvent extends Event
{
const CREATE_EVENT = 'entity_manager_event.create';
const UPDATE_EVENT = 'entity_manager_event.update';
const DELETE_EVENT = 'entity_manager_event.delete';
const PRE_CREATE_EVENT = 'entity_manager_event.pre_create';
const PRE_UPDATE_EVENT = 'entity_manager_event.pre_update';
const PRE_DELETE_EVENT = 'entity_manager_event.pre_delete';

protected $entity;

public function __construct($entity)
{
$this->entity = $entity;
}

public function getEntity()
{
return $this->entity;
}
}

+ 35
- 0
ShopBundle/Event/OrderShop/OrderShopChangeStatusEvent.php Wyświetl plik

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

namespace Lc\ShopBundle\Event\OrderShop;

use Symfony\Contracts\EventDispatcher\Event;

/**
* class EntityEvent.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class OrderShopChangeStatusEvent extends Event
{
const PRE_CHANGE_STATUS = 'order_shop_event.pre_change_status';
const POST_CHANGE_STATUS = 'order_shop_event.post_change_status';

protected $orderShop;
protected $orderStatus;

public function __construct($orderShop, $orderStatus)
{
$this->orderShop = $orderShop;
$this->orderStatus = $orderStatus;
}

public function getOrderShop()
{
return $this->orderShop;
}

public function getOrderStatus()
{
return $this->orderStatus;
}
}

+ 17
- 0
ShopBundle/Form/Backend/Common/EntityType.php Wyświetl plik

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

namespace Lc\ShopBundle\Form\Backend\Common;

use Symfony\Bridge\Doctrine\Form\Type\EntityType as DefaultEntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;

class EntityType extends DefaultEntityType
{
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults([
'merchant_filter' => true
]);
}
}

+ 42
- 0
ShopBundle/Form/Backend/Common/NewslettersType.php Wyświetl plik

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

namespace Lc\ShopBundle\Form\Backend\Common;

use Doctrine\ORM\EntityManagerInterface;

use Lc\ShopBundle\Context\NewsletterInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;

class NewslettersType extends AbstractType
{
protected $em;
public function __construct(EntityManagerInterface $entityManager){
$this->em = $entityManager;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
$builder = $event->getForm()->getParent();
$newsletterClass = $this->em->getClassMetadata(NewsletterInterface::class);

$builder->add('newsletters', EntityType::class, [
'class' => $newsletterClass->getName(),
'multiple' =>true,
'required' => false,
'merchant_filter'=> false
]);
});
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'merchant_filter' => false
]);
}
}

+ 2
- 1
ShopBundle/Form/Backend/Filters/ListFilterType.php Wyświetl plik

@@ -67,8 +67,9 @@ class ListFilterType extends AbstractType
)
));
break;
case 'text':
case 'string':
$builder->add($field['property'], TextType::class, array(
$builder->add(str_replace('.', '_',$field['property']), TextType::class, array(
'required' => false,
'attr'=>array(
'class'=> ' input-sm',

+ 14
- 9
ShopBundle/Form/Backend/ProductFamily/ProductFamilyCategoriesType.php Wyświetl plik

@@ -16,12 +16,12 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class ProductFamilyCategoriesType extends AbstractType
{
protected $em;
protected $productCategoryRepository ;
protected $productCategoryRepository;

public function __construct(EntityManagerInterface $entityManager, ProductCategoryRepository $productCategoryRepository)
{
$this->em = $entityManager;
$this->productCategoryRepository = $productCategoryRepository ;
$this->productCategoryRepository = $productCategoryRepository;
}

public function buildForm(FormBuilderInterface $builder, array $options)
@@ -34,20 +34,25 @@ class ProductFamilyCategoriesType extends AbstractType

foreach ($categories as $category) {
$builder->add('category_' . $category->getId(), CheckboxType::class, [
'label' => $category->getStatus() == 0 ? $category->getTitle() .' (hors ligne)': $category->getTitle() ,
'label' => $category->getStatus() == 0 ? $category->getTitle() . ' (hors ligne)' : $category->getTitle(),
'data' => $currentProductCategories->contains($category),
'required' => false,
'disabled'=>true,
'attr'=>[
'class'=>'none'
]
'disabled' => true,
'attr' => [
'class' => 'none',
'data-section' => $category->getSection()->getId()
],
]);
$childrenCategories = $this->productCategoryRepository->findAllByParent($category, true);
foreach ($childrenCategories as $children) {
$builder->add('category_children_' . $children->getId(), CheckboxType::class, [
'label' => $children->getStatus() == 0 ? $children->getTitle() .' (hors ligne)': $children->getTitle() ,
'label' => $children->getStatus() == 0 ? $children->getTitle() . ' (hors ligne)' : $children->getTitle(),
'data' => $currentProductCategories->contains($children),
'required' => false
'required' => false,
'attr' => [
'data-section' => $category->getSection()->getId()
],

]);
}
}

+ 17
- 17
ShopBundle/Form/Backend/ProductFamily/ProductType.php Wyświetl plik

@@ -29,6 +29,7 @@ class ProductType extends AbstractType
$this->em = $entityManager;
$this->utils = $utils;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{

@@ -36,12 +37,11 @@ class ProductType extends AbstractType

$builder->add('title', TextType::class, array(
"required" => false
)) ;

));

$builder->add('quantity', NumberType::class, array(
'label' => 'Quantité',
'required'=>false,
'required' => false,
'attr' => [
'append_html' => 'g'
]
@@ -50,9 +50,9 @@ class ProductType extends AbstractType
$unitClass = $this->em->getClassMetadata(UnitInterface::class)->getName();

$builder->add('unit', EntityType::class, array(
'class'=> $unitClass,
'class' => $unitClass,
'data' => 0,
'required'=>false,
'required' => false,
'choice_attr' => function ($choice) {
return [
'data-unit-reference' => $choice->getUnitReference(),
@@ -75,7 +75,7 @@ class ProductType extends AbstractType

$builder->add('buyingPrice', NumberType::class, array(
'label' => 'Prix d\'achat',
'required'=>false
'required' => false
));

$builder->add('buyingPriceWithTax', NumberType::class, array(
@@ -86,7 +86,7 @@ class ProductType extends AbstractType

$builder->add('buyingPriceByRefUnit', NumberType::class, array(
'label' => 'Prix d\'achat',
'required'=>false
'required' => false
));

$builder->add('buyingPriceByRefUnitWithTax', NumberType::class, array(
@@ -96,12 +96,12 @@ class ProductType extends AbstractType
));
$builder->add('multiplyingFactor', NumberType::class, array(
'label' => 'Coefficiant de multiplication',
'mapped'=>false,
'required'=>false
'mapped' => false,
'required' => false
));

$builder->add('priceByRefUnit', NumberType::class, array(
'required'=>false
'required' => false
));

$builder->add('priceByRefUnitWithTax', NumberType::class, array(
@@ -126,19 +126,19 @@ class ProductType extends AbstractType
$builder->add('position', HiddenType::class);
$builder->add('status', HiddenType::class);
$builder->add('exportTitle', TextType::class, array(
'required' =>false
'required' => false
));
$builder->add('exportNote', TextType::class, array(
'required' =>false
'required' => false
));
$reductionCartClass = $this->em->getClassMetadata(ReductionCartInterface::class)->getName();
$reductionCartRepo = $this->em->getRepository(ReductionCartInterface::class);

/* $builder->add('giftVoucherReductionCart', EntityType::class, array(
'required' =>false,
'class'=> $reductionCartClass,
'choices' => $reductionCartRepo->getOnlineReductionCart(),
));*/
/* $builder->add('giftVoucherReductionCart', EntityType::class, array(
'required' =>false,
'class'=> $reductionCartClass,
'choices' => $reductionCartRepo->getOnlineReductionCart(),
));*/

}


+ 41
- 0
ShopBundle/Form/DataTransformer/NewsletterSignupToBooleanTransformer.php Wyświetl plik

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

namespace Lc\ShopBundle\Form\DataTransformer;

use Lc\ShopBundle\Context\ProductInterface;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Services\UtilsManager;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Security\Core\Security;

class NewsletterSignupToBooleanTransformer implements DataTransformerInterface
{
private $security ;
private $userUtils ;

public function __construct(Security $security, UtilsManager $utilsManager)
{
$this->security = $security;
$this->userUtils = $utilsManager->getUserUtils() ;
}

public function transform($newsletter)
{
$user = $this->security->getUser() ;

if($user && $newsletter) {
return $this->userUtils->isSubscribedToNewsletter($user, $newsletter) ;
}

return false ;
}

public function reverseTransform($isSubscribed)
{
// Impossible de retrouver la newsletter depuis sa valeur booléenne.
//throw new TransformationFailedException('Impossible de retrouver la newsletter depuis sa valeur booléenne.') ;

return false ;
}
}

+ 14
- 8
ShopBundle/Form/Frontend/RegistrationType.php Wyświetl plik

@@ -17,6 +17,7 @@ class RegistrationType extends AbstractType
public function __construct(UtilsManager $utilsManager)
{
$this->utils = $utilsManager->getUtils() ;
$this->merchantUtils = $utilsManager->getMerchantUtils() ;
}

public function getParent()
@@ -26,6 +27,8 @@ class RegistrationType extends AbstractType

public function buildForm(FormBuilderInterface $builder, array $options)
{
$newsletters = $this->merchantUtils->getMerchantCurrent()->getNewsletters() ;

$builder->remove('username')
->add('gender', ChoiceType::class, [
'label' => 'field.default.title',
@@ -48,16 +51,19 @@ class RegistrationType extends AbstractType
->add('phone', TextType::class, [
'label' => 'field.default.phone',
'translation_domain' => 'lcshop',
])
->add('subscribeNewsletter', CheckboxType::class, [
'data' => true,
'label' => 'field.default.subscribeNewsletter',
'required' => false,
'mapped' => false,
'translation_domain' => 'lcshop',
'help' => 'Un seul mail par semaine qui annonce l’ouverture des ventes, les nouveautés et promotions de la semaine ainsi que des informations utiles.'
]);

foreach($newsletters as $newsletter) {
$builder->add('newsletter_'.$newsletter->getId(), CheckboxType::class, [
//'label' => 'field.default.subscribeNewsletter',
'label' => $newsletter->getTitle(),
'required' => false,
'mapped' => false,
'translation_domain' => 'lcshop',
'help' => $newsletter->getDescription()
]);
}

// captcha
$this->utils->addCaptchaType($builder);
}

+ 19
- 0
ShopBundle/Form/Frontend/TicketMessageType.php Wyświetl plik

@@ -12,11 +12,13 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\File;

class TicketMessageType extends AbstractType
{
@@ -28,6 +30,23 @@ class TicketMessageType extends AbstractType
'label' => 'field.Ticket.yourAnswer',
'translation_domain' => 'lcshop',
])
->add('image', FileType::class, [
'label' => 'Photo',
'mapped' => false,
'required' => false,
'constraints' => [
new File([
'maxSize' => '2048k',
'mimeTypes' => [
'image/png',
'image/jpeg',
'image/jpg',
'image/gif',
],
'mimeTypesMessage' => "Mauvais format d'image (formats acceptés : jpeg, png, gif)",
])
],
])
->add('closeTicket', CheckboxType::class, [
'label' => 'field.Ticket.closeTicket',
'translation_domain' => 'lcshop',

+ 143
- 70
ShopBundle/Form/Frontend/TicketType.php Wyświetl plik

@@ -4,104 +4,177 @@ namespace Lc\ShopBundle\Form\Frontend;

use App\Entity\Address;
use App\Entity\OrderShop;
use Captcha\Bundle\CaptchaBundle\Form\Type\CaptchaType;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\TicketInterface;
use Lc\ShopBundle\Model\Ticket;
use Lc\ShopBundle\Services\UtilsManager;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\File;

class TicketType extends AbstractType
{
protected $orderShopRepository ;
protected $security ;
protected $em ;
protected $priceUtils ;
protected $orderShopRepository;
protected $security;
protected $em;
protected $priceUtils;
protected $utils;

public function __construct(Security $security, EntityManagerInterface $em, UtilsManager $utilsManager)
{
$this->security = $security ;
$this->em = $em ;
$this->orderShopRepository = $this->em->getRepository(OrderShop::class) ;
$this->priceUtils = $utilsManager->getPriceUtils() ;
}
public function __construct(Security $security, EntityManagerInterface $em, UtilsManager $utilsManager)
{
$this->security = $security;
$this->em = $em;
$this->orderShopRepository = $this->em->getRepository(OrderShop::class);
$this->priceUtils = $utilsManager->getPriceUtils();
$this->utils = $utilsManager->getUtils();
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$isConnected = $this->security->getUser() ;
public function buildForm(FormBuilderInterface $builder, array $options)
{
$isConnected = $this->security->getUser();

if(!$isConnected) {
$builder->add('visitorFirstname', TextType::class, [
'label' => 'Prénom'
])
->add('visitorLastname', TextType::class, [
'label' => 'Nom'
])
->add('visitorEmail', EmailType::class, [
'label' => 'Email'
]) ;
}
if (!$isConnected) {
$builder->add(
'visitorFirstname',
TextType::class,
[
'label' => 'Prénom'
]
)
->add(
'visitorLastname',
TextType::class,
[
'label' => 'Nom'
]
)
->add(
'visitorEmail',
EmailType::class,
[
'label' => 'Email'
]
);
}

$builder
->add('type', ChoiceType::class, [
$builder
->add(
'type',
ChoiceType::class,
[
'label' => 'field.Ticket.type',
'multiple' => false,
'expanded' => false,
'choices' => [
'field.Ticket.typeOptions.'.Ticket::TYPE_GENERAL_QUESTION => Ticket::TYPE_GENERAL_QUESTION,
'field.Ticket.typeOptions.'.Ticket::TYPE_PRODUCT_UNAVAILABLE => Ticket::TYPE_PRODUCT_UNAVAILABLE,
'field.Ticket.typeOptions.'.Ticket::TYPE_PRODUCT_ERROR => Ticket::TYPE_PRODUCT_ERROR,
'field.Ticket.typeOptions.'.Ticket::TYPE_TECHNICAL_PROBLEM => Ticket::TYPE_TECHNICAL_PROBLEM,
'field.Ticket.typeOptions.'.Ticket::TYPE_POULTRY_BOOKING => Ticket::TYPE_POULTRY_BOOKING,
'field.Ticket.typeOptions.' . Ticket::TYPE_GENERAL_QUESTION => Ticket::TYPE_GENERAL_QUESTION,
'field.Ticket.typeOptions.' . Ticket::TYPE_PRODUCT_UNAVAILABLE => Ticket::TYPE_PRODUCT_UNAVAILABLE,
'field.Ticket.typeOptions.' . Ticket::TYPE_PRODUCT_ERROR => Ticket::TYPE_PRODUCT_ERROR,
'field.Ticket.typeOptions.' . Ticket::TYPE_TECHNICAL_PROBLEM => Ticket::TYPE_TECHNICAL_PROBLEM,
'field.Ticket.typeOptions.' . Ticket::TYPE_POULTRY_BOOKING => Ticket::TYPE_POULTRY_BOOKING,
],
'translation_domain' => 'lcshop',
]) ;
]
);


if($isConnected) {
$builder->add('orderShop', EntityType::class, [
'class' => $this->em->getClassMetadata(OrderShop::class)->getName(),
'multiple' => false,
'expanded' => false,
'choices' => $this->orderShopRepository->findAllBy([
'user' => $this->security->getUser(),
'isValid' => true
]),
'label' => 'field.default.order',
'placeholder' => '-- Choisissez une commande --',
'required' => false,
'choice_label' => function ($orderShop, $key, $value) {
return 'Commande du '.$orderShop->getValidationDate()->format('d/m/Y').' ('.number_format($this->priceUtils->getTotalWithTax($orderShop), 2).' €)' ;
},
'translation_domain' => 'lcshop',
]) ;
}
else {
// captcha (honey pot)
$builder->add('body', TextType::class, [
'label' => 'Body',
'required' => false,
]) ;
}
if ($isConnected) {
$builder->add(
'orderShop',
EntityType::class,
[
'class' => $this->em->getClassMetadata(OrderShop::class)->getName(),
'multiple' => false,
'expanded' => false,
'choices' => $this->orderShopRepository->findAllBy(
[
'user' => $this->security->getUser(),
'isValid' => true
]
),
'label' => 'field.default.order',
'placeholder' => '-- Choisissez une commande --',
'required' => false,
'choice_label' => function ($orderShop, $key, $value) {
return 'Commande du ' . $orderShop->getValidationDate()->format(
'd/m/Y'
) . ' (' . number_format(
$this->priceUtils->getTotalWithTax($orderShop),
2
) . ' €)';
},
'translation_domain' => 'lcshop',
]
);
} else {
// captcha
$this->utils->addCaptchaType($builder);
}

$builder->add('subject', TextType::class, [
'label' => 'Sujet'
])
->add('message', TextareaType::class, [
$builder->add(
'subject',
TextType::class,
[
'label' => 'Sujet'
]
)
->add(
'message',
TextareaType::class,
[
'mapped' => false,
'label' => 'Message'
]);
}
]
)
->add(
'image',
FileType::class,
[
'label' => 'Photo',
'mapped' => false,
'required' => false,
'constraints' => [
new File(
[
'maxSize' => '2048k',
'mimeTypes' => [
'image/png',
'image/jpeg',
'image/jpg',
'image/gif',
],
'mimeTypesMessage' => "Mauvais format d'image (formats acceptés : jpeg, png, gif)",
]
)
],
]
);

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
// Configure your form options here
]);
}
/*$builder->add(
'captchaCode',
CaptchaType::class,
array(
'captchaConfig' => 'TicketCaptcha',
'label' => 'Recopiez les caractères de l\'image'
)
);*/

}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'data_class' => $this->em->getClassMetadata(TicketInterface::class)->getName()
]
);
}
}

+ 127
- 0
ShopBundle/Manager/EntityManager.php Wyświetl plik

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

namespace Lc\ShopBundle\Manager;

use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Event\EntityManager\EntityManagerEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Security\Core\Security;

/**
* class EntityManager.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class EntityManager
{
protected $eventDispatcher;
protected $entityManager;
protected $security;
protected $userSystem = null;

public function __construct(EventDispatcherInterface $eventDispatcher, EntityManagerInterface $entityManager,
Security $security)
{
$this->eventDispatcher = $eventDispatcher;
$this->entityManager = $entityManager;
$this->security = $security;
}


public function getUserSystem()
{
if ($this->userSystem === null) {
$this->userSystem = $this->getRepository(UserInterface::class)->findOneByDevAlias('system');
}
return $this->userSystem;
}

public function getRepository($className)
{
return $this->entityManager->getRepository($this->getEntityName($className));
}


public function create($entity): self
{

if ($this->security->getUser() === null) {
if(method_exists($entity, 'setUpdatedBy')) {
$entity->setUpdatedBy($this->getUserSystem());
}
if(method_exists($entity, 'setCreatedBy')) {
$entity->setCreatedBy($this->getUserSystem());
}
}

$this->persist($entity);
$this->eventDispatcher->dispatch(new EntityManagerEvent($entity), EntityManagerEvent::CREATE_EVENT);
return $this;
}

public function update($entity): self
{
if ($this->security->getUser() === null) {
$entity->setUpdatedBy($this->getUserSystem());
}
$this->persist($entity);
$this->eventDispatcher->dispatch(new EntityManagerEvent($entity), EntityManagerEvent::UPDATE_EVENT);

return $this;
}

public function delete($entity): self
{
$this->remove($entity);
$this->eventDispatcher->dispatch(new EntityManagerEvent($entity), EntityManagerEvent::DELETE_EVENT);

return $this;
}

public function remove($entity): self
{
$this->entityManager->remove($entity) ;

return $this ;
}

public function flush(): self
{
$this->entityManager->flush();

return $this;
}

public function clear(): self
{
$this->entityManager->clear();

return $this;
}

public function persist($entity)
{
$this->entityManager->persist($entity);
}

public function refresh($entity)
{
$this->entityManager->refresh($entity);
}
public function getClassMetadata($className)
{
return $this->entityManager->getClassMetadata($className) ;
}

public function getEntityName($className)
{
if (substr($className, -9) === 'Interface') {
return $this->entityManager->getClassMetadata($className)->getName();
}
else {
return $className;
}
}
}

+ 0
- 8
ShopBundle/Model/AbstractDocumentEntity.php Wyświetl plik

@@ -38,17 +38,11 @@ abstract class AbstractDocumentEntity extends AbstractEntity implements StatusIn
*/
protected $description;



/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $devAlias;





public function getTitle(): ?string
{
return $this->title;
@@ -74,8 +68,6 @@ abstract class AbstractDocumentEntity extends AbstractEntity implements StatusIn
return $this;
}



public function getDevAlias(): ?string
{
return $this->devAlias;

+ 6
- 2
ShopBundle/Model/Merchant.php Wyświetl plik

@@ -349,9 +349,13 @@ abstract class Merchant extends AbstractDocumentEntity
public function getNewsletter()
{
$newsletters = $this->getNewsletters() ;
if(isset($newsletters[0])) {
return $newsletters[0] ;

foreach($newsletters as $newsletter) {
if($newsletter->getIsMain()) {
return $newsletter ;
}
}

return false ;
}


+ 17
- 0
ShopBundle/Model/Newsletter.php Wyświetl plik

@@ -24,6 +24,11 @@ abstract class Newsletter extends AbstractDocumentEntity implements FilterMercha
*/
protected $users;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isMain;

public function __toString()
{
return $this->getTitle() ;
@@ -73,4 +78,16 @@ abstract class Newsletter extends AbstractDocumentEntity implements FilterMercha

return $this;
}

public function getIsMain(): ?bool
{
return $this->isMain;
}

public function setIsMain(?bool $isMain): self
{
$this->isMain = $isMain;

return $this;
}
}

+ 88
- 0
ShopBundle/Model/OpenGraphTrait.php Wyświetl plik

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

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;


trait OpenGraphTrait
{
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $openGraphTitle;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $openGraphDescription;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $openGraphImage;

/**
* @Vich\UploadableField(mapping="images", fileNameProperty="openGraphImage")
* @var File
*/
protected $openGraphImageFile;


public function getOpenGraphTitle(): ?string
{
return $this->openGraphTitle;
}

public function setOpenGraphTitle(string $openGraphTitle): self
{
$this->openGraphTitle = $openGraphTitle;

return $this;
}

public function getOpenGraphDescription(): ?string
{
return $this->openGraphDescription;
}

public function setOpenGraphDescription(?string $openGraphDescription): self
{
$this->openGraphDescription = $openGraphDescription;

return $this;
}

public function getOpenGraphImage(): ?string
{
return $this->openGraphImage;
}

public function setOpenGraphImage(?string $openGraphImage): self
{
$this->openGraphImage = $openGraphImage;

return $this;
}

public function setOpenGraphImageFile(File $openGraphImageFile = null)
{
$this->openGraphImageFile = $openGraphImageFile;

// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
if ($openGraphImageFile) {
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedAt = new \DateTime('now');
}
}

public function getOpenGraphImageFile()
{
return $this->openGraphImageFile ;
}

}

+ 33
- 4
ShopBundle/Model/OrderShop.php Wyświetl plik

@@ -23,7 +23,7 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
protected $merchant;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="orders")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="orders", fetch="EAGER")
*/
protected $user;

@@ -73,7 +73,7 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
protected $orderPayments;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderProductInterface", mappedBy="orderShop", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderProductInterface", mappedBy="orderShop", cascade={"persist", "remove"}, orphanRemoval=true, fetch="EAGER")
*/
protected $orderProducts;

@@ -117,12 +117,17 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
*/
protected $updatedBy;


/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketInterface", mappedBy="orderShop")
*/
protected $tickets;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="orderShops")
* @ORM\JoinColumn(nullable=false)
*/
protected $section;

public function __construct()
{
$this->orderStatusHistories = new ArrayCollection();
@@ -298,8 +303,20 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
/**
* @return Collection|OrderPayment[]
*/
public function getOrderPayments(): Collection
public function getOrderPayments($meanPayment = null): Collection
{
if($meanPayment) {
$orderPaymentsReturn = new ArrayCollection() ;

foreach($this->orderPayments as $orderPayment) {
if($orderPayment->getMeanPayment() == $meanPayment) {
$orderPaymentsReturn[] = $orderPayment ;
}
}

return $orderPaymentsReturn ;
}

return $this->orderPayments;
}

@@ -572,4 +589,16 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
return false ;
}

public function getSection(): ?Section
{
return $this->section;
}

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

return $this;
}

}

+ 4
- 6
ShopBundle/Model/OrderStatus.php Wyświetl plik

@@ -14,11 +14,10 @@ abstract class OrderStatus
const ALIAS_CART = 'cart' ;
const ALIAS_CART_CANCELED = 'cart-canceled' ;
const ALIAS_WAITING_PAYMENT_ONLINE = 'waiting-payment-online' ;
const ALIAS_WAITING_PAYMENT_CREDIT = 'waiting-payment-credit' ;
const ALIAS_WAITING_BANK_RETURN = 'waiting-bank-return' ;
const ALIAS_PAID_ONLINE = 'paid-online' ;
const ALIAS_PARTIAL_PAYMENT = 'partial-payment' ;
const ALIAS_PAID = 'paid' ;
const ALIAS_ERROR_PAYMENT_ONLINE = 'error-payment-online' ;
const ALIAS_PAID_BY_CREDIT = 'paid-by-credit' ;
const ALIAS_WAITING_DELIVERY = 'waiting-delivery' ;
const ALIAS_WAITING_DELIVERY_WITH_PAYMENT = 'waiting-delivery-with-payment' ;
const ALIAS_DELIVERED_WITHOUT_PAYMENT = 'delivered-without-payment' ;
@@ -30,8 +29,7 @@ abstract class OrderStatus

//TODO : AJOUTER un champ valid ds orderSTATUS
static $statusAliasAsValid = [
self::ALIAS_PAID_ONLINE,
self::ALIAS_PAID_BY_CREDIT,
self::ALIAS_PAID,
self::ALIAS_WAITING_DELIVERY,
self::ALIAS_WAITING_BANK_RETURN,
self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT,
@@ -46,8 +44,8 @@ abstract class OrderStatus

static $statusAliasAsCart = [
self::ALIAS_CART,
self::ALIAS_PARTIAL_PAYMENT,
self::ALIAS_WAITING_PAYMENT_ONLINE,
self::ALIAS_WAITING_PAYMENT_CREDIT,
self::ALIAS_ERROR_PAYMENT_ONLINE
];


+ 5
- 0
ShopBundle/Model/PriceTrait.php Wyświetl plik

@@ -46,6 +46,11 @@ trait PriceTrait
return $this->getTaxRate() ;
}

public function getBuyingPriceInherited(): ?float
{
return $this->getBuyingPrice() ;
}

public function getBuyingPrice(): ?float
{
return $this->buyingPrice;

+ 4
- 0
ShopBundle/Model/Product.php Wyświetl plik

@@ -66,6 +66,10 @@ abstract class Product extends AbstractEntity implements SortableInterface, Prod
$title .= ' - ' . $this->getTitle();
}

if($this->getProductFamily()->hasProductsWithVariousWeight()) {
$title .= ' - '.$this->getQuantityLabelInherited() ;
}

return $title;
}


+ 31
- 6
ShopBundle/Model/ProductCategory.php Wyświetl plik

@@ -2,8 +2,6 @@

namespace Lc\ShopBundle\Model;

use App\Entity\Hub;
use App\Entity\ProductFamily;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@@ -34,7 +32,7 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt
protected $childrens;

/**
* @ORM\ManyToMany(targetEntity="App\Entity\ProductFamily", mappedBy="productCategories")
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="productCategories")
*/
protected $productFamilies;

@@ -43,6 +41,13 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt
*/
protected $saleStatus;


/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="productCategories")
* @ORM\JoinColumn(nullable=false)
*/
protected $section;

public function __construct()
{
$this->childrens = new ArrayCollection();
@@ -51,8 +56,10 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt

public function __toString()
{
// TODO: Implement __toString() method.
return $this->getTitle();
$parent = $this->getParent() ;
$title = $parent ? $parent->getTitle().' - ' : '' ;
$title .= $this->getTitle() ;
return $title ;
}

public function getParent(): ?self
@@ -81,7 +88,12 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt
*/
public function getChildrens(): Collection
{
return $this->childrens;
//TODO les lignes ci-dessous ne devraient pas exister, sert à résoudre le problème d'ordre dans le menu
$iterator = $this->childrens->getIterator();
$iterator->uasort(function ($a, $b) {
return ($a->getPosition() < $b->getPosition()) ? -1 : 1;
});
return new ArrayCollection(iterator_to_array($iterator));
}

public function addChildren(self $productCategory): self
@@ -171,4 +183,17 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt

return $this;
}

public function getSection(): ?Section
{
return $this->section;
}

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

return $this;
}

}

+ 772
- 682
ShopBundle/Model/ProductFamily.php
Plik diff jest za duży
Wyświetl plik


+ 5
- 3
ShopBundle/Model/ProductPropertyTrait.php Wyświetl plik

@@ -40,14 +40,16 @@ trait ProductPropertyTrait
*/
protected $propertyExpirationDate;




public function getBuyingPriceByRefUnit(): ?float
{
return $this->buyingPriceByRefUnit;
}

public function getBuyingPriceByRefUnitInherited(): ?float
{
return $this->getBuyingPriceByRefUnit() ;
}

public function setBuyingPriceByRefUnit(?float $buyingPriceByRefUnit): self
{
$this->buyingPriceByRefUnit = $buyingPriceByRefUnit;

+ 17
- 17
ShopBundle/Model/ReductionCredit.php Wyświetl plik

@@ -15,8 +15,8 @@ use Lc\ShopBundle\Context\StatusInterface;
*/
abstract class ReductionCredit extends AbstractEntity implements ReductionInterface, FilterMerchantInterface, StatusInterface
{
const TYPE_CREDIT = 'credit' ;
const TYPE_GIFT = 'gift' ;
const TYPE_CREDIT = 'credit';
const TYPE_GIFT = 'gift';


use ReductionTrait;
@@ -29,10 +29,11 @@ abstract class ReductionCredit extends AbstractEntity implements ReductionInterf
protected $title;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="reductionCredits")
*/
protected $users;


/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
@@ -90,6 +91,19 @@ abstract class ReductionCredit extends AbstractEntity implements ReductionInterf
return $this;
}


public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

/**
* @return Collection|User[]
*/
@@ -116,20 +130,6 @@ abstract class ReductionCredit extends AbstractEntity implements ReductionInterf
return $this;
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}




public function getSended(): ?bool
{

+ 172
- 0
ShopBundle/Model/Section.php Wyświetl plik

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

namespace Lc\ShopBundle\Model;

use App\Entity\Hub;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Section extends AbstractDocumentEntity implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=32)
*/
protected $cycle;

const SECTION_CYCLE_DAY = 'day' ;
const SECTION_CYCLE_WEEK = 'week' ;
const SECTION_CYCLE_MONTH = 'month' ;
const SECTION_CYCLE_YEAR = 'year' ;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="sections")
*/
protected $productFamilies;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="section")
*/
protected $orderShops;


/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", mappedBy="section")
*/
protected $productCategories;

public function __construct()
{
$this->productFamilies = new ArrayCollection();
$this->orderShops = new ArrayCollection();
}

public function __toString()
{
return $this->getTitle();
}

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

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

return $this;
}

public function getCycle(): ?string
{
return $this->cycle;
}

public function setCycle(string $cycle): self
{
$this->cycle = $cycle;

return $this;
}

/**
* @return Collection|ProductFamily[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
}

public function addProductFamily(ProductFamily $productFamily): self
{
if (!$this->productFamilies->contains($productFamily)) {
$this->productFamilies[] = $productFamily;
$productFamily->addSection($this);
}

return $this;
}

public function removeProductFamily(ProductFamily $productFamily): self
{
if ($this->productFamilies->contains($productFamily)) {
$this->productFamilies->removeElement($productFamily);
$productFamily->removeSection($this);
}

return $this;
}

/**
* @return Collection|OrderShop[]
*/
public function getOrderShops(): Collection
{
return $this->orderShops;
}

public function addOrderShop(OrderShop $orderShop): self
{
if (!$this->orderShops->contains($orderShop)) {
$this->orderShops[] = $orderShop;
$orderShop->setSection($this);
}

return $this;
}

public function removeOrderShop(OrderShop $orderShop): self
{
if ($this->orderShops->contains($orderShop)) {
$this->orderShops->removeElement($orderShop);
// set the owning side to null (unless already changed)
if ($orderShop->getSection() === $this) {
$orderShop->setSection(null);
}
}

return $this;
}

/**
* @return Collection|ProductCategory[]
*/
public function getProductCategories(): Collection
{
return $this->productCategories;
}

public function addProductCategory(ProductCategory $productCategory): self
{
if (!$this->productCategories->contains($productCategory)) {
$this->productCategories[] = $productCategory;
$productCategory->setSection($this);
}

return $this;
}

public function removeProductCategory(ProductCategory $productCategory): self
{
if ($this->productCategories->contains($productCategory)) {
$this->productCategories->removeElement($productCategory);
// set the owning side to null (unless already changed)
if ($productCategory->getSection() === $this) {
$productCategory->setSection(null);
}
}

return $this;
}
}

+ 17
- 0
ShopBundle/Model/TicketMessage.php Wyświetl plik

@@ -44,6 +44,11 @@ abstract class TicketMessage extends AbstractEntity
*/
protected $answerByAdmin;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $imageFilename;

public function __toString()
{
return $this->message;
@@ -84,4 +89,16 @@ abstract class TicketMessage extends AbstractEntity

return $this;
}

public function getImageFilename(): ?string
{
return $this->imageFilename;
}

public function setImageFilename(?string $imageFilename): self
{
$this->imageFilename = $imageFilename;

return $this;
}
}

+ 36
- 1
ShopBundle/Model/User.php Wyświetl plik

@@ -44,7 +44,6 @@ abstract class User extends UserModelFOS
*/
protected $orders;


/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
@@ -108,6 +107,11 @@ abstract class User extends UserModelFOS
protected $ticketTypesNotification = [];


/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ReductionCreditInterface", mappedBy="users")
*/
protected $reductionCredits;


public function __construct()
{
@@ -119,6 +123,8 @@ abstract class User extends UserModelFOS
$this->favoriteProductFamilies = new ArrayCollection();
$this->userPointSales = new ArrayCollection();
$this->userMerchants = new ArrayCollection();
$this->reductionCredits = new ArrayCollection();
$this->tickets = new ArrayCollection();
}

public function __toString()
@@ -464,4 +470,33 @@ abstract class User extends UserModelFOS

return $this;
}

/**
* @return Collection|ReductionCredit[]
*/
public function getReductionCredits(): Collection
{
return $this->reductionCredits;
}

public function addReductionCredit(ReductionCredit $reductionCredit): self
{
if (!$this->reductionCredits->contains($reductionCredit)) {
$this->reductionCredits[] = $reductionCredit;
$reductionCredit->addUser($this);
}

return $this;
}

public function removeReductionCredit(ReductionCredit $reductionCredit): self
{
if ($this->reductionCredits->contains($reductionCredit)) {
$this->reductionCredits->removeElement($reductionCredit);
$reductionCredit->removeUser($this);
}

return $this;
}

}

+ 25
- 7
ShopBundle/Repository/BaseRepository.php Wyświetl plik

@@ -10,26 +10,42 @@ use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\StatusInterface;
use Lc\ShopBundle\Services\Utils;

class BaseRepository extends EntityRepository implements ServiceEntityRepositoryInterface
{
public $merchantUtils;
protected $merchantUtils;
protected $utils;

/**
* @param string $entityClass The class name of the entity this repository manages
*/
public function __construct(EntityManager $entityManager, MerchantUtilsInterface $merchantUtils)
public function __construct(EntityManager $entityManager, MerchantUtilsInterface $merchantUtils, Utils $utils)
{
$this->merchantUtils = $merchantUtils;
$this->utils = $utils;
parent::__construct($entityManager, $entityManager->getClassMetadata($this->getInterfaceClass()));
}



public function findByTerm($field, $term, $limit=10){
$qb = $this->findByMerchantQuery();
$qb->select('e.'.$field);
$qb->andWhere(
$qb->expr()->like('e.'.$field, ':term'));

if($this->utils->hasFilterAssociation($field, '_')){
$aliasRelation = $this->utils->getFilterAssociationAlias($field, '_');

$qb->innerJoin('e.'.$aliasRelation, $aliasRelation);
$qb->select($this->utils->getFilterPropertyInit($field));
$qb->groupBy($this->utils->getFilterPropertyInit($field));
$qb->andWhere(
$qb->expr()->like($this->utils->getFilterPropertyInit($field), ':term'));
}else {
$qb->select('e.' . $field);
$qb->groupBy('e.' . $field);
$qb->andWhere(
$qb->expr()->like('e.' . $field, ':term'));
}
$qb->setParameter('term', '%'.$term.'%');
$qb->setMaxResults($limit);

@@ -39,6 +55,7 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository




public function findOneByOldUrl($url)
{
$qb = $this->createQueryBuilder('entity')
@@ -49,11 +66,12 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository
return $qb->getQuery()->getOneOrNullResult();
}

public function findByMerchantQuery() :QueryBuilder
public function findByMerchantQuery($merchant = null) :QueryBuilder
{
if($merchant === false || $merchant===null)$merchant = $this->merchantUtils->getMerchantCurrent();
return $this->createQueryBuilder('e')
->where('e.merchant = :currentMerchant')
->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()) ;
->setParameter('currentMerchant', $merchant) ;
}

public function findAll()

+ 270
- 254
ShopBundle/Repository/OrderShopRepository.php Wyświetl plik

@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Repository;

use App\Entity\DeliveryAvailabilityPointSale;
use App\Entity\DeliveryAvailabilityZone;
use App\Entity\PointSale;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Lc\ShopBundle\Context\DefaultRepositoryInterface;
@@ -19,304 +20,319 @@ use Lc\ShopBundle\Model\OrderStatus;
class OrderShopRepository extends BaseRepository implements DefaultRepositoryInterface
{

public function getInterfaceClass()
{
return OrderShopInterface::class;
public function getInterfaceClass()
{
return OrderShopInterface::class;
}

public function countValidOrderWithReductionCredit($reductionCredit, $user = null)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
if ($user) {
$query->andWhere('e.user = :user');
$query->setParameter('user', $user);
}
$query->innerJoin('e.orderReductionCredits', 'orc');
$query->andWhere('orc.reductionCredit = :reductionCredit');
$query->setParameter('reductionCredit', $reductionCredit);

public function countValidOrderWithReductionCredit($reductionCredit, $user=null)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
if($user) {
$query->andWhere('e.user = :user');
$query->setParameter('user', $user);
}
$query->innerJoin('e.orderReductionCredits', 'orc');
$query->andWhere('orc.reductionCredit = :reductionCredit');
$query->setParameter('reductionCredit', $reductionCredit);
return $query->getQuery()->getSingleScalarResult();
}

return $query->getQuery()->getSingleScalarResult();
}

public function countValidOrderWithReductionCart($reductionCart)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);

return $query->getQuery()->getSingleScalarResult();
}


public function countValidOrderWithReductionCartPerUser($reductionCart, $user)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->andWhere('e.user = :user');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
$query->setParameter('user', $user);

return $query->getQuery()->getSingleScalarResult();
}


public function filterOrderWaitingDelivery($query)
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasWaitingDelivery);
}

public function filterOrderCart($query)
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasAsCart);
}

public function filterOrderValid(?QueryBuilder $query): QueryBuilder
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasAsValid);
}

private function _filterOrderStatus($query, $statusArray)
{
$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias IN (:alias)');
$query->setParameter('alias', $statusArray);

return $query;
}

public function findCartCurrent($params)
{
$query = $this->findByMerchantQuery();

public function countValidOrderWithReductionCart($reductionCart)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
return $query->getQuery()->getSingleScalarResult();

if (isset($params['user'])) {
$query->andWhere('e.user = :user')->setParameter('user', $params['user']);
}

if (isset($params['visitor'])) {
$query->andWhere('e.visitor = :visitor')->setParameter('visitor', $params['visitor']);
}

$query = $this->filterOrderCart($query);

public function countValidOrderWithReductionCartPerUser($reductionCart, $user)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->andWhere('e.user = :user');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
$query->setParameter('user', $user);
return $query->getQuery()->getSingleScalarResult();
$query->leftJoin('e.orderReductionCarts', 'orderReductionCarts')
->addSelect('orderReductionCarts');

$results = $query->getQuery()->getResult();

if ($results) {
return $results[0];
}

return null;
}

public function findAllBy($params = [])
{
if (isset($params['merchant'])) {
$query = $this->findByMerchantQuery($params['merchant']);
} else {
$query = $this->findByMerchantQuery();
}

public function filterOrderWaitingDelivery($query)
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasWaitingDelivery) ;
if (isset($params['count']) && $params['count']) {
$query->select('count(e.id)');
}

public function filterOrderCart($query)
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasAsCart) ;
if (isset($params['select'])) {
$query->select($params['select']);
}
public function filterOrderValid(?QueryBuilder $query): QueryBuilder
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasAsValid) ;
if (isset($params['section'])) {
$query = $query->andWhere('e.section = :section')->setParameter('section', $params['section']);
}

private function _filterOrderStatus($query, $statusArray) {
$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias IN (:alias)');
$query->setParameter('alias',$statusArray);
return $query ;
if (isset($params['dateStart']) || isset($params['dateEnd'])) {
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate';
}

public function findCartCurrent($params)
{
$query = $this->findByMerchantQuery();
if (isset($params['dateStart'])) {
$query->andWhere('e.'.$params['dateField'].' >= :dateStart')->setParameter(
'dateStart',
$params['dateStart']
);
}
if (isset($params['dateEnd'])) {
$query->andWhere('e.'.$params['dateField'].' <= :dateEnd')->setParameter('dateEnd', $params['dateEnd']);
}

if (isset($params['weekNumber'])) {
$query->andWhere('e.weekNumber = :weekNumber')->setParameter('weekNumber', $params['weekNumber']);
$currentYear = new \DateTime();
$currentYear->setDate($currentYear->format('Y'), 1, 1);
$query->andWhere('e.validationDate >= :now')->setParameter('now', $currentYear);
}

if (isset($params['user'])) {
$query->andWhere('e.user = :user')->setParameter('user', $params['user']);
}
if (isset($params['isCart'])) {
$query = $this->filterOrderCart($query);
}

if (isset($params['visitor'])) {
$query->andWhere('e.visitor = :visitor')->setParameter('visitor', $params['visitor']);
}
if (isset($params['isValid'])) {
$query = $this->filterOrderValid($query);
}

$query = $this->filterOrderCart($query);
if (isset($params['isWaitingDelivery'])) {
$query = $this->filterOrderWaitingDelivery($query);
}

$query->leftJoin('e.orderReductionCarts', 'orderReductionCarts')
->addSelect('orderReductionCarts');
if (isset($params['orderStatus'])) {
$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias LIKE :alias');
$query->setParameter('alias', $params['orderStatus']);
}

$results = $query->getQuery()->getResult();
if (isset($params['user'])) {
$query->andWhere('e.user = :user')->setParameter('user', $params['user']);
}

if ($results) {
return $results[0];
}
if (isset($params['address'])) {
$query->andWhere('e.deliveryAddress = :address OR e.invoiceAddress = :address')->setParameter(
'address',
$params['address']
);
}

return null;
if (isset($params['weekDeliveryTrucks'])) {
$query->andWhere('e.weekDeliveryTruck IN (:weekDeliveryTrucks)')->setParameter(
'weekDeliveryTrucks',
$params['weekDeliveryTrucks']
);
}

public function findAllBy($params = [])
{
$query = $this->findByMerchantQuery();
if (isset($params['estimatedDeliveryDateTime'])) {
$query->andWhere('e.estimatedDeliveryDateTime >= :deliveryDateStart');
$query->andWhere('e.estimatedDeliveryDateTime < :deliveryDateEnd');
$date = clone $params['estimatedDeliveryDateTime'];
$query->setParameter('deliveryDateStart', $date->format('Y-m-d 00:00:00'));
$query->setParameter('deliveryDateEnd', $date->modify('+1 day')->format('Y-m-d 00:00:00'));
}

if (isset($params['count']) && $params['count']) {
$query->select('count(e.id)');
}
if (isset($params['deliveryDate'])) {
$query->andWhere('e.deliveryDate >= :deliveryDateStart');
$query->andWhere('e.deliveryDate < :deliveryDateEnd');
$date = clone $params['deliveryDate'];
$query->setParameter('deliveryDateStart', $date->format('Y-m-d 00:00:00'));
$query->setParameter('deliveryDateEnd', $date->modify('+1 day')->format('Y-m-d 00:00:00'));
}

if (isset($params['select'])) {
$query->select( $params['select']);
}
if (isset($params['mergeComplementaryOrderShops'])) {
$query->andWhere('e.mainOrderShop IS NULL');
$query->leftJoin('e.complementaryOrderShops', 'complementaryOrderShops');
}

if (isset($params['dateStart']) || isset($params['dateEnd'])) {
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate';
}
if (isset($params['excludeComplementaryOrderShops'])) {
$query->andWhere('e.mainOrderShop IS NULL');
}

if (isset($params['dateStart'])) {
$query->andWhere('e.' . $params['dateField'] . ' >= :dateStart')->setParameter('dateStart', $params['dateStart']);
}
if (isset($params['dateEnd'])) {
$query->andWhere('e.' . $params['dateField'] . ' <= :dateEnd')->setParameter('dateEnd', $params['dateEnd']);
}
$setParameterHorsTournee = false;
$setParameterGiftVoucher = false;

if (isset($params['weekNumber'])) {
$query->andWhere('e.weekNumber = :weekNumber')->setParameter('weekNumber', $params['weekNumber']);
}
if (isset($params['isCircuit'])) {
$query->leftJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere(
'e.deliveryPointSale IS NULL OR (pointSale.isDepository = 0 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher)))'
);
$setParameterHorsTournee = true;
$setParameterGiftVoucher = true;
}

if (isset($params['isCart'])) {
$query = $this->filterOrderCart($query);
}
if (isset($params['isDepository'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere(
'pointSale IS NOT NULL AND pointSale.isDepository = 1 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher))'
);
$setParameterHorsTournee = true;
$setParameterGiftVoucher = true;
}

if (isset($params['isValid'])) {
$query = $this->filterOrderValid($query);
}
if (isset($params['isOffCircuit'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasHorsTournee');
$setParameterHorsTournee = true;
}

if (isset($params['isWaitingDelivery'])) {
$query = $this->filterOrderWaitingDelivery($query);
}

if (isset($params['orderStatus'])) {
$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias LIKE :alias');
$query->setParameter('alias', $params['orderStatus']);
}
if (isset($params['isGiftVoucher'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasGiftVoucher');
$setParameterGiftVoucher = true;
}

if (isset($params['user'])) {
$query->andWhere('e.user = :user')->setParameter('user', $params['user']);
}

if(isset($params['address'])) {
$query->andWhere('e.deliveryAddress = :address OR e.invoiceAddress = :address')->setParameter('address', $params['address']);
}

if(isset($params['weekDeliveryTrucks'])) {
$query->andWhere('e.weekDeliveryTruck IN (:weekDeliveryTrucks)')->setParameter('weekDeliveryTrucks', $params['weekDeliveryTrucks']);
}

if(isset($params['estimatedDeliveryDateTime'])) {
$query->andWhere('e.estimatedDeliveryDateTime >= :deliveryDateStart');
$query->andWhere('e.estimatedDeliveryDateTime < :deliveryDateEnd');
$date = clone $params['estimatedDeliveryDateTime'];
$query->setParameter('deliveryDateStart', $date->format('Y-m-d 00:00:00'));
$query->setParameter('deliveryDateEnd', $date->modify('+1 day')->format('Y-m-d 00:00:00'));
}

if(isset($params['deliveryDate'])) {
$query->andWhere('e.deliveryDate >= :deliveryDateStart');
$query->andWhere('e.deliveryDate < :deliveryDateEnd');
$date = clone $params['deliveryDate'];
$query->setParameter('deliveryDateStart', $date->format('Y-m-d 00:00:00'));
$query->setParameter('deliveryDateEnd', $date->modify('+1 day')->format('Y-m-d 00:00:00'));
}

if (isset($params['mergeComplementaryOrderShops'])) {
$query->andWhere('e.mainOrderShop IS NULL');
$query->leftJoin('e.complementaryOrderShops', 'complementaryOrderShops');
}

if (isset($params['excludeComplementaryOrderShops'])) {
$query->andWhere('e.mainOrderShop IS NULL');
}

$setParameterHorsTournee = false ;
$setParameterGiftVoucher = false ;

if(isset($params['isCircuit'])) {
$query->leftJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('e.deliveryPointSale IS NULL OR (pointSale.isDepository = 0 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher)))');
$setParameterHorsTournee = true ;
$setParameterGiftVoucher = true ;
}

if(isset($params['isDepository'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.isDepository = 1 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher))');
$setParameterHorsTournee = true ;
$setParameterGiftVoucher = true ;
}

if(isset($params['isOffCircuit'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasHorsTournee');
$setParameterHorsTournee = true ;
}

if(isset($params['isGiftVoucher'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasGiftVoucher');
$setParameterGiftVoucher = true ;
}

if($setParameterHorsTournee) {
$query->setParameter('devAliasHorsTournee', 'horstournee') ;
}

if($setParameterGiftVoucher) {
$query->setParameter('devAliasGiftVoucher', 'giftvoucher') ;
}

if (isset($params['deliveryAvailability'])) {
$deliveryAvailability = $params['deliveryAvailability'] ;

$deliveryAvailabilityZone = ($deliveryAvailability instanceof DeliveryAvailabilityZone) ? $deliveryAvailability : false;
$deliveryAvailabilityPointSale = ($deliveryAvailability instanceof DeliveryAvailabilityPointSale) ? $deliveryAvailability : false;

if($deliveryAvailabilityZone){
$query->andWhere('e.deliveryAvailabilityZone = :deliveryAvailabilityZone');
$query->setParameter('deliveryAvailabilityZone', $deliveryAvailabilityZone);
}

if($deliveryAvailabilityPointSale) {
$query->andWhere('e.deliveryAvailabilityPointSale = :deliveryAvailabilityPointSale');
$query->setParameter('deliveryAvailabilityPointSale', $deliveryAvailabilityPointSale);
}
}
else{
$query->leftJoin('e.deliveryAvailabilityZone', 'deliveryAvailabilityZone');
$query->leftJoin('deliveryAvailabilityZone.deliverySlot', 'deliverySlotZone');

$query->leftJoin('e.deliveryAvailabilityPointSale', 'deliveryAvailabilityPointSale');
$query->leftJoin('deliveryAvailabilityPointSale.deliverySlot', 'deliverySlotPointSale');
}

if (isset($params['orderBy'])) {
$query->orderBy('e.' . $params['orderBy'], isset($params['orderByDirection']) ? $params['orderByDirection'] : 'DESC');
} else {
$query->orderBy('e.id', 'DESC');
}

if (isset($params['groupBy'])) {
$query->groupBy( $params['groupBy']);
}

if (isset($params['count']) && $params['count']) {
return $query->getQuery()->getSingleScalarResult();
} else {
return $query->getQuery()->getResult();
}
}

public function findLastOrderValidOfWeek($weekNumber)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.weekNumber = :weekNumber');
$query->andWhere('e.mainOrderShop = false OR e.mainOrderShop IS NULL');
$query->setParameter('weekNumber', $weekNumber);
$query->orderBy('e.weekId', 'DESC');
$query->setMaxResults(1);

return $query->getQuery()->getOneOrNullResult();
if ($setParameterHorsTournee) {
$query->setParameter('devAliasHorsTournee', PointSale::DEV_ALIAS_OFF_CIRCUIT);
}

if ($setParameterGiftVoucher) {
$query->setParameter('devAliasGiftVoucher', PointSale::DEV_ALIAS_GIFT_VOUCHER);
}

public function findLastOrderValid()
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.mainOrderShop = false OR e.mainOrderShop IS NULL');
$query->orderBy('e.idValidOrder', 'DESC');
$query->setMaxResults(1);

return $query->getQuery()->getOneOrNullResult();

if (isset($params['deliveryAvailability'])) {
$deliveryAvailability = $params['deliveryAvailability'];

$deliveryAvailabilityZone = ($deliveryAvailability instanceof DeliveryAvailabilityZone) ? $deliveryAvailability : false;
$deliveryAvailabilityPointSale = ($deliveryAvailability instanceof DeliveryAvailabilityPointSale) ? $deliveryAvailability : false;

if ($deliveryAvailabilityZone) {
$query->andWhere('e.deliveryAvailabilityZone = :deliveryAvailabilityZone');
$query->setParameter('deliveryAvailabilityZone', $deliveryAvailabilityZone);
}

if ($deliveryAvailabilityPointSale) {
$query->andWhere('e.deliveryAvailabilityPointSale = :deliveryAvailabilityPointSale');
$query->setParameter('deliveryAvailabilityPointSale', $deliveryAvailabilityPointSale);
}
} else {
$query->leftJoin('e.deliveryAvailabilityZone', 'deliveryAvailabilityZone');
$query->leftJoin('deliveryAvailabilityZone.deliverySlot', 'deliverySlotZone');

$query->leftJoin('e.deliveryAvailabilityPointSale', 'deliveryAvailabilityPointSale');
$query->leftJoin('deliveryAvailabilityPointSale.deliverySlot', 'deliverySlotPointSale');
}

if (isset($params['orderBy'])) {
$query->orderBy(
'e.'.$params['orderBy'],
isset($params['orderByDirection']) ? $params['orderByDirection'] : 'DESC'
);
} else {
$query->orderBy('e.id', 'DESC');
}

public function countValidOrderProductsOfWeekByProduct($weekNumber, $productId)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.weekNumber = :weekNumber');
$query->setParameter('weekNumber', $weekNumber);
$query->leftJoin('e.orderProducts', 'orderProduct');
$query->andWhere('orderProduct.product = :product');
$query->setParameter('product', $productId);
$query->select('SUM(orderProduct.quantityOrder) as quantity');

$result = $query->getQuery()->getOneOrNullResult();

return $result['quantity'];
if (isset($params['groupBy'])) {
$query->groupBy($params['groupBy']);
}

if (isset($params['count']) && $params['count']) {
return $query->getQuery()->getSingleScalarResult();
} else {
return $query->getQuery()->getResult();
}
}

public function findLastOrderValidOfWeek($weekNumber)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.weekNumber = :weekNumber');
$currentYear = new \DateTime();
$currentYear->setDate($currentYear->format('Y'), 1, 1);
$query->andWhere('e.validationDate >= :now')->setParameter('now', $currentYear);
$query->andWhere('e.mainOrderShop = false OR e.mainOrderShop IS NULL');
$query->setParameter('weekNumber', $weekNumber);
$query->orderBy('e.weekId', 'DESC');
$query->setMaxResults(1);

return $query->getQuery()->getOneOrNullResult();
}

public function findLastOrderValid()
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.mainOrderShop = false OR e.mainOrderShop IS NULL');
$query->orderBy('e.idValidOrder', 'DESC');
$query->setMaxResults(1);

return $query->getQuery()->getOneOrNullResult();
}


}

+ 13
- 1
ShopBundle/Repository/ProductCategoryRepository.php Wyświetl plik

@@ -35,6 +35,13 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit
return $query->getQuery()->getOneOrNullResult() ;
}

public function findOneByDevAlias($devAlias)
{
$query = $this->findByMerchantQuery() ;
$query->andWhere('e.devAlias = :devAlias')->setParameter('devAlias',$devAlias) ;
return $query->getQuery()->getOneOrNullResult() ;
}

public function findAllParents($withOffline = false)
{
$query = $this->findByMerchantQuery()
@@ -48,7 +55,7 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit
return $query->getQuery()->getResult();
}

public function findAllByParent($parentCategory, $withOffline = false, $withEmptyCategories = true)
public function findAllByParent($parentCategory, $withOffline = false, $withEmptyCategories = true, $filterBySpecificDay = false)
{
$query = $this->createQueryBuilder('e');
$query->andWhere('e.parent = :idParentCategory');
@@ -62,6 +69,11 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit
$query->andWhere('pf.status = 1') ;
}

if($filterBySpecificDay) {
$query->andWhere('e.displaySpecificDay IS NULL OR e.displaySpecificDay = :dayToday') ;
$query->setParameter('dayToday', date('N')) ;
}

$query->addOrderBy('e.position', 'ASC') ;

return $query->getQuery()->getResult();

+ 19
- 1
ShopBundle/Repository/ProductFamilyRepository.php Wyświetl plik

@@ -44,6 +44,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
$query = $this->findByMerchantQuery() ;
$query = $this->joinRelations($query) ;
$query->andWhere('e.status = 1') ;
$query->orderBy('RAND()');
return $query->getQuery()->getResult() ;
}

@@ -75,7 +76,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
$query->andWhere('e.status = 1');
$query->andWhere(':now <= e.propertyNoveltyExpirationDate')
->setParameter('now', new \DateTime()) ;
$query->orderBy('e.createdAt', 'DESC');
$query->orderBy('RAND()');

return $query->getQuery()->getResult() ;
}
@@ -122,7 +123,24 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
return $query->getQuery()->getResult() ;
}

public function getProductFamiliesBySection($section, $maxResults = false, $sortField = 'productCategories.position', $sortDirection = 'ASC')
{
$query = $this->findByMerchantQuery() ;
$query = $this->joinRelations($query) ;

$query->andWhere('e.status = 1');
$query->andWhere(':section MEMBER OF e.sections')
->setParameter('section', $section) ;
$query->leftJoin('e.productCategories', 'productCategories');
if($sortField){
$query->orderBy($sortField,$sortDirection);
}
if($maxResults) {
$query->setMaxResults($maxResults) ;
}

return $query->getQuery()->getResult() ;
}


}

+ 35
- 35
ShopBundle/Repository/ProductRepository.php Wyświetl plik

@@ -14,42 +14,42 @@ use Lc\ShopBundle\Model\ProductFamily;
*/
class ProductRepository extends BaseRepository implements DefaultRepositoryInterface
{
public function getInterfaceClass()
{
return ProductInterface::class;
}


public function findProductByAvailabilitiesNegative()
{
$qb = $this->createQueryBuilder('e');
$qb->innerJoin('e.productFamily', 'productFamily');
$qb->addSelect('productFamily');
$qb->where('productFamily.merchant = :currentMerchant');
$qb->andWhere('productFamily.status = 1');
$qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId());

$qb->andWhere(
$qb->expr()->orX(
$qb->expr()->andX(
$qb->expr()->orX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
),
'productFamily.availableQuantity < 0 '
public function getInterfaceClass()
{
return ProductInterface::class;
}


public function findProductByAvailabilitiesNegative()
{
$qb = $this->createQueryBuilder('e');
$qb->innerJoin('e.productFamily', 'productFamily');
$qb->addSelect('productFamily');
$qb->where('productFamily.merchant = :currentMerchant');
$qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId());
$qb->andWhere('productFamily.status = 1');

$qb->andWhere(
$qb->expr()->orX(
$qb->expr()->andX(
$qb->expr()->orX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
),
$qb->expr()->andX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'e.availableQuantity < 0 '
)
'productFamily.availableQuantity < 0 '
),
$qb->expr()->andX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'e.availableQuantity < 0 '
)
);
$qb->setParameter('behaviorCountStockByProductFamily', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY);
$qb->setParameter('behaviorCountStockByMeasure', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE);
$qb->setParameter('behaviorCountStockByProduct', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT);
$qb->groupBy('productFamily.id');

return $qb->getQuery()->getResult();
}
)
);
$qb->setParameter('behaviorCountStockByProductFamily', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY);
$qb->setParameter('behaviorCountStockByMeasure', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE);
$qb->setParameter('behaviorCountStockByProduct', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT);
$qb->groupBy('productFamily.id');

return $qb->getQuery()->getResult();
}

}

+ 4
- 3
ShopBundle/Repository/ReductionCartRepository.php Wyświetl plik

@@ -7,6 +7,7 @@ use Lc\ShopBundle\Context\DefaultRepositoryInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderUtilsInterface;
use Lc\ShopBundle\Context\ReductionCartInterface;
use Lc\ShopBundle\Services\Utils;

/**
* @method ReductionCartInterface|null find($id, $lockMode = null, $lockVersion = null)
@@ -18,9 +19,9 @@ class ReductionCartRepository extends BaseRepository implements DefaultRepositor
{
protected $orderUtils ;

public function __construct(EntityManager $entityManager, MerchantUtilsInterface $merchantUtils, OrderUtilsInterface $orderUtils)
public function __construct(EntityManager $entityManager, MerchantUtilsInterface $merchantUtils, Utils $utils, OrderUtilsInterface $orderUtils)
{
parent::__construct($entityManager, $merchantUtils);
parent::__construct($entityManager, $merchantUtils, $utils);
$this->orderUtils = $orderUtils ;
}

@@ -70,7 +71,7 @@ class ReductionCartRepository extends BaseRepository implements DefaultRepositor
foreach($reductionCarts as $reductionCart) {
if($this->orderUtils->isReductionCartMatchWithUser($reductionCart, $user)
&& $this->orderUtils->isReductionCartMatchWithGroupUser($reductionCart, $user)
&& $this->orderUtils->countReductionCartAvailableForUser($reductionCart, $user)
&& $this->orderUtils->getReductionCartRemainingQuantityPerUser($reductionCart, $user)
&& ($reductionCart->getUsers()->count() > 0 || $reductionCart->getGroupUsers()->count() > 0)) {

$reductionCartsArray[] = $reductionCart ;

+ 3
- 0
ShopBundle/Repository/ReductionCatalogRepository.php Wyświetl plik

@@ -60,6 +60,9 @@ class ReductionCatalogRepository extends BaseRepository implements DefaultReposi
$query->andWhere(':groupUser MEMBER OF e.groupUsers OR e.groupUsers is empty');
$query->setParameter('user', $user);
$query->setParameter('groupUser', $user->getGroupUsers());
}else{
$query->andWhere('e.users is empty');
$query->andWhere('e.groupUsers is empty');
}

$query->andWhere(':productFamily MEMBER OF e.productFamilies OR e.productFamilies is empty');

+ 50
- 0
ShopBundle/Repository/SectionRepository.php Wyświetl plik

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

namespace Lc\ShopBundle\Repository;

use Lc\ShopBundle\Context\SectionInterface;
use Lc\ShopBundle\Context\DefaultRepositoryInterface;

/**
* @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 BaseRepository implements DefaultRepositoryInterface
{
public function getInterfaceClass()
{
return SectionInterface::class;
}

// /**
// * @return Address[] Returns an array of Address objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('a')
->andWhere('a.exampleField = :val')
->setParameter('val', $value)
->orderBy('a.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/

/*
public function findOneBySomeField($value): ?Address
{
return $this->createQueryBuilder('a')
->andWhere('a.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}


+ 3
- 2
ShopBundle/Repository/UserRepository.php Wyświetl plik

@@ -19,12 +19,13 @@ class UserRepository extends BaseRepository implements DefaultRepositoryInterfac
return UserInterface::class;
}

public function findByMerchantQuery() :QueryBuilder
public function findByMerchantQuery($merchant = null) :QueryBuilder
{
if($merchant === false || $merchant===null)$merchant = $this->merchantUtils->getMerchantCurrent();
return $this->createQueryBuilder('e')
->innerJoin('e.userMerchants', "userMerchants")
->andWhere('userMerchants.merchant = :currentMerchant')
->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()) ;
->setParameter('currentMerchant', $merchant) ;
}

public function findAllByNewsletter($newsletter)

+ 9
- 0
ShopBundle/Repository/VisitorRepository.php Wyświetl plik

@@ -18,4 +18,13 @@ class VisitorRepository extends BaseRepository implements DefaultRepositoryInter
return VisitorInterface::class;
}


public function findOldVisitors($date){
$qb = $this->createQueryBuilder('v');
$qb->where('v.lastAccess < :date');
$qb->andWhere('v.totalVisit = 1');
$qb->setParameter('date', $date);
return $qb->getQuery()->getResult();

}
}

+ 204
- 134
ShopBundle/Resources/public/css/backend/custom.css Wyświetl plik

@@ -62,25 +62,30 @@ a.link-as-text {
color: #333;
}

/* line 34, ../../sass/backend/custom.scss */
.badge {
font-size: 90%;
}

/***************************************** ADMIN SIDEBAR ***************************************/
/* line 36, ../../sass/backend/custom.scss */
/* line 37, ../../sass/backend/custom.scss */
.main-sidebar p {
font-size: 0.8rem;
}

/* line 37, ../../sass/backend/custom.scss */
/* line 38, ../../sass/backend/custom.scss */
.main-sidebar .sidebar {
padding-left: 0px;
padding-right: 0px;
padding-top: 114px;
}

/* line 38, ../../sass/backend/custom.scss */
/* line 39, ../../sass/backend/custom.scss */
.main-sidebar .nav-link {
padding: .4rem .5rem .4rem .7rem;
}

/* line 40, ../../sass/backend/custom.scss */
/* line 41, ../../sass/backend/custom.scss */
body#pdl-body .wrapper .main-sidebar {
bottom: 0;
float: none;
@@ -90,153 +95,176 @@ body#pdl-body .wrapper .main-sidebar {
top: 0;
}

/* line 41, ../../sass/backend/custom.scss */
/* line 42, ../../sass/backend/custom.scss */
body#pdl-body .wrapper .sidebar {
height: 100%;
}

/* line 42, ../../sass/backend/custom.scss */
/* line 43, ../../sass/backend/custom.scss */
body#pdl-body .wrapper .sidebar nav {
padding-bottom: 40px;
}

/* line 43, ../../sass/backend/custom.scss */
/* line 44, ../../sass/backend/custom.scss */
body#pdl-body .wrapper .content-wrapper {
margin-top: 0;
padding-top: 57px;
}

/* line 44, ../../sass/backend/custom.scss */
/* line 45, ../../sass/backend/custom.scss */
.sidebar {
overflow-y: auto;
}

/* line 47, ../../sass/backend/custom.scss */
/* line 48, ../../sass/backend/custom.scss */
#lc-flash-messages {
display: none;
}

/* line 49, ../../sass/backend/custom.scss */
/* line 50, ../../sass/backend/custom.scss */
.main-sidebar .logo-long {
padding: 8px 0;
text-align: center;
}

/* line 50, ../../sass/backend/custom.scss */
/* line 51, ../../sass/backend/custom.scss */
.main-sidebar .logo-long img {
height: 40px;
display: inline-block;
}

/* line 51, ../../sass/backend/custom.scss */
/* line 52, ../../sass/backend/custom.scss */
.sidebar-collapse .main-sidebar .logo-long span {
display: none;
}

/* line 52, ../../sass/backend/custom.scss */
/* line 53, ../../sass/backend/custom.scss */
.sidebar-collapse .main-sidebar:hover .logo-long span {
display: inline-block;
}

/* line 54, ../../sass/backend/custom.scss */
/* line 55, ../../sass/backend/custom.scss */
.table.datatable-simple .highlight {
background: var(--teal);
}

/* line 55, ../../sass/backend/custom.scss */
/* line 56, ../../sass/backend/custom.scss */
.datatable-field-search.small {
width: 50px;
}

/* line 57, ../../sass/backend/custom.scss */
/* line 58, ../../sass/backend/custom.scss */
.dataTables_length, .dataTables_filter {
padding: .75rem 1.25rem 0.25rem;
}

/* line 59, ../../sass/backend/custom.scss */
/* line 60, ../../sass/backend/custom.scss */
table.fixedHeader-floating {
margin-top: 0px !important;
}

/* line 60, ../../sass/backend/custom.scss */
/* line 61, ../../sass/backend/custom.scss */
table th.sorting_asc, table th.sorting_desc {
border-top: 3px solid var(--success);
border-top: 2px solid var(--success);
}

/* line 61, ../../sass/backend/custom.scss */
.card-body table.lc-table-list th.sorted, table th.sorting_asc, table th.sorting_desc {
border-top: 2px solid var(--success);
/* line 62, ../../sass/backend/custom.scss */
.card-body table.lc-table-list th.filtered {
border-top: 2px solid var(--primary);
}

/*.card-body table.lc-table-list th{border-top:3px solid var(--success);}*/
/* line 63, ../../sass/backend/custom.scss */
/* line 64, ../../sass/backend/custom.scss */
table th.filtered {
border-top: 3px solid var(--primary);
border-top: 2px solid var(--primary);
}

/* line 65, ../../sass/backend/custom.scss */
.card-body table.lc-table-list th.sorted, table th.sorting_asc, table th.sorting_desc {
border-top: 2px solid var(--success);
}

/* line 66, ../../sass/backend/custom.scss */
.card-body table.lc-table-list th.sorted.filtered {
border-top: 0px;
position: relative;
}

/* line 67, ../../sass/backend/custom.scss */
.card-body table.lc-table-list th.sorted.filtered:after {
content: '';
height: 2px;
position: absolute;
left: 0;
width: 100%;
right: 0;
top: -1px;
background: linear-gradient(to right, var(--success) 0%, var(--success) 50%, var(--primary) 50%, var(--primary) 100%);
}

/* line 70, ../../sass/backend/custom.scss */
.lc-table-list thead a {
color: #212529;
}

/* line 67, ../../sass/backend/custom.scss */
/* line 71, ../../sass/backend/custom.scss */
.table-filters-line th {
font-weight: 400;
position: relative;
}

/* line 69, ../../sass/backend/custom.scss */
/* line 73, ../../sass/backend/custom.scss */
#list_filter_id {
width: 60px;
}

/* line 70, ../../sass/backend/custom.scss */
/* line 74, ../../sass/backend/custom.scss */
.lc-table-list .date-range {
width: 130px;
}

/* line 72, ../../sass/backend/custom.scss */
/* line 76, ../../sass/backend/custom.scss */
th.actions, td.actions {
white-space: nowrap;
text-align: right;
}

/* line 74, ../../sass/backend/custom.scss */
/* line 78, ../../sass/backend/custom.scss */
.table td, .table th {
padding: 0.35rem;
}

/* line 75, ../../sass/backend/custom.scss */
/* line 79, ../../sass/backend/custom.scss */
.delivery-field .form-group {
display: inline-block;
margin-bottom: 0px;
margin-right: 15px;
}

/* line 76, ../../sass/backend/custom.scss */
/* line 80, ../../sass/backend/custom.scss */
.delivery-field .form-group .form-control {
width: 150px;
}

/* line 78, ../../sass/backend/custom.scss */
/* line 82, ../../sass/backend/custom.scss */
table th input {
width: 100%;
}

/* line 79, ../../sass/backend/custom.scss */
/* line 83, ../../sass/backend/custom.scss */
table th .select2-container--default .select2-selection--single {
padding: 0.3rem 0.4rem;
}

/************************ LOGIN PAGE *********************/
/* line 82, ../../sass/backend/custom.scss */
/* line 86, ../../sass/backend/custom.scss */
.login-logo {
display: block;
margin: auto;
}

/************************ form error *********************/
/* line 85, ../../sass/backend/custom.scss */
/* line 89, ../../sass/backend/custom.scss */
.form-sent .form-control:invalid {
border-color: #dc3545;
padding-right: 2.25rem;
@@ -246,19 +274,19 @@ table th .select2-container--default .select2-selection--single {
background-size: calc(.75em + .375rem) calc(.75em + .375rem);
}

/* line 86, ../../sass/backend/custom.scss */
/* line 90, ../../sass/backend/custom.scss */
.form-sent select.form-control:invalid + .select2 .select2-selection {
border-color: #dc3545;
}

/* line 87, ../../sass/backend/custom.scss */
/* line 91, ../../sass/backend/custom.scss */
.form-sent select.form-control:invalid + .select2 .select2-selection b {
border-color: #dc3545 transparent transparent transparent;
}

/*CUSTOM Checkbox
/* Customize the label (the container) */
/* line 92, ../../sass/backend/custom.scss */
/* line 96, ../../sass/backend/custom.scss */
.form-check-label {
display: block;
position: relative;
@@ -271,7 +299,7 @@ table th .select2-container--default .select2-selection--single {
}

/* Hide the browser's default checkbox */
/* line 94, ../../sass/backend/custom.scss */
/* line 98, ../../sass/backend/custom.scss */
.form-check-label input {
position: absolute;
opacity: 0;
@@ -281,22 +309,22 @@ table th .select2-container--default .select2-selection--single {
}

/* Create a custom checkbox */
/* line 97, ../../sass/backend/custom.scss */
/* line 101, ../../sass/backend/custom.scss */
.form-check {
padding-left: 0px;
}

/* line 99, ../../sass/backend/custom.scss */
/* line 103, ../../sass/backend/custom.scss */
.form-sent .form-check-label input:invalid ~ .checkmark {
border-color: #dc3545;
}

/* line 100, ../../sass/backend/custom.scss */
/* line 104, ../../sass/backend/custom.scss */
.form-check-label input:disabled ~ .checkmark {
display: none;
}

/* line 101, ../../sass/backend/custom.scss */
/* line 105, ../../sass/backend/custom.scss */
.form-check-label input ~ .checkmark {
position: absolute;
top: 0;
@@ -307,36 +335,36 @@ table th .select2-container--default .select2-selection--single {
border: 1px solid var(--primary);
}

/* line 102, ../../sass/backend/custom.scss */
/* line 106, ../../sass/backend/custom.scss */
.form-check-label.big input ~ .checkmark {
height: 21px;
width: 21px;
}

/* line 103, ../../sass/backend/custom.scss */
/* line 107, ../../sass/backend/custom.scss */
.form-check-label input[type="checkbox"] ~ .checkmark {
top: 2px;
}

/* line 104, ../../sass/backend/custom.scss */
/* line 108, ../../sass/backend/custom.scss */
.form-check-label input[type="radio"] ~ .checkmark {
top: 3px;
border-radius: 50%;
}

/* line 105, ../../sass/backend/custom.scss */
/* line 109, ../../sass/backend/custom.scss */
.form-check-label:hover input ~ .checkmark {
background-color: #ccc;
}

/* When the checkbox is checked, add a blue background */
/* line 107, ../../sass/backend/custom.scss */
/* line 111, ../../sass/backend/custom.scss */
.form-check-label input:checked ~ .checkmark {
background-color: var(--primary);
}

/* Create the checkmark/indicator (hidden when not checked) */
/* line 109, ../../sass/backend/custom.scss */
/* line 113, ../../sass/backend/custom.scss */
.form-check-label .checkmark:after {
content: "";
position: absolute;
@@ -344,13 +372,13 @@ table th .select2-container--default .select2-selection--single {
}

/* Show the checkmark when checked */
/* line 111, ../../sass/backend/custom.scss */
/* line 115, ../../sass/backend/custom.scss */
.form-check-label input:checked ~ .checkmark:after {
display: block;
}

/* Style the checkmark/indicator */
/* line 113, ../../sass/backend/custom.scss */
/* line 117, ../../sass/backend/custom.scss */
.form-check-label .checkmark:after {
left: 7px;
top: 3px;
@@ -363,7 +391,7 @@ table th .select2-container--default .select2-selection--single {
transform: rotate(45deg);
}

/* line 114, ../../sass/backend/custom.scss */
/* line 118, ../../sass/backend/custom.scss */
.form-check-label input[type="checkbox"] ~ .checkmark:after {
left: 6px;
top: 2px;
@@ -376,7 +404,7 @@ table th .select2-container--default .select2-selection--single {
transform: rotate(45deg);
}

/* line 115, ../../sass/backend/custom.scss */
/* line 119, ../../sass/backend/custom.scss */
.form-check-label input[type="radio"] ~ .checkmark:after {
top: 4px;
left: 4px;
@@ -386,7 +414,7 @@ table th .select2-container--default .select2-selection--single {
background: white;
}

/* line 117, ../../sass/backend/custom.scss */
/* line 121, ../../sass/backend/custom.scss */
.form-check-label.big input[type="checkbox"] ~ .checkmark:after {
left: 7px;
top: 3px;
@@ -395,101 +423,118 @@ table th .select2-container--default .select2-selection--single {
}

/* Create a custom radio button */
/* line 121, ../../sass/backend/custom.scss */
/* line 125, ../../sass/backend/custom.scss */
.product-categories .parent .form-group.field-checkbox .form-check-label {
padding-left: 0px;
font-style: italic;
}

/* line 122, ../../sass/backend/custom.scss */
/* line 126, ../../sass/backend/custom.scss */
.product-categories .children .form-group.field-checkbox {
margin-left: 20px;
}

/* line 123, ../../sass/backend/custom.scss */
/* line 127, ../../sass/backend/custom.scss */
.product-categories .form-group {
margin-bottom: 0.15rem;
}

/* line 124, ../../sass/backend/custom.scss */
/* line 128, ../../sass/backend/custom.scss */
.lc-deleted-field {
display: none;
}

/* line 125, ../../sass/backend/custom.scss */
/* line 129, ../../sass/backend/custom.scss */
.lc-offline-field {
opacity: 0.5;
}

/* line 126, ../../sass/backend/custom.scss */
/* line 130, ../../sass/backend/custom.scss */
.lc-offline-field label::after {
content: ' [hors ligne]';
}

/* Général */
/* line 132, ../../sass/backend/custom.scss */
/* line 136, ../../sass/backend/custom.scss */
.btn.action-save {
float: right;
margin-left: 10px;
}

/* line 133, ../../sass/backend/custom.scss */
/* line 137, ../../sass/backend/custom.scss */
.button-action a.float-right {
margin-left: 10px;
}

/* line 135, ../../sass/backend/custom.scss */
/* line 139, ../../sass/backend/custom.scss */
.input-group-text {
padding: 0.25rem 0.75rem;
}

/* line 139, ../../sass/backend/custom.scss */
/* line 143, ../../sass/backend/custom.scss */
.col-form-label {
font-weight: bold;
}

/* line 141, ../../sass/backend/custom.scss */
/* line 145, ../../sass/backend/custom.scss */
#toast-container.toast-top-right {
top: 60px;
}

/* SIDEBAR */
/* line 144, ../../sass/backend/custom.scss */
/* line 148, ../../sass/backend/custom.scss */
.main-header.navbar {
padding: 0;
min-height: 57px;
}

/* line 145, ../../sass/backend/custom.scss */
/* line 149, ../../sass/backend/custom.scss */
.lc-navbar li {
border-left: 1px solid #e0e0e0;
padding: 0.5rem 1.5rem;
}

/* line 146, ../../sass/backend/custom.scss */
/* line 150, ../../sass/backend/custom.scss */
.lc-navbar li label {
margin-bottom: 0;
vertical-align: middle;
font-weight: normal !important;
}

/* line 148, ../../sass/backend/custom.scss */
/* line 152, ../../sass/backend/custom.scss */
#switch-merchant {
min-width: 170px;
}

/*************************** PAGINATION *******************************/
/* line 156, ../../sass/backend/custom.scss */
.pagination {
justify-content: center;
}

/* line 157, ../../sass/backend/custom.scss */
.disabled .page-link {
color: #343a40;
}

/* line 158, ../../sass/backend/custom.scss */
.disabled .page-link:hover, .page-link.current:hover {
background-color: #fff;
cursor: default;
}

/* Sortable */
/* line 154, ../../sass/backend/custom.scss */
/* line 163, ../../sass/backend/custom.scss */
.ui-sortable-helper {
display: table;
}

/* line 155, ../../sass/backend/custom.scss */
/* line 164, ../../sass/backend/custom.scss */
.ui-state-highlight {
background: #eee;
}

/* line 156, ../../sass/backend/custom.scss */
/* line 165, ../../sass/backend/custom.scss */
.lc-sortable div:last-child {
display: none;
}
@@ -506,13 +551,13 @@ table th .select2-container--default .select2-selection--single {
.lc-ckfinder-wrap .lc-ckfinder-button{width: 100%; bottom: 0px; left: 0; position: absolute;}
*/
/* VUES JS */
/* line 171, ../../sass/backend/custom.scss */
/* line 180, ../../sass/backend/custom.scss */
.nav-item .btn {
padding-right: 15px;
position: relative;
}

/* line 172, ../../sass/backend/custom.scss */
/* line 181, ../../sass/backend/custom.scss */
.nav-item .btn .invalid-form {
display: none;
position: absolute;
@@ -524,67 +569,67 @@ table th .select2-container--default .select2-selection--single {
font-size: 1.2rem;
}

/* line 173, ../../sass/backend/custom.scss */
/* line 182, ../../sass/backend/custom.scss */
.nav-item.has-invalid .btn .invalid-form {
display: inline-block;
z-index: 2;
}

/* ProductFamily */
/* line 178, ../../sass/backend/custom.scss */
/* line 187, ../../sass/backend/custom.scss */
.field-unit-quantity {
border-bottom: 2px dotted #eee;
padding-bottom: 10px;
margin-bottom: 20px;
}

/* line 179, ../../sass/backend/custom.scss */
/* line 188, ../../sass/backend/custom.scss */
.field-reduction-apply {
border-top: 2px dotted #eee;
padding-top: 10px;
margin-top: 20px;
}

/* line 181, ../../sass/backend/custom.scss */
/* line 190, ../../sass/backend/custom.scss */
.new-productfamily #nav-params,
.edit-productfamily #nav-params {
margin-bottom: 30px;
}

/* line 186, ../../sass/backend/custom.scss */
/* line 195, ../../sass/backend/custom.scss */
.new-productfamily #nav-params .btn,
.edit-productfamily #nav-params .btn {
margin-left: 20px;
}

/* line 191, ../../sass/backend/custom.scss */
/* line 200, ../../sass/backend/custom.scss */
.new-productfamily #product-categories .row,
.edit-productfamily #product-categories .row {
padding: 10px;
}

/* line 196, ../../sass/backend/custom.scss */
/* line 205, ../../sass/backend/custom.scss */
.new-productfamily #product-categories .form-group,
.edit-productfamily #product-categories .form-group {
width: 100%;
padding: 4px;
}

/* line 202, ../../sass/backend/custom.scss */
/* line 211, ../../sass/backend/custom.scss */
.new-productfamily #product-categories .children,
.edit-productfamily #product-categories .children {
margin-left: 20px;
width: 100%;
}

/* line 208, ../../sass/backend/custom.scss */
/* line 217, ../../sass/backend/custom.scss */
.new-productfamily ul.products,
.edit-productfamily ul.products {
padding: 0px;
list-style-type: none;
}

/* line 214, ../../sass/backend/custom.scss */
/* line 223, ../../sass/backend/custom.scss */
.new-productfamily ul.products li.product,
.edit-productfamily ul.products li.product {
padding: 0px;
@@ -592,55 +637,81 @@ table th .select2-container--default .select2-selection--single {
position: relative;
}

/* line 221, ../../sass/backend/custom.scss */
/* line 230, ../../sass/backend/custom.scss */
.new-productfamily ul.products li.add,
.edit-productfamily ul.products li.add {
text-align: right;
}

/* line 226, ../../sass/backend/custom.scss */
/* line 235, ../../sass/backend/custom.scss */
.autoresize textarea {
height: auto;
min-height: 38px;
}

/* line 228, ../../sass/backend/custom.scss */
/* line 237, ../../sass/backend/custom.scss */
.field-price .input-group.buyingPrice input, .field-price .input-group.buyingPrice .input-group-text {
font-weight: bold;
border-color: #222;
}

/* line 229, ../../sass/backend/custom.scss */
/* line 238, ../../sass/backend/custom.scss */
.field-price .input-group.buyingPriceByRefUnit input, .field-price .input-group.buyingPriceByRefUnit .input-group-text {
font-weight: bold;
border-color: #222;
}

/* line 230, ../../sass/backend/custom.scss */
/* line 239, ../../sass/backend/custom.scss */
.field-price .input-group.priceWithTax input, .field-price .input-group.priceWithTax .input-group-text {
font-weight: bold;
border-color: #222;
}

/* line 231, ../../sass/backend/custom.scss */
/* line 240, ../../sass/backend/custom.scss */
.field-price .input-group.priceByRefUnitWithTax input, .field-price .input-group.priceByRefUnitWithTax .input-group-text {
font-weight: bold;
border-color: #222;
}

/* line 232, ../../sass/backend/custom.scss */
/* line 241, ../../sass/backend/custom.scss */
.input-group.multiplyingFactor input, .input-group.multiplyingFactor .input-group-text {
font-weight: bold;
border-color: #222;
}

/* line 245, ../../sass/backend/custom.scss */
.layout-ajax #edit-productfamily-form .card-sections {
width: 100%;
position: fixed;
left: 0px;
top: 0px;
z-index: 10;
}
/* line 253, ../../sass/backend/custom.scss */
.layout-ajax #edit-productfamily-form .form {
padding-top: 50px;
}
/* line 257, ../../sass/backend/custom.scss */
.layout-ajax #edit-productfamily-form .card-footer {
display: none;
}
/* line 262, ../../sass/backend/custom.scss */
.layout-ajax #edit-productfamily-form .in-advanced-editing-table .form {
padding-top: 0px;
}
/* line 265, ../../sass/backend/custom.scss */
.layout-ajax #edit-productfamily-form .in-advanced-editing-table .card-sections,
.layout-ajax #edit-productfamily-form .in-advanced-editing-table .row-note {
display: none;
}

/* ORDER */
/* line 238, ../../sass/backend/custom.scss */
/* line 275, ../../sass/backend/custom.scss */
.table-order-summary {
width: 100%;
}

/* line 241, ../../sass/backend/custom.scss */
/* line 278, ../../sass/backend/custom.scss */
.order-product-item.redelivery {
background: rgba(18, 104, 253, 0.38) !important;
}
@@ -648,36 +719,36 @@ table th .select2-container--default .select2-selection--single {
/*.select2-container--bootstrap .select2-selection{max-width: none;}*/
/*.order-product-item{margin: 15px 0; padding: 0;}*/
/* Product */
/* line 246, ../../sass/backend/custom.scss */
/* line 283, ../../sass/backend/custom.scss */
.product-form-modal {
display: none;
}

/* line 247, ../../sass/backend/custom.scss */
/* line 284, ../../sass/backend/custom.scss */
.product-form.modal .form-check-label {
font-style: italic;
color: #666;
text-align: left;
}

/* line 248, ../../sass/backend/custom.scss */
/* line 285, ../../sass/backend/custom.scss */
.products-collection-table .inherited {
color: #888;
font-style: italic;
font-weight: initial;
}

/* line 249, ../../sass/backend/custom.scss */
/* line 286, ../../sass/backend/custom.scss */
.products-collection-table td {
position: relative;
}

/* line 250, ../../sass/backend/custom.scss */
/* line 287, ../../sass/backend/custom.scss */
.card-body.p-0 .products-collection-table tbody > tr > td:first-of-type, .card-body.p-0 .products-collection-table tbody > tr > th:first-of-type, .card-body.p-0 .products-collection-table thead > tr > td:first-of-type, .card-body.p-0 .products-collection-table thead > tr > th:first-of-type {
padding-left: 0.35rem;
}

/* line 251, ../../sass/backend/custom.scss */
/* line 288, ../../sass/backend/custom.scss */
.products-collection-table .btn-empty-field {
position: absolute;
right: 3px;
@@ -686,14 +757,14 @@ table th .select2-container--default .select2-selection--single {
padding: 0px;
}

/* line 252, ../../sass/backend/custom.scss */
/* line 289, ../../sass/backend/custom.scss */
#lc-product-family-edit .products-collection-table {
table-layout: fixed;
/* background-clip: padding-box;*/
border-collapse: collapse;
}

/* line 253, ../../sass/backend/custom.scss */
/* line 290, ../../sass/backend/custom.scss */
#lc-product-family-edit .products-collection-table th {
font-size: 13px;
border-left: 1px solid #dee2e6;
@@ -703,22 +774,22 @@ table th .select2-container--default .select2-selection--single {
position: relative;
}

/* line 254, ../../sass/backend/custom.scss */
/* line 291, ../../sass/backend/custom.scss */
#lc-product-family-edit .products-collection-table tfoot th {
border-top: 2px solid #dee2e6;
}

/* line 255, ../../sass/backend/custom.scss */
/* line 292, ../../sass/backend/custom.scss */
#lc-product-family-edit .products-collection-table th span {
white-space: initial;
}

/* line 256, ../../sass/backend/custom.scss */
/* line 293, ../../sass/backend/custom.scss */
#lc-product-family-edit .products-collection-table th:last-child {
border-right: 1px solid #dee2e6;
}

/* line 257, ../../sass/backend/custom.scss */
/* line 294, ../../sass/backend/custom.scss */
#lc-product-family-edit .products-collection-table td {
border-left: 1px solid #dee2e6;
text-align: center;
@@ -726,26 +797,25 @@ table th .select2-container--default .select2-selection--single {
border-bottom: 1px solid #dee2e6;
}

/* line 258, ../../sass/backend/custom.scss */
/* line 295, ../../sass/backend/custom.scss */
#lc-product-family-edit .products-collection-table td:last-child {
border-right: 1px solid #dee2e6;
white-space: nowrap;
}

/* line 259, ../../sass/backend/custom.scss */
/* line 296, ../../sass/backend/custom.scss */
#lc-product-family-edit .btn-add-product {
margin: 20px 0;
float: right;
}

/* line 260, ../../sass/backend/custom.scss */
/* line 297, ../../sass/backend/custom.scss */
#lc-product-family-edit .inherited {
color: #888;
font-style: italic;
font-weight: initial;
}

/* line 261, ../../sass/backend/custom.scss */
/* line 298, ../../sass/backend/custom.scss */
#lc-product-family-edit .products-collection-table td .value {
min-width: 80%;
margin: auto;
@@ -753,79 +823,79 @@ table th .select2-container--default .select2-selection--single {
cursor: pointer;
}

/* line 262, ../../sass/backend/custom.scss */
/* line 299, ../../sass/backend/custom.scss */
#lc-product-family-edit .products-collection-table td .modal {
text-align: left;
}

/* line 263, ../../sass/backend/custom.scss */
/* line 300, ../../sass/backend/custom.scss */
table.products-collection-table th.main-info, td.buyingPrice, td.multiplyingFactor, td.priceWithTax {
background: #eeeeee;
background-clip: padding-box;
text-decoration: underline;
}

/* line 265, ../../sass/backend/custom.scss */
/* line 302, ../../sass/backend/custom.scss */
table.products-collection-table tr.disabled {
opacity: 0.5;
}

/* line 266, ../../sass/backend/custom.scss */
/* line 303, ../../sass/backend/custom.scss */
.table-striped tbody .tr-sep {
border-top: 2px solid #888;
}

/* DeliveryZone */
/* line 270, ../../sass/backend/custom.scss */
/* line 307, ../../sass/backend/custom.scss */
#autocomplete-cities {
position: relative;
}

/* line 274, ../../sass/backend/custom.scss */
/* line 311, ../../sass/backend/custom.scss */
#autocomplete-cities .ui-autocomplete {
left: 30%;
top: 41px;
margin-left: 18px;
}

/* line 280, ../../sass/backend/custom.scss */
/* line 317, ../../sass/backend/custom.scss */
.head-reminders {
margin-top: 15px;
}

/* TABLEAU DE BORD */
/* line 283, ../../sass/backend/custom.scss */
/* line 320, ../../sass/backend/custom.scss */
.todo-list > li {
position: relative;
}

/* line 284, ../../sass/backend/custom.scss */
/* line 321, ../../sass/backend/custom.scss */
.todo-list > li .text {
margin-left: 30px;
}

/* line 285, ../../sass/backend/custom.scss */
/* line 322, ../../sass/backend/custom.scss */
.todo-list > li .tools {
position: absolute;
top: 4px;
right: 15px;
}

/* line 287, ../../sass/backend/custom.scss */
/* line 324, ../../sass/backend/custom.scss */
#addTicketMessageForm {
margin-top: 30px;
border-top: 2px dotted #eee;
padding-top: 30px;
}

/* line 289, ../../sass/backend/custom.scss */
/* line 326, ../../sass/backend/custom.scss */
#dashboard .list-btn-statistic {
display: flex;
flex-wrap: wrap;
justify-content: center;
}

/* line 290, ../../sass/backend/custom.scss */
/* line 327, ../../sass/backend/custom.scss */
#dashboard .btn-statistic {
width: 120px;
height: 70px;
@@ -834,62 +904,62 @@ table.products-collection-table tr.disabled {
line-height: 1rem;
}

/* line 291, ../../sass/backend/custom.scss */
/* line 328, ../../sass/backend/custom.scss */
#dashboard .btn-statistic small {
margin-bottom: 10px;
display: block;
}

/* line 292, ../../sass/backend/custom.scss */
/* line 329, ../../sass/backend/custom.scss */
#dashboard .btn-statistic .value {
display: block;
}

/* line 294, ../../sass/backend/custom.scss */
/* line 331, ../../sass/backend/custom.scss */
#dashboard #range_date_interval {
margin-bottom: 20px;
}

/* line 295, ../../sass/backend/custom.scss */
/* line 332, ../../sass/backend/custom.scss */
#dashboard #range_date_interval label {
float: left;
margin-right: 20px;
}

/* line 296, ../../sass/backend/custom.scss */
/* line 333, ../../sass/backend/custom.scss */
#dashboard #range_date_interval .form-check {
float: left;
margin-right: 10px;
}

/* line 297, ../../sass/backend/custom.scss */
/* line 334, ../../sass/backend/custom.scss */
#dashboard .table-condensed .btn, #dashboard .table-condensed .btn-sm {
white-space: nowrap;
}

/* Tickets */
/* line 303, ../../sass/backend/custom.scss */
/* line 340, ../../sass/backend/custom.scss */
#ticket-list .btn-sm {
display: block;
}

/* line 309, ../../sass/backend/custom.scss */
/* line 346, ../../sass/backend/custom.scss */
#toast-container {
width: 350px;
}

/* line 310, ../../sass/backend/custom.scss */
/* line 347, ../../sass/backend/custom.scss */
.toast {
float: right;
}

/* line 312, ../../sass/backend/custom.scss */
/* line 349, ../../sass/backend/custom.scss */
#toast-container:before:hover {
opacity: 1;
cursor: pointer;
}

/* line 316, ../../sass/backend/custom.scss */
/* line 353, ../../sass/backend/custom.scss */
#toast-close-all {
border: 0;
position: absolute;

+ 2
- 0
ShopBundle/Resources/public/css/backend/ekko-lightbox/ekko-ligthbox.min.css
Plik diff jest za duży
Wyświetl plik


+ 2
- 0
ShopBundle/Resources/public/js/backend/plugin/ekko-lightbox/ekko-lightbox.min.js
Plik diff jest za duży
Wyświetl plik


+ 71
- 1
ShopBundle/Resources/public/js/backend/script/default/init-common.js Wyświetl plik

@@ -5,7 +5,8 @@ jQuery(document).ready(function () {
initNotice();
initBtnEditReminder();
initBtnWriteToUser();
initCollectionWidget()
initCollectionWidget();
initBtnShowTotalOrderProduct();
$('form').on('focus', 'input[type=number]', function (e) {
$(this).on('wheel.disableScroll', function (e) {
e.preventDefault()
@@ -155,6 +156,11 @@ function initAdminLtePlugin() {
});


$(document).on('click', '[data-toggle="lightbox"]', function(event) {
event.preventDefault();
$(this).ekkoLightbox();
});

}

function moment() {
@@ -358,3 +364,67 @@ function resetNumItemsCollectionField($collectionWidget){
resetNumItemsCollectionField($collectionWidget);
});
}


function initBtnShowTotalOrderProduct(){
$('.lc-show-products-sales-statistic').unbind('click').on('click', function (){
$btn = $(this);
var url = $(this).data('url');
$('#modal-products-sales-statistic').remove();
$.ajax({
url: url,
method: "POST",
dataType: "json",
success: function (response) {
$('body').append(response.data);
$('#modal-products-sales-statistic').modal('show');
initModalProductsSalesStatistic(response.statistics);
}
});
});
}
function initModalProductsSalesStatistic(statistics) {
var chart = null;
$('.btn-products-sales-statistic').off('click');
$('.btn-products-sales-statistic').on('click', function () {
$('.table-products-sales-statistic').hide();
$('.btn-products-sales-statistic').addClass('btn-secondary').removeClass('btn-primary');
$(this).removeClass('btn-secondary').addClass('btn-primary');

$('#table-products-sales-statistic-'+$(this).data('property-name')).show()
if (chart) chart.destroy();
$(this).removeClass('btn-secondary');
chart = drawProductsSalesStatistic(statistics,$(this).data('property-name'))
});
$('.btn-products-sales-statistic').first().click();

}

function drawProductsSalesStatistic(statictics, propertyName) {

var options = {
bezierCurve : false,
tooltips: {
callbacks: {
label: (item) => item.yLabel ,
},
},
};

chart = new Chart(document.getElementById("chart"), {
"type": "line",
"data": {
"labels": Object.values(statictics.label),
"datasets": [{
"label": "Vente de produits / semaine",
"data": Object.values(statictics.data[propertyName].data),
"fill": false,
"borderColor": "rgb(75, 192, 192)",
"lineTension": 0.1
}]
},
"options": options
});
return chart;
}


+ 7
- 2
ShopBundle/Resources/public/js/backend/script/default/init-list.js Wyświetl plik

@@ -1,4 +1,4 @@
jQuery(document).ready(function () {
jQuery(document).ready(function () {
initDeleteAction();

initResetFilters();
@@ -26,9 +26,14 @@ function initDeleteAction() {
});


/* $('.action-confirm').each(function () {
$(this).on('click', function (e) {
return confirm("Êtes vous sur de vouloir effectuer cette action ?");
});
});*/
$('.action-duplicate').each(function () {
$(this).on('click', function (e) {
return confirm("Press a button!");
return confirm("Êtes vous sur de vouloir effectuer cette action ?");
});
});
}

+ 4
- 0
ShopBundle/Resources/public/js/backend/script/merchant/vuejs-merchant.js Wyświetl plik

@@ -38,6 +38,10 @@ appOrder = new Vue({
{
name: 'maintenance',
nameDisplay: 'Maintenance'
},
{
name: 'lunch',
nameDisplay: 'Repas du midi'
}
]
}, window.addressValues, window.merchantPanelOrderValues);

+ 2
- 2
ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js Wyświetl plik

@@ -49,7 +49,7 @@ Vue.component('order-product', {
},
modalAddReductionCredit:function () {
$(this.$parent.$refs['addReductionCreditFormTitle']).val(this.orderProduct.title);
$(this.$parent.$refs['addReductionCreditFormValue']).val(this.orderProduct.price);
$(this.$parent.$refs['addReductionCreditFormValue']).val(this.orderProduct.priceWithTaxAndReduction);
$(this.$parent.$refs['addReductionCreditFormBehaviorTaxRate']).val('tax-included').trigger('change');
$('#modal-add-reduction-credit').modal('show');
}
@@ -115,7 +115,7 @@ appOrder = new Vue({
}
},
preventFormSubmit: function (){
$(document).keypress(function(e) {
$('#lc-order-edit').keypress(function(e) {
if (e.which == 13) {
e.preventDefault();
}

+ 30
- 7
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js Wyświetl plik

@@ -1,6 +1,8 @@
// Reference array sent to dynamic staticRenderFns
var staticRenderFns = [];
$(window).on('load', function () {
/*var appProductFamily ;
lcInitProductFamily() ;*/

Vue.component('product-unit-price', {
mixins: [mixinUnit, mixinPrice, mixinTemplate],
@@ -159,7 +161,11 @@ $(window).on('load', function () {
},
behaviorPriceValue: function () {
return this.productFamily.behaviorPrice;
}
},
hasExportInfo: function () {
if((this.exportNote != null && this.exportNote != '') || (this.exportTitle != null && this.exportTitle != ''))return true
else return false;
},
},
data() {
return Object.assign(
@@ -191,7 +197,9 @@ $(window).on('load', function () {
expirationDateInherited: false,
availableQuantityInherited: false,
availableQuantityDefaultInherited: false,
propertyExpirationDateInherited: false
propertyExpirationDateInherited: false,
exportTitle: null,
exportNote: null
}, window.productForm[this.keyForm])
},
mounted: function () {
@@ -225,7 +233,11 @@ $(window).on('load', function () {
}else{
this.status = 1;
$(this.$el).removeClass('disabled');
if(this.hasExportInfo){
alert('Cette déclinaison contient un titre ou une note à l\'export');
}
}

},
decode(str){
var textArea = document.createElement('textarea');
@@ -331,7 +343,6 @@ $(window).on('load', function () {
watch: {}
});


appProductFamily = new Vue({
el: '#lc-product-family-edit',
mixins: [mixinReduction],
@@ -419,13 +430,14 @@ $(window).on('load', function () {
typeExpirationDate: null,
behaviorExpirationDate: null,
propertyAllergens: null,
propertyOrganicLabelActive: false,
propertyQualityLabelActive: false,
propertyOrganicLabel: null,
propertyNoveltyExpirationDateActive: false,
propertyNoveltyExpirationDate:null,
activeProducts: false,
giftVoucherActive: false,
productsQuantityAsTitle: false,
section: null,
formProducts: {},
currentSection: 'general',
sectionsArray: [
@@ -487,6 +499,7 @@ $(window).on('load', function () {
}

}
this.sectionHasChanged();
this.initLcSortableProductsList();
});

@@ -583,19 +596,26 @@ $(window).on('load', function () {
if (typeof this.$refs.productUnitPrice !== 'undefined') {
return this.$refs.productUnitPrice.behaviorPrice;
}
},
sectionHasChanged: function (){
$('.product-categories').find('.form-check-input:not(.none)').prop('disabled', true);
$('.product-categories').find('.form-check-input[data-section="'+this.section+'"]:not(.none)').prop('disabled', false);
}
},
watch: {
title: function () {
this.updateChild()
},
section: function (){
this.sectionHasChanged()
},
propertyNoveltyExpirationDateActive: function () {
if(!this.propertyNoveltyExpirationDateActive){
this.propertyNoveltyExpirationDate = null;
}
},
propertyOrganicLabelActive: function () {
if(!this.propertyOrganicLabelActive){
propertyQualityLabelActive: function () {
if(!this.propertyQualityLabelActive){
this.propertyOrganicLabel = null;
$(this.$refs['propertyOrganicLabel']).val('').trigger('change');
}
@@ -616,5 +636,8 @@ $(window).on('load', function () {
for (var key in formProductTemplate) {
appProductFamily.formProducts[key] = formProductTemplate[key];
}

});

function lcInitProductFamily() {

}

+ 43
- 5
ShopBundle/Resources/public/sass/backend/custom.scss Wyświetl plik

@@ -31,6 +31,7 @@ body{font-size: 0.9rem;}

a.link-as-text{color:#333;}

.badge{font-size: 90%;}

/***************************************** ADMIN SIDEBAR ***************************************/
.main-sidebar p{font-size: 0.8rem;}
@@ -57,10 +58,13 @@ body#pdl-body .wrapper .content-wrapper{margin-top: 0; padding-top: 57px;}
.dataTables_length, .dataTables_filter{padding: .75rem 1.25rem 0.25rem;}

table.fixedHeader-floating{margin-top: 0px !important;}
table th.sorting_asc, table th.sorting_desc{border-top:3px solid var(--success);}
.card-body table.lc-table-list th.sorted, table th.sorting_asc, table th.sorting_desc{border-top:2px solid var(--success);}
table th.sorting_asc, table th.sorting_desc{border-top:2px solid var(--success);}
.card-body table.lc-table-list th.filtered{border-top:2px solid var(--primary);}
/*.card-body table.lc-table-list th{border-top:3px solid var(--success);}*/
table th.filtered{border-top:3px solid var(--primary);}
table th.filtered{border-top:2px solid var(--primary);}
.card-body table.lc-table-list th.sorted, table th.sorting_asc, table th.sorting_desc{border-top:2px solid var(--success);}
.card-body table.lc-table-list th.sorted.filtered{border-top:0px; position: relative;}
.card-body table.lc-table-list th.sorted.filtered:after{ content: ''; height: 2px; position: absolute; left: 0; width: 100%; right: 0; top: -1px; background: linear-gradient(to right, var(--success) 0%, var(--success) 50%, var(--primary) 50%, var(--primary) 100%);}


.lc-table-list thead a{color: #212529}
@@ -148,6 +152,11 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0
#switch-merchant {
min-width: 170px ;
}
/*************************** PAGINATION *******************************/
.pagination{justify-content: center;}
.disabled .page-link{color: #343a40;}
.disabled .page-link:hover, .page-link.current:hover{background-color: #fff; cursor: default;}


/* Sortable */

@@ -231,7 +240,35 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0
.field-price .input-group.priceByRefUnitWithTax input,.field-price .input-group.priceByRefUnitWithTax .input-group-text{font-weight: bold; border-color: #222 }
.input-group.multiplyingFactor input,.input-group.multiplyingFactor .input-group-text{font-weight: bold; border-color: #222 }


.layout-ajax {
#edit-productfamily-form {
.card-sections {
width: 100%;
position: fixed;
left: 0px;
top: 0px;
z-index: 10;
}

.form {
padding-top: 50px;
}

.card-footer {
display: none;
}

.in-advanced-editing-table {
.form {
padding-top: 0px ;
}
.card-sections,
.row-note {
display: none;
}
}
}
}

/* ORDER */

@@ -256,7 +293,7 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0
#lc-product-family-edit .products-collection-table th:last-child{border-right: 1px solid #dee2e6;}
#lc-product-family-edit .products-collection-table td{border-left: 1px solid #dee2e6; text-align: center; font-size: 13px; border-bottom: 1px solid #dee2e6;}
#lc-product-family-edit .products-collection-table td:last-child{border-right: 1px solid #dee2e6; white-space: nowrap; }
#lc-product-family-edit .btn-add-product {margin: 20px 0; float: right;}
#lc-product-family-edit .btn-add-product {float: right;}
#lc-product-family-edit .inherited {color: #888; font-style: italic; font-weight: initial;}
#lc-product-family-edit .products-collection-table td .value {min-width: 80%; margin: auto; min-height: 35px; cursor: pointer;}
#lc-product-family-edit .products-collection-table td .modal {text-align: left;}
@@ -334,3 +371,4 @@ color:#fff;
-webkit-box-shadow: 0 0 12px #999;
box-shadow: 0 0 12px #999;
}


+ 50
- 6
ShopBundle/Resources/translations/lcshop.fr.yaml Wyświetl plik

@@ -23,6 +23,8 @@ group:
default: Édition
Général: Général
Adresse: Adresse
Redelivery:
list: Liste des relivraisons
Supplier:
contact: Personne de contact
Reminder:
@@ -31,6 +33,7 @@ group:
Statistic:
title: Statistiques
ProductFamily:
status: Espaces et statuts
addresses: Livraisons & facturation
main: Général
products: Déclinaisons
@@ -49,13 +52,17 @@ group:
initReduction: Réduction
export: Note à l'export
stockNegative: Produits stocks négatif
purchaseOrder: Bons de commandes
ReductionCatalog:
info: Informations principal
conditions: Conditions d'application
ReductionCredit:
list: Liste des avoirs
ReductionCart:
info: Informations
conditions: Conditions d'applications
actions: Actions
list: Liste des réductions paniers
OrderShop:
redelivery: Relivraison
resume: Résumé de commande
@@ -71,6 +78,10 @@ group:
tickets: Tickets relatif à la commande
orderStatusHistories: Historique de changement de statut
waitingBankReturn: Commandes en attente de retour banque
list: Liste des commandes
giftVoucher: Commandes de bons cadeaux
multiplePayment: Paiements multiples

Ticket:
listMessages: Liste des messages
list: Tickets ouverts
@@ -85,8 +96,14 @@ group:
email: Email
delivery: Livraison
maintenance: Maintenance
lunch: Repas du midi
Address:
listLoopBesancon: Adresses de Besançon à spécifier (lat / long)
User:
item: Utilisateur
Notification:
main: Notifications



None: Aucune valeur
@@ -129,14 +146,15 @@ error:
deliverySlotMissing: Vous n'avez pas de créneau de livraison
productUnavailable: Certains produits ne sont plus disponibles
nextStatusNotAllow: La commande ne peut passer à ce statut
noPayment: Le montant de la commande n'a pas été règlé dans sa totalité
incompletePayment: Le montant de la commande n'a pas été règlé dans sa totalité
otherOrderAlreadyExist: Une autre commande existe déjà pour cet utilisateur, vous avez été redirigé.
minimumAmountZone: Montant minimum de commande non respecté pour cette zone
minimumAmountPointSale: Montant minimum de commande non respecté pour ce point de vente
noPayment: Aucun paiement n'a été enregistré pour cette commande
reductionCart:
conditionsError: Cette réduction ne peut pas être appliqué sur cette commande
date: La réduction n'est plus active
pointSale: L'ambassade ne correspond pas
pointSale: Cette réduction étant liée à une ambassade, le code sera à rentrer à l'étape « Paiement » (après avoir choisi la livraison dans l’ambassade correspondante).
deliveryZone: La zone de livraison ne correspond pas
deliverySlot: La créneau de livraison ne correspond pas
groupUser: Le(s) groupe(s) utilisateurs ne correspondent pas
@@ -160,6 +178,7 @@ error:
editStockNoQuantityDefault: "Le stock n'a pas été modifié pour le produit #%id% (Aucune quantité par défaut)"
field:
default:
section: Espace
unit: Unité
placeholder: Choisissez une option
deliveryPointSale: Lieu de livraison
@@ -273,6 +292,7 @@ field:
cash: Espèce
transfer: Virement
credit: Compte prépayé
transfer-gift: Transfert de bon cadeau
minimumAmountCb: "Paiement par carte bancaire : montant minimum"
emailFrom: "Email (From) : email"
emailFromName: "Email (From) : nom"
@@ -281,14 +301,24 @@ field:
emailFromPurchaseOrder: "Email (From) : bons de commande"
order: Commande
subject: Sujet
metaTitle: Meta title
metaDescription: Meta description
metaTitle: Titre (meta)
metaDescription: Description (meta)
users: Utilisateurs
total: Total
products: Produits
purchaseOrderEmailContent: "Contenu par défaut de l'email envoyé aux producteurs"
dateStart: Date de début
dateEnd: Date de fin
messageLunchOpen: Message (section ouverte)
messageLunchClosed: Message (section fermée)
displaySpecificDay: Disponible un jour spécifique
groupUsers: Groupes
ticketTypesNotification: Catégorie ticket
newsletter: Newsletter
isEligibleTicketRestaurant: Éligible ticket restaurant
openGraphTitle: Titre (OpenGraph)
openGraphDescription: Description (OpenGraph)
openGraphImageFile: Image (OpenGraph)

PointSale:
code: Code
@@ -301,6 +331,7 @@ field:
displayTotalWeightInPurchaseOrder: Afficher le poids total dans les bons de commande

ProductFamily:
sections: Espace où le produit est vendu
taxRateInherited: Utiliser la TVA par défaut
activeProducts: Activer les déclinaisons
productsType: Type de déclinaisons
@@ -316,10 +347,11 @@ field:
availableQuantityDefault: Quantité par défaut
quantity: Quantité
behaviorCountStock: Gestion du stock
behaviorDisplaySale: Affichage du total des ventes
differentSupplierTaxRate: TVA différente pour le producteur
supplierTaxRate: TVA du producteur
propertyNoveltyExpirationDateActive: Marquer le produit comme "nouveauté" jusqu'au
propertyOrganicLabelActive: Marquer le produit comme "labellisé"
propertyQualityLabelActive: Marquer le produit comme "labellisé"
propertyLargeVolume: Marquer le produit comme "gros volume"
propertyCharacteristics: Caractéristiques
propertyPackaging: Conditionnement
@@ -332,6 +364,7 @@ field:
displayPriceUnitRef: Afficher le prix par unité de référence
behaviorPrice: Travailler avec des tarifs
productsQuantityAsTitle: Titre équivalent à quantité
isDisabledOnPurchaseOrder: Automatiquement désactiver ce produit dans les bons de commandes
behaviorPriceOptions:
by-piece: À la pièce
by-reference-unit: Par unité de référence
@@ -340,6 +373,9 @@ field:
by-product-family: Gérer le stock par produit (à l'unité)
by-product: Gérer le stock par déclainaison
unlimited: Illimité
behaviorDisplaySaleOptions:
by-measure: Par unité de référence
by-quantity: Par quantité
behaviorStockWeek: Renouvelement du stock chaque semaine
behaviorStockWeekOptions:
renewable: Renouvelable
@@ -349,6 +385,7 @@ field:
ab: Agriculture biologique
hve: Haute valeur environnementale
nature-progres: Nature & progrès
tvvr: "Terra Vitis : Viticulture Responsable"
behaviorExpirationDate: Gèrer
behaviorExpirationDateOptions:
by-product-family: Par produit
@@ -417,6 +454,10 @@ field:
quantityOrder: Quantité commandé
quantityProduct: Quantité (en rapport à l'unité)
unit: Unité
OrderShopLunch:
deliveryTypeOptions:
point-sale: En ambassade
home: À domicile
OrderShop:
hasReach: Étape atteinte
deliveryTrucks: Véhicules de livraison
@@ -491,7 +532,8 @@ field:
days: Par jour
week: Par semaine
month: Par mois

User:
isSaleAlwaysOpen: Commandes toujours ouvertes
action:
apply: Appliquer
new: Créer %entity_label%
@@ -519,11 +561,13 @@ action:
product:
editStock: Gérer les stocks
editProductFamily: Éditer le produit
statSales: Afficher plus de semaines
user:
account: Mon compte
logout: Me déconnecter
address: Adresse utilisateur
switch: Prendre la main

order:
addOrderProduct: Ajouter un produit
addReductionCart: Ajouter une réduction

+ 19
- 10
ShopBundle/Resources/views/backend/default/block/actions.html.twig Wyświetl plik

@@ -4,24 +4,33 @@
{% if action.group is defined and action.group==true %}
{% set dropdownAction = dropdownAction|merge({(loop.index0): action}) %}
{% else %}
{% set display_button = true %}

{% if 'list' == action.name %}
{% set action_href = request_parameters.referer|default('') ? request_parameters.referer|easyadmin_urldecode : path('easyadmin', request_parameters|merge({ action: 'list' })) %}
{% elseif 'method' == action.type %}
{% set action_href = path('easyadmin', request_parameters|merge({ action: action.name, id: item_id })) %}
{% elseif 'route' == action.type %}
{% set action_href = path(action.name, request_parameters|merge({ action: action.name, id: item_id })) %}
{% elseif 'productfamily_advanced_editing' == action.type %}
{% set action_href = path('easyadmin', request_parameters|merge({ action: action.action, id: item_id })) %}
{% if action.name == 'products' and not item.activeProducts %}
{% set display_button = false %}
{% endif %}
{% endif %}

{{ include(action.template, {
action: action,
action_href: action_href,
is_dropdown: is_dropdown|default(false),
item: item,
item_id: item_id,
request_parameters: request_parameters,
translation_domain: translation_domain,
trans_parameters: trans_parameters,
}, with_context = false) }}
{% if display_button %}
{{ include(action.template, {
action: action,
action_href: action_href,
is_dropdown: is_dropdown|default(false),
item: item,
item_id: item_id,
request_parameters: request_parameters,
translation_domain: translation_domain,
trans_parameters: trans_parameters,
}, with_context = false) }}
{% endif %}
{% endif %}
{% endfor %}
{% if dropdownAction|length > 0 %}

+ 11
- 0
ShopBundle/Resources/views/backend/default/block/embed_figure_box.twig Wyświetl plik

@@ -0,0 +1,11 @@

<div class="small-box {% block class %}bg-info{% endblock %}">
<div class="inner">
<h3>{% block value %}{% endblock %}</h3>
<p>{% block label %}{% endblock %}</p>

<div class="icon">
<i class="fa fa-{% block icon %}bg-info{% endblock %}"></i>
</div>
</div>
</div>

+ 27
- 0
ShopBundle/Resources/views/backend/default/block/list_ordersgiftvoucher.html.twig Wyświetl plik

@@ -0,0 +1,27 @@
<table class="table table-condensed" id="address-list">
<thead>
<tr>
<th>Id</th>
<th>Utilisateurs</th>
<th>Date</th>
<th></th>
</tr>
</thead>
<tbody>
{% for order in orderShopsWeekGiftVoucher %}
<tr>
<td>{{ order.id }}</td>
<td>{{ order.user }}</td>
<td>{{ order.updatedAt|date('d-m H:i') }}</td>
<td><a class="btn-sm btn-success"
href="{{ path('easyadmin', {id: order.id, entity: 'OrderShop', action: 'show'}) }}">
<i class="fas fa-eye"></i>
</a></td>
</tr>
{% else %}
<tr>
<td colspan="4"><i>Aucune commande de bons cadeaux</i></td>
{% endfor %}
</tbody>
</table>


+ 0
- 31
ShopBundle/Resources/views/backend/default/block/list_tickets.html.twig Wyświetl plik

@@ -1,31 +0,0 @@
<table class="table table-condensed" id="ticket-list">
<thead>
<tr>
<th>Sujet</th>
<th>Statut</th>
<th>Dernier message</th>
<th></th>
</tr>
</thead>
<tbody>
{% for ticket in tickets %}
<tr>
<td>{{ ticket.subject }}</td>
<td>
{% set value = ticket.status %}
{% include '@LcShop/backend/default/list-fields/field_ticket_status.html.twig' %}
</td>
<td>
{% set item = ticket %}
{% include '@LcShop/backend/default/list-fields/field_ticket_last_message.html.twig' %}
</td>
<td>
<a class="btn-sm btn-success" href="{{ path('easyadmin', {id: ticket.id, entity: 'Ticket', action: 'show'}) }}">
<i class="fas fa-eye"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>


+ 193
- 15
ShopBundle/Resources/views/backend/default/block/macros.html.twig Wyświetl plik

@@ -276,19 +276,197 @@

{% endmacro available_quantity_product %}

{# {% macro modal(title, form) %}
{% embed '@LcShop/backend/default/block/embed_modal.twig' %}
{% trans_default_domain 'lcshop' %}
{% block id %}{{ id }}{% endblock %}
{% block title %}{{ title }}{% endblock %}
{% block form_start %}
{{ form_start(form) }}

{% endblock %}
{% block icon %}{{ icon }}{% endblock %}
{% block label %}{{ label }}{% endblock %}
{% block value %}
{{ value }}
{% endblock %}
{% endembed %}
{% endmacro box_info %}#}
{% macro button(entity, action, id=null, class="success", title=null, icon=null) %}

{% if title %}
{% set trad = title %}
{% else %}
{% set trad = 'action.'~action %}
{% endif %}

{% if icon is null %}
{% if action=="edit" %}{% set icon = 'pen' %}
{% elseif action=="show" %}{% set icon = 'eye' %}
{% endif %}
{% endif %}
{% set param = {action : action, entity: entity, referer: app.request.requestUri} %}
{% if id %}{% set param = param|merge({id: id}) %}{% endif %}
<a class="btn-sm btn-{{ class }}" data-toggle="tooltip" title="{{ trad|trans({}, "lcshop") }}"
href="{{ path('easyadmin', param) }}">
<i class="fas fa-{{ icon }}"></i>
</a>

{% endmacro button %}
{% macro list_tickets(tickets) %}
<table class="table table-condensed">
<thead>
<tr>
<th>Sujet</th>
<th>Statut</th>
<th>Dernier message</th>
<th></th>
</tr>
</thead>
<tbody>
{% for ticket in tickets %}
<tr>
<td>{{ ticket.subject }}</td>
<td>
{% set value = ticket.status %}
{% include '@LcShop/backend/default/field/ticket_status.html.twig' %}
</td>
<td>
{% set item = ticket %}
{% include '@LcShop/backend/default/field/ticket_last_message.html.twig' %}
</td>
<td>
{{ _self.button('Ticket', 'show', ticket.id) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro list_tickets %}



{% macro list_reduction_credits(reductionCredits, user) %}
{% set merchant_current = merchantUtils.getMerchantCurrent() %}
<table class="table table-condensed">
<thead>
<tr>
<th>Titre</th>
<th>Montant</th>
<th>En ligne</th>
<th>Utilisé</th>
<th></th>
</tr>
</thead>
<tbody>
{% for reductionCredit in reductionCredits %}
{% if reductionCredit.getMerchant() == merchant_current %}
{% set isUsed = orderUtils.isReductionCreditUsed(reductionCredit, user) %}
<tr>
<td>{{ reductionCredit.title }}</td>
<td>
{{ reductionCredit.value|format_price(false) }}
</td>
<td>
{% include '@LcShop/backend/default/field/status.html.twig' with {value: reductionCredit.status} %}
</td>
<td>
{% include '@EasyAdmin/default/field_boolean.html.twig' with {value: isUsed} %}
</td>
<td>
{% if isUsed == false and reductionCredit.status >=0 %}
{{ _self.button('ReductionCredit', 'edit', reductionCredit.id, 'primary') }}
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
{% endmacro list_reduction_credits %}


{% macro list_reduction_carts(reductionCarts, user = false) %}
<table class="table table-condensed">
<thead>
<tr>
<th>Titre</th>
<th>Montant</th>
<th>Quantité utilisé</th>
<th>Quantité restante</th>
<th>En ligne</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for reductionCart in reductionCarts %}
<tr>
<td>{{ reductionCart.title }}</td>
<td>
{% if reductionCart.value > 0 %}
{{ reductionCart.value }}
{% if reductionCart.unit == 'percent' %}%{% else %}€{% endif %}

{% if reductionCart.appliedTo is defined and reductionCart.appliedTo|length > 0 %}
sur
{% if reductionCart.appliedTo == 'order-products' %}
les produits
{% endif %}
{% endif %}

({% if reductionCart.behaviorTaxRate == 'tax-included' %}TTC{% else %}HT{% endif %})
{% endif %}

{% if reductionCart.freeShipping %}
{% if reductionCart.value > 0 %}<br/>{% endif %}
Livraison offerte
{% endif %}
</td>

<td>
{% if user is not null %}
{% set totalUsed = orderUtils.getReductionCartUsedQuantityPerUser(reductionCart, user) %}
{{ totalUsed }}
{% endif %}

</td>
<td>
{% if user is not null %}
{{ reductionCart.availableQuantityPerUser - totalUsed }}
{% endif %}
</td>
<td>
{% include '@EasyAdmin/default/field_boolean.html.twig' with {value: reductionCart.status} %}
</td>
<td>
{{ _self.button('ReductionCart', 'edit', reductionCart.id, 'primary') }}
</td>

</tr>
{% endfor %}
</tbody>
</table>
{% endmacro list_reduction_carts %}



{% macro box_user_info(user) %}
{% embed '@LcShop/backend/default/block/embed_box.twig' %}
{% trans_default_domain 'lcshop' %}
{% block class %}bg-info{% endblock %}
{% block icon %}user{% endblock %}
{% block label %}{{ "group.User.item"|trans({}, 'lcshop') }}{% endblock %}
{% block value %}
#{{ user.id }}&nbsp;
{{ user.gender == 1 ? 'Mme.' : 'M.' }} {{ user.name }} {{ user.age < 200 ? '('~user.age~' ans)' : ''}}<br />
{{ user.email }}<br />

<span style="margin-top: 5px; display: inline-block;">
<span data-toggle="tooltip" data-placement="bottom" title="Nombre de commandes" class="badge badge-info">
{{ orderUtils.countValidOrderShopByUser(user) }} <i class="fa fa-shopping-cart"></i>
</span>
<span data-toggle="tooltip" data-placement="bottom" title="Total dépensés" class="badge badge-success">
{{ orderUtils.getTotalSpentByUser(user) }} <i class="fa fa-euro-sign"></i>
</span>

<span data-toggle="tooltip" data-placement="bottom" title="Nombre de relivraisons" class="badge badge-warning">
{{ orderUtils.countRedeliveryByUser(user) }} <i class="fa fa-undo"></i>
</span>
<span data-toggle="tooltip" data-placement="bottom" title="Nombre d'avoirs" class="badge badge-danger">
{{ user.reductionCredits|length }} <i class="fa fa-backspace"></i>
</span>
</span>

{% endblock %}
{% block button %}
<a class="btn btn-sm btn-secondary" href="{{ path('easyadmin', {"action" : 'show', 'entity': 'User', 'id': user.id}) }}">
Voir la fiche
</a>
{% endblock %}
{% endembed %}
{% endmacro box_user_info %}

+ 103
- 0
ShopBundle/Resources/views/backend/default/block/paginator.html.twig Wyświetl plik

@@ -0,0 +1,103 @@
{% trans_default_domain 'EasyAdminBundle' %}

{% set _paginator_request_parameters = _request_parameters|merge({'referer': null}) %}

{% if paginator.haveToPaginate %}
<div class="list-pagination">
<div class="row">
<div class="col-sm-3 hidden-xs list-pagination-counter">
{{ 'paginator.counter'|trans({ '%start%': paginator.currentPageOffsetStart, '%end%': paginator.currentPageOffsetEnd, '%results%': paginator.nbResults})|raw }}
</div>
<div class="col-xs-12 col-sm-9">
<ul class="pagination list-pagination-paginator {{ 1 == paginator.currentPage ? 'first-page' : '' }} {{ paginator.hasNextPage ? '' : 'last-page' }}">
{% if 1 == paginator.currentPage %}
<li class="disabled">
<span class="page-link ">
<i class="fa fa-angle-double-left"></i>
</span>
</li>
{% else %}
<li>
<a class="page-link"
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: 1 }) ) }}">
<i class="fa fa-angle-double-left"></i>
</a>
</li>
{% endif %}

{% if paginator.hasPreviousPage %}
<li>
<a class="page-link"
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: paginator.previousPage }) ) }}">
<i class="fa fa-angle-left"></i>
</a>
</li>
{% else %}
<li class="disabled">
<span class="page-link">
<i class="fa fa-angle-left"></i>
</span>
</li>
{% endif %}

{# BEGIN DISPLAYING PAGE NUMBERS #}

{# the number of pages that are displayed around the active page #}
{% set nearbyPagesLimit = 8 %}

{% if paginator.currentPage > 1 %}
{% for i in range(paginator.currentPage-nearbyPagesLimit, paginator.currentPage-1) if ( i > 0 ) %}
<li >
<a class="page-link"
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: i }) ) }}">{{ i }}</a>
</li>
{% endfor %}
{% endif %}
<li>
<a class="current page-link">{{ paginator.currentPage }}</a>
</li>
{% if paginator.currentPage < paginator.nbPages %}
{% for i in range(paginator.currentPage+1, paginator.currentPage + nearbyPagesLimit) if ( i <= paginator.nbPages ) %}
<li>
<a class="page-link"
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: i }) ) }}">{{ i }}</a>
</li>
{% endfor %}
{% endif %}

{# END DISPLAYING PAGE NUMBERS #}

{% if paginator.hasNextPage %}
<li>
<a class="page-link"
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: paginator.nextPage }) ) }}">
<i class="fa fa-angle-right"></i>
</a>
</li>
{% else %}
<li class="disabled">
<span class="page-link">
<i class="fa fa-angle-right"></i>
</span>
</li>
{% endif %}

{% if paginator.currentPage < paginator.nbPages %}
<li>
<a class="page-link"
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: paginator.nbPages }) ) }}">
<i class="fa fa-angle-double-right"></i>
</a>
</li>
{% else %}
<li class="disabled">
<span class="page-link">
<i class="fa fa-angle-double-right"></i>
</span>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endif %}

+ 34
- 0
ShopBundle/Resources/views/backend/default/edit-ajax.html.twig Wyświetl plik

@@ -0,0 +1,34 @@
{% form_theme form with easyadmin_config('design.form_theme') only %}

{% set _entity_config = easyadmin_entity(app.request.query.get('entity')) %}
{% set _entity_id = attribute(entity, _entity_config.primary_key_field_name) %}
{% trans_default_domain _entity_config.translation_domain %}

{% set _trans_parameters = { '%entity_name%': _entity_config.name|trans, '%entity_label%': _entity_config.label|trans, '%entity_id%': _entity_id } %}

{% extends '@LcShop/backend/default/layout/layout-ajax.html.twig' %}

{% block ajax %}
{% block entity_form %}
{{ form(form) }}
{% endblock entity_form %}

{% block head_stylesheets %}
{{ parent() }}
<link rel="stylesheet"
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/jquery-ui/jquery-ui.min.css') }}">
{% endblock %}

{% block plugin_javascript %}
{{ parent() }}
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery-ui/jquery-ui.min.js') }}"></script>
<script type="text/javascript">
var CKEDITOR_BASEPATH = "{{ ckeditor_base_path("/bundles/fosckeditor/") }}";
</script>
<script type="text/javascript" src="{{ asset('bundles/fosckeditor/ckeditor.js') }}"></script>
{% endblock %}

{% block script_javascript %}
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-edit.js') }}"></script>
{% endblock %}
{% endblock %}

ShopBundle/Resources/views/backend/default/list-fields/list_association.html.twig → ShopBundle/Resources/views/backend/default/field/association.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/default/list-fields/list_association_users.html.twig → ShopBundle/Resources/views/backend/default/field/association_users.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/default/list-fields/field_badge.html.twig → ShopBundle/Resources/views/backend/default/field/badge.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/default/list-fields/list_children.html.twig → ShopBundle/Resources/views/backend/default/field/children.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/default/list-fields/field_date.html.twig → ShopBundle/Resources/views/backend/default/field/date.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/default/list-fields/field_datetime.html.twig → ShopBundle/Resources/views/backend/default/field/datetime.html.twig Wyświetl plik

@@ -1,8 +1,12 @@
{# {{ value|date('U')}} #}

{% if field_options.format == "d/m/Y h:i A e" or field_options.format == null %}
{% if value is not null %}
{% if field_options is not defined or field_options.format == "d/m/Y h:i A e" or field_options.format == null %}
{% set format = "d/m/Y H:i" %}
{% else %}
{% set format = field_options.format %}
{% endif %}
<time data-timestamp="{{ value|date('U') }}" title="{{ value|date('r') }}">{{ value|date(format) }}</time>
{% else %}
<span class="badge badge-secondary">Non défini</span>
{% endif %}

ShopBundle/Resources/views/backend/default/list-fields/list_day.html.twig → ShopBundle/Resources/views/backend/default/field/day.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/default/list-fields/field_options_translatable.html.twig → ShopBundle/Resources/views/backend/default/field/options_translatable.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/default/list-fields/field_price.html.twig → ShopBundle/Resources/views/backend/default/field/price.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/default/list-fields/field_product_family_available_quantity.html.twig → ShopBundle/Resources/views/backend/default/field/product_family_available_quantity.html.twig Wyświetl plik


+ 2
- 0
ShopBundle/Resources/views/backend/default/field/product_family_sales.html.twig Wyświetl plik

@@ -0,0 +1,2 @@
{% import '@LcShop/backend/productfamily/macros.html.twig' as macros %}
{{ macros.product_family_sales_statistic(orderUtils.getProductsSalesStatistic(item, 2), item) }}

+ 9
- 0
ShopBundle/Resources/views/backend/default/field/status.html.twig Wyświetl plik

@@ -0,0 +1,9 @@
{% trans_default_domain 'EasyAdminBundle' %}

{% if value == 1 %}
<span class="badge badge-success">{{ 'label.true'|trans }}</span>
{% elseif value == 0 %}
<span class="badge badge-danger">{{ 'label.false'|trans }}</span>
{% elseif value == -1 %}
<span class="badge badge-secondary">Supprimé</span>
{% endif %}

+ 3
- 0
ShopBundle/Resources/views/backend/default/field/supplier.html.twig Wyświetl plik

@@ -0,0 +1,3 @@
{% if link_parameters is defined %}
<a href="{{ path('easyadmin', link_parameters|merge({entity: 'Supplier', referer: '' })) }}">{{ value|easyadmin_truncate }}</a>
{% endif %}

+ 5
- 0
ShopBundle/Resources/views/backend/default/field/textorempty.html.twig Wyświetl plik

@@ -0,0 +1,5 @@
{% if value is not null or value is not empty %}
{{ value }}
{% else %}
<span class="badge badge-secondary">Non défini</span>
{% endif %}

ShopBundle/Resources/views/backend/default/list-fields/field_ticket_last_message.html.twig → ShopBundle/Resources/views/backend/default/field/ticket_last_message.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/default/list-fields/field_ticket_status.html.twig → ShopBundle/Resources/views/backend/default/field/ticket_status.html.twig Wyświetl plik


+ 9
- 0
ShopBundle/Resources/views/backend/default/field/toggle.html.twig Wyświetl plik

@@ -0,0 +1,9 @@
{% trans_default_domain 'EasyAdminBundle' %}

{% block toggle %}
<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-danger" data-propertyname="{{ field_options.property }}">
<input type="checkbox" class="custom-control-input" id="customSwitch{{ item.id }}-{{ field_options.property }}" {{ value == true ? 'checked' }}>
<label class="custom-control-label" for="customSwitch{{ item.id }}-{{ field_options.property }}">{% block label %}{{ field_options.label }}{% endblock %}</label>
</div>
{% endblock %}


+ 1
- 0
ShopBundle/Resources/views/backend/default/field/total.html.twig Wyświetl plik

@@ -0,0 +1 @@
{{ priceUtils.getTotalWithTax(item, true)|format_price|raw }}<br />

+ 7
- 0
ShopBundle/Resources/views/backend/default/field/user.html.twig Wyświetl plik

@@ -0,0 +1,7 @@
{% if item is defined and item.user is defined and item.user is not null %}
<a href="{{ path('easyadmin', {"entity": 'User', 'action': "show", "id" : item.user.id})}}">{{ value }}</a>
{% elseif user is defined and user is not null %}
<a href="{{ path('easyadmin', {"entity": 'User', 'action': "show", "id" : user.id})}}">{{ user }}</a>
{% else %}
{{ value }}
{% endif %}

+ 24
- 1
ShopBundle/Resources/views/backend/default/layout/layout-ajax.html.twig Wyświetl plik

@@ -1,5 +1,28 @@
{% trans_default_domain "lcshop" %}

<div class="layout-ajax">
{% block ajax %}
{% block head_stylesheets %}
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/fontawesome-free/css/all.min.css') }}">
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/adminlte.css') }}">
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/custom.css') }}">
{% endblock %}

{% endblock %}
{% block plugin_javascript %}
<!-- jQuery -->
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery/jquery.min.js') }}"></script>
<!-- Bootstrap 4 -->
<script src="{{ asset('bundles/lcshop/js/backend/plugin/bootstrap/bootstrap.bundle.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/toastr/toastr.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/select2/select2.full.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/bootstrap/bootstrap-switch.min.js') }}"></script>
<!-- AdminLTE App -->
<script src="{{ asset('bundles/lcshop/js/backend/plugin/adminlte.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/script/default/utils.js') }}"></script>
{% endblock plugin_javascript %}

{% block script_javascript %}
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-common.js') }}"></script>
{% endblock script_javascript %}
{% endblock %}
</div>

+ 0
- 2
ShopBundle/Resources/views/backend/default/list-fields/field_product_family_total_product_ordered.html.twig Wyświetl plik

@@ -1,2 +0,0 @@
{% import '@LcShop/backend/productfamily/macros.html.twig' as macros %}
{{ macros.total_order_product_family(orderUtils.getTotalProductOrderedLastWeeks(item, 2, true)['total'], item, true) }}

+ 0
- 14
ShopBundle/Resources/views/backend/default/list-fields/field_toggle.html.twig Wyświetl plik

@@ -1,14 +0,0 @@
{% trans_default_domain 'EasyAdminBundle' %}

<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-danger" data-propertyname="{{ field_options.property }}">
<input type="checkbox" class="custom-control-input" id="customSwitch{{ item.id }}-{{ field_options.property }}" {{ value == true ? 'checked' }}>
<label class="custom-control-label" for="customSwitch{{ item.id }}-{{ field_options.property }}">{{ field_options.label }}</label>
</div>
{#

{% if value == true %}
<span class="badge badge-success">{{ 'label.true'|trans }}</span>
{% else %}
<span class="badge badge-danger">{{ 'label.false'|trans }}</span>
{% endif %}
#}

+ 0
- 1
ShopBundle/Resources/views/backend/default/list-fields/field_total.html.twig Wyświetl plik

@@ -1 +0,0 @@
{{ priceUtils.getTotalWithTax(item)|format_price|raw }}

+ 50
- 22
ShopBundle/Resources/views/backend/default/list.html.twig Wyświetl plik

@@ -12,6 +12,7 @@
sortField: app.request.get('sortField'),
sortDirection: app.request.get('sortDirection'),
page: app.request.get('page', 1),
maxResults: app.request.get('maxResults', _entity_config.list.max_results),
filters: app.request.get('filters', []),
referer: null
}) %}
@@ -27,7 +28,7 @@
{% set _has_filters = _entity_config.list.filters|default(false) %}

{% block body_id 'easyadmin-list-' ~ _entity_config.name %}
{#{% block body_class 'list list-' ~ _entity_config.name|lower %}#}
{# {% block body_class 'list list-' ~ _entity_config.name|lower %} #}

{% block content_title %}
{% apply spaceless %}
@@ -42,7 +43,7 @@
{% endblock %}

{% block global_actions %}
{#{% if easyadmin_action_is_enabled_for_list_view('new', _entity_config.name) %}
{# {% if easyadmin_action_is_enabled_for_list_view('new', _entity_config.name) %}
{% set _action = easyadmin_get_action_for_list_view('new', _entity_config.name) %}
{% block new_action %}
<div class="button-action">
@@ -54,7 +55,7 @@
</a>
</div>
{% endblock new_action %}
{% endif %}#}
{% endif %} #}
{% endblock global_actions %}

{% block batch_actions %}
@@ -86,15 +87,22 @@
{% set _fields_visible_by_user = fields|filter((metadata, field) => easyadmin_is_granted(metadata.permission)) %}
{% set _number_of_hidden_results = 0 %}
{% set _list_item_actions = easyadmin_get_actions_for_list_item(_entity_config.name) %}
<div class="row">
<div class="row" id="{% block list_id %}{% endblock %}">
<div class="col-12">
<div class="card card-outline card-primary">
<div class="card-header">
{% block card_header %}

<h2 class="card-title text-lg ">
<div class="btn-group">
{% set itemsPerPage = [10,20,30,50,100,200] %}
{% for itemPerPage in itemsPerPage %}
<a href="{{ path('easyadmin', _request_parameters|merge({ maxResults: itemPerPage, page : "1" })) }}"
class="btn btn-sm {{ paginator.maxPerPage == itemPerPage ? 'btn-outline-secondary' : 'btn-secondary' }}">{{ itemPerPage }}</a>
{% endfor %}

</div>
{% block paginator_nb_results %}
{#{{ "list.title"|trans({'%label%' : _entity_config['label']|lower }) }}#}
{# {{ "list.title"|trans({'%label%' : _entity_config['label']|lower }) }} #}
{% if paginator.nbResultsTotal != paginator.nbResults %}
<span data-toggle="tooltip" title="{{ "list.nbResultsFiltered"|trans }}"
class="badge badge-info">{{ paginator.nbResults }} <i
@@ -204,12 +212,24 @@
{% endif %}

{% for field, metadata in _fields_visible_by_user %}

{% set isSortingField = (metadata.property == app.request.get('sortField')) or ('association' == metadata.type and app.request.get('sortField') starts with metadata.property ~ '.') %}
{% set nextSortDirection = isSortingField ? (app.request.get('sortDirection') == 'DESC' ? 'ASC' : 'DESC') : 'DESC' %}
{% set nextSortDirection = isSortingField ? (app.request.get('sortDirection') == 'DESC' ? 'ASC' : 'DESC') : 'ASC' %}
{% set _column_label = metadata.label|trans(_trans_parameters) %}
{% set _column_icon = isSortingField ? (nextSortDirection == 'DESC' ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %}
{% set isFilteredField = false %}
{% if filters_form[field] is defined and filters_form[field].vars.value is not empty %}
{% if (metadata['dataType'] == 'datetime' or metadata['dataType'] == 'date') %}
{% if filters_form[field]['dateStart'].vars.value is not empty and filters_form[field]['dateEnd'].vars.value is not empty %}
{% set isFilteredField = true %}
{% endif %}
{% else %}
{% set isFilteredField = true %}
{% endif %}
{% endif %}


<th class="{{ isSortingField ? 'sorted' }} {{ metadata.virtual ? 'virtual' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}>
<th class="{{ isSortingField ? 'sorted' }} {{ isFilteredField ? 'filtered': '' }} {{ metadata.virtual ? 'virtual' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}>
{% if metadata.sortable %}
<a href="{{ path('easyadmin', _request_parameters|merge({ page: 1, sortField: metadata.property, sortDirection: nextSortDirection })) }}">
{{ _column_label|raw }} <i class="fa fa-fw {{ _column_icon }}"></i>
@@ -220,22 +240,24 @@
</th>
{% endfor %}

{% if _list_item_actions|length > 0 %}
{# {% if _list_item_actions|length > 0 %}#}
<th {% if _entity_config.list.collapse_actions %}width="10px"{% endif %} {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}>
<span class="sr-only">{{ 'list.row_actions'|trans(_trans_parameters, 'EasyAdminBundle') }}</span>
</th>
{% endif %}
{#{% endif %}#}
</tr>
{% endblock table_head %}
{% block table_filters %}
{% set fieldAreNotEmpty = false %}
{% if filters_form is defined %}
<tr class="table-filters-line">
{% if _has_batch_actions %}
<th></th>{% endif %}
{% for field, metadata in _fields_visible_by_user %}
<th>
{% set field = utils.getFilterPropertyClean(field) %}
{% if filters_form[field] is defined %}
{% if filters_form[field].vars.value is not null and filters_form[field].vars.value is not empty %}{% set fieldAreNotEmpty = true %}{% endif %}
{% if metadata['dataType'] == 'datetime' or metadata['dataType'] == 'date' %}
<div class="input-group input-group-sm">
<input type="text"
@@ -248,7 +270,7 @@
</div>
{% else %}
<div class="form-widget input-group-sm">
{% if metadata.dataType == 'integer' or metadata.dataType== 'string' %}
{% if metadata.dataType == 'integer' or metadata.dataType== 'string' or metadata.dataType== 'text' %}
{{ form_widget(filters_form[field], {'attr': {'autocomplete': 'off', 'data-lc-autocomplete-url' : path('easyadmin', {
action: 'autocomplete',
field: field,
@@ -265,7 +287,7 @@

</th>
{% endfor %}
{% if _list_item_actions|length > 0 %}
{#{% if _list_item_actions|length > 0 %}#}
<th class="actions">
<button type="submit" form="filters-form" class="btn btn-sm btn-info"
data-toggle="tooltip"
@@ -273,8 +295,8 @@
aria-label="{{ "action.apply"|trans({}, 'lcshop') }}">
<i class="fa fa-search"></i>
</button>
{% if filters_form.vars.submitted %}
<a href="{{ path('easyadmin', {action: app.request.get('action'), entity: _entity_config.name}) }}"
{% if filters_form.vars.submitted or fieldAreNotEmpty %}
<a href="{{ path('easyadmin', _request_parameters|merge({ 'filterClear' : 'clearAll', list_filter : null, referer : null })) }}"
class="btn btn-sm btn-warning lc-reset-filters"
data-toggle="tooltip"
title="{{ "action.reset"|trans({}, 'lcshop') }}"
@@ -285,7 +307,7 @@


</th>
{% endif %}
{# {% endif %}#}

</tr>
{% endif %}
@@ -305,7 +327,7 @@
{% else %}
{# the empty string concatenation is needed when the primary key is an object (e.g. an Uuid object) #}
{% set _item_id = '' ~ attribute(item, _entity_config.primary_key_field_name) %}
<tr data-id="{{ _item_id }}">
<tr id="tr-entity-id-{{ _item_id }}" data-id="{{ _item_id }}">
{% if _has_batch_actions %}
<td><input type="checkbox" class="form-batch-checkbox"
value="{{ _item_id }}"></td>
@@ -317,21 +339,24 @@


<td class="{{ isSortingField ? 'sorted' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}>
{% if (field == 'title' or field== 'id') and (metadata.dataType=="string" or metadata.dataType=="integer") %}

{% if (field == 'title' or field== 'id') and (metadata.dataType=="string" or metadata.dataType=="integer") and _entity_config.name != 'ProductFamilyAdvancedEditing' %}
<a class="link-as-text"
href="{{ path('easyadmin', _request_parameters|merge({ action: 'edit', id: item.id })) }}">
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }}
</a>
{% else %}
{# {% if metadatafieldName =="supplier" %}
{{ dump(metadata) }}
{% endif %} #}
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }}
{% endif %}
</td>
{% endfor %}

<td class="actions">
{% if _list_item_actions|length > 0 %}
{% set _column_label = 'list.row_actions'|trans(_trans_parameters, 'EasyAdminBundle') %}
<td class="actions">
{% block item_actions %}
{% set _actions_template = '@LcShop/backend/default/block/actions.html.twig' %}
{{ include(_actions_template, {
@@ -344,8 +369,9 @@
item: item
}, with_context = false) }}
{% endblock item_actions %}
</td>
{% endif %}
</td>

</tr>
{% endif %}
{% else %}
@@ -430,7 +456,7 @@
<script src="{{ asset('bundles/lcshop/js/backend/plugin/daterange/daterangepicker.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/jquery.highlight.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/autocomplete/bootstrap-autocomplete.min.js') }}"></script>
{#<script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/responsive.bootstrap4.min.js') }}"></script>#}
{# <script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/responsive.bootstrap4.min.js') }}"></script> #}
{% endblock %}

{% block script_javascript %}
@@ -439,6 +465,8 @@


<script type="text/javascript">


$(document).ready(function () {
const toggles = document.querySelectorAll('.custom-switch input[type="checkbox"]');
for (i = 0; i < toggles.length; i++) {

+ 5
- 4
ShopBundle/Resources/views/backend/default/sortable.html.twig Wyświetl plik

@@ -73,14 +73,14 @@
</tr>
{% endfor %}

{# {% if _number_of_hidden_results > 0 %}
{# {% if _number_of_hidden_results > 0 %}
<tr class="datagrid-row-empty">
<td class="text-center" colspan="{{ _fields_visible_by_user|length + 1 }}">
<span class="datagrid-row-empty-message"><i
class="fa fa-lock mr-1"></i> {{ 'security.list.hidden_results'|trans({}, 'EasyAdminBundle') }}</span>
</td>
</tr>
{% endif %}#}
{% endif %} #}
{% endblock table_body %}
</tbody>
</table>
@@ -101,7 +101,9 @@
{% set _action = easyadmin_get_action_for_edit_view('list', _entity_config.name) %}

<div class="button-action">
<a class=" {{ _action.css_class|default('') }}" href="{{ path('easyadmin', _request_parameters|merge({ action: _action.name })) }}" target="{{ _action.target }}">
<a class=" {{ _action.css_class|default('') }}"
href="{{ path('easyadmin', _request_parameters|merge({ action: _action.name })) }}"
target="{{ _action.target }}">
{{ _action.label is defined and not _action.label is empty ? _action.label|trans(_trans_parameters) }}
</a>

@@ -112,7 +114,6 @@
</div>
</div>
{{ form_end(postion_form) }}

{% endblock main %}

{% block head_stylesheets %}

+ 2
- 2
ShopBundle/Resources/views/backend/form/custom_bootstrap_4.html.twig Wyświetl plik

@@ -233,12 +233,12 @@
{% set _translation_domain = easyadmin.entity.translation_domain %}
{% set _trans_parameters = { '%entity_name%': easyadmin.entity.name|trans(domain = _translation_domain), '%entity_label%': easyadmin.entity.label|trans(domain = _translation_domain) } %}

{# the 'save' action is hardcoded for the 'edit' and 'new' views #}
<button type="submit" name="save_and_leave" class="btn btn-primary action-save">
<span class="btn-label">{{ 'action.save'|trans(_trans_parameters, _translation_domain) }}</span>
</button>

{% if easyadmin.entity.name =='ProductFamily' %}
<button name="submitAndStay" value="1" type="submit" class="btn btn-success action-save">
<button name="submitAndStay" value="1" type="submit" class="btn btn-success action-save action-save-and-stay">
<span class="btn-label">{{ 'action.saveAndStay'|trans(_trans_parameters, _translation_domain) }}</span>
</button>
{% endif %}

+ 3
- 1
ShopBundle/Resources/views/backend/merchant/form.html.twig Wyświetl plik

@@ -45,7 +45,9 @@
<div v-show="currentSection == 'maintenance'" class="panel panel-default">
{% include '@LcShop/backend/merchant/panel_maintenance.html.twig' %}
</div>

<div v-show="currentSection == 'lunch'" class="panel panel-default">
{% include '@LcShop/backend/merchant/panel_lunch.html.twig' %}
</div>
</div>

</div>

+ 18
- 0
ShopBundle/Resources/views/backend/merchant/panel_lunch.html.twig Wyświetl plik

@@ -0,0 +1,18 @@
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}

<div class="row">
<div class="col-8">
{{ macros.card_start('Merchant.lunch','light') }}
{% if form.merchantConfigs['message-lunch-open'] is defined %}
<div class="col-12">
{{ form_row(form.merchantConfigs['message-lunch-open']) }}
</div>
{% endif %}
{% if form.merchantConfigs['message-lunch-closed'] is defined %}
<div class="col-12">
{{ form_row(form.merchantConfigs['message-lunch-closed']) }}
</div>
{% endif %}
{{ macros.card_end() }}
</div>
</div>

ShopBundle/Resources/views/backend/order/list-fields/field-complementary.html.twig → ShopBundle/Resources/views/backend/order/field/complementary.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/order/list-fields/field_hasreach.html.twig → ShopBundle/Resources/views/backend/order/field/hasreach.html.twig Wyświetl plik


ShopBundle/Resources/views/backend/order/list-fields/order-payment.html.twig → ShopBundle/Resources/views/backend/order/field/order-payment.html.twig Wyświetl plik


+ 1
- 0
ShopBundle/Resources/views/backend/order/field/order_status.html.twig Wyświetl plik

@@ -0,0 +1 @@
<span class="badge badge-{{ value.color is defined ? value.color : item.orderStatus.color }}">{{ value }}</span>

+ 0
- 23
ShopBundle/Resources/views/backend/order/macros.html.twig Wyświetl plik

@@ -226,29 +226,6 @@
</div>
{% endmacro %}


{% macro box_user_info() %}
{% embed '@LcShop/backend/default/block/embed_box.twig' %}
{% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
{% trans_default_domain 'lcshop' %}
{% block class %}bg-info{% endblock %}
{% block icon %}credit-card{% endblock %}
{% block label %}{{ "field.OrderShop.reference"|trans({}, 'lcshop') }}{% endblock %}
{% block value %}
<span v-if="order.user" v-html="order.user"></span>
<span v-else v-html="order.visitor"></span>
{% endblock %}
{% block button %}
<a class="btn btn-sm btn-secondary" target="_blank" :href="order.userLink">
Voir la fiche
</a>
{% endblock %}
{% endembed %}
{% endmacro box_user_info %}




{% macro box_reference() %}
{% embed '@LcShop/backend/default/block/embed_box.twig' %}
{% import '@LcShop/backend/order/macros.html.twig' as order_macros %}

+ 1
- 1
ShopBundle/Resources/views/backend/order/show-cart.html.twig Wyświetl plik

@@ -19,7 +19,7 @@
<div class="lc-vue-js-container" id="lc-order-edit">
<div class="row">
<div class="col-3">
{{ order_macros.box_user_info() }}
{{ macros.box_user_info(entity.user) }}
</div>
<div class="col-3">
{{ order_macros.box_total_order() }}

+ 1
- 1
ShopBundle/Resources/views/backend/order/show-order.html.twig Wyświetl plik

@@ -20,7 +20,7 @@
<div class="lc-vue-js-container" id="lc-order-edit">
<div class="row">
<div class="col-3">
{{ order_macros.box_user_info() }}
{{ macros.box_user_info(entity.user) }}
</div>
<div class="col-3">
{{ order_macros.box_total_order() }}

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików

Ładowanie…
Anuluj
Zapisz