<?php | |||||
namespace Lc\ShopBundle\Context; | |||||
interface SectionInterface | |||||
{ | |||||
} |
<?php | |||||
namespace Lc\ShopBundle\Context; | |||||
interface SectionUtilsInterface | |||||
{ | |||||
} |
use Symfony\Component\Form\FormEvents; | use Symfony\Component\Form\FormEvents; | ||||
use Symfony\Component\HttpFoundation\JsonResponse; | use Symfony\Component\HttpFoundation\JsonResponse; | ||||
use Symfony\Component\HttpFoundation\Response; | use Symfony\Component\HttpFoundation\Response; | ||||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
use Symfony\Contracts\Translation\TranslatorInterface; | use Symfony\Contracts\Translation\TranslatorInterface; | ||||
protected $merchantUtils; | protected $merchantUtils; | ||||
protected $mailjetTransport; | protected $mailjetTransport; | ||||
protected $orderUtils; | protected $orderUtils; | ||||
protected $mailUtils ; | |||||
protected $mailUtils; | |||||
protected $translator; | protected $translator; | ||||
protected $utilsProcess; | protected $utilsProcess; | ||||
protected $session; | |||||
protected $sectionUtils; | |||||
protected $filtersForm = null; | protected $filtersForm = null; | ||||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, | 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->security = $security; | ||||
$this->userManager = $userManager; | $this->userManager = $userManager; | ||||
$this->utils = $utilsManager->getUtils(); | $this->utils = $utilsManager->getUtils(); | ||||
$this->merchantUtils = $utilsManager->getMerchantUtils(); | $this->merchantUtils = $utilsManager->getMerchantUtils(); | ||||
$this->orderUtils = $utilsManager->getOrderUtils();; | $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->translator = $translator; | ||||
$this->session = $session; | |||||
} | } | ||||
public function createCustomForm($class, $action, $parameters, $data = true, $options = array()) | public function createCustomForm($class, $action, $parameters, $data = true, $options = array()) | ||||
$response = array(); | $response = array(); | ||||
foreach ($values as $value) { | foreach ($values as $value) { | ||||
$response[] = $value[$field]; | |||||
$response[] = $value[$this->utils->getFilterWithoutAssociationAlias($field, '_')]; | |||||
} | } | ||||
return new JsonResponse($response); | return new JsonResponse($response); | ||||
$dqlFilter = sprintf(str_replace('currentMerchant', $this->getUser()->getMerchant()->getId(), $dqlFilter)); | $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 (new $entityClass instanceof StatusInterface && strpos($dqlFilter, 'entity.status') === false) { | ||||
if ($dqlFilter) $dqlFilter .= sprintf(' AND entity.status > = 0'); | if ($dqlFilter) $dqlFilter .= sprintf(' AND entity.status > = 0'); | ||||
else $dqlFilter .= sprintf(' entity.status > = 0'); | else $dqlFilter .= sprintf(' entity.status > = 0'); | ||||
$dqlFilter = $this->commonDqlFilterQueryBuilder($entityClass, $dqlFilter); | $dqlFilter = $this->commonDqlFilterQueryBuilder($entityClass, $dqlFilter); | ||||
$queryBuilder = parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter); | $queryBuilder = parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter); | ||||
$this->commonQueryFilter($entityClass, $queryBuilder); | $this->commonQueryFilter($entityClass, $queryBuilder); | ||||
$listFields = $this->entity['list']['fields']; | $listFields = $this->entity['list']['fields']; | ||||
$this->filtersForm = $this->createForm(ListFilterType::class, null, array( | $this->filtersForm = $this->createForm(ListFilterType::class, null, array( | ||||
'entity_class' => $this->entity['class'] | 'entity_class' => $this->entity['class'] | ||||
)); | )); | ||||
$this->filtersForm->handleRequest($this->request); | $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) { | 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']) { | switch ($field['dataType']) { | ||||
case 'option': | case 'option': | ||||
case 'integer': | case 'integer': | ||||
case 'text': | case 'text': | ||||
case 'string': | case 'string': | ||||
case 'toggle': | 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 ($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; | break; | ||||
case 'association' : | 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 ($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); | $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; | break; | ||||
case 'datetime': | case 'datetime': | ||||
case 'date': | 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 ($dateStart) $queryBuilder->andWhere('entity.' . $field['property'] . ' >= :dateStart')->setParameter('dateStart', $dateStart); | ||||
if ($dateEnd) $queryBuilder->andWhere('entity.' . $field['property'] . ' <= :dateEnd')->setParameter('dateEnd', $dateEnd); | if ($dateEnd) $queryBuilder->andWhere('entity.' . $field['property'] . ' <= :dateEnd')->setParameter('dateEnd', $dateEnd); | ||||
} | } | ||||
} | } | ||||
//TODO déplacer dans LC | |||||
if ($this->entity['name'] == 'OrderShopLunch' || $this->entity['name'] == 'OrderShopLunchDay') { | |||||
$queryBuilder->addOrderBy('entity.user', 'asc'); | |||||
} | |||||
return $queryBuilder; | 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 = []) | public function renderTemplate($actionName, $templatePath, array $parameters = []) | ||||
{ | { | ||||
} | } | ||||
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() | public function sortAction() | ||||
{ | { | ||||
$isFilterMerchantInterface = in_array('Lc\ShopBundle\Context\FilterMerchantInterface', $classImplements); | $isFilterMerchantInterface = in_array('Lc\ShopBundle\Context\FilterMerchantInterface', $classImplements); | ||||
$isFilterMultipleMerchantsInterface = in_array('Lc\ShopBundle\Context\FilterMultipleMerchantsInterface', $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)) { | if (in_array('Lc\ShopBundle\Context\StatusInterface', $classImplements)) { | ||||
$statusInterface = true; | $statusInterface = true; | ||||
$form->add($child->getName(), EntityType::class, array( | $form->add($child->getName(), EntityType::class, array( | ||||
'class' => $this->em->getClassMetadata($passedOptions['class'])->getName(), | 'class' => $this->em->getClassMetadata($passedOptions['class'])->getName(), | ||||
'label' => $passedOptions['label'], | 'label' => $passedOptions['label'], | ||||
'expanded' => isset($passedOptions['expanded']) ? $passedOptions['expanded'] : false, | |||||
'multiple' => isset($passedOptions['multiple']) ? $passedOptions['multiple'] : false, | 'multiple' => isset($passedOptions['multiple']) ? $passedOptions['multiple'] : false, | ||||
'placeholder' => '--', | 'placeholder' => '--', | ||||
'translation_domain' => 'lcshop', | 'translation_domain' => 'lcshop', | ||||
$id = $this->request->query->get('id'); | $id = $this->request->query->get('id'); | ||||
$easyadmin = $this->request->attributes->get('easyadmin'); | $easyadmin = $this->request->attributes->get('easyadmin'); | ||||
$entity = $easyadmin['item']; | |||||
$entity = $easyadmin['item']; | |||||
if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) { | if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) { | ||||
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue')); | $newValue = 'true' === mb_strtolower($this->request->query->get('newValue')); | ||||
return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]); | 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'); | $id = $this->request->query->get('id'); | ||||
$refererUrl = $this->request->query->get('referer', ''); | $refererUrl = $this->request->query->get('referer', ''); | ||||
$easyadmin = $this->request->attributes->get('easyadmin'); | $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); | $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'); | $id = $this->request->query->get('id'); | ||||
$hubAlias = $this->request->query->get('hub'); | $hubAlias = $this->request->query->get('hub'); | ||||
$refererUrl = $this->request->query->get('referer', ''); | $refererUrl = $this->request->query->get('referer', ''); | ||||
$user = $this->security->getUser() ; | |||||
$user = $this->security->getUser(); | |||||
$easyadmin = $this->request->attributes->get('easyadmin'); | $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); | $user->setMerchant($hub); | ||||
$this->em->persist($user); | $this->em->persist($user); | ||||
$this->em->flush(); | $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); | return $this->redirect($url); | ||||
}else{ | |||||
return $this->redirect($hub->getMerchantConfig('url').substr($url,1)); | |||||
} else { | |||||
return $this->redirect($hub->getMerchantConfig('url') . substr($url, 1)); | |||||
} | } | ||||
} | } |
use Lc\ShopBundle\Services\UtilsManager; | use Lc\ShopBundle\Services\UtilsManager; | ||||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | ||||
use Symfony\Component\HttpFoundation\BinaryFileResponse; | use Symfony\Component\HttpFoundation\BinaryFileResponse; | ||||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||||
use Symfony\Component\HttpFoundation\StreamedResponse; | use Symfony\Component\HttpFoundation\StreamedResponse; | ||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
{ | { | ||||
protected $documentRepository ; | 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()) ; | $this->documentRepository = $this->em->getRepository($this->em->getClassMetadata(DocumentInterface::class)->getName()) ; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | |||||
} |
use Lc\ShopBundle\Services\UtilsManager; | use Lc\ShopBundle\Services\UtilsManager; | ||||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | ||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | ||||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | ||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
{ | { | ||||
protected $parameterBag ; | 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 ; | $this->parameterBag = $parameterBag ; | ||||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||||
} | } | ||||
public function sendTestAction() | public function sendTestAction() | ||||
{ | { | ||||
$newsletter = $this->getNewsletter() ; | $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([ | $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); | $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.") ; | throw new \ErrorException("L'email de contact n'est pas défini pour ce Merchant.") ; | ||||
} | |||||
} | } | ||||
return $this->redirectToRoute('easyadmin', ['entity' => 'News', 'action' => 'list']) ; | return $this->redirectToRoute('easyadmin', ['entity' => 'News', 'action' => 'list']) ; | ||||
$currentMerchant = $this->merchantUtils->getMerchantCurrent() ; | $currentMerchant = $this->merchantUtils->getMerchantCurrent() ; | ||||
$newsletter = $this->getNewsletter() ; | $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, | 'news' => $news, | ||||
'newsletter' => $newsletter, | 'newsletter' => $newsletter, | ||||
'user' => $this->security->getUser() | 'user' => $this->security->getUser() | ||||
] ; | |||||
] ; | |||||
$i = 0 ; | |||||
$i = 0 ; | |||||
foreach ($users as $user) { | |||||
foreach ($users as $user) { | |||||
$paramsTemplate['user'] =$user; | $paramsTemplate['user'] =$user; | ||||
if(!isset($packageMessagesArray[$i])) { | if(!isset($packageMessagesArray[$i])) { | ||||
$packageMessagesArray[$i] = [] ; | |||||
$packageMessagesArray[$i] = [] ; | |||||
} | } | ||||
if($user->getEmail() && strlen($user->getEmail())) { | 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']); | $mj = new \Mailjet\Client($this->mailjetTransport->getApiKey(), $this->mailjetTransport->getApiSecret(),true,['version' => 'v3.1']); | ||||
foreach($packageMessagesArray as $messagesArray) { | 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()) { | 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 { | 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.'); | $this->addFlash('error', 'Aucun utilisateur inscrit à la newsletter.'); | ||||
} | |||||
} | } | ||||
return $this->redirectToRoute('easyadmin', ['entity' => 'News', 'action' => 'list']) ; | return $this->redirectToRoute('easyadmin', ['entity' => 'News', 'action' => 'list']) ; | ||||
public function getNewsletter() | 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 { | else { | ||||
throw new \ErrorException('Aucune newsletter n\'est liée à ce Merchant.') ; | |||||
$this->utils->addFlash('error', 'Aucune newsletter n\'est liée à l\'actualité.'); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | |||||
} |
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||||
use Symfony\Component\HttpFoundation\Response; | use Symfony\Component\HttpFoundation\Response; | ||||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | ||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
use Symfony\Contracts\Translation\TranslatorInterface; | use Symfony\Contracts\Translation\TranslatorInterface; | ||||
protected $creditUtils; | protected $creditUtils; | ||||
protected $mailUtils; | 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->creditUtils = $utilsManager->getCreditUtils(); | ||||
$this->mailUtils = $utilsManager->getMailUtils(); | $this->mailUtils = $utilsManager->getMailUtils(); | ||||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||||
} | } | ||||
protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null) | protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null) | ||||
$parameters['form_order_send_payment_link'] = $this->createCustomForm(OrderSendPaymentLink::class, 'orderSendPaymentLink', $parameters)->createView(); | $parameters['form_order_send_payment_link'] = $this->createCustomForm(OrderSendPaymentLink::class, 'orderSendPaymentLink', $parameters)->createView(); | ||||
break; | break; | ||||
case OrderStatus::ALIAS_ERROR_PAYMENT_ONLINE : | case OrderStatus::ALIAS_ERROR_PAYMENT_ONLINE : | ||||
case OrderStatus::ALIAS_WAITING_PAYMENT_CREDIT : | |||||
case OrderStatus::ALIAS_PARTIAL_PAYMENT : | |||||
case OrderStatus::ALIAS_WAITING_PAYMENT_ONLINE : | case OrderStatus::ALIAS_WAITING_PAYMENT_ONLINE : | ||||
$parameters['form_order_send_payment_link'] = $this->createCustomForm(OrderSendPaymentLink::class, 'orderSendPaymentLink', $parameters)->createView(); | $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(); | $parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView(); | ||||
$parameters['form_order_status'] = $this->createCustomForm(OrderStatusType::class, 'orderStatus', $parameters)->createView(); | $parameters['form_order_status'] = $this->createCustomForm(OrderStatusType::class, 'orderStatus', $parameters)->createView(); | ||||
$parameters['form_order_invoice_address'] = $this->createCustomForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView(); | $parameters['form_order_invoice_address'] = $this->createCustomForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView(); | ||||
break; | 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_DELIVERY : | ||||
case OrderStatus::ALIAS_WAITING_BANK_RETURN : | case OrderStatus::ALIAS_WAITING_BANK_RETURN : | ||||
$parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView(); | $parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView(); | ||||
$id = $this->request->query->get('id'); | $id = $this->request->query->get('id'); | ||||
$entity = $this->request->query->get('entity'); | $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', [ | return $this->redirectToRoute('easyadmin', [ | ||||
'action' => 'show', | 'action' => 'show', | ||||
'entity' => $entity, | 'entity' => $entity, |
namespace Lc\ShopBundle\Controller\Backend; | namespace Lc\ShopBundle\Controller\Backend; | ||||
use App\Entity\DepositoryZone; | |||||
use App\Entity\Product; | use App\Entity\Product; | ||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Doctrine\ORM\EntityRepository; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents; | use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents; | ||||
use FOS\UserBundle\Model\UserManagerInterface; | use FOS\UserBundle\Model\UserManagerInterface; | ||||
use Lc\ShopBundle\Context\ImageInterface; | use Lc\ShopBundle\Context\ImageInterface; | ||||
use Lc\ShopBundle\Model\ProductFamily; | use Lc\ShopBundle\Model\ProductFamily; | ||||
use Lc\ShopBundle\Services\UtilsManager; | use Lc\ShopBundle\Services\UtilsManager; | ||||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | 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\ChoiceType; | ||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType; | use Symfony\Component\Form\Extension\Core\Type\CollectionType; | ||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | use Symfony\Component\Form\Extension\Core\Type\HiddenType; | ||||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | use Symfony\Component\Form\Extension\Core\Type\NumberType; | ||||
use Symfony\Component\Form\FormError; | use Symfony\Component\Form\FormError; | ||||
use Symfony\Component\HttpFoundation\Response; | use Symfony\Component\HttpFoundation\Response; | ||||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
use Symfony\Contracts\Translation\TranslatorInterface; | use Symfony\Contracts\Translation\TranslatorInterface; | ||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | ||||
private $parameterBag ; | private $parameterBag ; | ||||
private $productFamilyUtils ; | 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->parameterBag = $parameterBag ; | ||||
$this->productFamilyUtils = $utilsManager->getProductFamilyUtils() ; | $this->productFamilyUtils = $utilsManager->getProductFamilyUtils() ; | ||||
} | } | ||||
'expanded' => true | '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( | $formBuilder->add('behaviorAddToCart', ChoiceType::class, array( | ||||
'data' => $entity->getBehaviorAddToCart() ? $entity->getBehaviorAddToCart() : 'simple', | 'data' => $entity->getBehaviorAddToCart() ? $entity->getBehaviorAddToCart() : 'simple', | ||||
'choices' => array( | 'choices' => array( | ||||
$formBuilder->add('propertyOrganicLabel', ChoiceType::class, array( | $formBuilder->add('propertyOrganicLabel', ChoiceType::class, array( | ||||
'choices' => 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', | 'translation_domain' => 'lcshop', | ||||
'multiple' => false, | 'multiple' => false, | ||||
'required' => false | 'required' => false | ||||
)); | )); | ||||
$formBuilder->add('products', CollectionType::class, array( | $formBuilder->add('products', CollectionType::class, array( | ||||
'label' => 'Déclinaisons', | 'label' => 'Déclinaisons', | ||||
'entry_type' => ProductType::class, | 'entry_type' => ProductType::class, | ||||
protected function editAction() | protected function editAction() | ||||
{ | { | ||||
$this->dispatch(EasyAdminEvents::PRE_EDIT); | $this->dispatch(EasyAdminEvents::PRE_EDIT); | ||||
$id = $this->request->query->get('id'); | $id = $this->request->query->get('id'); | ||||
if ($editForm->get('stayOnPage')->getData() != "false" || $this->request->get('submitAndStay') !== null) { | if ($editForm->get('stayOnPage')->getData() != "false" || $this->request->get('submitAndStay') !== null) { | ||||
$refererUrl = $this->request->query->get('referer', ''); | $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 { | } else { | ||||
return $this->redirectToReferrer(); | return $this->redirectToReferrer(); | ||||
} | } | ||||
'entity' => $entity, | 'entity' => $entity, | ||||
'delete_form' => $deleteForm->createView(), | 'delete_form' => $deleteForm->createView(), | ||||
'sortableProductsField' => $sortableProductsField, | 'sortableProductsField' => $sortableProductsField, | ||||
'totalProductOrdered' => $this->orderUtils->getTotalProductOrderedLastWeeks($entity) | |||||
'productsSalesStatistic' => $this->orderUtils->getProductsSalesStatistic($entity) | |||||
]; | ]; | ||||
return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]); | return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]); | ||||
'entity' => $entity, | 'entity' => $entity, | ||||
'categories' => $categories, | 'categories' => $categories, | ||||
'sortableProductsField' => array(), | 'sortableProductsField' => array(), | ||||
'totalProductOrdered' => array('total'=>0) | |||||
'productsSalesStatistic' => null | |||||
]; | ]; | ||||
return $this->executeDynamicMethod('render<EntityName>Template', ['new', $this->entity['templates']['new'], $parameters]); | return $this->executeDynamicMethod('render<EntityName>Template', ['new', $this->entity['templates']['new'], $parameters]); |
use Lc\ShopBundle\Services\UtilsManager; | use Lc\ShopBundle\Services\UtilsManager; | ||||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | ||||
use Symfony\Component\HttpFoundation\Response; | use Symfony\Component\HttpFoundation\Response; | ||||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
use Symfony\Contracts\Translation\TranslatorInterface; | use Symfony\Contracts\Translation\TranslatorInterface; | ||||
protected $ticketUtils; | protected $ticketUtils; | ||||
protected $userUtils; | 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->ticketUtils = $utilsManager->getTicketUtils(); | ||||
$this->userUtils = $utilsManager->getUserUtils(); | $this->userUtils = $utilsManager->getUserUtils(); | ||||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||||
} | } | ||||
public function persistTicketEntity($entity, $form) | public function persistTicketEntity($entity, $form) |
namespace Lc\ShopBundle\Controller\Backend; | namespace Lc\ShopBundle\Controller\Backend; | ||||
use App\Entity\OrderShop; | |||||
use App\Form\Backend\Common\AddressType; | use App\Form\Backend\Common\AddressType; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents; | |||||
use FOS\UserBundle\Doctrine\UserManager; | use FOS\UserBundle\Doctrine\UserManager; | ||||
use FOS\UserBundle\Model\UserManagerInterface ; | use FOS\UserBundle\Model\UserManagerInterface ; | ||||
use Lc\ShopBundle\Context\AddressInterface; | use Lc\ShopBundle\Context\AddressInterface; | ||||
class UserController extends AdminController | 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() | public function createNewEntity() | ||||
{ | { | ||||
return $this->userManager->createUser(); | return $this->userManager->createUser(); |
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | ||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
use Symfony\Contracts\Translation\TranslatorInterface; | use Symfony\Contracts\Translation\TranslatorInterface; | ||||
{ | { | ||||
protected $creditUtils; | 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(); | $this->creditUtils = $utilsManager->getCreditUtils(); | ||||
} | } | ||||
public function addCreditHistoryAction(){ | public function addCreditHistoryAction(){ |
protected $orderUtils ; | protected $orderUtils ; | ||||
protected $userUtils ; | protected $userUtils ; | ||||
protected $priceUtils ; | protected $priceUtils ; | ||||
protected $sectionUtils ; | |||||
protected $mailUtils ; | |||||
protected $router ; | protected $router ; | ||||
protected $productFamilyRepository ; | protected $productFamilyRepository ; | ||||
protected $orderProductRepository ; | protected $orderProductRepository ; | ||||
$this->orderUtils = $utilsManager->getOrderUtils() ; | $this->orderUtils = $utilsManager->getOrderUtils() ; | ||||
$this->userUtils = $utilsManager->getUserUtils() ; | $this->userUtils = $utilsManager->getUserUtils() ; | ||||
$this->priceUtils = $utilsManager->getPriceUtils() ; | $this->priceUtils = $utilsManager->getPriceUtils() ; | ||||
$this->sectionUtils = $utilsManager->getSectionUtils() ; | |||||
$this->mailUtils = $utilsManager->getMailUtils() ; | |||||
$this->router = $router ; | $this->router = $router ; | ||||
$this->productFamilyRepository = $this->em->getRepository($this->em->getClassMetaData(ProductFamilyInterface::class)->getName()) ; | $this->productFamilyRepository = $this->em->getRepository($this->em->getClassMetaData(ProductFamilyInterface::class)->getName()) ; | ||||
$this->orderProductRepository = $this->em->getRepository($this->em->getClassMetaData(OrderProductInterface::class)->getName()) ; | $this->orderProductRepository = $this->em->getRepository($this->em->getClassMetaData(OrderProductInterface::class)->getName()) ; |
<?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; | |||||
} | |||||
} |
<?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; | |||||
} | |||||
} |
<?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 | |||||
]); | |||||
} | |||||
} |
<?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 | |||||
]); | |||||
} | |||||
} |
) | ) | ||||
)); | )); | ||||
break; | break; | ||||
case 'text': | |||||
case 'string': | case 'string': | ||||
$builder->add($field['property'], TextType::class, array( | |||||
$builder->add(str_replace('.', '_',$field['property']), TextType::class, array( | |||||
'required' => false, | 'required' => false, | ||||
'attr'=>array( | 'attr'=>array( | ||||
'class'=> ' input-sm', | 'class'=> ' input-sm', |
class ProductFamilyCategoriesType extends AbstractType | class ProductFamilyCategoriesType extends AbstractType | ||||
{ | { | ||||
protected $em; | protected $em; | ||||
protected $productCategoryRepository ; | |||||
protected $productCategoryRepository; | |||||
public function __construct(EntityManagerInterface $entityManager, ProductCategoryRepository $productCategoryRepository) | public function __construct(EntityManagerInterface $entityManager, ProductCategoryRepository $productCategoryRepository) | ||||
{ | { | ||||
$this->em = $entityManager; | $this->em = $entityManager; | ||||
$this->productCategoryRepository = $productCategoryRepository ; | |||||
$this->productCategoryRepository = $productCategoryRepository; | |||||
} | } | ||||
public function buildForm(FormBuilderInterface $builder, array $options) | public function buildForm(FormBuilderInterface $builder, array $options) | ||||
foreach ($categories as $category) { | foreach ($categories as $category) { | ||||
$builder->add('category_' . $category->getId(), CheckboxType::class, [ | $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), | 'data' => $currentProductCategories->contains($category), | ||||
'required' => false, | 'required' => false, | ||||
'disabled'=>true, | |||||
'attr'=>[ | |||||
'class'=>'none' | |||||
] | |||||
'disabled' => true, | |||||
'attr' => [ | |||||
'class' => 'none', | |||||
'data-section' => $category->getSection()->getId() | |||||
], | |||||
]); | ]); | ||||
$childrenCategories = $this->productCategoryRepository->findAllByParent($category, true); | $childrenCategories = $this->productCategoryRepository->findAllByParent($category, true); | ||||
foreach ($childrenCategories as $children) { | foreach ($childrenCategories as $children) { | ||||
$builder->add('category_children_' . $children->getId(), CheckboxType::class, [ | $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), | 'data' => $currentProductCategories->contains($children), | ||||
'required' => false | |||||
'required' => false, | |||||
'attr' => [ | |||||
'data-section' => $category->getSection()->getId() | |||||
], | |||||
]); | ]); | ||||
} | } | ||||
} | } |
$this->em = $entityManager; | $this->em = $entityManager; | ||||
$this->utils = $utils; | $this->utils = $utils; | ||||
} | } | ||||
public function buildForm(FormBuilderInterface $builder, array $options) | public function buildForm(FormBuilderInterface $builder, array $options) | ||||
{ | { | ||||
$builder->add('title', TextType::class, array( | $builder->add('title', TextType::class, array( | ||||
"required" => false | "required" => false | ||||
)) ; | |||||
)); | |||||
$builder->add('quantity', NumberType::class, array( | $builder->add('quantity', NumberType::class, array( | ||||
'label' => 'Quantité', | 'label' => 'Quantité', | ||||
'required'=>false, | |||||
'required' => false, | |||||
'attr' => [ | 'attr' => [ | ||||
'append_html' => 'g' | 'append_html' => 'g' | ||||
] | ] | ||||
$unitClass = $this->em->getClassMetadata(UnitInterface::class)->getName(); | $unitClass = $this->em->getClassMetadata(UnitInterface::class)->getName(); | ||||
$builder->add('unit', EntityType::class, array( | $builder->add('unit', EntityType::class, array( | ||||
'class'=> $unitClass, | |||||
'class' => $unitClass, | |||||
'data' => 0, | 'data' => 0, | ||||
'required'=>false, | |||||
'required' => false, | |||||
'choice_attr' => function ($choice) { | 'choice_attr' => function ($choice) { | ||||
return [ | return [ | ||||
'data-unit-reference' => $choice->getUnitReference(), | 'data-unit-reference' => $choice->getUnitReference(), | ||||
$builder->add('buyingPrice', NumberType::class, array( | $builder->add('buyingPrice', NumberType::class, array( | ||||
'label' => 'Prix d\'achat', | 'label' => 'Prix d\'achat', | ||||
'required'=>false | |||||
'required' => false | |||||
)); | )); | ||||
$builder->add('buyingPriceWithTax', NumberType::class, array( | $builder->add('buyingPriceWithTax', NumberType::class, array( | ||||
$builder->add('buyingPriceByRefUnit', NumberType::class, array( | $builder->add('buyingPriceByRefUnit', NumberType::class, array( | ||||
'label' => 'Prix d\'achat', | 'label' => 'Prix d\'achat', | ||||
'required'=>false | |||||
'required' => false | |||||
)); | )); | ||||
$builder->add('buyingPriceByRefUnitWithTax', NumberType::class, array( | $builder->add('buyingPriceByRefUnitWithTax', NumberType::class, array( | ||||
)); | )); | ||||
$builder->add('multiplyingFactor', NumberType::class, array( | $builder->add('multiplyingFactor', NumberType::class, array( | ||||
'label' => 'Coefficiant de multiplication', | 'label' => 'Coefficiant de multiplication', | ||||
'mapped'=>false, | |||||
'required'=>false | |||||
'mapped' => false, | |||||
'required' => false | |||||
)); | )); | ||||
$builder->add('priceByRefUnit', NumberType::class, array( | $builder->add('priceByRefUnit', NumberType::class, array( | ||||
'required'=>false | |||||
'required' => false | |||||
)); | )); | ||||
$builder->add('priceByRefUnitWithTax', NumberType::class, array( | $builder->add('priceByRefUnitWithTax', NumberType::class, array( | ||||
$builder->add('position', HiddenType::class); | $builder->add('position', HiddenType::class); | ||||
$builder->add('status', HiddenType::class); | $builder->add('status', HiddenType::class); | ||||
$builder->add('exportTitle', TextType::class, array( | $builder->add('exportTitle', TextType::class, array( | ||||
'required' =>false | |||||
'required' => false | |||||
)); | )); | ||||
$builder->add('exportNote', TextType::class, array( | $builder->add('exportNote', TextType::class, array( | ||||
'required' =>false | |||||
'required' => false | |||||
)); | )); | ||||
$reductionCartClass = $this->em->getClassMetadata(ReductionCartInterface::class)->getName(); | $reductionCartClass = $this->em->getClassMetadata(ReductionCartInterface::class)->getName(); | ||||
$reductionCartRepo = $this->em->getRepository(ReductionCartInterface::class); | $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(), | |||||
));*/ | |||||
} | } | ||||
<?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 ; | |||||
} | |||||
} |
public function __construct(UtilsManager $utilsManager) | public function __construct(UtilsManager $utilsManager) | ||||
{ | { | ||||
$this->utils = $utilsManager->getUtils() ; | $this->utils = $utilsManager->getUtils() ; | ||||
$this->merchantUtils = $utilsManager->getMerchantUtils() ; | |||||
} | } | ||||
public function getParent() | public function getParent() | ||||
public function buildForm(FormBuilderInterface $builder, array $options) | public function buildForm(FormBuilderInterface $builder, array $options) | ||||
{ | { | ||||
$newsletters = $this->merchantUtils->getMerchantCurrent()->getNewsletters() ; | |||||
$builder->remove('username') | $builder->remove('username') | ||||
->add('gender', ChoiceType::class, [ | ->add('gender', ChoiceType::class, [ | ||||
'label' => 'field.default.title', | 'label' => 'field.default.title', | ||||
->add('phone', TextType::class, [ | ->add('phone', TextType::class, [ | ||||
'label' => 'field.default.phone', | 'label' => 'field.default.phone', | ||||
'translation_domain' => 'lcshop', | '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 | // captcha | ||||
$this->utils->addCaptchaType($builder); | $this->utils->addCaptchaType($builder); | ||||
} | } |
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | ||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||||
use Symfony\Component\Form\Extension\Core\Type\EmailType; | 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\TextareaType; | ||||
use Symfony\Component\Form\Extension\Core\Type\TextType; | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||||
use Symfony\Component\Form\FormBuilderInterface; | use Symfony\Component\Form\FormBuilderInterface; | ||||
use Symfony\Component\OptionsResolver\OptionsResolver; | use Symfony\Component\OptionsResolver\OptionsResolver; | ||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
use Symfony\Component\Validator\Constraints\File; | |||||
class TicketMessageType extends AbstractType | class TicketMessageType extends AbstractType | ||||
{ | { | ||||
'label' => 'field.Ticket.yourAnswer', | 'label' => 'field.Ticket.yourAnswer', | ||||
'translation_domain' => 'lcshop', | '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, [ | ->add('closeTicket', CheckboxType::class, [ | ||||
'label' => 'field.Ticket.closeTicket', | 'label' => 'field.Ticket.closeTicket', | ||||
'translation_domain' => 'lcshop', | 'translation_domain' => 'lcshop', |
use App\Entity\Address; | use App\Entity\Address; | ||||
use App\Entity\OrderShop; | use App\Entity\OrderShop; | ||||
use Captcha\Bundle\CaptchaBundle\Form\Type\CaptchaType; | |||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Lc\ShopBundle\Context\TicketInterface; | |||||
use Lc\ShopBundle\Model\Ticket; | use Lc\ShopBundle\Model\Ticket; | ||||
use Lc\ShopBundle\Services\UtilsManager; | use Lc\ShopBundle\Services\UtilsManager; | ||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||||
use Symfony\Component\Form\AbstractType; | use Symfony\Component\Form\AbstractType; | ||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||||
use Symfony\Component\Form\Extension\Core\Type\EmailType; | 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\TextareaType; | ||||
use Symfony\Component\Form\Extension\Core\Type\TextType; | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||||
use Symfony\Component\Form\FormBuilderInterface; | use Symfony\Component\Form\FormBuilderInterface; | ||||
use Symfony\Component\OptionsResolver\OptionsResolver; | use Symfony\Component\OptionsResolver\OptionsResolver; | ||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
use Symfony\Component\Validator\Constraints\File; | |||||
class TicketType extends AbstractType | 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', | 'label' => 'field.Ticket.type', | ||||
'multiple' => false, | 'multiple' => false, | ||||
'expanded' => false, | 'expanded' => false, | ||||
'choices' => [ | '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', | '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' | '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() | |||||
] | |||||
); | |||||
} | |||||
} | } |
<?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; | |||||
} | |||||
} | |||||
} |
*/ | */ | ||||
protected $description; | protected $description; | ||||
/** | /** | ||||
* @ORM\Column(type="string", length=255, nullable=true) | * @ORM\Column(type="string", length=255, nullable=true) | ||||
*/ | */ | ||||
protected $devAlias; | protected $devAlias; | ||||
public function getTitle(): ?string | public function getTitle(): ?string | ||||
{ | { | ||||
return $this->title; | return $this->title; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getDevAlias(): ?string | public function getDevAlias(): ?string | ||||
{ | { | ||||
return $this->devAlias; | return $this->devAlias; |
public function getNewsletter() | public function getNewsletter() | ||||
{ | { | ||||
$newsletters = $this->getNewsletters() ; | $newsletters = $this->getNewsletters() ; | ||||
if(isset($newsletters[0])) { | |||||
return $newsletters[0] ; | |||||
foreach($newsletters as $newsletter) { | |||||
if($newsletter->getIsMain()) { | |||||
return $newsletter ; | |||||
} | |||||
} | } | ||||
return false ; | return false ; | ||||
} | } | ||||
*/ | */ | ||||
protected $users; | protected $users; | ||||
/** | |||||
* @ORM\Column(type="boolean", nullable=true) | |||||
*/ | |||||
protected $isMain; | |||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->getTitle() ; | return $this->getTitle() ; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getIsMain(): ?bool | |||||
{ | |||||
return $this->isMain; | |||||
} | |||||
public function setIsMain(?bool $isMain): self | |||||
{ | |||||
$this->isMain = $isMain; | |||||
return $this; | |||||
} | |||||
} | } |
<?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 ; | |||||
} | |||||
} |
protected $merchant; | protected $merchant; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="orders") | |||||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="orders", fetch="EAGER") | |||||
*/ | */ | ||||
protected $user; | protected $user; | ||||
protected $orderPayments; | 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; | protected $orderProducts; | ||||
*/ | */ | ||||
protected $updatedBy; | protected $updatedBy; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketInterface", mappedBy="orderShop") | * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketInterface", mappedBy="orderShop") | ||||
*/ | */ | ||||
protected $tickets; | protected $tickets; | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="orderShops") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $section; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->orderStatusHistories = new ArrayCollection(); | $this->orderStatusHistories = new ArrayCollection(); | ||||
/** | /** | ||||
* @return Collection|OrderPayment[] | * @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; | return $this->orderPayments; | ||||
} | } | ||||
return false ; | return false ; | ||||
} | } | ||||
public function getSection(): ?Section | |||||
{ | |||||
return $this->section; | |||||
} | |||||
public function setSection(?Section $section): self | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
} | } |
const ALIAS_CART = 'cart' ; | const ALIAS_CART = 'cart' ; | ||||
const ALIAS_CART_CANCELED = 'cart-canceled' ; | const ALIAS_CART_CANCELED = 'cart-canceled' ; | ||||
const ALIAS_WAITING_PAYMENT_ONLINE = 'waiting-payment-online' ; | 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_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_ERROR_PAYMENT_ONLINE = 'error-payment-online' ; | ||||
const ALIAS_PAID_BY_CREDIT = 'paid-by-credit' ; | |||||
const ALIAS_WAITING_DELIVERY = 'waiting-delivery' ; | const ALIAS_WAITING_DELIVERY = 'waiting-delivery' ; | ||||
const ALIAS_WAITING_DELIVERY_WITH_PAYMENT = 'waiting-delivery-with-payment' ; | const ALIAS_WAITING_DELIVERY_WITH_PAYMENT = 'waiting-delivery-with-payment' ; | ||||
const ALIAS_DELIVERED_WITHOUT_PAYMENT = 'delivered-without-payment' ; | const ALIAS_DELIVERED_WITHOUT_PAYMENT = 'delivered-without-payment' ; | ||||
//TODO : AJOUTER un champ valid ds orderSTATUS | //TODO : AJOUTER un champ valid ds orderSTATUS | ||||
static $statusAliasAsValid = [ | static $statusAliasAsValid = [ | ||||
self::ALIAS_PAID_ONLINE, | |||||
self::ALIAS_PAID_BY_CREDIT, | |||||
self::ALIAS_PAID, | |||||
self::ALIAS_WAITING_DELIVERY, | self::ALIAS_WAITING_DELIVERY, | ||||
self::ALIAS_WAITING_BANK_RETURN, | self::ALIAS_WAITING_BANK_RETURN, | ||||
self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT, | self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT, | ||||
static $statusAliasAsCart = [ | static $statusAliasAsCart = [ | ||||
self::ALIAS_CART, | self::ALIAS_CART, | ||||
self::ALIAS_PARTIAL_PAYMENT, | |||||
self::ALIAS_WAITING_PAYMENT_ONLINE, | self::ALIAS_WAITING_PAYMENT_ONLINE, | ||||
self::ALIAS_WAITING_PAYMENT_CREDIT, | |||||
self::ALIAS_ERROR_PAYMENT_ONLINE | self::ALIAS_ERROR_PAYMENT_ONLINE | ||||
]; | ]; | ||||
return $this->getTaxRate() ; | return $this->getTaxRate() ; | ||||
} | } | ||||
public function getBuyingPriceInherited(): ?float | |||||
{ | |||||
return $this->getBuyingPrice() ; | |||||
} | |||||
public function getBuyingPrice(): ?float | public function getBuyingPrice(): ?float | ||||
{ | { | ||||
return $this->buyingPrice; | return $this->buyingPrice; |
$title .= ' - ' . $this->getTitle(); | $title .= ' - ' . $this->getTitle(); | ||||
} | } | ||||
if($this->getProductFamily()->hasProductsWithVariousWeight()) { | |||||
$title .= ' - '.$this->getQuantityLabelInherited() ; | |||||
} | |||||
return $title; | return $title; | ||||
} | } | ||||
namespace Lc\ShopBundle\Model; | namespace Lc\ShopBundle\Model; | ||||
use App\Entity\Hub; | |||||
use App\Entity\ProductFamily; | |||||
use Doctrine\Common\Collections\ArrayCollection; | use Doctrine\Common\Collections\ArrayCollection; | ||||
use Doctrine\Common\Collections\Collection; | use Doctrine\Common\Collections\Collection; | ||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
protected $childrens; | protected $childrens; | ||||
/** | /** | ||||
* @ORM\ManyToMany(targetEntity="App\Entity\ProductFamily", mappedBy="productCategories") | |||||
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="productCategories") | |||||
*/ | */ | ||||
protected $productFamilies; | protected $productFamilies; | ||||
*/ | */ | ||||
protected $saleStatus; | protected $saleStatus; | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="productCategories") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $section; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->childrens = new ArrayCollection(); | $this->childrens = new ArrayCollection(); | ||||
public function __toString() | 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 | public function getParent(): ?self | ||||
*/ | */ | ||||
public function getChildrens(): Collection | 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 | public function addChildren(self $productCategory): self | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getSection(): ?Section | |||||
{ | |||||
return $this->section; | |||||
} | |||||
public function setSection(?Section $section): self | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
} | } |
*/ | */ | ||||
protected $propertyExpirationDate; | protected $propertyExpirationDate; | ||||
public function getBuyingPriceByRefUnit(): ?float | public function getBuyingPriceByRefUnit(): ?float | ||||
{ | { | ||||
return $this->buyingPriceByRefUnit; | return $this->buyingPriceByRefUnit; | ||||
} | } | ||||
public function getBuyingPriceByRefUnitInherited(): ?float | |||||
{ | |||||
return $this->getBuyingPriceByRefUnit() ; | |||||
} | |||||
public function setBuyingPriceByRefUnit(?float $buyingPriceByRefUnit): self | public function setBuyingPriceByRefUnit(?float $buyingPriceByRefUnit): self | ||||
{ | { | ||||
$this->buyingPriceByRefUnit = $buyingPriceByRefUnit; | $this->buyingPriceByRefUnit = $buyingPriceByRefUnit; |
*/ | */ | ||||
abstract class ReductionCredit extends AbstractEntity implements ReductionInterface, FilterMerchantInterface, 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; | use ReductionTrait; | ||||
protected $title; | protected $title; | ||||
/** | /** | ||||
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface") | |||||
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="reductionCredits") | |||||
*/ | */ | ||||
protected $users; | protected $users; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface") | * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface") | ||||
* @ORM\JoinColumn(nullable=false) | * @ORM\JoinColumn(nullable=false) | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getType(): ?string | |||||
{ | |||||
return $this->type; | |||||
} | |||||
public function setType(string $type): self | |||||
{ | |||||
$this->type = $type; | |||||
return $this; | |||||
} | |||||
/** | /** | ||||
* @return Collection|User[] | * @return Collection|User[] | ||||
*/ | */ | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getType(): ?string | |||||
{ | |||||
return $this->type; | |||||
} | |||||
public function setType(string $type): self | |||||
{ | |||||
$this->type = $type; | |||||
return $this; | |||||
} | |||||
public function getSended(): ?bool | public function getSended(): ?bool | ||||
{ | { |
<?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; | |||||
} | |||||
} |
*/ | */ | ||||
protected $answerByAdmin; | protected $answerByAdmin; | ||||
/** | |||||
* @ORM\Column(type="string", length=255, nullable=true) | |||||
*/ | |||||
protected $imageFilename; | |||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->message; | return $this->message; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getImageFilename(): ?string | |||||
{ | |||||
return $this->imageFilename; | |||||
} | |||||
public function setImageFilename(?string $imageFilename): self | |||||
{ | |||||
$this->imageFilename = $imageFilename; | |||||
return $this; | |||||
} | |||||
} | } |
*/ | */ | ||||
protected $orders; | protected $orders; | ||||
/** | /** | ||||
* @ORM\Column(type="string", length=64, nullable=true) | * @ORM\Column(type="string", length=64, nullable=true) | ||||
*/ | */ | ||||
protected $ticketTypesNotification = []; | protected $ticketTypesNotification = []; | ||||
/** | |||||
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ReductionCreditInterface", mappedBy="users") | |||||
*/ | |||||
protected $reductionCredits; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->favoriteProductFamilies = new ArrayCollection(); | $this->favoriteProductFamilies = new ArrayCollection(); | ||||
$this->userPointSales = new ArrayCollection(); | $this->userPointSales = new ArrayCollection(); | ||||
$this->userMerchants = new ArrayCollection(); | $this->userMerchants = new ArrayCollection(); | ||||
$this->reductionCredits = new ArrayCollection(); | |||||
$this->tickets = new ArrayCollection(); | |||||
} | } | ||||
public function __toString() | public function __toString() | ||||
return $this; | 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; | |||||
} | |||||
} | } |
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface; | use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface; | ||||
use Lc\ShopBundle\Context\MerchantUtilsInterface; | use Lc\ShopBundle\Context\MerchantUtilsInterface; | ||||
use Lc\ShopBundle\Context\StatusInterface; | use Lc\ShopBundle\Context\StatusInterface; | ||||
use Lc\ShopBundle\Services\Utils; | |||||
class BaseRepository extends EntityRepository implements ServiceEntityRepositoryInterface | class BaseRepository extends EntityRepository implements ServiceEntityRepositoryInterface | ||||
{ | { | ||||
public $merchantUtils; | |||||
protected $merchantUtils; | |||||
protected $utils; | |||||
/** | /** | ||||
* @param string $entityClass The class name of the entity this repository manages | * @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->merchantUtils = $merchantUtils; | ||||
$this->utils = $utils; | |||||
parent::__construct($entityManager, $entityManager->getClassMetadata($this->getInterfaceClass())); | parent::__construct($entityManager, $entityManager->getClassMetadata($this->getInterfaceClass())); | ||||
} | } | ||||
public function findByTerm($field, $term, $limit=10){ | public function findByTerm($field, $term, $limit=10){ | ||||
$qb = $this->findByMerchantQuery(); | $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->setParameter('term', '%'.$term.'%'); | ||||
$qb->setMaxResults($limit); | $qb->setMaxResults($limit); | ||||
public function findOneByOldUrl($url) | public function findOneByOldUrl($url) | ||||
{ | { | ||||
$qb = $this->createQueryBuilder('entity') | $qb = $this->createQueryBuilder('entity') | ||||
return $qb->getQuery()->getOneOrNullResult(); | 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') | return $this->createQueryBuilder('e') | ||||
->where('e.merchant = :currentMerchant') | ->where('e.merchant = :currentMerchant') | ||||
->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()) ; | |||||
->setParameter('currentMerchant', $merchant) ; | |||||
} | } | ||||
public function findAll() | public function findAll() |
use App\Entity\DeliveryAvailabilityPointSale; | use App\Entity\DeliveryAvailabilityPointSale; | ||||
use App\Entity\DeliveryAvailabilityZone; | use App\Entity\DeliveryAvailabilityZone; | ||||
use App\Entity\PointSale; | |||||
use Doctrine\ORM\Query\Expr\Join; | use Doctrine\ORM\Query\Expr\Join; | ||||
use Doctrine\ORM\QueryBuilder; | use Doctrine\ORM\QueryBuilder; | ||||
use Lc\ShopBundle\Context\DefaultRepositoryInterface; | use Lc\ShopBundle\Context\DefaultRepositoryInterface; | ||||
class OrderShopRepository extends BaseRepository implements DefaultRepositoryInterface | 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(); | |||||
} | |||||
} | } |
return $query->getQuery()->getOneOrNullResult() ; | 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) | public function findAllParents($withOffline = false) | ||||
{ | { | ||||
$query = $this->findByMerchantQuery() | $query = $this->findByMerchantQuery() | ||||
return $query->getQuery()->getResult(); | 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 = $this->createQueryBuilder('e'); | ||||
$query->andWhere('e.parent = :idParentCategory'); | $query->andWhere('e.parent = :idParentCategory'); | ||||
$query->andWhere('pf.status = 1') ; | $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') ; | $query->addOrderBy('e.position', 'ASC') ; | ||||
return $query->getQuery()->getResult(); | return $query->getQuery()->getResult(); |
$query = $this->findByMerchantQuery() ; | $query = $this->findByMerchantQuery() ; | ||||
$query = $this->joinRelations($query) ; | $query = $this->joinRelations($query) ; | ||||
$query->andWhere('e.status = 1') ; | $query->andWhere('e.status = 1') ; | ||||
$query->orderBy('RAND()'); | |||||
return $query->getQuery()->getResult() ; | return $query->getQuery()->getResult() ; | ||||
} | } | ||||
$query->andWhere('e.status = 1'); | $query->andWhere('e.status = 1'); | ||||
$query->andWhere(':now <= e.propertyNoveltyExpirationDate') | $query->andWhere(':now <= e.propertyNoveltyExpirationDate') | ||||
->setParameter('now', new \DateTime()) ; | ->setParameter('now', new \DateTime()) ; | ||||
$query->orderBy('e.createdAt', 'DESC'); | |||||
$query->orderBy('RAND()'); | |||||
return $query->getQuery()->getResult() ; | return $query->getQuery()->getResult() ; | ||||
} | } | ||||
return $query->getQuery()->getResult() ; | 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() ; | |||||
} | |||||
} | } |
*/ | */ | ||||
class ProductRepository extends BaseRepository implements DefaultRepositoryInterface | 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(); | |||||
} | |||||
} | } |
use Lc\ShopBundle\Context\MerchantUtilsInterface; | use Lc\ShopBundle\Context\MerchantUtilsInterface; | ||||
use Lc\ShopBundle\Context\OrderUtilsInterface; | use Lc\ShopBundle\Context\OrderUtilsInterface; | ||||
use Lc\ShopBundle\Context\ReductionCartInterface; | use Lc\ShopBundle\Context\ReductionCartInterface; | ||||
use Lc\ShopBundle\Services\Utils; | |||||
/** | /** | ||||
* @method ReductionCartInterface|null find($id, $lockMode = null, $lockVersion = null) | * @method ReductionCartInterface|null find($id, $lockMode = null, $lockVersion = null) | ||||
{ | { | ||||
protected $orderUtils ; | 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 ; | $this->orderUtils = $orderUtils ; | ||||
} | } | ||||
foreach($reductionCarts as $reductionCart) { | foreach($reductionCarts as $reductionCart) { | ||||
if($this->orderUtils->isReductionCartMatchWithUser($reductionCart, $user) | if($this->orderUtils->isReductionCartMatchWithUser($reductionCart, $user) | ||||
&& $this->orderUtils->isReductionCartMatchWithGroupUser($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)) { | && ($reductionCart->getUsers()->count() > 0 || $reductionCart->getGroupUsers()->count() > 0)) { | ||||
$reductionCartsArray[] = $reductionCart ; | $reductionCartsArray[] = $reductionCart ; |
$query->andWhere(':groupUser MEMBER OF e.groupUsers OR e.groupUsers is empty'); | $query->andWhere(':groupUser MEMBER OF e.groupUsers OR e.groupUsers is empty'); | ||||
$query->setParameter('user', $user); | $query->setParameter('user', $user); | ||||
$query->setParameter('groupUser', $user->getGroupUsers()); | $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'); | $query->andWhere(':productFamily MEMBER OF e.productFamilies OR e.productFamilies is empty'); |
<?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() | |||||
; | |||||
} | |||||
*/ | |||||
} | |||||
return UserInterface::class; | 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') | return $this->createQueryBuilder('e') | ||||
->innerJoin('e.userMerchants', "userMerchants") | ->innerJoin('e.userMerchants', "userMerchants") | ||||
->andWhere('userMerchants.merchant = :currentMerchant') | ->andWhere('userMerchants.merchant = :currentMerchant') | ||||
->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()) ; | |||||
->setParameter('currentMerchant', $merchant) ; | |||||
} | } | ||||
public function findAllByNewsletter($newsletter) | public function findAllByNewsletter($newsletter) |
return VisitorInterface::class; | 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(); | |||||
} | |||||
} | } |
color: #333; | color: #333; | ||||
} | } | ||||
/* line 34, ../../sass/backend/custom.scss */ | |||||
.badge { | |||||
font-size: 90%; | |||||
} | |||||
/***************************************** ADMIN SIDEBAR ***************************************/ | /***************************************** ADMIN SIDEBAR ***************************************/ | ||||
/* line 36, ../../sass/backend/custom.scss */ | |||||
/* line 37, ../../sass/backend/custom.scss */ | |||||
.main-sidebar p { | .main-sidebar p { | ||||
font-size: 0.8rem; | font-size: 0.8rem; | ||||
} | } | ||||
/* line 37, ../../sass/backend/custom.scss */ | |||||
/* line 38, ../../sass/backend/custom.scss */ | |||||
.main-sidebar .sidebar { | .main-sidebar .sidebar { | ||||
padding-left: 0px; | padding-left: 0px; | ||||
padding-right: 0px; | padding-right: 0px; | ||||
padding-top: 114px; | padding-top: 114px; | ||||
} | } | ||||
/* line 38, ../../sass/backend/custom.scss */ | |||||
/* line 39, ../../sass/backend/custom.scss */ | |||||
.main-sidebar .nav-link { | .main-sidebar .nav-link { | ||||
padding: .4rem .5rem .4rem .7rem; | padding: .4rem .5rem .4rem .7rem; | ||||
} | } | ||||
/* line 40, ../../sass/backend/custom.scss */ | |||||
/* line 41, ../../sass/backend/custom.scss */ | |||||
body#pdl-body .wrapper .main-sidebar { | body#pdl-body .wrapper .main-sidebar { | ||||
bottom: 0; | bottom: 0; | ||||
float: none; | float: none; | ||||
top: 0; | top: 0; | ||||
} | } | ||||
/* line 41, ../../sass/backend/custom.scss */ | |||||
/* line 42, ../../sass/backend/custom.scss */ | |||||
body#pdl-body .wrapper .sidebar { | body#pdl-body .wrapper .sidebar { | ||||
height: 100%; | height: 100%; | ||||
} | } | ||||
/* line 42, ../../sass/backend/custom.scss */ | |||||
/* line 43, ../../sass/backend/custom.scss */ | |||||
body#pdl-body .wrapper .sidebar nav { | body#pdl-body .wrapper .sidebar nav { | ||||
padding-bottom: 40px; | padding-bottom: 40px; | ||||
} | } | ||||
/* line 43, ../../sass/backend/custom.scss */ | |||||
/* line 44, ../../sass/backend/custom.scss */ | |||||
body#pdl-body .wrapper .content-wrapper { | body#pdl-body .wrapper .content-wrapper { | ||||
margin-top: 0; | margin-top: 0; | ||||
padding-top: 57px; | padding-top: 57px; | ||||
} | } | ||||
/* line 44, ../../sass/backend/custom.scss */ | |||||
/* line 45, ../../sass/backend/custom.scss */ | |||||
.sidebar { | .sidebar { | ||||
overflow-y: auto; | overflow-y: auto; | ||||
} | } | ||||
/* line 47, ../../sass/backend/custom.scss */ | |||||
/* line 48, ../../sass/backend/custom.scss */ | |||||
#lc-flash-messages { | #lc-flash-messages { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 49, ../../sass/backend/custom.scss */ | |||||
/* line 50, ../../sass/backend/custom.scss */ | |||||
.main-sidebar .logo-long { | .main-sidebar .logo-long { | ||||
padding: 8px 0; | padding: 8px 0; | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 50, ../../sass/backend/custom.scss */ | |||||
/* line 51, ../../sass/backend/custom.scss */ | |||||
.main-sidebar .logo-long img { | .main-sidebar .logo-long img { | ||||
height: 40px; | height: 40px; | ||||
display: inline-block; | display: inline-block; | ||||
} | } | ||||
/* line 51, ../../sass/backend/custom.scss */ | |||||
/* line 52, ../../sass/backend/custom.scss */ | |||||
.sidebar-collapse .main-sidebar .logo-long span { | .sidebar-collapse .main-sidebar .logo-long span { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 52, ../../sass/backend/custom.scss */ | |||||
/* line 53, ../../sass/backend/custom.scss */ | |||||
.sidebar-collapse .main-sidebar:hover .logo-long span { | .sidebar-collapse .main-sidebar:hover .logo-long span { | ||||
display: inline-block; | display: inline-block; | ||||
} | } | ||||
/* line 54, ../../sass/backend/custom.scss */ | |||||
/* line 55, ../../sass/backend/custom.scss */ | |||||
.table.datatable-simple .highlight { | .table.datatable-simple .highlight { | ||||
background: var(--teal); | background: var(--teal); | ||||
} | } | ||||
/* line 55, ../../sass/backend/custom.scss */ | |||||
/* line 56, ../../sass/backend/custom.scss */ | |||||
.datatable-field-search.small { | .datatable-field-search.small { | ||||
width: 50px; | width: 50px; | ||||
} | } | ||||
/* line 57, ../../sass/backend/custom.scss */ | |||||
/* line 58, ../../sass/backend/custom.scss */ | |||||
.dataTables_length, .dataTables_filter { | .dataTables_length, .dataTables_filter { | ||||
padding: .75rem 1.25rem 0.25rem; | padding: .75rem 1.25rem 0.25rem; | ||||
} | } | ||||
/* line 59, ../../sass/backend/custom.scss */ | |||||
/* line 60, ../../sass/backend/custom.scss */ | |||||
table.fixedHeader-floating { | table.fixedHeader-floating { | ||||
margin-top: 0px !important; | margin-top: 0px !important; | ||||
} | } | ||||
/* line 60, ../../sass/backend/custom.scss */ | |||||
/* line 61, ../../sass/backend/custom.scss */ | |||||
table th.sorting_asc, table th.sorting_desc { | 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);}*/ | /*.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 { | 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 */ | /* 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 { | .lc-table-list thead a { | ||||
color: #212529; | color: #212529; | ||||
} | } | ||||
/* line 67, ../../sass/backend/custom.scss */ | |||||
/* line 71, ../../sass/backend/custom.scss */ | |||||
.table-filters-line th { | .table-filters-line th { | ||||
font-weight: 400; | font-weight: 400; | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* line 69, ../../sass/backend/custom.scss */ | |||||
/* line 73, ../../sass/backend/custom.scss */ | |||||
#list_filter_id { | #list_filter_id { | ||||
width: 60px; | width: 60px; | ||||
} | } | ||||
/* line 70, ../../sass/backend/custom.scss */ | |||||
/* line 74, ../../sass/backend/custom.scss */ | |||||
.lc-table-list .date-range { | .lc-table-list .date-range { | ||||
width: 130px; | width: 130px; | ||||
} | } | ||||
/* line 72, ../../sass/backend/custom.scss */ | |||||
/* line 76, ../../sass/backend/custom.scss */ | |||||
th.actions, td.actions { | th.actions, td.actions { | ||||
white-space: nowrap; | white-space: nowrap; | ||||
text-align: right; | text-align: right; | ||||
} | } | ||||
/* line 74, ../../sass/backend/custom.scss */ | |||||
/* line 78, ../../sass/backend/custom.scss */ | |||||
.table td, .table th { | .table td, .table th { | ||||
padding: 0.35rem; | padding: 0.35rem; | ||||
} | } | ||||
/* line 75, ../../sass/backend/custom.scss */ | |||||
/* line 79, ../../sass/backend/custom.scss */ | |||||
.delivery-field .form-group { | .delivery-field .form-group { | ||||
display: inline-block; | display: inline-block; | ||||
margin-bottom: 0px; | margin-bottom: 0px; | ||||
margin-right: 15px; | margin-right: 15px; | ||||
} | } | ||||
/* line 76, ../../sass/backend/custom.scss */ | |||||
/* line 80, ../../sass/backend/custom.scss */ | |||||
.delivery-field .form-group .form-control { | .delivery-field .form-group .form-control { | ||||
width: 150px; | width: 150px; | ||||
} | } | ||||
/* line 78, ../../sass/backend/custom.scss */ | |||||
/* line 82, ../../sass/backend/custom.scss */ | |||||
table th input { | table th input { | ||||
width: 100%; | width: 100%; | ||||
} | } | ||||
/* line 79, ../../sass/backend/custom.scss */ | |||||
/* line 83, ../../sass/backend/custom.scss */ | |||||
table th .select2-container--default .select2-selection--single { | table th .select2-container--default .select2-selection--single { | ||||
padding: 0.3rem 0.4rem; | padding: 0.3rem 0.4rem; | ||||
} | } | ||||
/************************ LOGIN PAGE *********************/ | /************************ LOGIN PAGE *********************/ | ||||
/* line 82, ../../sass/backend/custom.scss */ | |||||
/* line 86, ../../sass/backend/custom.scss */ | |||||
.login-logo { | .login-logo { | ||||
display: block; | display: block; | ||||
margin: auto; | margin: auto; | ||||
} | } | ||||
/************************ form error *********************/ | /************************ form error *********************/ | ||||
/* line 85, ../../sass/backend/custom.scss */ | |||||
/* line 89, ../../sass/backend/custom.scss */ | |||||
.form-sent .form-control:invalid { | .form-sent .form-control:invalid { | ||||
border-color: #dc3545; | border-color: #dc3545; | ||||
padding-right: 2.25rem; | padding-right: 2.25rem; | ||||
background-size: calc(.75em + .375rem) calc(.75em + .375rem); | 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 { | .form-sent select.form-control:invalid + .select2 .select2-selection { | ||||
border-color: #dc3545; | 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 { | .form-sent select.form-control:invalid + .select2 .select2-selection b { | ||||
border-color: #dc3545 transparent transparent transparent; | border-color: #dc3545 transparent transparent transparent; | ||||
} | } | ||||
/*CUSTOM Checkbox | /*CUSTOM Checkbox | ||||
/* Customize the label (the container) */ | /* Customize the label (the container) */ | ||||
/* line 92, ../../sass/backend/custom.scss */ | |||||
/* line 96, ../../sass/backend/custom.scss */ | |||||
.form-check-label { | .form-check-label { | ||||
display: block; | display: block; | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* Hide the browser's default checkbox */ | /* Hide the browser's default checkbox */ | ||||
/* line 94, ../../sass/backend/custom.scss */ | |||||
/* line 98, ../../sass/backend/custom.scss */ | |||||
.form-check-label input { | .form-check-label input { | ||||
position: absolute; | position: absolute; | ||||
opacity: 0; | opacity: 0; | ||||
} | } | ||||
/* Create a custom checkbox */ | /* Create a custom checkbox */ | ||||
/* line 97, ../../sass/backend/custom.scss */ | |||||
/* line 101, ../../sass/backend/custom.scss */ | |||||
.form-check { | .form-check { | ||||
padding-left: 0px; | padding-left: 0px; | ||||
} | } | ||||
/* line 99, ../../sass/backend/custom.scss */ | |||||
/* line 103, ../../sass/backend/custom.scss */ | |||||
.form-sent .form-check-label input:invalid ~ .checkmark { | .form-sent .form-check-label input:invalid ~ .checkmark { | ||||
border-color: #dc3545; | border-color: #dc3545; | ||||
} | } | ||||
/* line 100, ../../sass/backend/custom.scss */ | |||||
/* line 104, ../../sass/backend/custom.scss */ | |||||
.form-check-label input:disabled ~ .checkmark { | .form-check-label input:disabled ~ .checkmark { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 101, ../../sass/backend/custom.scss */ | |||||
/* line 105, ../../sass/backend/custom.scss */ | |||||
.form-check-label input ~ .checkmark { | .form-check-label input ~ .checkmark { | ||||
position: absolute; | position: absolute; | ||||
top: 0; | top: 0; | ||||
border: 1px solid var(--primary); | border: 1px solid var(--primary); | ||||
} | } | ||||
/* line 102, ../../sass/backend/custom.scss */ | |||||
/* line 106, ../../sass/backend/custom.scss */ | |||||
.form-check-label.big input ~ .checkmark { | .form-check-label.big input ~ .checkmark { | ||||
height: 21px; | height: 21px; | ||||
width: 21px; | width: 21px; | ||||
} | } | ||||
/* line 103, ../../sass/backend/custom.scss */ | |||||
/* line 107, ../../sass/backend/custom.scss */ | |||||
.form-check-label input[type="checkbox"] ~ .checkmark { | .form-check-label input[type="checkbox"] ~ .checkmark { | ||||
top: 2px; | top: 2px; | ||||
} | } | ||||
/* line 104, ../../sass/backend/custom.scss */ | |||||
/* line 108, ../../sass/backend/custom.scss */ | |||||
.form-check-label input[type="radio"] ~ .checkmark { | .form-check-label input[type="radio"] ~ .checkmark { | ||||
top: 3px; | top: 3px; | ||||
border-radius: 50%; | border-radius: 50%; | ||||
} | } | ||||
/* line 105, ../../sass/backend/custom.scss */ | |||||
/* line 109, ../../sass/backend/custom.scss */ | |||||
.form-check-label:hover input ~ .checkmark { | .form-check-label:hover input ~ .checkmark { | ||||
background-color: #ccc; | background-color: #ccc; | ||||
} | } | ||||
/* When the checkbox is checked, add a blue background */ | /* 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 { | .form-check-label input:checked ~ .checkmark { | ||||
background-color: var(--primary); | background-color: var(--primary); | ||||
} | } | ||||
/* Create the checkmark/indicator (hidden when not checked) */ | /* 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 { | .form-check-label .checkmark:after { | ||||
content: ""; | content: ""; | ||||
position: absolute; | position: absolute; | ||||
} | } | ||||
/* Show the checkmark when checked */ | /* Show the checkmark when checked */ | ||||
/* line 111, ../../sass/backend/custom.scss */ | |||||
/* line 115, ../../sass/backend/custom.scss */ | |||||
.form-check-label input:checked ~ .checkmark:after { | .form-check-label input:checked ~ .checkmark:after { | ||||
display: block; | display: block; | ||||
} | } | ||||
/* Style the checkmark/indicator */ | /* Style the checkmark/indicator */ | ||||
/* line 113, ../../sass/backend/custom.scss */ | |||||
/* line 117, ../../sass/backend/custom.scss */ | |||||
.form-check-label .checkmark:after { | .form-check-label .checkmark:after { | ||||
left: 7px; | left: 7px; | ||||
top: 3px; | top: 3px; | ||||
transform: rotate(45deg); | transform: rotate(45deg); | ||||
} | } | ||||
/* line 114, ../../sass/backend/custom.scss */ | |||||
/* line 118, ../../sass/backend/custom.scss */ | |||||
.form-check-label input[type="checkbox"] ~ .checkmark:after { | .form-check-label input[type="checkbox"] ~ .checkmark:after { | ||||
left: 6px; | left: 6px; | ||||
top: 2px; | top: 2px; | ||||
transform: rotate(45deg); | transform: rotate(45deg); | ||||
} | } | ||||
/* line 115, ../../sass/backend/custom.scss */ | |||||
/* line 119, ../../sass/backend/custom.scss */ | |||||
.form-check-label input[type="radio"] ~ .checkmark:after { | .form-check-label input[type="radio"] ~ .checkmark:after { | ||||
top: 4px; | top: 4px; | ||||
left: 4px; | left: 4px; | ||||
background: white; | background: white; | ||||
} | } | ||||
/* line 117, ../../sass/backend/custom.scss */ | |||||
/* line 121, ../../sass/backend/custom.scss */ | |||||
.form-check-label.big input[type="checkbox"] ~ .checkmark:after { | .form-check-label.big input[type="checkbox"] ~ .checkmark:after { | ||||
left: 7px; | left: 7px; | ||||
top: 3px; | top: 3px; | ||||
} | } | ||||
/* Create a custom radio button */ | /* 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 { | .product-categories .parent .form-group.field-checkbox .form-check-label { | ||||
padding-left: 0px; | padding-left: 0px; | ||||
font-style: italic; | font-style: italic; | ||||
} | } | ||||
/* line 122, ../../sass/backend/custom.scss */ | |||||
/* line 126, ../../sass/backend/custom.scss */ | |||||
.product-categories .children .form-group.field-checkbox { | .product-categories .children .form-group.field-checkbox { | ||||
margin-left: 20px; | margin-left: 20px; | ||||
} | } | ||||
/* line 123, ../../sass/backend/custom.scss */ | |||||
/* line 127, ../../sass/backend/custom.scss */ | |||||
.product-categories .form-group { | .product-categories .form-group { | ||||
margin-bottom: 0.15rem; | margin-bottom: 0.15rem; | ||||
} | } | ||||
/* line 124, ../../sass/backend/custom.scss */ | |||||
/* line 128, ../../sass/backend/custom.scss */ | |||||
.lc-deleted-field { | .lc-deleted-field { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 125, ../../sass/backend/custom.scss */ | |||||
/* line 129, ../../sass/backend/custom.scss */ | |||||
.lc-offline-field { | .lc-offline-field { | ||||
opacity: 0.5; | opacity: 0.5; | ||||
} | } | ||||
/* line 126, ../../sass/backend/custom.scss */ | |||||
/* line 130, ../../sass/backend/custom.scss */ | |||||
.lc-offline-field label::after { | .lc-offline-field label::after { | ||||
content: ' [hors ligne]'; | content: ' [hors ligne]'; | ||||
} | } | ||||
/* Général */ | /* Général */ | ||||
/* line 132, ../../sass/backend/custom.scss */ | |||||
/* line 136, ../../sass/backend/custom.scss */ | |||||
.btn.action-save { | .btn.action-save { | ||||
float: right; | float: right; | ||||
margin-left: 10px; | margin-left: 10px; | ||||
} | } | ||||
/* line 133, ../../sass/backend/custom.scss */ | |||||
/* line 137, ../../sass/backend/custom.scss */ | |||||
.button-action a.float-right { | .button-action a.float-right { | ||||
margin-left: 10px; | margin-left: 10px; | ||||
} | } | ||||
/* line 135, ../../sass/backend/custom.scss */ | |||||
/* line 139, ../../sass/backend/custom.scss */ | |||||
.input-group-text { | .input-group-text { | ||||
padding: 0.25rem 0.75rem; | padding: 0.25rem 0.75rem; | ||||
} | } | ||||
/* line 139, ../../sass/backend/custom.scss */ | |||||
/* line 143, ../../sass/backend/custom.scss */ | |||||
.col-form-label { | .col-form-label { | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
/* line 141, ../../sass/backend/custom.scss */ | |||||
/* line 145, ../../sass/backend/custom.scss */ | |||||
#toast-container.toast-top-right { | #toast-container.toast-top-right { | ||||
top: 60px; | top: 60px; | ||||
} | } | ||||
/* SIDEBAR */ | /* SIDEBAR */ | ||||
/* line 144, ../../sass/backend/custom.scss */ | |||||
/* line 148, ../../sass/backend/custom.scss */ | |||||
.main-header.navbar { | .main-header.navbar { | ||||
padding: 0; | padding: 0; | ||||
min-height: 57px; | min-height: 57px; | ||||
} | } | ||||
/* line 145, ../../sass/backend/custom.scss */ | |||||
/* line 149, ../../sass/backend/custom.scss */ | |||||
.lc-navbar li { | .lc-navbar li { | ||||
border-left: 1px solid #e0e0e0; | border-left: 1px solid #e0e0e0; | ||||
padding: 0.5rem 1.5rem; | padding: 0.5rem 1.5rem; | ||||
} | } | ||||
/* line 146, ../../sass/backend/custom.scss */ | |||||
/* line 150, ../../sass/backend/custom.scss */ | |||||
.lc-navbar li label { | .lc-navbar li label { | ||||
margin-bottom: 0; | margin-bottom: 0; | ||||
vertical-align: middle; | vertical-align: middle; | ||||
font-weight: normal !important; | font-weight: normal !important; | ||||
} | } | ||||
/* line 148, ../../sass/backend/custom.scss */ | |||||
/* line 152, ../../sass/backend/custom.scss */ | |||||
#switch-merchant { | #switch-merchant { | ||||
min-width: 170px; | 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 */ | /* Sortable */ | ||||
/* line 154, ../../sass/backend/custom.scss */ | |||||
/* line 163, ../../sass/backend/custom.scss */ | |||||
.ui-sortable-helper { | .ui-sortable-helper { | ||||
display: table; | display: table; | ||||
} | } | ||||
/* line 155, ../../sass/backend/custom.scss */ | |||||
/* line 164, ../../sass/backend/custom.scss */ | |||||
.ui-state-highlight { | .ui-state-highlight { | ||||
background: #eee; | background: #eee; | ||||
} | } | ||||
/* line 156, ../../sass/backend/custom.scss */ | |||||
/* line 165, ../../sass/backend/custom.scss */ | |||||
.lc-sortable div:last-child { | .lc-sortable div:last-child { | ||||
display: none; | display: none; | ||||
} | } | ||||
.lc-ckfinder-wrap .lc-ckfinder-button{width: 100%; bottom: 0px; left: 0; position: absolute;} | .lc-ckfinder-wrap .lc-ckfinder-button{width: 100%; bottom: 0px; left: 0; position: absolute;} | ||||
*/ | */ | ||||
/* VUES JS */ | /* VUES JS */ | ||||
/* line 171, ../../sass/backend/custom.scss */ | |||||
/* line 180, ../../sass/backend/custom.scss */ | |||||
.nav-item .btn { | .nav-item .btn { | ||||
padding-right: 15px; | padding-right: 15px; | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* line 172, ../../sass/backend/custom.scss */ | |||||
/* line 181, ../../sass/backend/custom.scss */ | |||||
.nav-item .btn .invalid-form { | .nav-item .btn .invalid-form { | ||||
display: none; | display: none; | ||||
position: absolute; | position: absolute; | ||||
font-size: 1.2rem; | font-size: 1.2rem; | ||||
} | } | ||||
/* line 173, ../../sass/backend/custom.scss */ | |||||
/* line 182, ../../sass/backend/custom.scss */ | |||||
.nav-item.has-invalid .btn .invalid-form { | .nav-item.has-invalid .btn .invalid-form { | ||||
display: inline-block; | display: inline-block; | ||||
z-index: 2; | z-index: 2; | ||||
} | } | ||||
/* ProductFamily */ | /* ProductFamily */ | ||||
/* line 178, ../../sass/backend/custom.scss */ | |||||
/* line 187, ../../sass/backend/custom.scss */ | |||||
.field-unit-quantity { | .field-unit-quantity { | ||||
border-bottom: 2px dotted #eee; | border-bottom: 2px dotted #eee; | ||||
padding-bottom: 10px; | padding-bottom: 10px; | ||||
margin-bottom: 20px; | margin-bottom: 20px; | ||||
} | } | ||||
/* line 179, ../../sass/backend/custom.scss */ | |||||
/* line 188, ../../sass/backend/custom.scss */ | |||||
.field-reduction-apply { | .field-reduction-apply { | ||||
border-top: 2px dotted #eee; | border-top: 2px dotted #eee; | ||||
padding-top: 10px; | padding-top: 10px; | ||||
margin-top: 20px; | margin-top: 20px; | ||||
} | } | ||||
/* line 181, ../../sass/backend/custom.scss */ | |||||
/* line 190, ../../sass/backend/custom.scss */ | |||||
.new-productfamily #nav-params, | .new-productfamily #nav-params, | ||||
.edit-productfamily #nav-params { | .edit-productfamily #nav-params { | ||||
margin-bottom: 30px; | margin-bottom: 30px; | ||||
} | } | ||||
/* line 186, ../../sass/backend/custom.scss */ | |||||
/* line 195, ../../sass/backend/custom.scss */ | |||||
.new-productfamily #nav-params .btn, | .new-productfamily #nav-params .btn, | ||||
.edit-productfamily #nav-params .btn { | .edit-productfamily #nav-params .btn { | ||||
margin-left: 20px; | margin-left: 20px; | ||||
} | } | ||||
/* line 191, ../../sass/backend/custom.scss */ | |||||
/* line 200, ../../sass/backend/custom.scss */ | |||||
.new-productfamily #product-categories .row, | .new-productfamily #product-categories .row, | ||||
.edit-productfamily #product-categories .row { | .edit-productfamily #product-categories .row { | ||||
padding: 10px; | padding: 10px; | ||||
} | } | ||||
/* line 196, ../../sass/backend/custom.scss */ | |||||
/* line 205, ../../sass/backend/custom.scss */ | |||||
.new-productfamily #product-categories .form-group, | .new-productfamily #product-categories .form-group, | ||||
.edit-productfamily #product-categories .form-group { | .edit-productfamily #product-categories .form-group { | ||||
width: 100%; | width: 100%; | ||||
padding: 4px; | padding: 4px; | ||||
} | } | ||||
/* line 202, ../../sass/backend/custom.scss */ | |||||
/* line 211, ../../sass/backend/custom.scss */ | |||||
.new-productfamily #product-categories .children, | .new-productfamily #product-categories .children, | ||||
.edit-productfamily #product-categories .children { | .edit-productfamily #product-categories .children { | ||||
margin-left: 20px; | margin-left: 20px; | ||||
width: 100%; | width: 100%; | ||||
} | } | ||||
/* line 208, ../../sass/backend/custom.scss */ | |||||
/* line 217, ../../sass/backend/custom.scss */ | |||||
.new-productfamily ul.products, | .new-productfamily ul.products, | ||||
.edit-productfamily ul.products { | .edit-productfamily ul.products { | ||||
padding: 0px; | padding: 0px; | ||||
list-style-type: none; | list-style-type: none; | ||||
} | } | ||||
/* line 214, ../../sass/backend/custom.scss */ | |||||
/* line 223, ../../sass/backend/custom.scss */ | |||||
.new-productfamily ul.products li.product, | .new-productfamily ul.products li.product, | ||||
.edit-productfamily ul.products li.product { | .edit-productfamily ul.products li.product { | ||||
padding: 0px; | padding: 0px; | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* line 221, ../../sass/backend/custom.scss */ | |||||
/* line 230, ../../sass/backend/custom.scss */ | |||||
.new-productfamily ul.products li.add, | .new-productfamily ul.products li.add, | ||||
.edit-productfamily ul.products li.add { | .edit-productfamily ul.products li.add { | ||||
text-align: right; | text-align: right; | ||||
} | } | ||||
/* line 226, ../../sass/backend/custom.scss */ | |||||
/* line 235, ../../sass/backend/custom.scss */ | |||||
.autoresize textarea { | .autoresize textarea { | ||||
height: auto; | height: auto; | ||||
min-height: 38px; | 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 { | .field-price .input-group.buyingPrice input, .field-price .input-group.buyingPrice .input-group-text { | ||||
font-weight: bold; | font-weight: bold; | ||||
border-color: #222; | 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 { | .field-price .input-group.buyingPriceByRefUnit input, .field-price .input-group.buyingPriceByRefUnit .input-group-text { | ||||
font-weight: bold; | font-weight: bold; | ||||
border-color: #222; | 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 { | .field-price .input-group.priceWithTax input, .field-price .input-group.priceWithTax .input-group-text { | ||||
font-weight: bold; | font-weight: bold; | ||||
border-color: #222; | 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 { | .field-price .input-group.priceByRefUnitWithTax input, .field-price .input-group.priceByRefUnitWithTax .input-group-text { | ||||
font-weight: bold; | font-weight: bold; | ||||
border-color: #222; | 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 { | .input-group.multiplyingFactor input, .input-group.multiplyingFactor .input-group-text { | ||||
font-weight: bold; | font-weight: bold; | ||||
border-color: #222; | 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 */ | /* ORDER */ | ||||
/* line 238, ../../sass/backend/custom.scss */ | |||||
/* line 275, ../../sass/backend/custom.scss */ | |||||
.table-order-summary { | .table-order-summary { | ||||
width: 100%; | width: 100%; | ||||
} | } | ||||
/* line 241, ../../sass/backend/custom.scss */ | |||||
/* line 278, ../../sass/backend/custom.scss */ | |||||
.order-product-item.redelivery { | .order-product-item.redelivery { | ||||
background: rgba(18, 104, 253, 0.38) !important; | background: rgba(18, 104, 253, 0.38) !important; | ||||
} | } | ||||
/*.select2-container--bootstrap .select2-selection{max-width: none;}*/ | /*.select2-container--bootstrap .select2-selection{max-width: none;}*/ | ||||
/*.order-product-item{margin: 15px 0; padding: 0;}*/ | /*.order-product-item{margin: 15px 0; padding: 0;}*/ | ||||
/* Product */ | /* Product */ | ||||
/* line 246, ../../sass/backend/custom.scss */ | |||||
/* line 283, ../../sass/backend/custom.scss */ | |||||
.product-form-modal { | .product-form-modal { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 247, ../../sass/backend/custom.scss */ | |||||
/* line 284, ../../sass/backend/custom.scss */ | |||||
.product-form.modal .form-check-label { | .product-form.modal .form-check-label { | ||||
font-style: italic; | font-style: italic; | ||||
color: #666; | color: #666; | ||||
text-align: left; | text-align: left; | ||||
} | } | ||||
/* line 248, ../../sass/backend/custom.scss */ | |||||
/* line 285, ../../sass/backend/custom.scss */ | |||||
.products-collection-table .inherited { | .products-collection-table .inherited { | ||||
color: #888; | color: #888; | ||||
font-style: italic; | font-style: italic; | ||||
font-weight: initial; | font-weight: initial; | ||||
} | } | ||||
/* line 249, ../../sass/backend/custom.scss */ | |||||
/* line 286, ../../sass/backend/custom.scss */ | |||||
.products-collection-table td { | .products-collection-table td { | ||||
position: relative; | 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 { | .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; | padding-left: 0.35rem; | ||||
} | } | ||||
/* line 251, ../../sass/backend/custom.scss */ | |||||
/* line 288, ../../sass/backend/custom.scss */ | |||||
.products-collection-table .btn-empty-field { | .products-collection-table .btn-empty-field { | ||||
position: absolute; | position: absolute; | ||||
right: 3px; | right: 3px; | ||||
padding: 0px; | padding: 0px; | ||||
} | } | ||||
/* line 252, ../../sass/backend/custom.scss */ | |||||
/* line 289, ../../sass/backend/custom.scss */ | |||||
#lc-product-family-edit .products-collection-table { | #lc-product-family-edit .products-collection-table { | ||||
table-layout: fixed; | table-layout: fixed; | ||||
/* background-clip: padding-box;*/ | /* background-clip: padding-box;*/ | ||||
border-collapse: collapse; | border-collapse: collapse; | ||||
} | } | ||||
/* line 253, ../../sass/backend/custom.scss */ | |||||
/* line 290, ../../sass/backend/custom.scss */ | |||||
#lc-product-family-edit .products-collection-table th { | #lc-product-family-edit .products-collection-table th { | ||||
font-size: 13px; | font-size: 13px; | ||||
border-left: 1px solid #dee2e6; | border-left: 1px solid #dee2e6; | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* line 254, ../../sass/backend/custom.scss */ | |||||
/* line 291, ../../sass/backend/custom.scss */ | |||||
#lc-product-family-edit .products-collection-table tfoot th { | #lc-product-family-edit .products-collection-table tfoot th { | ||||
border-top: 2px solid #dee2e6; | 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 { | #lc-product-family-edit .products-collection-table th span { | ||||
white-space: initial; | 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 { | #lc-product-family-edit .products-collection-table th:last-child { | ||||
border-right: 1px solid #dee2e6; | 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 { | #lc-product-family-edit .products-collection-table td { | ||||
border-left: 1px solid #dee2e6; | border-left: 1px solid #dee2e6; | ||||
text-align: center; | text-align: center; | ||||
border-bottom: 1px solid #dee2e6; | 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 { | #lc-product-family-edit .products-collection-table td:last-child { | ||||
border-right: 1px solid #dee2e6; | border-right: 1px solid #dee2e6; | ||||
white-space: nowrap; | white-space: nowrap; | ||||
} | } | ||||
/* line 259, ../../sass/backend/custom.scss */ | |||||
/* line 296, ../../sass/backend/custom.scss */ | |||||
#lc-product-family-edit .btn-add-product { | #lc-product-family-edit .btn-add-product { | ||||
margin: 20px 0; | |||||
float: right; | float: right; | ||||
} | } | ||||
/* line 260, ../../sass/backend/custom.scss */ | |||||
/* line 297, ../../sass/backend/custom.scss */ | |||||
#lc-product-family-edit .inherited { | #lc-product-family-edit .inherited { | ||||
color: #888; | color: #888; | ||||
font-style: italic; | font-style: italic; | ||||
font-weight: initial; | font-weight: initial; | ||||
} | } | ||||
/* line 261, ../../sass/backend/custom.scss */ | |||||
/* line 298, ../../sass/backend/custom.scss */ | |||||
#lc-product-family-edit .products-collection-table td .value { | #lc-product-family-edit .products-collection-table td .value { | ||||
min-width: 80%; | min-width: 80%; | ||||
margin: auto; | margin: auto; | ||||
cursor: pointer; | cursor: pointer; | ||||
} | } | ||||
/* line 262, ../../sass/backend/custom.scss */ | |||||
/* line 299, ../../sass/backend/custom.scss */ | |||||
#lc-product-family-edit .products-collection-table td .modal { | #lc-product-family-edit .products-collection-table td .modal { | ||||
text-align: left; | 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 { | table.products-collection-table th.main-info, td.buyingPrice, td.multiplyingFactor, td.priceWithTax { | ||||
background: #eeeeee; | background: #eeeeee; | ||||
background-clip: padding-box; | background-clip: padding-box; | ||||
text-decoration: underline; | text-decoration: underline; | ||||
} | } | ||||
/* line 265, ../../sass/backend/custom.scss */ | |||||
/* line 302, ../../sass/backend/custom.scss */ | |||||
table.products-collection-table tr.disabled { | table.products-collection-table tr.disabled { | ||||
opacity: 0.5; | opacity: 0.5; | ||||
} | } | ||||
/* line 266, ../../sass/backend/custom.scss */ | |||||
/* line 303, ../../sass/backend/custom.scss */ | |||||
.table-striped tbody .tr-sep { | .table-striped tbody .tr-sep { | ||||
border-top: 2px solid #888; | border-top: 2px solid #888; | ||||
} | } | ||||
/* DeliveryZone */ | /* DeliveryZone */ | ||||
/* line 270, ../../sass/backend/custom.scss */ | |||||
/* line 307, ../../sass/backend/custom.scss */ | |||||
#autocomplete-cities { | #autocomplete-cities { | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* line 274, ../../sass/backend/custom.scss */ | |||||
/* line 311, ../../sass/backend/custom.scss */ | |||||
#autocomplete-cities .ui-autocomplete { | #autocomplete-cities .ui-autocomplete { | ||||
left: 30%; | left: 30%; | ||||
top: 41px; | top: 41px; | ||||
margin-left: 18px; | margin-left: 18px; | ||||
} | } | ||||
/* line 280, ../../sass/backend/custom.scss */ | |||||
/* line 317, ../../sass/backend/custom.scss */ | |||||
.head-reminders { | .head-reminders { | ||||
margin-top: 15px; | margin-top: 15px; | ||||
} | } | ||||
/* TABLEAU DE BORD */ | /* TABLEAU DE BORD */ | ||||
/* line 283, ../../sass/backend/custom.scss */ | |||||
/* line 320, ../../sass/backend/custom.scss */ | |||||
.todo-list > li { | .todo-list > li { | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* line 284, ../../sass/backend/custom.scss */ | |||||
/* line 321, ../../sass/backend/custom.scss */ | |||||
.todo-list > li .text { | .todo-list > li .text { | ||||
margin-left: 30px; | margin-left: 30px; | ||||
} | } | ||||
/* line 285, ../../sass/backend/custom.scss */ | |||||
/* line 322, ../../sass/backend/custom.scss */ | |||||
.todo-list > li .tools { | .todo-list > li .tools { | ||||
position: absolute; | position: absolute; | ||||
top: 4px; | top: 4px; | ||||
right: 15px; | right: 15px; | ||||
} | } | ||||
/* line 287, ../../sass/backend/custom.scss */ | |||||
/* line 324, ../../sass/backend/custom.scss */ | |||||
#addTicketMessageForm { | #addTicketMessageForm { | ||||
margin-top: 30px; | margin-top: 30px; | ||||
border-top: 2px dotted #eee; | border-top: 2px dotted #eee; | ||||
padding-top: 30px; | padding-top: 30px; | ||||
} | } | ||||
/* line 289, ../../sass/backend/custom.scss */ | |||||
/* line 326, ../../sass/backend/custom.scss */ | |||||
#dashboard .list-btn-statistic { | #dashboard .list-btn-statistic { | ||||
display: flex; | display: flex; | ||||
flex-wrap: wrap; | flex-wrap: wrap; | ||||
justify-content: center; | justify-content: center; | ||||
} | } | ||||
/* line 290, ../../sass/backend/custom.scss */ | |||||
/* line 327, ../../sass/backend/custom.scss */ | |||||
#dashboard .btn-statistic { | #dashboard .btn-statistic { | ||||
width: 120px; | width: 120px; | ||||
height: 70px; | height: 70px; | ||||
line-height: 1rem; | line-height: 1rem; | ||||
} | } | ||||
/* line 291, ../../sass/backend/custom.scss */ | |||||
/* line 328, ../../sass/backend/custom.scss */ | |||||
#dashboard .btn-statistic small { | #dashboard .btn-statistic small { | ||||
margin-bottom: 10px; | margin-bottom: 10px; | ||||
display: block; | display: block; | ||||
} | } | ||||
/* line 292, ../../sass/backend/custom.scss */ | |||||
/* line 329, ../../sass/backend/custom.scss */ | |||||
#dashboard .btn-statistic .value { | #dashboard .btn-statistic .value { | ||||
display: block; | display: block; | ||||
} | } | ||||
/* line 294, ../../sass/backend/custom.scss */ | |||||
/* line 331, ../../sass/backend/custom.scss */ | |||||
#dashboard #range_date_interval { | #dashboard #range_date_interval { | ||||
margin-bottom: 20px; | margin-bottom: 20px; | ||||
} | } | ||||
/* line 295, ../../sass/backend/custom.scss */ | |||||
/* line 332, ../../sass/backend/custom.scss */ | |||||
#dashboard #range_date_interval label { | #dashboard #range_date_interval label { | ||||
float: left; | float: left; | ||||
margin-right: 20px; | margin-right: 20px; | ||||
} | } | ||||
/* line 296, ../../sass/backend/custom.scss */ | |||||
/* line 333, ../../sass/backend/custom.scss */ | |||||
#dashboard #range_date_interval .form-check { | #dashboard #range_date_interval .form-check { | ||||
float: left; | float: left; | ||||
margin-right: 10px; | margin-right: 10px; | ||||
} | } | ||||
/* line 297, ../../sass/backend/custom.scss */ | |||||
/* line 334, ../../sass/backend/custom.scss */ | |||||
#dashboard .table-condensed .btn, #dashboard .table-condensed .btn-sm { | #dashboard .table-condensed .btn, #dashboard .table-condensed .btn-sm { | ||||
white-space: nowrap; | white-space: nowrap; | ||||
} | } | ||||
/* Tickets */ | /* Tickets */ | ||||
/* line 303, ../../sass/backend/custom.scss */ | |||||
/* line 340, ../../sass/backend/custom.scss */ | |||||
#ticket-list .btn-sm { | #ticket-list .btn-sm { | ||||
display: block; | display: block; | ||||
} | } | ||||
/* line 309, ../../sass/backend/custom.scss */ | |||||
/* line 346, ../../sass/backend/custom.scss */ | |||||
#toast-container { | #toast-container { | ||||
width: 350px; | width: 350px; | ||||
} | } | ||||
/* line 310, ../../sass/backend/custom.scss */ | |||||
/* line 347, ../../sass/backend/custom.scss */ | |||||
.toast { | .toast { | ||||
float: right; | float: right; | ||||
} | } | ||||
/* line 312, ../../sass/backend/custom.scss */ | |||||
/* line 349, ../../sass/backend/custom.scss */ | |||||
#toast-container:before:hover { | #toast-container:before:hover { | ||||
opacity: 1; | opacity: 1; | ||||
cursor: pointer; | cursor: pointer; | ||||
} | } | ||||
/* line 316, ../../sass/backend/custom.scss */ | |||||
/* line 353, ../../sass/backend/custom.scss */ | |||||
#toast-close-all { | #toast-close-all { | ||||
border: 0; | border: 0; | ||||
position: absolute; | position: absolute; |
initNotice(); | initNotice(); | ||||
initBtnEditReminder(); | initBtnEditReminder(); | ||||
initBtnWriteToUser(); | initBtnWriteToUser(); | ||||
initCollectionWidget() | |||||
initCollectionWidget(); | |||||
initBtnShowTotalOrderProduct(); | |||||
$('form').on('focus', 'input[type=number]', function (e) { | $('form').on('focus', 'input[type=number]', function (e) { | ||||
$(this).on('wheel.disableScroll', function (e) { | $(this).on('wheel.disableScroll', function (e) { | ||||
e.preventDefault() | e.preventDefault() | ||||
}); | }); | ||||
$(document).on('click', '[data-toggle="lightbox"]', function(event) { | |||||
event.preventDefault(); | |||||
$(this).ekkoLightbox(); | |||||
}); | |||||
} | } | ||||
function moment() { | function moment() { | ||||
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; | |||||
} | |||||
jQuery(document).ready(function () { | |||||
jQuery(document).ready(function () { | |||||
initDeleteAction(); | initDeleteAction(); | ||||
initResetFilters(); | initResetFilters(); | ||||
}); | }); | ||||
/* $('.action-confirm').each(function () { | |||||
$(this).on('click', function (e) { | |||||
return confirm("Êtes vous sur de vouloir effectuer cette action ?"); | |||||
}); | |||||
});*/ | |||||
$('.action-duplicate').each(function () { | $('.action-duplicate').each(function () { | ||||
$(this).on('click', function (e) { | $(this).on('click', function (e) { | ||||
return confirm("Press a button!"); | |||||
return confirm("Êtes vous sur de vouloir effectuer cette action ?"); | |||||
}); | }); | ||||
}); | }); | ||||
} | } |
{ | { | ||||
name: 'maintenance', | name: 'maintenance', | ||||
nameDisplay: 'Maintenance' | nameDisplay: 'Maintenance' | ||||
}, | |||||
{ | |||||
name: 'lunch', | |||||
nameDisplay: 'Repas du midi' | |||||
} | } | ||||
] | ] | ||||
}, window.addressValues, window.merchantPanelOrderValues); | }, window.addressValues, window.merchantPanelOrderValues); |
}, | }, | ||||
modalAddReductionCredit:function () { | modalAddReductionCredit:function () { | ||||
$(this.$parent.$refs['addReductionCreditFormTitle']).val(this.orderProduct.title); | $(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'); | $(this.$parent.$refs['addReductionCreditFormBehaviorTaxRate']).val('tax-included').trigger('change'); | ||||
$('#modal-add-reduction-credit').modal('show'); | $('#modal-add-reduction-credit').modal('show'); | ||||
} | } | ||||
} | } | ||||
}, | }, | ||||
preventFormSubmit: function (){ | preventFormSubmit: function (){ | ||||
$(document).keypress(function(e) { | |||||
$('#lc-order-edit').keypress(function(e) { | |||||
if (e.which == 13) { | if (e.which == 13) { | ||||
e.preventDefault(); | e.preventDefault(); | ||||
} | } |
// Reference array sent to dynamic staticRenderFns | // Reference array sent to dynamic staticRenderFns | ||||
var staticRenderFns = []; | var staticRenderFns = []; | ||||
$(window).on('load', function () { | $(window).on('load', function () { | ||||
/*var appProductFamily ; | |||||
lcInitProductFamily() ;*/ | |||||
Vue.component('product-unit-price', { | Vue.component('product-unit-price', { | ||||
mixins: [mixinUnit, mixinPrice, mixinTemplate], | mixins: [mixinUnit, mixinPrice, mixinTemplate], | ||||
}, | }, | ||||
behaviorPriceValue: function () { | behaviorPriceValue: function () { | ||||
return this.productFamily.behaviorPrice; | return this.productFamily.behaviorPrice; | ||||
} | |||||
}, | |||||
hasExportInfo: function () { | |||||
if((this.exportNote != null && this.exportNote != '') || (this.exportTitle != null && this.exportTitle != ''))return true | |||||
else return false; | |||||
}, | |||||
}, | }, | ||||
data() { | data() { | ||||
return Object.assign( | return Object.assign( | ||||
expirationDateInherited: false, | expirationDateInherited: false, | ||||
availableQuantityInherited: false, | availableQuantityInherited: false, | ||||
availableQuantityDefaultInherited: false, | availableQuantityDefaultInherited: false, | ||||
propertyExpirationDateInherited: false | |||||
propertyExpirationDateInherited: false, | |||||
exportTitle: null, | |||||
exportNote: null | |||||
}, window.productForm[this.keyForm]) | }, window.productForm[this.keyForm]) | ||||
}, | }, | ||||
mounted: function () { | mounted: function () { | ||||
}else{ | }else{ | ||||
this.status = 1; | this.status = 1; | ||||
$(this.$el).removeClass('disabled'); | $(this.$el).removeClass('disabled'); | ||||
if(this.hasExportInfo){ | |||||
alert('Cette déclinaison contient un titre ou une note à l\'export'); | |||||
} | |||||
} | } | ||||
}, | }, | ||||
decode(str){ | decode(str){ | ||||
var textArea = document.createElement('textarea'); | var textArea = document.createElement('textarea'); | ||||
watch: {} | watch: {} | ||||
}); | }); | ||||
appProductFamily = new Vue({ | appProductFamily = new Vue({ | ||||
el: '#lc-product-family-edit', | el: '#lc-product-family-edit', | ||||
mixins: [mixinReduction], | mixins: [mixinReduction], | ||||
typeExpirationDate: null, | typeExpirationDate: null, | ||||
behaviorExpirationDate: null, | behaviorExpirationDate: null, | ||||
propertyAllergens: null, | propertyAllergens: null, | ||||
propertyOrganicLabelActive: false, | |||||
propertyQualityLabelActive: false, | |||||
propertyOrganicLabel: null, | propertyOrganicLabel: null, | ||||
propertyNoveltyExpirationDateActive: false, | propertyNoveltyExpirationDateActive: false, | ||||
propertyNoveltyExpirationDate:null, | propertyNoveltyExpirationDate:null, | ||||
activeProducts: false, | activeProducts: false, | ||||
giftVoucherActive: false, | giftVoucherActive: false, | ||||
productsQuantityAsTitle: false, | productsQuantityAsTitle: false, | ||||
section: null, | |||||
formProducts: {}, | formProducts: {}, | ||||
currentSection: 'general', | currentSection: 'general', | ||||
sectionsArray: [ | sectionsArray: [ | ||||
} | } | ||||
} | } | ||||
this.sectionHasChanged(); | |||||
this.initLcSortableProductsList(); | this.initLcSortableProductsList(); | ||||
}); | }); | ||||
if (typeof this.$refs.productUnitPrice !== 'undefined') { | if (typeof this.$refs.productUnitPrice !== 'undefined') { | ||||
return this.$refs.productUnitPrice.behaviorPrice; | 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: { | watch: { | ||||
title: function () { | title: function () { | ||||
this.updateChild() | this.updateChild() | ||||
}, | }, | ||||
section: function (){ | |||||
this.sectionHasChanged() | |||||
}, | |||||
propertyNoveltyExpirationDateActive: function () { | propertyNoveltyExpirationDateActive: function () { | ||||
if(!this.propertyNoveltyExpirationDateActive){ | if(!this.propertyNoveltyExpirationDateActive){ | ||||
this.propertyNoveltyExpirationDate = null; | this.propertyNoveltyExpirationDate = null; | ||||
} | } | ||||
}, | }, | ||||
propertyOrganicLabelActive: function () { | |||||
if(!this.propertyOrganicLabelActive){ | |||||
propertyQualityLabelActive: function () { | |||||
if(!this.propertyQualityLabelActive){ | |||||
this.propertyOrganicLabel = null; | this.propertyOrganicLabel = null; | ||||
$(this.$refs['propertyOrganicLabel']).val('').trigger('change'); | $(this.$refs['propertyOrganicLabel']).val('').trigger('change'); | ||||
} | } | ||||
for (var key in formProductTemplate) { | for (var key in formProductTemplate) { | ||||
appProductFamily.formProducts[key] = formProductTemplate[key]; | appProductFamily.formProducts[key] = formProductTemplate[key]; | ||||
} | } | ||||
}); | }); | ||||
function lcInitProductFamily() { | |||||
} |
a.link-as-text{color:#333;} | a.link-as-text{color:#333;} | ||||
.badge{font-size: 90%;} | |||||
/***************************************** ADMIN SIDEBAR ***************************************/ | /***************************************** ADMIN SIDEBAR ***************************************/ | ||||
.main-sidebar p{font-size: 0.8rem;} | .main-sidebar p{font-size: 0.8rem;} | ||||
.dataTables_length, .dataTables_filter{padding: .75rem 1.25rem 0.25rem;} | .dataTables_length, .dataTables_filter{padding: .75rem 1.25rem 0.25rem;} | ||||
table.fixedHeader-floating{margin-top: 0px !important;} | 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);}*/ | /*.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} | .lc-table-list thead a{color: #212529} | ||||
#switch-merchant { | #switch-merchant { | ||||
min-width: 170px ; | 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 */ | /* Sortable */ | ||||
.field-price .input-group.priceByRefUnitWithTax input,.field-price .input-group.priceByRefUnitWithTax .input-group-text{font-weight: bold; border-color: #222 } | .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 } | .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 */ | /* ORDER */ | ||||
#lc-product-family-edit .products-collection-table th:last-child{border-right: 1px solid #dee2e6;} | #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{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 .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 .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 .value {min-width: 80%; margin: auto; min-height: 35px; cursor: pointer;} | ||||
#lc-product-family-edit .products-collection-table td .modal {text-align: left;} | #lc-product-family-edit .products-collection-table td .modal {text-align: left;} | ||||
-webkit-box-shadow: 0 0 12px #999; | -webkit-box-shadow: 0 0 12px #999; | ||||
box-shadow: 0 0 12px #999; | box-shadow: 0 0 12px #999; | ||||
} | } | ||||
default: Édition | default: Édition | ||||
Général: Général | Général: Général | ||||
Adresse: Adresse | Adresse: Adresse | ||||
Redelivery: | |||||
list: Liste des relivraisons | |||||
Supplier: | Supplier: | ||||
contact: Personne de contact | contact: Personne de contact | ||||
Reminder: | Reminder: | ||||
Statistic: | Statistic: | ||||
title: Statistiques | title: Statistiques | ||||
ProductFamily: | ProductFamily: | ||||
status: Espaces et statuts | |||||
addresses: Livraisons & facturation | addresses: Livraisons & facturation | ||||
main: Général | main: Général | ||||
products: Déclinaisons | products: Déclinaisons | ||||
initReduction: Réduction | initReduction: Réduction | ||||
export: Note à l'export | export: Note à l'export | ||||
stockNegative: Produits stocks négatif | stockNegative: Produits stocks négatif | ||||
purchaseOrder: Bons de commandes | |||||
ReductionCatalog: | ReductionCatalog: | ||||
info: Informations principal | info: Informations principal | ||||
conditions: Conditions d'application | conditions: Conditions d'application | ||||
ReductionCredit: | |||||
list: Liste des avoirs | |||||
ReductionCart: | ReductionCart: | ||||
info: Informations | info: Informations | ||||
conditions: Conditions d'applications | conditions: Conditions d'applications | ||||
actions: Actions | actions: Actions | ||||
list: Liste des réductions paniers | |||||
OrderShop: | OrderShop: | ||||
redelivery: Relivraison | redelivery: Relivraison | ||||
resume: Résumé de commande | resume: Résumé de commande | ||||
tickets: Tickets relatif à la commande | tickets: Tickets relatif à la commande | ||||
orderStatusHistories: Historique de changement de statut | orderStatusHistories: Historique de changement de statut | ||||
waitingBankReturn: Commandes en attente de retour banque | waitingBankReturn: Commandes en attente de retour banque | ||||
list: Liste des commandes | |||||
giftVoucher: Commandes de bons cadeaux | |||||
multiplePayment: Paiements multiples | |||||
Ticket: | Ticket: | ||||
listMessages: Liste des messages | listMessages: Liste des messages | ||||
list: Tickets ouverts | list: Tickets ouverts | ||||
email: Email | email: Email | ||||
delivery: Livraison | delivery: Livraison | ||||
maintenance: Maintenance | maintenance: Maintenance | ||||
lunch: Repas du midi | |||||
Address: | Address: | ||||
listLoopBesancon: Adresses de Besançon à spécifier (lat / long) | listLoopBesancon: Adresses de Besançon à spécifier (lat / long) | ||||
User: | |||||
item: Utilisateur | |||||
Notification: | |||||
main: Notifications | |||||
None: Aucune valeur | None: Aucune valeur | ||||
deliverySlotMissing: Vous n'avez pas de créneau de livraison | deliverySlotMissing: Vous n'avez pas de créneau de livraison | ||||
productUnavailable: Certains produits ne sont plus disponibles | productUnavailable: Certains produits ne sont plus disponibles | ||||
nextStatusNotAllow: La commande ne peut passer à ce statut | 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é. | otherOrderAlreadyExist: Une autre commande existe déjà pour cet utilisateur, vous avez été redirigé. | ||||
minimumAmountZone: Montant minimum de commande non respecté pour cette zone | minimumAmountZone: Montant minimum de commande non respecté pour cette zone | ||||
minimumAmountPointSale: Montant minimum de commande non respecté pour ce point de vente | minimumAmountPointSale: Montant minimum de commande non respecté pour ce point de vente | ||||
noPayment: Aucun paiement n'a été enregistré pour cette commande | |||||
reductionCart: | reductionCart: | ||||
conditionsError: Cette réduction ne peut pas être appliqué sur cette commande | conditionsError: Cette réduction ne peut pas être appliqué sur cette commande | ||||
date: La réduction n'est plus active | 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 | deliveryZone: La zone de livraison ne correspond pas | ||||
deliverySlot: La créneau de livraison ne correspond pas | deliverySlot: La créneau de livraison ne correspond pas | ||||
groupUser: Le(s) groupe(s) utilisateurs ne correspondent pas | groupUser: Le(s) groupe(s) utilisateurs ne correspondent pas | ||||
editStockNoQuantityDefault: "Le stock n'a pas été modifié pour le produit #%id% (Aucune quantité par défaut)" | editStockNoQuantityDefault: "Le stock n'a pas été modifié pour le produit #%id% (Aucune quantité par défaut)" | ||||
field: | field: | ||||
default: | default: | ||||
section: Espace | |||||
unit: Unité | unit: Unité | ||||
placeholder: Choisissez une option | placeholder: Choisissez une option | ||||
deliveryPointSale: Lieu de livraison | deliveryPointSale: Lieu de livraison | ||||
cash: Espèce | cash: Espèce | ||||
transfer: Virement | transfer: Virement | ||||
credit: Compte prépayé | credit: Compte prépayé | ||||
transfer-gift: Transfert de bon cadeau | |||||
minimumAmountCb: "Paiement par carte bancaire : montant minimum" | minimumAmountCb: "Paiement par carte bancaire : montant minimum" | ||||
emailFrom: "Email (From) : email" | emailFrom: "Email (From) : email" | ||||
emailFromName: "Email (From) : nom" | emailFromName: "Email (From) : nom" | ||||
emailFromPurchaseOrder: "Email (From) : bons de commande" | emailFromPurchaseOrder: "Email (From) : bons de commande" | ||||
order: Commande | order: Commande | ||||
subject: Sujet | subject: Sujet | ||||
metaTitle: Meta title | |||||
metaDescription: Meta description | |||||
metaTitle: Titre (meta) | |||||
metaDescription: Description (meta) | |||||
users: Utilisateurs | users: Utilisateurs | ||||
total: Total | total: Total | ||||
products: Produits | products: Produits | ||||
purchaseOrderEmailContent: "Contenu par défaut de l'email envoyé aux producteurs" | purchaseOrderEmailContent: "Contenu par défaut de l'email envoyé aux producteurs" | ||||
dateStart: Date de début | dateStart: Date de début | ||||
dateEnd: Date de fin | 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: | PointSale: | ||||
code: Code | code: Code | ||||
displayTotalWeightInPurchaseOrder: Afficher le poids total dans les bons de commande | displayTotalWeightInPurchaseOrder: Afficher le poids total dans les bons de commande | ||||
ProductFamily: | ProductFamily: | ||||
sections: Espace où le produit est vendu | |||||
taxRateInherited: Utiliser la TVA par défaut | taxRateInherited: Utiliser la TVA par défaut | ||||
activeProducts: Activer les déclinaisons | activeProducts: Activer les déclinaisons | ||||
productsType: Type de déclinaisons | productsType: Type de déclinaisons | ||||
availableQuantityDefault: Quantité par défaut | availableQuantityDefault: Quantité par défaut | ||||
quantity: Quantité | quantity: Quantité | ||||
behaviorCountStock: Gestion du stock | behaviorCountStock: Gestion du stock | ||||
behaviorDisplaySale: Affichage du total des ventes | |||||
differentSupplierTaxRate: TVA différente pour le producteur | differentSupplierTaxRate: TVA différente pour le producteur | ||||
supplierTaxRate: TVA du producteur | supplierTaxRate: TVA du producteur | ||||
propertyNoveltyExpirationDateActive: Marquer le produit comme "nouveauté" jusqu'au | 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" | propertyLargeVolume: Marquer le produit comme "gros volume" | ||||
propertyCharacteristics: Caractéristiques | propertyCharacteristics: Caractéristiques | ||||
propertyPackaging: Conditionnement | propertyPackaging: Conditionnement | ||||
displayPriceUnitRef: Afficher le prix par unité de référence | displayPriceUnitRef: Afficher le prix par unité de référence | ||||
behaviorPrice: Travailler avec des tarifs | behaviorPrice: Travailler avec des tarifs | ||||
productsQuantityAsTitle: Titre équivalent à quantité | productsQuantityAsTitle: Titre équivalent à quantité | ||||
isDisabledOnPurchaseOrder: Automatiquement désactiver ce produit dans les bons de commandes | |||||
behaviorPriceOptions: | behaviorPriceOptions: | ||||
by-piece: À la pièce | by-piece: À la pièce | ||||
by-reference-unit: Par unité de référence | by-reference-unit: Par unité de référence | ||||
by-product-family: Gérer le stock par produit (à l'unité) | by-product-family: Gérer le stock par produit (à l'unité) | ||||
by-product: Gérer le stock par déclainaison | by-product: Gérer le stock par déclainaison | ||||
unlimited: Illimité | unlimited: Illimité | ||||
behaviorDisplaySaleOptions: | |||||
by-measure: Par unité de référence | |||||
by-quantity: Par quantité | |||||
behaviorStockWeek: Renouvelement du stock chaque semaine | behaviorStockWeek: Renouvelement du stock chaque semaine | ||||
behaviorStockWeekOptions: | behaviorStockWeekOptions: | ||||
renewable: Renouvelable | renewable: Renouvelable | ||||
ab: Agriculture biologique | ab: Agriculture biologique | ||||
hve: Haute valeur environnementale | hve: Haute valeur environnementale | ||||
nature-progres: Nature & progrès | nature-progres: Nature & progrès | ||||
tvvr: "Terra Vitis : Viticulture Responsable" | |||||
behaviorExpirationDate: Gèrer | behaviorExpirationDate: Gèrer | ||||
behaviorExpirationDateOptions: | behaviorExpirationDateOptions: | ||||
by-product-family: Par produit | by-product-family: Par produit | ||||
quantityOrder: Quantité commandé | quantityOrder: Quantité commandé | ||||
quantityProduct: Quantité (en rapport à l'unité) | quantityProduct: Quantité (en rapport à l'unité) | ||||
unit: Unité | unit: Unité | ||||
OrderShopLunch: | |||||
deliveryTypeOptions: | |||||
point-sale: En ambassade | |||||
home: À domicile | |||||
OrderShop: | OrderShop: | ||||
hasReach: Étape atteinte | hasReach: Étape atteinte | ||||
deliveryTrucks: Véhicules de livraison | deliveryTrucks: Véhicules de livraison | ||||
days: Par jour | days: Par jour | ||||
week: Par semaine | week: Par semaine | ||||
month: Par mois | month: Par mois | ||||
User: | |||||
isSaleAlwaysOpen: Commandes toujours ouvertes | |||||
action: | action: | ||||
apply: Appliquer | apply: Appliquer | ||||
new: Créer %entity_label% | new: Créer %entity_label% | ||||
product: | product: | ||||
editStock: Gérer les stocks | editStock: Gérer les stocks | ||||
editProductFamily: Éditer le produit | editProductFamily: Éditer le produit | ||||
statSales: Afficher plus de semaines | |||||
user: | user: | ||||
account: Mon compte | account: Mon compte | ||||
logout: Me déconnecter | logout: Me déconnecter | ||||
address: Adresse utilisateur | address: Adresse utilisateur | ||||
switch: Prendre la main | switch: Prendre la main | ||||
order: | order: | ||||
addOrderProduct: Ajouter un produit | addOrderProduct: Ajouter un produit | ||||
addReductionCart: Ajouter une réduction | addReductionCart: Ajouter une réduction |
{% if action.group is defined and action.group==true %} | {% if action.group is defined and action.group==true %} | ||||
{% set dropdownAction = dropdownAction|merge({(loop.index0): action}) %} | {% set dropdownAction = dropdownAction|merge({(loop.index0): action}) %} | ||||
{% else %} | {% else %} | ||||
{% set display_button = true %} | |||||
{% if 'list' == action.name %} | {% if 'list' == action.name %} | ||||
{% set action_href = request_parameters.referer|default('') ? request_parameters.referer|easyadmin_urldecode : path('easyadmin', request_parameters|merge({ action: 'list' })) %} | {% set action_href = request_parameters.referer|default('') ? request_parameters.referer|easyadmin_urldecode : path('easyadmin', request_parameters|merge({ action: 'list' })) %} | ||||
{% elseif 'method' == action.type %} | {% elseif 'method' == action.type %} | ||||
{% set action_href = path('easyadmin', request_parameters|merge({ action: action.name, id: item_id })) %} | {% set action_href = path('easyadmin', request_parameters|merge({ action: action.name, id: item_id })) %} | ||||
{% elseif 'route' == action.type %} | {% elseif 'route' == action.type %} | ||||
{% set action_href = path(action.name, request_parameters|merge({ action: action.name, id: item_id })) %} | {% 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 %} | {% 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 %} | {% endif %} | ||||
{% endfor %} | {% endfor %} | ||||
{% if dropdownAction|length > 0 %} | {% if dropdownAction|length > 0 %} |
<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> |
<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> | |||||
<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> | |||||
{% endmacro available_quantity_product %} | {% 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 }} | |||||
{{ 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 %} |
{% 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 %} |
{% 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 %} |
{# {{ value|date('U')}} #} | {# {{ 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" %} | {% set format = "d/m/Y H:i" %} | ||||
{% else %} | {% else %} | ||||
{% set format = field_options.format %} | {% set format = field_options.format %} | ||||
{% endif %} | {% endif %} | ||||
<time data-timestamp="{{ value|date('U') }}" title="{{ value|date('r') }}">{{ value|date(format) }}</time> | <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 %} |
{% import '@LcShop/backend/productfamily/macros.html.twig' as macros %} | |||||
{{ macros.product_family_sales_statistic(orderUtils.getProductsSalesStatistic(item, 2), item) }} |
{% 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 %} |
{% if link_parameters is defined %} | |||||
<a href="{{ path('easyadmin', link_parameters|merge({entity: 'Supplier', referer: '' })) }}">{{ value|easyadmin_truncate }}</a> | |||||
{% endif %} |
{% if value is not null or value is not empty %} | |||||
{{ value }} | |||||
{% else %} | |||||
<span class="badge badge-secondary">Non défini</span> | |||||
{% endif %} |
{% 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 %} | |||||
{{ priceUtils.getTotalWithTax(item, true)|format_price|raw }}<br /> |
{% 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 %} |
{% trans_default_domain "lcshop" %} | {% trans_default_domain "lcshop" %} | ||||
<div class="layout-ajax"> | |||||
{% block 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> |
{% import '@LcShop/backend/productfamily/macros.html.twig' as macros %} | |||||
{{ macros.total_order_product_family(orderUtils.getTotalProductOrderedLastWeeks(item, 2, true)['total'], item, true) }} |
{% 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 %} | |||||
#} |
{{ priceUtils.getTotalWithTax(item)|format_price|raw }} |
sortField: app.request.get('sortField'), | sortField: app.request.get('sortField'), | ||||
sortDirection: app.request.get('sortDirection'), | sortDirection: app.request.get('sortDirection'), | ||||
page: app.request.get('page', 1), | page: app.request.get('page', 1), | ||||
maxResults: app.request.get('maxResults', _entity_config.list.max_results), | |||||
filters: app.request.get('filters', []), | filters: app.request.get('filters', []), | ||||
referer: null | referer: null | ||||
}) %} | }) %} | ||||
{% set _has_filters = _entity_config.list.filters|default(false) %} | {% set _has_filters = _entity_config.list.filters|default(false) %} | ||||
{% block body_id 'easyadmin-list-' ~ _entity_config.name %} | {% 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 %} | {% block content_title %} | ||||
{% apply spaceless %} | {% apply spaceless %} | ||||
{% endblock %} | {% endblock %} | ||||
{% block global_actions %} | {% 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) %} | {% set _action = easyadmin_get_action_for_list_view('new', _entity_config.name) %} | ||||
{% block new_action %} | {% block new_action %} | ||||
<div class="button-action"> | <div class="button-action"> | ||||
</a> | </a> | ||||
</div> | </div> | ||||
{% endblock new_action %} | {% endblock new_action %} | ||||
{% endif %}#} | |||||
{% endif %} #} | |||||
{% endblock global_actions %} | {% endblock global_actions %} | ||||
{% block batch_actions %} | {% block batch_actions %} | ||||
{% set _fields_visible_by_user = fields|filter((metadata, field) => easyadmin_is_granted(metadata.permission)) %} | {% set _fields_visible_by_user = fields|filter((metadata, field) => easyadmin_is_granted(metadata.permission)) %} | ||||
{% set _number_of_hidden_results = 0 %} | {% set _number_of_hidden_results = 0 %} | ||||
{% set _list_item_actions = easyadmin_get_actions_for_list_item(_entity_config.name) %} | {% 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="col-12"> | ||||
<div class="card card-outline card-primary"> | <div class="card card-outline card-primary"> | ||||
<div class="card-header"> | <div class="card-header"> | ||||
{% block card_header %} | {% block card_header %} | ||||
<h2 class="card-title text-lg "> | <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 %} | {% 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 %} | {% if paginator.nbResultsTotal != paginator.nbResults %} | ||||
<span data-toggle="tooltip" title="{{ "list.nbResultsFiltered"|trans }}" | <span data-toggle="tooltip" title="{{ "list.nbResultsFiltered"|trans }}" | ||||
class="badge badge-info">{{ paginator.nbResults }} <i | class="badge badge-info">{{ paginator.nbResults }} <i | ||||
{% endif %} | {% endif %} | ||||
{% for field, metadata in _fields_visible_by_user %} | {% 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 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_label = metadata.label|trans(_trans_parameters) %} | ||||
{% set _column_icon = isSortingField ? (nextSortDirection == 'DESC' ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %} | {% 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 %} | {% if metadata.sortable %} | ||||
<a href="{{ path('easyadmin', _request_parameters|merge({ page: 1, sortField: metadata.property, sortDirection: nextSortDirection })) }}"> | <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> | {{ _column_label|raw }} <i class="fa fa-fw {{ _column_icon }}"></i> | ||||
</th> | </th> | ||||
{% endfor %} | {% 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"' }}> | <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> | <span class="sr-only">{{ 'list.row_actions'|trans(_trans_parameters, 'EasyAdminBundle') }}</span> | ||||
</th> | </th> | ||||
{% endif %} | |||||
{#{% endif %}#} | |||||
</tr> | </tr> | ||||
{% endblock table_head %} | {% endblock table_head %} | ||||
{% block table_filters %} | {% block table_filters %} | ||||
{% set fieldAreNotEmpty = false %} | |||||
{% if filters_form is defined %} | {% if filters_form is defined %} | ||||
<tr class="table-filters-line"> | <tr class="table-filters-line"> | ||||
{% if _has_batch_actions %} | {% if _has_batch_actions %} | ||||
<th></th>{% endif %} | <th></th>{% endif %} | ||||
{% for field, metadata in _fields_visible_by_user %} | {% for field, metadata in _fields_visible_by_user %} | ||||
<th> | <th> | ||||
{% set field = utils.getFilterPropertyClean(field) %} | |||||
{% if filters_form[field] is defined %} | {% 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' %} | {% if metadata['dataType'] == 'datetime' or metadata['dataType'] == 'date' %} | ||||
<div class="input-group input-group-sm"> | <div class="input-group input-group-sm"> | ||||
<input type="text" | <input type="text" | ||||
</div> | </div> | ||||
{% else %} | {% else %} | ||||
<div class="form-widget input-group-sm"> | <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', { | {{ form_widget(filters_form[field], {'attr': {'autocomplete': 'off', 'data-lc-autocomplete-url' : path('easyadmin', { | ||||
action: 'autocomplete', | action: 'autocomplete', | ||||
field: field, | field: field, | ||||
</th> | </th> | ||||
{% endfor %} | {% endfor %} | ||||
{% if _list_item_actions|length > 0 %} | |||||
{#{% if _list_item_actions|length > 0 %}#} | |||||
<th class="actions"> | <th class="actions"> | ||||
<button type="submit" form="filters-form" class="btn btn-sm btn-info" | <button type="submit" form="filters-form" class="btn btn-sm btn-info" | ||||
data-toggle="tooltip" | data-toggle="tooltip" | ||||
aria-label="{{ "action.apply"|trans({}, 'lcshop') }}"> | aria-label="{{ "action.apply"|trans({}, 'lcshop') }}"> | ||||
<i class="fa fa-search"></i> | <i class="fa fa-search"></i> | ||||
</button> | </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" | class="btn btn-sm btn-warning lc-reset-filters" | ||||
data-toggle="tooltip" | data-toggle="tooltip" | ||||
title="{{ "action.reset"|trans({}, 'lcshop') }}" | title="{{ "action.reset"|trans({}, 'lcshop') }}" | ||||
</th> | </th> | ||||
{% endif %} | |||||
{# {% endif %}#} | |||||
</tr> | </tr> | ||||
{% endif %} | {% endif %} | ||||
{% else %} | {% else %} | ||||
{# the empty string concatenation is needed when the primary key is an object (e.g. an Uuid object) #} | {# 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) %} | {% 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 %} | {% if _has_batch_actions %} | ||||
<td><input type="checkbox" class="form-batch-checkbox" | <td><input type="checkbox" class="form-batch-checkbox" | ||||
value="{{ _item_id }}"></td> | value="{{ _item_id }}"></td> | ||||
<td class="{{ isSortingField ? 'sorted' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | <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" | <a class="link-as-text" | ||||
href="{{ path('easyadmin', _request_parameters|merge({ action: 'edit', id: item.id })) }}"> | href="{{ path('easyadmin', _request_parameters|merge({ action: 'edit', id: item.id })) }}"> | ||||
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} | {{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} | ||||
</a> | </a> | ||||
{% else %} | {% else %} | ||||
{# {% if metadatafieldName =="supplier" %} | |||||
{{ dump(metadata) }} | |||||
{% endif %} #} | |||||
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} | {{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} | ||||
{% endif %} | {% endif %} | ||||
</td> | </td> | ||||
{% endfor %} | {% endfor %} | ||||
<td class="actions"> | |||||
{% if _list_item_actions|length > 0 %} | {% if _list_item_actions|length > 0 %} | ||||
{% set _column_label = 'list.row_actions'|trans(_trans_parameters, 'EasyAdminBundle') %} | {% set _column_label = 'list.row_actions'|trans(_trans_parameters, 'EasyAdminBundle') %} | ||||
<td class="actions"> | |||||
{% block item_actions %} | {% block item_actions %} | ||||
{% set _actions_template = '@LcShop/backend/default/block/actions.html.twig' %} | {% set _actions_template = '@LcShop/backend/default/block/actions.html.twig' %} | ||||
{{ include(_actions_template, { | {{ include(_actions_template, { | ||||
item: item | item: item | ||||
}, with_context = false) }} | }, with_context = false) }} | ||||
{% endblock item_actions %} | {% endblock item_actions %} | ||||
</td> | |||||
{% endif %} | {% endif %} | ||||
</td> | |||||
</tr> | </tr> | ||||
{% endif %} | {% endif %} | ||||
{% else %} | {% else %} | ||||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/daterange/daterangepicker.js') }}"></script> | <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/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/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 %} | {% endblock %} | ||||
{% block script_javascript %} | {% block script_javascript %} | ||||
<script type="text/javascript"> | <script type="text/javascript"> | ||||
$(document).ready(function () { | $(document).ready(function () { | ||||
const toggles = document.querySelectorAll('.custom-switch input[type="checkbox"]'); | const toggles = document.querySelectorAll('.custom-switch input[type="checkbox"]'); | ||||
for (i = 0; i < toggles.length; i++) { | for (i = 0; i < toggles.length; i++) { |
</tr> | </tr> | ||||
{% endfor %} | {% endfor %} | ||||
{# {% if _number_of_hidden_results > 0 %} | |||||
{# {% if _number_of_hidden_results > 0 %} | |||||
<tr class="datagrid-row-empty"> | <tr class="datagrid-row-empty"> | ||||
<td class="text-center" colspan="{{ _fields_visible_by_user|length + 1 }}"> | <td class="text-center" colspan="{{ _fields_visible_by_user|length + 1 }}"> | ||||
<span class="datagrid-row-empty-message"><i | <span class="datagrid-row-empty-message"><i | ||||
class="fa fa-lock mr-1"></i> {{ 'security.list.hidden_results'|trans({}, 'EasyAdminBundle') }}</span> | class="fa fa-lock mr-1"></i> {{ 'security.list.hidden_results'|trans({}, 'EasyAdminBundle') }}</span> | ||||
</td> | </td> | ||||
</tr> | </tr> | ||||
{% endif %}#} | |||||
{% endif %} #} | |||||
{% endblock table_body %} | {% endblock table_body %} | ||||
</tbody> | </tbody> | ||||
</table> | </table> | ||||
{% set _action = easyadmin_get_action_for_edit_view('list', _entity_config.name) %} | {% set _action = easyadmin_get_action_for_edit_view('list', _entity_config.name) %} | ||||
<div class="button-action"> | <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) }} | {{ _action.label is defined and not _action.label is empty ? _action.label|trans(_trans_parameters) }} | ||||
</a> | </a> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
{{ form_end(postion_form) }} | {{ form_end(postion_form) }} | ||||
{% endblock main %} | {% endblock main %} | ||||
{% block head_stylesheets %} | {% block head_stylesheets %} |
{% set _translation_domain = easyadmin.entity.translation_domain %} | {% 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) } %} | {% 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"> | <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> | <span class="btn-label">{{ 'action.save'|trans(_trans_parameters, _translation_domain) }}</span> | ||||
</button> | </button> | ||||
{% if easyadmin.entity.name =='ProductFamily' %} | {% 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> | <span class="btn-label">{{ 'action.saveAndStay'|trans(_trans_parameters, _translation_domain) }}</span> | ||||
</button> | </button> | ||||
{% endif %} | {% endif %} |
<div v-show="currentSection == 'maintenance'" class="panel panel-default"> | <div v-show="currentSection == 'maintenance'" class="panel panel-default"> | ||||
{% include '@LcShop/backend/merchant/panel_maintenance.html.twig' %} | {% include '@LcShop/backend/merchant/panel_maintenance.html.twig' %} | ||||
</div> | </div> | ||||
<div v-show="currentSection == 'lunch'" class="panel panel-default"> | |||||
{% include '@LcShop/backend/merchant/panel_lunch.html.twig' %} | |||||
</div> | |||||
</div> | </div> | ||||
</div> | </div> |
{% 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> |
<span class="badge badge-{{ value.color is defined ? value.color : item.orderStatus.color }}">{{ value }}</span> |
</div> | </div> | ||||
{% endmacro %} | {% 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() %} | {% macro box_reference() %} | ||||
{% embed '@LcShop/backend/default/block/embed_box.twig' %} | {% embed '@LcShop/backend/default/block/embed_box.twig' %} | ||||
{% import '@LcShop/backend/order/macros.html.twig' as order_macros %} | {% import '@LcShop/backend/order/macros.html.twig' as order_macros %} |
<div class="lc-vue-js-container" id="lc-order-edit"> | <div class="lc-vue-js-container" id="lc-order-edit"> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col-3"> | <div class="col-3"> | ||||
{{ order_macros.box_user_info() }} | |||||
{{ macros.box_user_info(entity.user) }} | |||||
</div> | </div> | ||||
<div class="col-3"> | <div class="col-3"> | ||||
{{ order_macros.box_total_order() }} | {{ order_macros.box_total_order() }} |
<div class="lc-vue-js-container" id="lc-order-edit"> | <div class="lc-vue-js-container" id="lc-order-edit"> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col-3"> | <div class="col-3"> | ||||
{{ order_macros.box_user_info() }} | |||||
{{ macros.box_user_info(entity.user) }} | |||||
</div> | </div> | ||||
<div class="col-3"> | <div class="col-3"> | ||||
{{ order_macros.box_total_order() }} | {{ order_macros.box_total_order() }} |