@@ -0,0 +1,8 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Context; | |||
interface SectionInterface | |||
{ | |||
} |
@@ -0,0 +1,8 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Context; | |||
interface SectionUtilsInterface | |||
{ | |||
} |
@@ -42,8 +42,15 @@ class AddressApiController extends AbstractController | |||
$codesPostaux = $city->codesPostaux ; | |||
if($context == 'frontend') { | |||
$label = '<span class="city">'.$city->nom.'</span> <span class="zip">'.$codesPostaux[0].'</span>' ; | |||
} | |||
else { | |||
$label = $city->nom.' - '.$codesPostaux[0] ; | |||
} | |||
$return[] = [ | |||
'label' => '<span class="city">'.$city->nom.'</span> <span class="zip">'.$codesPostaux[0].'</span>', | |||
'label' => $label, | |||
'city' => $city->nom, | |||
'value' => $city->code | |||
] ; |
@@ -29,6 +29,7 @@ use Symfony\Component\Form\FormEvent; | |||
use Symfony\Component\Form\FormEvents; | |||
use Symfony\Component\HttpFoundation\JsonResponse; | |||
use Symfony\Component\HttpFoundation\Response; | |||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||
use Symfony\Component\Security\Core\Security; | |||
use Symfony\Contracts\Translation\TranslatorInterface; | |||
@@ -41,13 +42,15 @@ class AdminController extends EasyAdminController | |||
protected $merchantUtils; | |||
protected $mailjetTransport; | |||
protected $orderUtils; | |||
protected $mailUtils ; | |||
protected $mailUtils; | |||
protected $translator; | |||
protected $utilsProcess; | |||
protected $session; | |||
protected $sectionUtils; | |||
protected $filtersForm = null; | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, | |||
MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator) | |||
MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session) | |||
{ | |||
$this->security = $security; | |||
$this->userManager = $userManager; | |||
@@ -56,9 +59,11 @@ class AdminController extends EasyAdminController | |||
$this->utils = $utilsManager->getUtils(); | |||
$this->merchantUtils = $utilsManager->getMerchantUtils(); | |||
$this->orderUtils = $utilsManager->getOrderUtils();; | |||
$this->mailUtils = $utilsManager->getMailUtils() ; | |||
$this->utilsProcess = $utilsManager->getUtilsProcess() ; | |||
$this->mailUtils = $utilsManager->getMailUtils(); | |||
$this->utilsProcess = $utilsManager->getUtilsProcess(); | |||
$this->sectionUtils = $utilsManager->getSectionUtils(); | |||
$this->translator = $translator; | |||
$this->session = $session; | |||
} | |||
public function createCustomForm($class, $action, $parameters, $data = true, $options = array()) | |||
@@ -131,6 +136,21 @@ class AdminController extends EasyAdminController | |||
$dqlFilter = sprintf(str_replace('currentMerchant', $this->getUser()->getMerchant()->getId(), $dqlFilter)); | |||
} | |||
if ($pos = strpos($dqlFilter, 'TODAYSTART')) { | |||
$date = new \DateTime(); | |||
$dqlFilter = sprintf(str_replace('TODAYSTART', $date->format('Y-m-d').' 00:00:00', $dqlFilter)); | |||
} | |||
if ($pos = strpos($dqlFilter, 'TODAYEND')) { | |||
$date = new \DateTime(); | |||
$dqlFilter = sprintf(str_replace('TODAYEND', $date->format('Y-m-d').' 23:59:59', $dqlFilter)); | |||
} | |||
if ($pos = strpos($dqlFilter, 'sectionLunch')) { | |||
$dqlFilter = sprintf(str_replace('sectionLunch', $this->sectionUtils->getSection('lunch')->getId(), $dqlFilter)); | |||
} else if ($pos = strpos($dqlFilter, 'sectionMarket')) { | |||
$dqlFilter = sprintf(str_replace('sectionMarket', $this->sectionUtils->getSection('market')->getId(), $dqlFilter)); | |||
} | |||
if (new $entityClass instanceof StatusInterface && strpos($dqlFilter, 'entity.status') === false) { | |||
if ($dqlFilter) $dqlFilter .= sprintf(' AND entity.status > = 0'); | |||
else $dqlFilter .= sprintf(' entity.status > = 0'); | |||
@@ -173,17 +193,21 @@ class AdminController extends EasyAdminController | |||
'entity_class' => $this->entity['class'] | |||
)); | |||
$this->filtersForm->handleRequest($this->request); | |||
if ($this->filtersForm->isSubmitted() && $this->filtersForm->isValid()) { | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$view = $easyadmin['view']; | |||
if($easyadmin['view']=='listChildren') $view = 'list'; | |||
if (($this->filtersForm->isSubmitted() && $this->filtersForm->isValid()) || $this->entity[$view]['filters']!==false) { | |||
foreach ($listFields as $field) { | |||
if ($this->filtersForm->has($field['property'])) { | |||
//if ($this->filtersForm->has($field['property'])->getConfig()->getOption('AdminController')) { | |||
if ($this->filtersForm->has($field['property'])) { | |||
switch ($field['dataType']) { | |||
case 'option': | |||
case 'integer': | |||
case 'text': | |||
case 'string': | |||
case 'toggle': | |||
$filter = $this->filtersForm->get($field['property'])->getData(); | |||
$filter = $this->getListFilterParam($field['property']); | |||
//$filter = $this->filtersForm->get($field['property'])->getData(); | |||
if ($filter !== null) { | |||
$queryBuilder->andWhere('entity.' . $field['property'] . ' LIKE :' . $field['property'] . ''); | |||
@@ -191,26 +215,25 @@ class AdminController extends EasyAdminController | |||
} | |||
break; | |||
case 'association' : | |||
$filter = $this->filtersForm->get($field['property'])->getData(); | |||
$filter = $this->getListFilterParam($field['property']); | |||
//$filter = $this->filtersForm->get($field['property'])->getData(); | |||
if ($filter !== null) { | |||
if ($field['type_options']['multiple']) { | |||
$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . ''); | |||
} else { | |||
$queryBuilder->andWhere('entity.' . $field['property'] . ' = :' . $field['property'] . ''); | |||
} | |||
if($filter instanceof TreeInterface && $filter->getParent() == null) { | |||
if ($filter instanceof TreeInterface && $filter->getParent() == null) { | |||
$queryBuilder->setParameter($field['property'], array_merge(array($filter), $filter->getChildrens()->toArray())); | |||
}else{ | |||
} else { | |||
$queryBuilder->setParameter($field['property'], $filter); | |||
} | |||
} | |||
break; | |||
case 'datetime': | |||
case 'date': | |||
$dateStart = $this->filtersForm->get($field['property'])->get('dateStart')->getData(); | |||
$dateEnd = $this->filtersForm->get($field['property'])->get('dateEnd')->getData(); | |||
$dateStart = $this->getListFilterParam($field['property'], 'dateStart'); | |||
$dateEnd = $this->getListFilterParam($field['property'], 'dateEnd'); | |||
if ($dateStart) $queryBuilder->andWhere('entity.' . $field['property'] . ' >= :dateStart')->setParameter('dateStart', $dateStart); | |||
if ($dateEnd) $queryBuilder->andWhere('entity.' . $field['property'] . ' <= :dateEnd')->setParameter('dateEnd', $dateEnd); | |||
@@ -222,9 +245,63 @@ class AdminController extends EasyAdminController | |||
} | |||
} | |||
//TODO déplacer dans LC | |||
if($this->entity['name']== 'OrderShopLunch' || $this->entity['name']== 'OrderShopLunchDay'){ | |||
$queryBuilder->addOrderBy('entity.user', 'asc'); | |||
} | |||
return $queryBuilder; | |||
} | |||
//TODO finaliser la sauvegarde des filtres | |||
protected function getListFilterParam($param, $extraParam = null){ | |||
$entityName = $this->entity['name']; | |||
$sessionParam = $entityName.$param.$extraParam; | |||
//CUSTOM | |||
if($extraParam){ | |||
$value = $this->filtersForm->get($param)->get($extraParam)->getViewData(); | |||
}else{ | |||
$value = $this->filtersForm->get($param)->getViewData(); | |||
} | |||
if($this->request->query->get('filterClear')){ | |||
$this->session->remove($sessionParam); | |||
}else { | |||
if ($value) { | |||
$this->session->set($sessionParam, $value); | |||
} else if ($this->session->get($sessionParam) && !$this->filtersForm->isSubmitted() && $this->filtersForm->get($param)) { | |||
$value = $this->session->get($sessionParam); | |||
if($extraParam){ | |||
if($this->filtersForm->get($param)->get($extraParam)->getConfig()->getOption('input')=='datetime'){ | |||
$this->filtersForm->get($param)->get($extraParam)->setData(new \DateTime($value)); | |||
}else{ | |||
$this->filtersForm->get($param)->get($extraParam)->setData($value); | |||
} | |||
}else { | |||
//Champ association | |||
if ($this->filtersForm->get($param)->getConfig()->getOption('class')) { | |||
$valFormated = $this->em->getRepository($this->filtersForm->get($param)->getConfig()->getOption('class'))->find($value); | |||
$this->filtersForm->get($param)->setData($valFormated); | |||
} else { | |||
//Champ noramux | |||
$this->filtersForm->get($param)->setData($value); | |||
} | |||
} | |||
} | |||
} | |||
if($value !== "")return $value; | |||
else return null; | |||
} | |||
public function renderTemplate($actionName, $templatePath, array $parameters = []) | |||
{ | |||
@@ -303,6 +380,47 @@ class AdminController extends EasyAdminController | |||
} | |||
protected function getListParam($param, $default =null){ | |||
$entityName = $this->entity['name']; | |||
$sessionParam = $entityName.$param; | |||
//CUSTOM | |||
if($param == 'maxResults'){ | |||
$val = $this->entity['list']['max_results']; | |||
}else{ | |||
$val = $this->request->query->get($param, $default); | |||
} | |||
if(isset($_GET[$param])){ | |||
$val = $this->request->query->get($param); | |||
$this->session->set($sessionParam, $val); | |||
}else if($this->session->get($sessionParam)){ | |||
$val = $this->session->get($sessionParam); | |||
$this->request->query->set($param, $val); | |||
} | |||
return $val; | |||
} | |||
protected function listAction() | |||
{ | |||
$this->dispatch(EasyAdminEvents::PRE_LIST); | |||
$fields = $this->entity['list']['fields']; | |||
$paginator = $this->findAll($this->entity['class'], $this->getListParam('page', 1), $this->getListParam('maxResults'), $this->getListParam('sortField'), $this->getListParam('sortDirection'), $this->entity['list']['dql_filter']); | |||
$this->dispatch(EasyAdminEvents::POST_LIST, ['paginator' => $paginator]); | |||
$parameters = [ | |||
'paginator' => $paginator, | |||
'fields' => $fields, | |||
'batch_form' => $this->createBatchForm($this->entity['name'])->createView(), | |||
'delete_form_template' => $this->createDeleteForm($this->entity['name'], '__id__')->createView(), | |||
]; | |||
return $this->executeDynamicMethod('render<EntityName>Template', ['list', $this->entity['templates']['list'], $parameters]); | |||
} | |||
public function sortAction() | |||
{ | |||
@@ -477,6 +595,7 @@ class AdminController extends EasyAdminController | |||
$form->add($child->getName(), EntityType::class, array( | |||
'class' => $this->em->getClassMetadata($passedOptions['class'])->getName(), | |||
'label' => $passedOptions['label'], | |||
'expanded' => isset($passedOptions['expanded']) ? $passedOptions['expanded'] : false, | |||
'multiple' => isset($passedOptions['multiple']) ? $passedOptions['multiple'] : false, | |||
'placeholder' => '--', | |||
'translation_domain' => 'lcshop', | |||
@@ -527,7 +646,7 @@ class AdminController extends EasyAdminController | |||
$id = $this->request->query->get('id'); | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$entity = $easyadmin['item']; | |||
$entity = $easyadmin['item']; | |||
if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) { | |||
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue')); | |||
@@ -572,65 +691,68 @@ class AdminController extends EasyAdminController | |||
return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]); | |||
} | |||
/* public function createNewEntity(){ | |||
$idDuplicate = $this->request->query->get('duplicate', null); | |||
if($idDuplicate){ | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($idDuplicate); | |||
/* public function createNewEntity(){ | |||
$idDuplicate = $this->request->query->get('duplicate', null); | |||
if($idDuplicate){ | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($idDuplicate); | |||
$newProductFamily = clone $entity ; | |||
$this->em->persist($newProductFamily) ; | |||
$this->em->flush() ; | |||
}else{ | |||
$entityFullyQualifiedClassName = $this->entity['class']; | |||
$newProductFamily = clone $entity ; | |||
$this->em->persist($newProductFamily) ; | |||
$this->em->flush() ; | |||
}else{ | |||
$entityFullyQualifiedClassName = $this->entity['class']; | |||
return new $entityFullyQualifiedClassName(); | |||
} | |||
return new $entityFullyQualifiedClassName(); | |||
} | |||
}*/ | |||
}*/ | |||
public function duplicateAction(){ | |||
public function duplicateAction() | |||
{ | |||
$id = $this->request->query->get('id'); | |||
$refererUrl = $this->request->query->get('referer', ''); | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($id); | |||
$entity = $this->em->getRepository($easyadmin['entity']['class'])->find($id); | |||
$newEntity = $this->utilsProcess->duplicateEntity($entity); | |||
return $this->redirectToRoute('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' =>$newEntity->getId(), 'referer' =>$refererUrl ]) ; | |||
return $this->redirectToRoute('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' => $newEntity->getId(), 'referer' => $refererUrl]); | |||
} | |||
public function duplicateOtherHubAction(){ | |||
public function duplicateOtherHubAction() | |||
{ | |||
$id = $this->request->query->get('id'); | |||
$hubAlias = $this->request->query->get('hub'); | |||
$refererUrl = $this->request->query->get('referer', ''); | |||
$user = $this->security->getUser() ; | |||
$user = $this->security->getUser(); | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($id); | |||
$hub= $this->em->getRepository(MerchantInterface::class)->findOneByDevAlias($hubAlias); | |||
$entity = $this->em->getRepository($easyadmin['entity']['class'])->find($id); | |||
$hub = $this->em->getRepository(MerchantInterface::class)->findOneByDevAlias($hubAlias); | |||
$newEntity = $this->utilsProcess->duplicateEntityToOtherHub($entity,$hub); | |||
$newEntity = $this->utilsProcess->duplicateEntityToOtherHub($entity, $hub); | |||
$user->setMerchant($hub); | |||
$this->em->persist($user); | |||
$this->em->flush(); | |||
$redirectUrl = $this->generateUrl('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' =>$newEntity->getId(), 'referer' =>$refererUrl ]).'&hubredirection=true'; | |||
$redirectUrl = $this->generateUrl('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' => $newEntity->getId(), 'referer' => $refererUrl]) . '&hubredirection=true'; | |||
return $this->redirectToOtherHub($hub, $redirectUrl) ; | |||
return $this->redirectToOtherHub($hub, $redirectUrl); | |||
} | |||
public function redirectToOtherHub($hub, $url){ | |||
if(strpos($_SERVER['HTTP_HOST'], 'localhost')!==false){ | |||
public function redirectToOtherHub($hub, $url) | |||
{ | |||
if (strpos($_SERVER['HTTP_HOST'], 'localhost') !== false) { | |||
return $this->redirect($url); | |||
}else{ | |||
return $this->redirect($hub->getMerchantConfig('url').substr($url,1)); | |||
} else { | |||
return $this->redirect($hub->getMerchantConfig('url') . substr($url, 1)); | |||
} | |||
} |
@@ -11,6 +11,7 @@ use Lc\ShopBundle\Services\Utils; | |||
use Lc\ShopBundle\Services\UtilsManager; | |||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | |||
use Symfony\Component\HttpFoundation\BinaryFileResponse; | |||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||
use Symfony\Component\HttpFoundation\StreamedResponse; | |||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | |||
use Symfony\Component\Security\Core\Security; | |||
@@ -20,9 +21,9 @@ class DocumentController extends AdminController | |||
{ | |||
protected $documentRepository ; | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator) | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session) | |||
{ | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session); | |||
$this->documentRepository = $this->em->getRepository($this->em->getClassMetadata(DocumentInterface::class)->getName()) ; | |||
} | |||
@@ -47,4 +48,4 @@ class DocumentController extends AdminController | |||
} | |||
} | |||
} | |||
} |
@@ -11,6 +11,7 @@ use Lc\ShopBundle\Services\MailUtils; | |||
use Lc\ShopBundle\Services\UtilsManager; | |||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | |||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | |||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | |||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | |||
use Symfony\Component\Security\Core\Security; | |||
@@ -21,12 +22,10 @@ class NewsController extends AdminController | |||
{ | |||
protected $parameterBag ; | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, | |||
MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, | |||
ParameterBagInterface $parameterBag) | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session, ParameterBagInterface $parameterBag) | |||
{ | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session); | |||
$this->parameterBag = $parameterBag ; | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||
} | |||
public function sendTestAction() | |||
@@ -68,7 +67,7 @@ class NewsController extends AdminController | |||
$newsletter = $this->getNewsletter() ; | |||
$news = $this->getNews() ; | |||
$users = $this->em->getRepository($this->em->getClassMetadata(UserInterface::class)->getName())->findAllByNewsletter($newsletter) ; | |||
$countUsers = count($users) ; | |||
$packageMessagesArray = []; | |||
@@ -81,7 +80,10 @@ class NewsController extends AdminController | |||
] ; | |||
$i = 0 ; | |||
foreach ($users as $user) { | |||
$paramsTemplate['user'] =$user; | |||
if(!isset($packageMessagesArray[$i])) { | |||
$packageMessagesArray[$i] = [] ; | |||
} | |||
@@ -142,6 +144,7 @@ class NewsController extends AdminController | |||
public function getNewsletter() | |||
{ | |||
$newsletter = $this->merchantUtils->getMerchantCurrent()->getNewsletter() ; | |||
if($newsletter) { | |||
return $newsletter ; | |||
} | |||
@@ -163,4 +166,4 @@ class NewsController extends AdminController | |||
} | |||
} | |||
} | |||
} |
@@ -33,6 +33,7 @@ use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\HttpFoundation\Response; | |||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | |||
use Symfony\Component\Security\Core\Security; | |||
use Symfony\Contracts\Translation\TranslatorInterface; | |||
@@ -43,11 +44,11 @@ class OrderController extends AdminController | |||
protected $creditUtils; | |||
protected $mailUtils; | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator) | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session) | |||
{ | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session); | |||
$this->creditUtils = $utilsManager->getCreditUtils(); | |||
$this->mailUtils = $utilsManager->getMailUtils(); | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||
} | |||
protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null) | |||
@@ -580,6 +581,23 @@ class OrderController extends AdminController | |||
$id = $this->request->query->get('id'); | |||
$entity = $this->request->query->get('entity'); | |||
if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) { | |||
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue')); | |||
$fieldsMetadata = $this->entity['list']['fields']; | |||
if($property == 'isGivenToCustomer'){ | |||
$orderShop =$this->getOrderShopEntity(); | |||
$orderShop->setIsGivenToCustomer($newValue); | |||
$this->em->persist($orderShop); | |||
$this->em->flush(); | |||
$this->utils->addFlash('success', 'success.common.fieldChange'); | |||
$response['flashMessages'] = $this->utils->getFlashMessages(); | |||
return new Response(json_encode($response)); | |||
} | |||
} | |||
return $this->redirectToRoute('easyadmin', [ | |||
'action' => 'show', | |||
'entity' => $entity, |
@@ -25,6 +25,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||
use Symfony\Component\Form\FormError; | |||
use Symfony\Component\HttpFoundation\Response; | |||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||
use Symfony\Component\Security\Core\Security; | |||
use Symfony\Contracts\Translation\TranslatorInterface; | |||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | |||
@@ -37,11 +38,9 @@ class ProductFamilyController extends AdminController | |||
private $parameterBag ; | |||
private $productFamilyUtils ; | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, | |||
MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, | |||
ParameterBagInterface $parameterBag) | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session, ParameterBagInterface $parameterBag) | |||
{ | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session); | |||
$this->parameterBag = $parameterBag ; | |||
$this->productFamilyUtils = $utilsManager->getProductFamilyUtils() ; | |||
} | |||
@@ -209,7 +208,6 @@ class ProductFamilyController extends AdminController | |||
protected function editAction() | |||
{ | |||
$this->dispatch(EasyAdminEvents::PRE_EDIT); | |||
$id = $this->request->query->get('id'); | |||
@@ -266,7 +264,7 @@ class ProductFamilyController extends AdminController | |||
if ($editForm->get('stayOnPage')->getData() != "false" || $this->request->get('submitAndStay') !== null) { | |||
$refererUrl = $this->request->query->get('referer', ''); | |||
return $this->redirectToRoute('easyadmin', ['entity' => 'ProductFamily', 'action' => 'edit', 'id' => $id, 'referer' => $refererUrl]); | |||
return $this->redirectToRoute('easyadmin', ['entity' => 'ProductFamily', 'action' => 'edit', 'id' => $id, 'referer' => $refererUrl, 'ajax' => $this->request->query->get('ajax')]); | |||
} else { | |||
return $this->redirectToReferrer(); | |||
} |
@@ -5,25 +5,44 @@ namespace Lc\ShopBundle\Controller\Backend; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents; | |||
use FOS\UserBundle\Model\UserManagerInterface; | |||
use Lc\ShopBundle\Context\OrderShopInterface; | |||
use Lc\ShopBundle\Context\UserInterface; | |||
use Lc\ShopBundle\Form\Backend\Ticket\TicketMessageType; | |||
use Lc\ShopBundle\Form\Backend\Ticket\TicketStatusType; | |||
use Lc\ShopBundle\Model\Ticket; | |||
use Lc\ShopBundle\Services\UtilsManager; | |||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | |||
use Symfony\Component\HttpFoundation\Response; | |||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||
use Symfony\Component\Security\Core\Security; | |||
use Symfony\Contracts\Translation\TranslatorInterface; | |||
class TicketController extends AdminController | |||
{ | |||
protected $ticketUtils; | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator) | |||
protected $userUtils; | |||
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(); | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||
$this->userUtils = $utilsManager->getUserUtils(); | |||
} | |||
public function persistTicketEntity($entity, $form) | |||
{ | |||
$entity->setStatus(Ticket::TICKET_STATUS_OPEN); | |||
$ticket = $this->ticketUtils->createTicket([ | |||
'user' => $entity->getUser(), | |||
'type' => $entity->getType(), | |||
'orderShop' => $entity->getOrderShop(), | |||
'subject' => $entity->getSubject(), | |||
'message' => $form->get('message')->getData(), | |||
'createByAdmin' => true, | |||
]); | |||
} | |||
protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null) | |||
{ | |||
@@ -81,7 +100,8 @@ class TicketController extends AdminController | |||
} | |||
public function ticketStatusAction(){ | |||
public function ticketStatusAction() | |||
{ | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$ticket = $easyadmin['item']; | |||
@@ -89,10 +109,10 @@ class TicketController extends AdminController | |||
$formTicketStatusForm->handleRequest($this->request); | |||
if ($formTicketStatusForm->isSubmitted() && $formTicketStatusForm->isValid()) { | |||
$this->em->persist($ticket); | |||
$this->em->flush(); | |||
$this->em->persist($ticket); | |||
$this->em->flush(); | |||
$this->utils->addFlash('success', 'success.ticket.statusChange'); | |||
$this->utils->addFlash('success', 'success.ticket.statusChange'); | |||
} else { | |||
$this->utils->addFlash('error', $formTicketStatusForm->getErrors()); | |||
} | |||
@@ -101,7 +121,8 @@ class TicketController extends AdminController | |||
return new Response(json_encode($response)); | |||
} | |||
public function newMessageTicketAction(){ | |||
public function newMessageTicketAction() | |||
{ | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$ticket = $easyadmin['item']; | |||
@@ -110,9 +131,9 @@ class TicketController extends AdminController | |||
if ($formAddTicketMessage->isSubmitted() && $formAddTicketMessage->isValid()) { | |||
$this->ticketUtils->createTicketMessage(array( | |||
'ticket'=>$ticket, | |||
'message'=> $formAddTicketMessage->get('message')->getData(), | |||
'answerByAdmin'=>true | |||
'ticket' => $ticket, | |||
'message' => $formAddTicketMessage->get('message')->getData(), | |||
'answerByAdmin' => true | |||
)); | |||
$this->utils->addFlash('success', 'success.ticket.addMessage'); | |||
@@ -126,4 +147,76 @@ class TicketController extends AdminController | |||
'id' => $ticket->getId() | |||
]); | |||
} | |||
public function newAction() | |||
{ | |||
$this->dispatch(EasyAdminEvents::PRE_NEW); | |||
$entity = $this->executeDynamicMethod('createNew<EntityName>Entity'); | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$easyadmin['item'] = $entity; | |||
$this->request->attributes->set('easyadmin', $easyadmin); | |||
$fields = $this->entity['new']['fields']; | |||
$newForm = $this->executeDynamicMethod('create<EntityName>NewForm', [$entity, $fields]); | |||
if ($this->request->request->get('user')) { | |||
$userRepo = $this->em->getRepository(UserInterface::class); | |||
$newForm->get('user')->setData($userRepo->find($this->request->request->get('user'))); | |||
} | |||
if ($this->request->request->get('orderId')) { | |||
$newForm->get('orderId')->setData($this->request->request->get('orderId')); | |||
} | |||
$newForm->handleRequest($this->request); | |||
if ($newForm->isSubmitted() && $newForm->isValid()) { | |||
if ($newForm->get('orderId')->getData()) { | |||
$orderShopRepo = $this->em->getRepository(OrderShopInterface::class); | |||
$orderShop = $orderShopRepo->find($newForm->get('orderId')->getData()); | |||
if($orderShop)$entity->setOrderShop($orderShop); | |||
} | |||
$this->processUploadedFiles($newForm); | |||
$this->dispatch(EasyAdminEvents::PRE_PERSIST, ['entity' => $entity]); | |||
$this->executeDynamicMethod('persist<EntityName>Entity', [$entity, $newForm]); | |||
$this->dispatch(EasyAdminEvents::POST_PERSIST, ['entity' => $entity]); | |||
$this->utils->addFlash('success', 'success.ticket.addMessage'); | |||
if ($this->request->isXmlHttpRequest()) { | |||
$response['type'] = 'success'; | |||
$response['flashMessages'] = $this->utils->getFlashMessages(); | |||
return new Response(json_encode($response)); | |||
} else { | |||
return $this->redirectToReferrer(); | |||
} | |||
} | |||
$this->dispatch(EasyAdminEvents::POST_NEW, [ | |||
'entity_fields' => $fields, | |||
'form' => $newForm, | |||
'entity' => $entity, | |||
]); | |||
$parameters = [ | |||
'form' => $newForm->createView(), | |||
'entity_fields' => $fields, | |||
'entity' => $entity, | |||
]; | |||
if ($this->request->isXmlHttpRequest()) { | |||
$response['modal'] = $this->renderView('@LcShop/backend/ticket/modal/create.html.twig', $parameters); | |||
return new Response(json_encode($response)); | |||
} else { | |||
return $this->executeDynamicMethod('render<EntityName>Template', ['new', $this->entity['templates']['new'], $parameters]); | |||
} | |||
} | |||
} |
@@ -16,6 +16,7 @@ use Lc\ShopBundle\Services\UtilsManager; | |||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||
use Symfony\Component\Security\Core\Security; | |||
use Symfony\Contracts\Translation\TranslatorInterface; | |||
@@ -23,10 +24,11 @@ class UserMerchantController extends AdminController | |||
{ | |||
protected $creditUtils; | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator) | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator, SessionInterface $session) | |||
{ | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session); | |||
$this->creditUtils = $utilsManager->getCreditUtils(); | |||
} | |||
public function addCreditHistoryAction(){ |
@@ -27,6 +27,8 @@ class CartController extends BaseController | |||
protected $orderUtils ; | |||
protected $userUtils ; | |||
protected $priceUtils ; | |||
protected $sectionUtils ; | |||
protected $mailUtils ; | |||
protected $router ; | |||
protected $productFamilyRepository ; | |||
protected $orderProductRepository ; | |||
@@ -42,6 +44,8 @@ class CartController extends BaseController | |||
$this->orderUtils = $utilsManager->getOrderUtils() ; | |||
$this->userUtils = $utilsManager->getUserUtils() ; | |||
$this->priceUtils = $utilsManager->getPriceUtils() ; | |||
$this->sectionUtils = $utilsManager->getSectionUtils() ; | |||
$this->mailUtils = $utilsManager->getMailUtils() ; | |||
$this->router = $router ; | |||
$this->productFamilyRepository = $this->em->getRepository($this->em->getClassMetaData(ProductFamilyInterface::class)->getName()) ; | |||
$this->orderProductRepository = $this->em->getRepository($this->em->getClassMetaData(OrderProductInterface::class)->getName()) ; |
@@ -16,12 +16,12 @@ use Symfony\Component\OptionsResolver\OptionsResolver; | |||
class ProductFamilyCategoriesType extends AbstractType | |||
{ | |||
protected $em; | |||
protected $productCategoryRepository ; | |||
protected $productCategoryRepository; | |||
public function __construct(EntityManagerInterface $entityManager, ProductCategoryRepository $productCategoryRepository) | |||
{ | |||
$this->em = $entityManager; | |||
$this->productCategoryRepository = $productCategoryRepository ; | |||
$this->productCategoryRepository = $productCategoryRepository; | |||
} | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
@@ -34,20 +34,25 @@ class ProductFamilyCategoriesType extends AbstractType | |||
foreach ($categories as $category) { | |||
$builder->add('category_' . $category->getId(), CheckboxType::class, [ | |||
'label' => $category->getStatus() == 0 ? $category->getTitle() .' (hors ligne)': $category->getTitle() , | |||
'label' => $category->getStatus() == 0 ? $category->getTitle() . ' (hors ligne)' : $category->getTitle(), | |||
'data' => $currentProductCategories->contains($category), | |||
'required' => false, | |||
'disabled'=>true, | |||
'attr'=>[ | |||
'class'=>'none' | |||
] | |||
'disabled' => true, | |||
'attr' => [ | |||
'class' => 'none', | |||
'data-section' => $category->getSection()->getId() | |||
], | |||
]); | |||
$childrenCategories = $this->productCategoryRepository->findAllByParent($category, true); | |||
foreach ($childrenCategories as $children) { | |||
$builder->add('category_children_' . $children->getId(), CheckboxType::class, [ | |||
'label' => $children->getStatus() == 0 ? $children->getTitle() .' (hors ligne)': $children->getTitle() , | |||
'label' => $children->getStatus() == 0 ? $children->getTitle() . ' (hors ligne)' : $children->getTitle(), | |||
'data' => $currentProductCategories->contains($children), | |||
'required' => false | |||
'required' => false, | |||
'attr' => [ | |||
'data-section' => $category->getSection()->getId() | |||
], | |||
]); | |||
} | |||
} |
@@ -29,6 +29,7 @@ class ProductType extends AbstractType | |||
$this->em = $entityManager; | |||
$this->utils = $utils; | |||
} | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
@@ -36,12 +37,11 @@ class ProductType extends AbstractType | |||
$builder->add('title', TextType::class, array( | |||
"required" => false | |||
)) ; | |||
)); | |||
$builder->add('quantity', NumberType::class, array( | |||
'label' => 'Quantité', | |||
'required'=>false, | |||
'required' => false, | |||
'attr' => [ | |||
'append_html' => 'g' | |||
] | |||
@@ -50,9 +50,9 @@ class ProductType extends AbstractType | |||
$unitClass = $this->em->getClassMetadata(UnitInterface::class)->getName(); | |||
$builder->add('unit', EntityType::class, array( | |||
'class'=> $unitClass, | |||
'class' => $unitClass, | |||
'data' => 0, | |||
'required'=>false, | |||
'required' => false, | |||
'choice_attr' => function ($choice) { | |||
return [ | |||
'data-unit-reference' => $choice->getUnitReference(), | |||
@@ -75,7 +75,7 @@ class ProductType extends AbstractType | |||
$builder->add('buyingPrice', NumberType::class, array( | |||
'label' => 'Prix d\'achat', | |||
'required'=>false | |||
'required' => false | |||
)); | |||
$builder->add('buyingPriceWithTax', NumberType::class, array( | |||
@@ -86,7 +86,7 @@ class ProductType extends AbstractType | |||
$builder->add('buyingPriceByRefUnit', NumberType::class, array( | |||
'label' => 'Prix d\'achat', | |||
'required'=>false | |||
'required' => false | |||
)); | |||
$builder->add('buyingPriceByRefUnitWithTax', NumberType::class, array( | |||
@@ -96,12 +96,12 @@ class ProductType extends AbstractType | |||
)); | |||
$builder->add('multiplyingFactor', NumberType::class, array( | |||
'label' => 'Coefficiant de multiplication', | |||
'mapped'=>false, | |||
'required'=>false | |||
'mapped' => false, | |||
'required' => false | |||
)); | |||
$builder->add('priceByRefUnit', NumberType::class, array( | |||
'required'=>false | |||
'required' => false | |||
)); | |||
$builder->add('priceByRefUnitWithTax', NumberType::class, array( | |||
@@ -126,19 +126,19 @@ class ProductType extends AbstractType | |||
$builder->add('position', HiddenType::class); | |||
$builder->add('status', HiddenType::class); | |||
$builder->add('exportTitle', TextType::class, array( | |||
'required' =>false | |||
'required' => false | |||
)); | |||
$builder->add('exportNote', TextType::class, array( | |||
'required' =>false | |||
'required' => false | |||
)); | |||
$reductionCartClass = $this->em->getClassMetadata(ReductionCartInterface::class)->getName(); | |||
$reductionCartRepo = $this->em->getRepository(ReductionCartInterface::class); | |||
/* $builder->add('giftVoucherReductionCart', EntityType::class, array( | |||
'required' =>false, | |||
'class'=> $reductionCartClass, | |||
'choices' => $reductionCartRepo->getOnlineReductionCart(), | |||
));*/ | |||
/* $builder->add('giftVoucherReductionCart', EntityType::class, array( | |||
'required' =>false, | |||
'class'=> $reductionCartClass, | |||
'choices' => $reductionCartRepo->getOnlineReductionCart(), | |||
));*/ | |||
} | |||
@@ -0,0 +1,78 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Form\Backend\Ticket; | |||
use App\Entity\Product; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Lc\ShopBundle\Context\CreditHistoryInterface; | |||
use Lc\ShopBundle\Context\OrderProductInterface; | |||
use Lc\ShopBundle\Context\OrderReductionCartInterface; | |||
use Lc\ShopBundle\Context\OrderShopInterface; | |||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||
use Lc\ShopBundle\Context\ProductInterface; | |||
use Lc\ShopBundle\Context\ReductionCartInterface; | |||
use Lc\ShopBundle\Context\ReductionCreditInterface; | |||
use Lc\ShopBundle\Context\TicketInterface; | |||
use Lc\ShopBundle\Context\TicketMessageInterface; | |||
use Lc\ShopBundle\Form\DataTransformer\ProductToIdTransformer; | |||
use Lc\ShopBundle\Model\CreditHistory; | |||
use Lc\ShopBundle\Model\Ticket; | |||
use Lc\ShopBundle\Services\Utils; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\Extension\Core\Type\ButtonType; | |||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||
use Symfony\Component\Form\Extension\Core\Type\DateType; | |||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||
use Symfony\Component\Form\Extension\Core\Type\MoneyType; | |||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\Form\FormEvent; | |||
use Symfony\Component\Form\FormEvents; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
class TicketTypeType extends AbstractType | |||
{ | |||
protected $em; | |||
public function __construct(EntityManagerInterface $em) | |||
{ | |||
$this->em = $em; | |||
} | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event){ | |||
$builder = $event->getForm()->getParent(); | |||
$builder->add('type', ChoiceType::class, [ | |||
'label' => 'field.Ticket.type', | |||
'multiple' => false, | |||
'expanded' => false, | |||
'choices' => [ | |||
'field.Ticket.typeOptions.' . Ticket::TYPE_MESSAGE_FROM_PDL => Ticket::TYPE_MESSAGE_FROM_PDL, | |||
'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', | |||
]); | |||
}); | |||
} | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
$resolver->setDefaults([ | |||
'data_class' => $this->em->getClassMetadata(TicketInterface::class)->getName(), | |||
'translation_domain' => 'lcshop' | |||
]); | |||
} | |||
} |
@@ -50,10 +50,12 @@ class RegistrationType extends AbstractType | |||
'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.' | |||
]); | |||
// captcha |
@@ -117,12 +117,17 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa | |||
*/ | |||
protected $updatedBy; | |||
/** | |||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketInterface", mappedBy="orderShop") | |||
*/ | |||
protected $tickets; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="orderShops") | |||
* @ORM\JoinColumn(nullable=false) | |||
*/ | |||
protected $section; | |||
public function __construct() | |||
{ | |||
$this->orderStatusHistories = new ArrayCollection(); | |||
@@ -572,4 +577,16 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa | |||
return false ; | |||
} | |||
public function getSection(): ?Section | |||
{ | |||
return $this->section; | |||
} | |||
public function setSection(?Section $section): self | |||
{ | |||
$this->section = $section; | |||
return $this; | |||
} | |||
} |
@@ -46,6 +46,11 @@ trait PriceTrait | |||
return $this->getTaxRate() ; | |||
} | |||
public function getBuyingPriceInherited(): ?float | |||
{ | |||
return $this->getBuyingPrice() ; | |||
} | |||
public function getBuyingPrice(): ?float | |||
{ | |||
return $this->buyingPrice; |
@@ -2,8 +2,6 @@ | |||
namespace Lc\ShopBundle\Model; | |||
use App\Entity\Hub; | |||
use App\Entity\ProductFamily; | |||
use Doctrine\Common\Collections\ArrayCollection; | |||
use Doctrine\Common\Collections\Collection; | |||
use Doctrine\ORM\Mapping as ORM; | |||
@@ -34,7 +32,7 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt | |||
protected $childrens; | |||
/** | |||
* @ORM\ManyToMany(targetEntity="App\Entity\ProductFamily", mappedBy="productCategories") | |||
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="productCategories") | |||
*/ | |||
protected $productFamilies; | |||
@@ -43,6 +41,13 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt | |||
*/ | |||
protected $saleStatus; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="productCategories") | |||
* @ORM\JoinColumn(nullable=false) | |||
*/ | |||
protected $section; | |||
public function __construct() | |||
{ | |||
$this->childrens = new ArrayCollection(); | |||
@@ -51,8 +56,10 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt | |||
public function __toString() | |||
{ | |||
// TODO: Implement __toString() method. | |||
return $this->getTitle(); | |||
$parent = $this->getParent() ; | |||
$title = $parent ? $parent->getTitle().' - ' : '' ; | |||
$title .= $this->getTitle() ; | |||
return $title ; | |||
} | |||
public function getParent(): ?self | |||
@@ -81,7 +88,12 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt | |||
*/ | |||
public function getChildrens(): Collection | |||
{ | |||
return $this->childrens; | |||
//TODO les lignes ci-dessous ne devraient pas exister, sert à résoudre le problème d'ordre dans le menu | |||
$iterator = $this->childrens->getIterator(); | |||
$iterator->uasort(function ($a, $b) { | |||
return ($a->getPosition() < $b->getPosition()) ? -1 : 1; | |||
}); | |||
return new ArrayCollection(iterator_to_array($iterator)); | |||
} | |||
public function addChildren(self $productCategory): self | |||
@@ -171,4 +183,17 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt | |||
return $this; | |||
} | |||
public function getSection(): ?Section | |||
{ | |||
return $this->section; | |||
} | |||
public function setSection(?Section $section): self | |||
{ | |||
$this->section = $section; | |||
return $this; | |||
} | |||
} |
@@ -222,12 +222,16 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr | |||
*/ | |||
protected $behaviorPrice; | |||
/** | |||
* @ORM\Column(type="boolean") | |||
*/ | |||
protected $saleStatus; | |||
/** | |||
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="productFamilies") | |||
*/ | |||
protected $sections; | |||
public function __construct() | |||
{ | |||
$this->productCategories = new ArrayCollection(); | |||
@@ -857,4 +861,50 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr | |||
return $this; | |||
} | |||
/** | |||
* @return Collection|Section[] | |||
*/ | |||
public function getSections(): Collection | |||
{ | |||
return $this->sections; | |||
} | |||
public function addSection(Section $section): self | |||
{ | |||
if (!$this->sections->contains($section)) { | |||
$this->sections[] = $section; | |||
} | |||
return $this; | |||
} | |||
public function removeSection(Section $section): self | |||
{ | |||
if ($this->sections->contains($section)) { | |||
$this->sections->removeElement($section); | |||
} | |||
return $this; | |||
} | |||
public function getFieldBuyingPrice() | |||
{ | |||
if($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) { | |||
return 'buyingPrice' ; | |||
} | |||
elseif($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) { | |||
return 'buyingPriceByRefUnit' ; | |||
} | |||
} | |||
public function getFieldPrice() | |||
{ | |||
if($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) { | |||
return 'price' ; | |||
} | |||
elseif($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) { | |||
return 'priceByRefUnit' ; | |||
} | |||
} | |||
} |
@@ -40,14 +40,16 @@ trait ProductPropertyTrait | |||
*/ | |||
protected $propertyExpirationDate; | |||
public function getBuyingPriceByRefUnit(): ?float | |||
{ | |||
return $this->buyingPriceByRefUnit; | |||
} | |||
public function getBuyingPriceByRefUnitInherited(): ?float | |||
{ | |||
return $this->getBuyingPriceByRefUnit() ; | |||
} | |||
public function setBuyingPriceByRefUnit(?float $buyingPriceByRefUnit): self | |||
{ | |||
$this->buyingPriceByRefUnit = $buyingPriceByRefUnit; |
@@ -71,7 +71,7 @@ abstract class ReductionCart extends AbstractEntity implements ReductionProperty | |||
protected $uncombinableTypes = []; | |||
/** | |||
* @ORM\Column(type="integer") | |||
* @ORM\Column(type="integer", nullable=true) | |||
*/ | |||
protected $availableQuantityPerCode; | |||
public function __toString() |
@@ -0,0 +1,172 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Model; | |||
use App\Entity\Hub; | |||
use Doctrine\Common\Collections\ArrayCollection; | |||
use Doctrine\Common\Collections\Collection; | |||
use Doctrine\ORM\Mapping as ORM; | |||
use Lc\ShopBundle\Context\FilterMerchantInterface; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
abstract class Section extends AbstractDocumentEntity implements FilterMerchantInterface | |||
{ | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface") | |||
* @ORM\JoinColumn(nullable=false) | |||
*/ | |||
protected $merchant; | |||
/** | |||
* @ORM\Column(type="string", length=32) | |||
*/ | |||
protected $cycle; | |||
const SECTION_CYCLE_DAY = 'day' ; | |||
const SECTION_CYCLE_WEEK = 'week' ; | |||
const SECTION_CYCLE_MONTH = 'month' ; | |||
const SECTION_CYCLE_YEAR = 'year' ; | |||
/** | |||
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="sections") | |||
*/ | |||
protected $productFamilies; | |||
/** | |||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="section") | |||
*/ | |||
protected $orderShops; | |||
/** | |||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", mappedBy="section") | |||
*/ | |||
protected $productCategories; | |||
public function __construct() | |||
{ | |||
$this->productFamilies = new ArrayCollection(); | |||
$this->orderShops = new ArrayCollection(); | |||
} | |||
public function __toString() | |||
{ | |||
return $this->getTitle(); | |||
} | |||
public function getMerchant(): ?Hub | |||
{ | |||
return $this->merchant; | |||
} | |||
public function setMerchant(?Hub $merchant): self | |||
{ | |||
$this->merchant = $merchant; | |||
return $this; | |||
} | |||
public function getCycle(): ?string | |||
{ | |||
return $this->cycle; | |||
} | |||
public function setCycle(string $cycle): self | |||
{ | |||
$this->cycle = $cycle; | |||
return $this; | |||
} | |||
/** | |||
* @return Collection|ProductFamily[] | |||
*/ | |||
public function getProductFamilies(): Collection | |||
{ | |||
return $this->productFamilies; | |||
} | |||
public function addProductFamily(ProductFamily $productFamily): self | |||
{ | |||
if (!$this->productFamilies->contains($productFamily)) { | |||
$this->productFamilies[] = $productFamily; | |||
$productFamily->addSection($this); | |||
} | |||
return $this; | |||
} | |||
public function removeProductFamily(ProductFamily $productFamily): self | |||
{ | |||
if ($this->productFamilies->contains($productFamily)) { | |||
$this->productFamilies->removeElement($productFamily); | |||
$productFamily->removeSection($this); | |||
} | |||
return $this; | |||
} | |||
/** | |||
* @return Collection|OrderShop[] | |||
*/ | |||
public function getOrderShops(): Collection | |||
{ | |||
return $this->orderShops; | |||
} | |||
public function addOrderShop(OrderShop $orderShop): self | |||
{ | |||
if (!$this->orderShops->contains($orderShop)) { | |||
$this->orderShops[] = $orderShop; | |||
$orderShop->setSection($this); | |||
} | |||
return $this; | |||
} | |||
public function removeOrderShop(OrderShop $orderShop): self | |||
{ | |||
if ($this->orderShops->contains($orderShop)) { | |||
$this->orderShops->removeElement($orderShop); | |||
// set the owning side to null (unless already changed) | |||
if ($orderShop->getSection() === $this) { | |||
$orderShop->setSection(null); | |||
} | |||
} | |||
return $this; | |||
} | |||
/** | |||
* @return Collection|ProductCategory[] | |||
*/ | |||
public function getProductCategories(): Collection | |||
{ | |||
return $this->productCategories; | |||
} | |||
public function addProductCategory(ProductCategory $productCategory): self | |||
{ | |||
if (!$this->productCategories->contains($productCategory)) { | |||
$this->productCategories[] = $productCategory; | |||
$productCategory->setSection($this); | |||
} | |||
return $this; | |||
} | |||
public function removeProductCategory(ProductCategory $productCategory): self | |||
{ | |||
if ($this->productCategories->contains($productCategory)) { | |||
$this->productCategories->removeElement($productCategory); | |||
// set the owning side to null (unless already changed) | |||
if ($productCategory->getSection() === $this) { | |||
$productCategory->setSection(null); | |||
} | |||
} | |||
return $this; | |||
} | |||
} |
@@ -23,6 +23,7 @@ abstract class Ticket extends AbstractEntity implements FilterMerchantInterface | |||
const TYPE_TECHNICAL_PROBLEM = 'technical-problem' ; | |||
const TYPE_GENERAL_QUESTION = 'general-question' ; | |||
const TYPE_POULTRY_BOOKING = 'poultry-booking' ; | |||
const TYPE_MESSAGE_FROM_PDL = 'message-from-pdl' ; | |||
const TICKET_STATUS_OPEN = 'open' ; |
@@ -128,6 +128,10 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt | |||
$query->select( $params['select']); | |||
} | |||
if (isset($params['section'])) { | |||
$query = $query->andWhere('e.section = :section')->setParameter('section', $params['section']); | |||
} | |||
if (isset($params['dateStart']) || isset($params['dateEnd'])) { | |||
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate'; | |||
} |
@@ -35,6 +35,13 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit | |||
return $query->getQuery()->getOneOrNullResult() ; | |||
} | |||
public function findOneByDevAlias($devAlias) | |||
{ | |||
$query = $this->findByMerchantQuery() ; | |||
$query->andWhere('e.devAlias = :devAlias')->setParameter('devAlias',$devAlias) ; | |||
return $query->getQuery()->getOneOrNullResult() ; | |||
} | |||
public function findAllParents($withOffline = false) | |||
{ | |||
$query = $this->findByMerchantQuery() | |||
@@ -48,7 +55,7 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit | |||
return $query->getQuery()->getResult(); | |||
} | |||
public function findAllByParent($parentCategory, $withOffline = false, $withEmptyCategories = true) | |||
public function findAllByParent($parentCategory, $withOffline = false, $withEmptyCategories = true, $filterBySpecificDay = false) | |||
{ | |||
$query = $this->createQueryBuilder('e'); | |||
$query->andWhere('e.parent = :idParentCategory'); | |||
@@ -62,6 +69,11 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit | |||
$query->andWhere('pf.status = 1') ; | |||
} | |||
if($filterBySpecificDay) { | |||
$query->andWhere('e.displaySpecificDay IS NULL OR e.displaySpecificDay = :dayToday') ; | |||
$query->setParameter('dayToday', date('N')) ; | |||
} | |||
$query->addOrderBy('e.position', 'ASC') ; | |||
return $query->getQuery()->getResult(); |
@@ -44,6 +44,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor | |||
$query = $this->findByMerchantQuery() ; | |||
$query = $this->joinRelations($query) ; | |||
$query->andWhere('e.status = 1') ; | |||
$query->orderBy('RAND()'); | |||
return $query->getQuery()->getResult() ; | |||
} | |||
@@ -75,7 +76,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor | |||
$query->andWhere('e.status = 1'); | |||
$query->andWhere(':now <= e.propertyNoveltyExpirationDate') | |||
->setParameter('now', new \DateTime()) ; | |||
$query->orderBy('e.createdAt', 'DESC'); | |||
$query->orderBy('RAND()'); | |||
return $query->getQuery()->getResult() ; | |||
} | |||
@@ -122,7 +123,24 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor | |||
return $query->getQuery()->getResult() ; | |||
} | |||
public function getProductFamiliesBySection($section, $maxResults = false, $sortField = 'productCategories.position', $sortDirection = 'ASC') | |||
{ | |||
$query = $this->findByMerchantQuery() ; | |||
$query = $this->joinRelations($query) ; | |||
$query->andWhere('e.status = 1'); | |||
$query->andWhere(':section MEMBER OF e.sections') | |||
->setParameter('section', $section) ; | |||
$query->leftJoin('e.productCategories', 'productCategories'); | |||
if($sortField){ | |||
$query->orderBy($sortField,$sortDirection); | |||
} | |||
if($maxResults) { | |||
$query->setMaxResults($maxResults) ; | |||
} | |||
return $query->getQuery()->getResult() ; | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Repository; | |||
use Lc\ShopBundle\Context\SectionInterface; | |||
use Lc\ShopBundle\Context\DefaultRepositoryInterface; | |||
/** | |||
* @method SectionInterface|null find($id, $lockMode = null, $lockVersion = null) | |||
* @method SectionInterface|null findOneBy(array $criteria, array $orderBy = null) | |||
* @method SectionInterface[] findAll() | |||
* @method SectionInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||
*/ | |||
class SectionRepository extends BaseRepository implements DefaultRepositoryInterface | |||
{ | |||
public function getInterfaceClass() | |||
{ | |||
return SectionInterface::class; | |||
} | |||
// /** | |||
// * @return Address[] Returns an array of Address objects | |||
// */ | |||
/* | |||
public function findByExampleField($value) | |||
{ | |||
return $this->createQueryBuilder('a') | |||
->andWhere('a.exampleField = :val') | |||
->setParameter('val', $value) | |||
->orderBy('a.id', 'ASC') | |||
->setMaxResults(10) | |||
->getQuery() | |||
->getResult() | |||
; | |||
} | |||
*/ | |||
/* | |||
public function findOneBySomeField($value): ?Address | |||
{ | |||
return $this->createQueryBuilder('a') | |||
->andWhere('a.exampleField = :val') | |||
->setParameter('val', $value) | |||
->getQuery() | |||
->getOneOrNullResult() | |||
; | |||
} | |||
*/ | |||
} | |||
@@ -160,83 +160,106 @@ table.fixedHeader-floating { | |||
/* line 60, ../../sass/backend/custom.scss */ | |||
table th.sorting_asc, table th.sorting_desc { | |||
border-top: 3px solid var(--success); | |||
border-top: 2px solid var(--success); | |||
} | |||
/* line 61, ../../sass/backend/custom.scss */ | |||
.card-body table.lc-table-list th.sorted, table th.sorting_asc, table th.sorting_desc { | |||
border-top: 2px solid var(--success); | |||
.card-body table.lc-table-list th.filtered { | |||
border-top: 2px solid var(--primary); | |||
} | |||
/*.card-body table.lc-table-list th{border-top:3px solid var(--success);}*/ | |||
/* line 63, ../../sass/backend/custom.scss */ | |||
table th.filtered { | |||
border-top: 3px solid var(--primary); | |||
border-top: 2px solid var(--primary); | |||
} | |||
/* line 64, ../../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 65, ../../sass/backend/custom.scss */ | |||
.card-body table.lc-table-list th.sorted.filtered { | |||
border-top: 0px; | |||
position: relative; | |||
} | |||
/* line 66, ../../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 69, ../../sass/backend/custom.scss */ | |||
.lc-table-list thead a { | |||
color: #212529; | |||
} | |||
/* line 67, ../../sass/backend/custom.scss */ | |||
/* line 70, ../../sass/backend/custom.scss */ | |||
.table-filters-line th { | |||
font-weight: 400; | |||
position: relative; | |||
} | |||
/* line 69, ../../sass/backend/custom.scss */ | |||
/* line 72, ../../sass/backend/custom.scss */ | |||
#list_filter_id { | |||
width: 60px; | |||
} | |||
/* line 70, ../../sass/backend/custom.scss */ | |||
/* line 73, ../../sass/backend/custom.scss */ | |||
.lc-table-list .date-range { | |||
width: 130px; | |||
} | |||
/* line 72, ../../sass/backend/custom.scss */ | |||
/* line 75, ../../sass/backend/custom.scss */ | |||
th.actions, td.actions { | |||
white-space: nowrap; | |||
text-align: right; | |||
} | |||
/* line 74, ../../sass/backend/custom.scss */ | |||
/* line 77, ../../sass/backend/custom.scss */ | |||
.table td, .table th { | |||
padding: 0.35rem; | |||
} | |||
/* line 75, ../../sass/backend/custom.scss */ | |||
/* line 78, ../../sass/backend/custom.scss */ | |||
.delivery-field .form-group { | |||
display: inline-block; | |||
margin-bottom: 0px; | |||
margin-right: 15px; | |||
} | |||
/* line 76, ../../sass/backend/custom.scss */ | |||
/* line 79, ../../sass/backend/custom.scss */ | |||
.delivery-field .form-group .form-control { | |||
width: 150px; | |||
} | |||
/* line 78, ../../sass/backend/custom.scss */ | |||
/* line 81, ../../sass/backend/custom.scss */ | |||
table th input { | |||
width: 100%; | |||
} | |||
/* line 79, ../../sass/backend/custom.scss */ | |||
/* line 82, ../../sass/backend/custom.scss */ | |||
table th .select2-container--default .select2-selection--single { | |||
padding: 0.3rem 0.4rem; | |||
} | |||
/************************ LOGIN PAGE *********************/ | |||
/* line 82, ../../sass/backend/custom.scss */ | |||
/* line 85, ../../sass/backend/custom.scss */ | |||
.login-logo { | |||
display: block; | |||
margin: auto; | |||
} | |||
/************************ form error *********************/ | |||
/* line 85, ../../sass/backend/custom.scss */ | |||
/* line 88, ../../sass/backend/custom.scss */ | |||
.form-sent .form-control:invalid { | |||
border-color: #dc3545; | |||
padding-right: 2.25rem; | |||
@@ -246,19 +269,19 @@ table th .select2-container--default .select2-selection--single { | |||
background-size: calc(.75em + .375rem) calc(.75em + .375rem); | |||
} | |||
/* line 86, ../../sass/backend/custom.scss */ | |||
/* line 89, ../../sass/backend/custom.scss */ | |||
.form-sent select.form-control:invalid + .select2 .select2-selection { | |||
border-color: #dc3545; | |||
} | |||
/* line 87, ../../sass/backend/custom.scss */ | |||
/* line 90, ../../sass/backend/custom.scss */ | |||
.form-sent select.form-control:invalid + .select2 .select2-selection b { | |||
border-color: #dc3545 transparent transparent transparent; | |||
} | |||
/*CUSTOM Checkbox | |||
/* Customize the label (the container) */ | |||
/* line 92, ../../sass/backend/custom.scss */ | |||
/* line 95, ../../sass/backend/custom.scss */ | |||
.form-check-label { | |||
display: block; | |||
position: relative; | |||
@@ -271,7 +294,7 @@ table th .select2-container--default .select2-selection--single { | |||
} | |||
/* Hide the browser's default checkbox */ | |||
/* line 94, ../../sass/backend/custom.scss */ | |||
/* line 97, ../../sass/backend/custom.scss */ | |||
.form-check-label input { | |||
position: absolute; | |||
opacity: 0; | |||
@@ -281,22 +304,22 @@ table th .select2-container--default .select2-selection--single { | |||
} | |||
/* Create a custom checkbox */ | |||
/* line 97, ../../sass/backend/custom.scss */ | |||
/* line 100, ../../sass/backend/custom.scss */ | |||
.form-check { | |||
padding-left: 0px; | |||
} | |||
/* line 99, ../../sass/backend/custom.scss */ | |||
/* line 102, ../../sass/backend/custom.scss */ | |||
.form-sent .form-check-label input:invalid ~ .checkmark { | |||
border-color: #dc3545; | |||
} | |||
/* line 100, ../../sass/backend/custom.scss */ | |||
/* line 103, ../../sass/backend/custom.scss */ | |||
.form-check-label input:disabled ~ .checkmark { | |||
display: none; | |||
} | |||
/* line 101, ../../sass/backend/custom.scss */ | |||
/* line 104, ../../sass/backend/custom.scss */ | |||
.form-check-label input ~ .checkmark { | |||
position: absolute; | |||
top: 0; | |||
@@ -307,36 +330,36 @@ table th .select2-container--default .select2-selection--single { | |||
border: 1px solid var(--primary); | |||
} | |||
/* line 102, ../../sass/backend/custom.scss */ | |||
/* line 105, ../../sass/backend/custom.scss */ | |||
.form-check-label.big input ~ .checkmark { | |||
height: 21px; | |||
width: 21px; | |||
} | |||
/* line 103, ../../sass/backend/custom.scss */ | |||
/* line 106, ../../sass/backend/custom.scss */ | |||
.form-check-label input[type="checkbox"] ~ .checkmark { | |||
top: 2px; | |||
} | |||
/* line 104, ../../sass/backend/custom.scss */ | |||
/* line 107, ../../sass/backend/custom.scss */ | |||
.form-check-label input[type="radio"] ~ .checkmark { | |||
top: 3px; | |||
border-radius: 50%; | |||
} | |||
/* line 105, ../../sass/backend/custom.scss */ | |||
/* line 108, ../../sass/backend/custom.scss */ | |||
.form-check-label:hover input ~ .checkmark { | |||
background-color: #ccc; | |||
} | |||
/* When the checkbox is checked, add a blue background */ | |||
/* line 107, ../../sass/backend/custom.scss */ | |||
/* line 110, ../../sass/backend/custom.scss */ | |||
.form-check-label input:checked ~ .checkmark { | |||
background-color: var(--primary); | |||
} | |||
/* Create the checkmark/indicator (hidden when not checked) */ | |||
/* line 109, ../../sass/backend/custom.scss */ | |||
/* line 112, ../../sass/backend/custom.scss */ | |||
.form-check-label .checkmark:after { | |||
content: ""; | |||
position: absolute; | |||
@@ -344,13 +367,13 @@ table th .select2-container--default .select2-selection--single { | |||
} | |||
/* Show the checkmark when checked */ | |||
/* line 111, ../../sass/backend/custom.scss */ | |||
/* line 114, ../../sass/backend/custom.scss */ | |||
.form-check-label input:checked ~ .checkmark:after { | |||
display: block; | |||
} | |||
/* Style the checkmark/indicator */ | |||
/* line 113, ../../sass/backend/custom.scss */ | |||
/* line 116, ../../sass/backend/custom.scss */ | |||
.form-check-label .checkmark:after { | |||
left: 7px; | |||
top: 3px; | |||
@@ -363,7 +386,7 @@ table th .select2-container--default .select2-selection--single { | |||
transform: rotate(45deg); | |||
} | |||
/* line 114, ../../sass/backend/custom.scss */ | |||
/* line 117, ../../sass/backend/custom.scss */ | |||
.form-check-label input[type="checkbox"] ~ .checkmark:after { | |||
left: 6px; | |||
top: 2px; | |||
@@ -376,7 +399,7 @@ table th .select2-container--default .select2-selection--single { | |||
transform: rotate(45deg); | |||
} | |||
/* line 115, ../../sass/backend/custom.scss */ | |||
/* line 118, ../../sass/backend/custom.scss */ | |||
.form-check-label input[type="radio"] ~ .checkmark:after { | |||
top: 4px; | |||
left: 4px; | |||
@@ -386,7 +409,7 @@ table th .select2-container--default .select2-selection--single { | |||
background: white; | |||
} | |||
/* line 117, ../../sass/backend/custom.scss */ | |||
/* line 120, ../../sass/backend/custom.scss */ | |||
.form-check-label.big input[type="checkbox"] ~ .checkmark:after { | |||
left: 7px; | |||
top: 3px; | |||
@@ -395,101 +418,118 @@ table th .select2-container--default .select2-selection--single { | |||
} | |||
/* Create a custom radio button */ | |||
/* line 121, ../../sass/backend/custom.scss */ | |||
/* line 124, ../../sass/backend/custom.scss */ | |||
.product-categories .parent .form-group.field-checkbox .form-check-label { | |||
padding-left: 0px; | |||
font-style: italic; | |||
} | |||
/* line 122, ../../sass/backend/custom.scss */ | |||
/* line 125, ../../sass/backend/custom.scss */ | |||
.product-categories .children .form-group.field-checkbox { | |||
margin-left: 20px; | |||
} | |||
/* line 123, ../../sass/backend/custom.scss */ | |||
/* line 126, ../../sass/backend/custom.scss */ | |||
.product-categories .form-group { | |||
margin-bottom: 0.15rem; | |||
} | |||
/* line 124, ../../sass/backend/custom.scss */ | |||
/* line 127, ../../sass/backend/custom.scss */ | |||
.lc-deleted-field { | |||
display: none; | |||
} | |||
/* line 125, ../../sass/backend/custom.scss */ | |||
/* line 128, ../../sass/backend/custom.scss */ | |||
.lc-offline-field { | |||
opacity: 0.5; | |||
} | |||
/* line 126, ../../sass/backend/custom.scss */ | |||
/* line 129, ../../sass/backend/custom.scss */ | |||
.lc-offline-field label::after { | |||
content: ' [hors ligne]'; | |||
} | |||
/* Général */ | |||
/* line 132, ../../sass/backend/custom.scss */ | |||
/* line 135, ../../sass/backend/custom.scss */ | |||
.btn.action-save { | |||
float: right; | |||
margin-left: 10px; | |||
} | |||
/* line 133, ../../sass/backend/custom.scss */ | |||
/* line 136, ../../sass/backend/custom.scss */ | |||
.button-action a.float-right { | |||
margin-left: 10px; | |||
} | |||
/* line 135, ../../sass/backend/custom.scss */ | |||
/* line 138, ../../sass/backend/custom.scss */ | |||
.input-group-text { | |||
padding: 0.25rem 0.75rem; | |||
} | |||
/* line 139, ../../sass/backend/custom.scss */ | |||
/* line 142, ../../sass/backend/custom.scss */ | |||
.col-form-label { | |||
font-weight: bold; | |||
} | |||
/* line 141, ../../sass/backend/custom.scss */ | |||
/* line 144, ../../sass/backend/custom.scss */ | |||
#toast-container.toast-top-right { | |||
top: 60px; | |||
} | |||
/* SIDEBAR */ | |||
/* line 144, ../../sass/backend/custom.scss */ | |||
/* line 147, ../../sass/backend/custom.scss */ | |||
.main-header.navbar { | |||
padding: 0; | |||
min-height: 57px; | |||
} | |||
/* line 145, ../../sass/backend/custom.scss */ | |||
/* line 148, ../../sass/backend/custom.scss */ | |||
.lc-navbar li { | |||
border-left: 1px solid #e0e0e0; | |||
padding: 0.5rem 1.5rem; | |||
} | |||
/* line 146, ../../sass/backend/custom.scss */ | |||
/* line 149, ../../sass/backend/custom.scss */ | |||
.lc-navbar li label { | |||
margin-bottom: 0; | |||
vertical-align: middle; | |||
font-weight: normal !important; | |||
} | |||
/* line 148, ../../sass/backend/custom.scss */ | |||
/* line 151, ../../sass/backend/custom.scss */ | |||
#switch-merchant { | |||
min-width: 170px; | |||
} | |||
/*************************** PAGINATION *******************************/ | |||
/* line 155, ../../sass/backend/custom.scss */ | |||
.pagination { | |||
justify-content: center; | |||
} | |||
/* line 156, ../../sass/backend/custom.scss */ | |||
.disabled .page-link { | |||
color: #343a40; | |||
} | |||
/* line 157, ../../sass/backend/custom.scss */ | |||
.disabled .page-link:hover, .page-link.current:hover { | |||
background-color: #fff; | |||
cursor: default; | |||
} | |||
/* Sortable */ | |||
/* line 154, ../../sass/backend/custom.scss */ | |||
/* line 162, ../../sass/backend/custom.scss */ | |||
.ui-sortable-helper { | |||
display: table; | |||
} | |||
/* line 155, ../../sass/backend/custom.scss */ | |||
/* line 163, ../../sass/backend/custom.scss */ | |||
.ui-state-highlight { | |||
background: #eee; | |||
} | |||
/* line 156, ../../sass/backend/custom.scss */ | |||
/* line 164, ../../sass/backend/custom.scss */ | |||
.lc-sortable div:last-child { | |||
display: none; | |||
} | |||
@@ -506,13 +546,13 @@ table th .select2-container--default .select2-selection--single { | |||
.lc-ckfinder-wrap .lc-ckfinder-button{width: 100%; bottom: 0px; left: 0; position: absolute;} | |||
*/ | |||
/* VUES JS */ | |||
/* line 171, ../../sass/backend/custom.scss */ | |||
/* line 179, ../../sass/backend/custom.scss */ | |||
.nav-item .btn { | |||
padding-right: 15px; | |||
position: relative; | |||
} | |||
/* line 172, ../../sass/backend/custom.scss */ | |||
/* line 180, ../../sass/backend/custom.scss */ | |||
.nav-item .btn .invalid-form { | |||
display: none; | |||
position: absolute; | |||
@@ -524,67 +564,67 @@ table th .select2-container--default .select2-selection--single { | |||
font-size: 1.2rem; | |||
} | |||
/* line 173, ../../sass/backend/custom.scss */ | |||
/* line 181, ../../sass/backend/custom.scss */ | |||
.nav-item.has-invalid .btn .invalid-form { | |||
display: inline-block; | |||
z-index: 2; | |||
} | |||
/* ProductFamily */ | |||
/* line 178, ../../sass/backend/custom.scss */ | |||
/* line 186, ../../sass/backend/custom.scss */ | |||
.field-unit-quantity { | |||
border-bottom: 2px dotted #eee; | |||
padding-bottom: 10px; | |||
margin-bottom: 20px; | |||
} | |||
/* line 179, ../../sass/backend/custom.scss */ | |||
/* line 187, ../../sass/backend/custom.scss */ | |||
.field-reduction-apply { | |||
border-top: 2px dotted #eee; | |||
padding-top: 10px; | |||
margin-top: 20px; | |||
} | |||
/* line 181, ../../sass/backend/custom.scss */ | |||
/* line 189, ../../sass/backend/custom.scss */ | |||
.new-productfamily #nav-params, | |||
.edit-productfamily #nav-params { | |||
margin-bottom: 30px; | |||
} | |||
/* line 186, ../../sass/backend/custom.scss */ | |||
/* line 194, ../../sass/backend/custom.scss */ | |||
.new-productfamily #nav-params .btn, | |||
.edit-productfamily #nav-params .btn { | |||
margin-left: 20px; | |||
} | |||
/* line 191, ../../sass/backend/custom.scss */ | |||
/* line 199, ../../sass/backend/custom.scss */ | |||
.new-productfamily #product-categories .row, | |||
.edit-productfamily #product-categories .row { | |||
padding: 10px; | |||
} | |||
/* line 196, ../../sass/backend/custom.scss */ | |||
/* line 204, ../../sass/backend/custom.scss */ | |||
.new-productfamily #product-categories .form-group, | |||
.edit-productfamily #product-categories .form-group { | |||
width: 100%; | |||
padding: 4px; | |||
} | |||
/* line 202, ../../sass/backend/custom.scss */ | |||
/* line 210, ../../sass/backend/custom.scss */ | |||
.new-productfamily #product-categories .children, | |||
.edit-productfamily #product-categories .children { | |||
margin-left: 20px; | |||
width: 100%; | |||
} | |||
/* line 208, ../../sass/backend/custom.scss */ | |||
/* line 216, ../../sass/backend/custom.scss */ | |||
.new-productfamily ul.products, | |||
.edit-productfamily ul.products { | |||
padding: 0px; | |||
list-style-type: none; | |||
} | |||
/* line 214, ../../sass/backend/custom.scss */ | |||
/* line 222, ../../sass/backend/custom.scss */ | |||
.new-productfamily ul.products li.product, | |||
.edit-productfamily ul.products li.product { | |||
padding: 0px; | |||
@@ -592,55 +632,81 @@ table th .select2-container--default .select2-selection--single { | |||
position: relative; | |||
} | |||
/* line 221, ../../sass/backend/custom.scss */ | |||
/* line 229, ../../sass/backend/custom.scss */ | |||
.new-productfamily ul.products li.add, | |||
.edit-productfamily ul.products li.add { | |||
text-align: right; | |||
} | |||
/* line 226, ../../sass/backend/custom.scss */ | |||
/* line 234, ../../sass/backend/custom.scss */ | |||
.autoresize textarea { | |||
height: auto; | |||
min-height: 38px; | |||
} | |||
/* line 228, ../../sass/backend/custom.scss */ | |||
/* line 236, ../../sass/backend/custom.scss */ | |||
.field-price .input-group.buyingPrice input, .field-price .input-group.buyingPrice .input-group-text { | |||
font-weight: bold; | |||
border-color: #222; | |||
} | |||
/* line 229, ../../sass/backend/custom.scss */ | |||
/* line 237, ../../sass/backend/custom.scss */ | |||
.field-price .input-group.buyingPriceByRefUnit input, .field-price .input-group.buyingPriceByRefUnit .input-group-text { | |||
font-weight: bold; | |||
border-color: #222; | |||
} | |||
/* line 230, ../../sass/backend/custom.scss */ | |||
/* line 238, ../../sass/backend/custom.scss */ | |||
.field-price .input-group.priceWithTax input, .field-price .input-group.priceWithTax .input-group-text { | |||
font-weight: bold; | |||
border-color: #222; | |||
} | |||
/* line 231, ../../sass/backend/custom.scss */ | |||
/* line 239, ../../sass/backend/custom.scss */ | |||
.field-price .input-group.priceByRefUnitWithTax input, .field-price .input-group.priceByRefUnitWithTax .input-group-text { | |||
font-weight: bold; | |||
border-color: #222; | |||
} | |||
/* line 232, ../../sass/backend/custom.scss */ | |||
/* line 240, ../../sass/backend/custom.scss */ | |||
.input-group.multiplyingFactor input, .input-group.multiplyingFactor .input-group-text { | |||
font-weight: bold; | |||
border-color: #222; | |||
} | |||
/* line 244, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .card-sections { | |||
width: 100%; | |||
position: fixed; | |||
left: 0px; | |||
top: 0px; | |||
z-index: 10; | |||
} | |||
/* line 252, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .form { | |||
padding-top: 50px; | |||
} | |||
/* line 256, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .card-footer { | |||
display: none; | |||
} | |||
/* line 261, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .in-advanced-editing-table .form { | |||
padding-top: 0px; | |||
} | |||
/* line 264, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .in-advanced-editing-table .card-sections, | |||
.layout-ajax #edit-productfamily-form .in-advanced-editing-table .row-note { | |||
display: none; | |||
} | |||
/* ORDER */ | |||
/* line 238, ../../sass/backend/custom.scss */ | |||
/* line 274, ../../sass/backend/custom.scss */ | |||
.table-order-summary { | |||
width: 100%; | |||
} | |||
/* line 241, ../../sass/backend/custom.scss */ | |||
/* line 277, ../../sass/backend/custom.scss */ | |||
.order-product-item.redelivery { | |||
background: rgba(18, 104, 253, 0.38) !important; | |||
} | |||
@@ -648,36 +714,36 @@ table th .select2-container--default .select2-selection--single { | |||
/*.select2-container--bootstrap .select2-selection{max-width: none;}*/ | |||
/*.order-product-item{margin: 15px 0; padding: 0;}*/ | |||
/* Product */ | |||
/* line 246, ../../sass/backend/custom.scss */ | |||
/* line 282, ../../sass/backend/custom.scss */ | |||
.product-form-modal { | |||
display: none; | |||
} | |||
/* line 247, ../../sass/backend/custom.scss */ | |||
/* line 283, ../../sass/backend/custom.scss */ | |||
.product-form.modal .form-check-label { | |||
font-style: italic; | |||
color: #666; | |||
text-align: left; | |||
} | |||
/* line 248, ../../sass/backend/custom.scss */ | |||
/* line 284, ../../sass/backend/custom.scss */ | |||
.products-collection-table .inherited { | |||
color: #888; | |||
font-style: italic; | |||
font-weight: initial; | |||
} | |||
/* line 249, ../../sass/backend/custom.scss */ | |||
/* line 285, ../../sass/backend/custom.scss */ | |||
.products-collection-table td { | |||
position: relative; | |||
} | |||
/* line 250, ../../sass/backend/custom.scss */ | |||
/* line 286, ../../sass/backend/custom.scss */ | |||
.card-body.p-0 .products-collection-table tbody > tr > td:first-of-type, .card-body.p-0 .products-collection-table tbody > tr > th:first-of-type, .card-body.p-0 .products-collection-table thead > tr > td:first-of-type, .card-body.p-0 .products-collection-table thead > tr > th:first-of-type { | |||
padding-left: 0.35rem; | |||
} | |||
/* line 251, ../../sass/backend/custom.scss */ | |||
/* line 287, ../../sass/backend/custom.scss */ | |||
.products-collection-table .btn-empty-field { | |||
position: absolute; | |||
right: 3px; | |||
@@ -686,14 +752,14 @@ table th .select2-container--default .select2-selection--single { | |||
padding: 0px; | |||
} | |||
/* line 252, ../../sass/backend/custom.scss */ | |||
/* line 288, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table { | |||
table-layout: fixed; | |||
/* background-clip: padding-box;*/ | |||
border-collapse: collapse; | |||
} | |||
/* line 253, ../../sass/backend/custom.scss */ | |||
/* line 289, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table th { | |||
font-size: 13px; | |||
border-left: 1px solid #dee2e6; | |||
@@ -703,22 +769,22 @@ table th .select2-container--default .select2-selection--single { | |||
position: relative; | |||
} | |||
/* line 254, ../../sass/backend/custom.scss */ | |||
/* line 290, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table tfoot th { | |||
border-top: 2px solid #dee2e6; | |||
} | |||
/* line 255, ../../sass/backend/custom.scss */ | |||
/* line 291, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table th span { | |||
white-space: initial; | |||
} | |||
/* line 256, ../../sass/backend/custom.scss */ | |||
/* line 292, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table th:last-child { | |||
border-right: 1px solid #dee2e6; | |||
} | |||
/* line 257, ../../sass/backend/custom.scss */ | |||
/* line 293, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table td { | |||
border-left: 1px solid #dee2e6; | |||
text-align: center; | |||
@@ -726,26 +792,26 @@ table th .select2-container--default .select2-selection--single { | |||
border-bottom: 1px solid #dee2e6; | |||
} | |||
/* line 258, ../../sass/backend/custom.scss */ | |||
/* line 294, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table td:last-child { | |||
border-right: 1px solid #dee2e6; | |||
white-space: nowrap; | |||
} | |||
/* line 259, ../../sass/backend/custom.scss */ | |||
/* line 295, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .btn-add-product { | |||
margin: 20px 0; | |||
float: right; | |||
} | |||
/* line 260, ../../sass/backend/custom.scss */ | |||
/* line 296, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .inherited { | |||
color: #888; | |||
font-style: italic; | |||
font-weight: initial; | |||
} | |||
/* line 261, ../../sass/backend/custom.scss */ | |||
/* line 297, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table td .value { | |||
min-width: 80%; | |||
margin: auto; | |||
@@ -753,79 +819,79 @@ table th .select2-container--default .select2-selection--single { | |||
cursor: pointer; | |||
} | |||
/* line 262, ../../sass/backend/custom.scss */ | |||
/* line 298, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table td .modal { | |||
text-align: left; | |||
} | |||
/* line 263, ../../sass/backend/custom.scss */ | |||
/* line 299, ../../sass/backend/custom.scss */ | |||
table.products-collection-table th.main-info, td.buyingPrice, td.multiplyingFactor, td.priceWithTax { | |||
background: #eeeeee; | |||
background-clip: padding-box; | |||
text-decoration: underline; | |||
} | |||
/* line 265, ../../sass/backend/custom.scss */ | |||
/* line 301, ../../sass/backend/custom.scss */ | |||
table.products-collection-table tr.disabled { | |||
opacity: 0.5; | |||
} | |||
/* line 266, ../../sass/backend/custom.scss */ | |||
/* line 302, ../../sass/backend/custom.scss */ | |||
.table-striped tbody .tr-sep { | |||
border-top: 2px solid #888; | |||
} | |||
/* DeliveryZone */ | |||
/* line 270, ../../sass/backend/custom.scss */ | |||
/* line 306, ../../sass/backend/custom.scss */ | |||
#autocomplete-cities { | |||
position: relative; | |||
} | |||
/* line 274, ../../sass/backend/custom.scss */ | |||
/* line 310, ../../sass/backend/custom.scss */ | |||
#autocomplete-cities .ui-autocomplete { | |||
left: 30%; | |||
top: 41px; | |||
margin-left: 18px; | |||
} | |||
/* line 280, ../../sass/backend/custom.scss */ | |||
/* line 316, ../../sass/backend/custom.scss */ | |||
.head-reminders { | |||
margin-top: 15px; | |||
} | |||
/* TABLEAU DE BORD */ | |||
/* line 283, ../../sass/backend/custom.scss */ | |||
/* line 319, ../../sass/backend/custom.scss */ | |||
.todo-list > li { | |||
position: relative; | |||
} | |||
/* line 284, ../../sass/backend/custom.scss */ | |||
/* line 320, ../../sass/backend/custom.scss */ | |||
.todo-list > li .text { | |||
margin-left: 30px; | |||
} | |||
/* line 285, ../../sass/backend/custom.scss */ | |||
/* line 321, ../../sass/backend/custom.scss */ | |||
.todo-list > li .tools { | |||
position: absolute; | |||
top: 4px; | |||
right: 15px; | |||
} | |||
/* line 287, ../../sass/backend/custom.scss */ | |||
/* line 323, ../../sass/backend/custom.scss */ | |||
#addTicketMessageForm { | |||
margin-top: 30px; | |||
border-top: 2px dotted #eee; | |||
padding-top: 30px; | |||
} | |||
/* line 289, ../../sass/backend/custom.scss */ | |||
/* line 325, ../../sass/backend/custom.scss */ | |||
#dashboard .list-btn-statistic { | |||
display: flex; | |||
flex-wrap: wrap; | |||
justify-content: center; | |||
} | |||
/* line 290, ../../sass/backend/custom.scss */ | |||
/* line 326, ../../sass/backend/custom.scss */ | |||
#dashboard .btn-statistic { | |||
width: 120px; | |||
height: 70px; | |||
@@ -834,62 +900,62 @@ table.products-collection-table tr.disabled { | |||
line-height: 1rem; | |||
} | |||
/* line 291, ../../sass/backend/custom.scss */ | |||
/* line 327, ../../sass/backend/custom.scss */ | |||
#dashboard .btn-statistic small { | |||
margin-bottom: 10px; | |||
display: block; | |||
} | |||
/* line 292, ../../sass/backend/custom.scss */ | |||
/* line 328, ../../sass/backend/custom.scss */ | |||
#dashboard .btn-statistic .value { | |||
display: block; | |||
} | |||
/* line 294, ../../sass/backend/custom.scss */ | |||
/* line 330, ../../sass/backend/custom.scss */ | |||
#dashboard #range_date_interval { | |||
margin-bottom: 20px; | |||
} | |||
/* line 295, ../../sass/backend/custom.scss */ | |||
/* line 331, ../../sass/backend/custom.scss */ | |||
#dashboard #range_date_interval label { | |||
float: left; | |||
margin-right: 20px; | |||
} | |||
/* line 296, ../../sass/backend/custom.scss */ | |||
/* line 332, ../../sass/backend/custom.scss */ | |||
#dashboard #range_date_interval .form-check { | |||
float: left; | |||
margin-right: 10px; | |||
} | |||
/* line 297, ../../sass/backend/custom.scss */ | |||
/* line 333, ../../sass/backend/custom.scss */ | |||
#dashboard .table-condensed .btn, #dashboard .table-condensed .btn-sm { | |||
white-space: nowrap; | |||
} | |||
/* Tickets */ | |||
/* line 303, ../../sass/backend/custom.scss */ | |||
/* line 339, ../../sass/backend/custom.scss */ | |||
#ticket-list .btn-sm { | |||
display: block; | |||
} | |||
/* line 309, ../../sass/backend/custom.scss */ | |||
/* line 345, ../../sass/backend/custom.scss */ | |||
#toast-container { | |||
width: 350px; | |||
} | |||
/* line 310, ../../sass/backend/custom.scss */ | |||
/* line 346, ../../sass/backend/custom.scss */ | |||
.toast { | |||
float: right; | |||
} | |||
/* line 312, ../../sass/backend/custom.scss */ | |||
/* line 348, ../../sass/backend/custom.scss */ | |||
#toast-container:before:hover { | |||
opacity: 1; | |||
cursor: pointer; | |||
} | |||
/* line 316, ../../sass/backend/custom.scss */ | |||
/* line 352, ../../sass/backend/custom.scss */ | |||
#toast-close-all { | |||
border: 0; | |||
position: absolute; |
@@ -4,6 +4,8 @@ jQuery(document).ready(function () { | |||
initButtonConfirm() | |||
initNotice(); | |||
initBtnEditReminder(); | |||
initBtnWriteToUser(); | |||
initCollectionWidget() | |||
$('form').on('focus', 'input[type=number]', function (e) { | |||
$(this).on('wheel.disableScroll', function (e) { | |||
e.preventDefault() | |||
@@ -274,3 +276,85 @@ function initReminderModal(url) { | |||
}); | |||
} | |||
function initBtnWriteToUser(){ | |||
$('#btn-ticket-write-to-user').on('click', function () { | |||
$btn = $(this); | |||
var order = ''; | |||
if($btn.data('order')) { | |||
order = '&orderId=' + $btn.data('order'); | |||
} | |||
$.ajax({ | |||
url: $btn.data('url'), | |||
data: "user="+$btn.data('user')+order, | |||
method: "POST", | |||
dataType: "json", | |||
success: function (response) { | |||
$('body').append(response.modal); | |||
initModalNewTicket(); | |||
} | |||
}); | |||
}); | |||
} | |||
function initModalNewTicket(){ | |||
$('#modal-new-ticket select.form-control').each(function (i, elm) { | |||
if (!$(this).hasClass('disable-select2')) { | |||
setSelect2($(elm)); | |||
} | |||
}); | |||
$('#modal-new-ticket').modal('show'); | |||
log($('#modal-new-ticket .btn-save')); | |||
$('#modal-new-ticket .btn-save').on('click', function (){ | |||
$form = $(this).parents('form'); | |||
if(checkFormValidity('#'+$form.prop('id'))) { | |||
$('#modal-new-ticket').modal('hide'); | |||
$.ajax({ | |||
url: $form.prop('action'), | |||
data: $form.serialize(), | |||
method: $form.prop('method'), | |||
dataType: "json", | |||
success: function (response) { | |||
setFlashMessages(response.flashMessages); | |||
$('#modal-new-ticket').remove(); | |||
} | |||
}); | |||
} | |||
}) | |||
} | |||
function initCollectionWidget(){ | |||
$('.form-widget-compound>div[data-prototype]').each(function (i,collectionWidget){ | |||
resetNumItemsCollectionField($(collectionWidget)); | |||
$(collectionWidget).on('easyadmin.collection.item-added', function (){ | |||
resetNumItemsCollectionField($(this)); | |||
}) | |||
}); | |||
} | |||
function resetNumItemsCollectionField($collectionWidget){ | |||
numItems = $collectionWidget.children('div.form-group').length; | |||
$collectionWidget.children('div.form-group').each(function (i,item){ | |||
$field = $(item).find('input[type="text"]'); | |||
//Chanegment ID | |||
posId = $field.prop('id').lastIndexOf('_') + 1; | |||
idPrefix = $field.prop('id').substr(0, posId); | |||
$field.prop('id', idPrefix+i); | |||
//Chanegment Name | |||
posName = $field.prop('name').lastIndexOf('[') + 1; | |||
namePrefix = $field.prop('name').substr(0, posName); | |||
$field.prop('name', namePrefix+i+']'); | |||
$(item).find('.field-collection-item-action').remove(); | |||
$(item).find('.field-collection-item-row').append('<button style="border:0px; background: none; " class="field-collection-item-action field-collection-item-remove" type="button">×</button>'); | |||
}); | |||
$collectionWidget.find('.field-collection-item-remove').off('click'); | |||
$collectionWidget.find('.field-collection-item-remove').on('click', function (){ | |||
$(this).parents('.form-group:first').remove(); | |||
resetNumItemsCollectionField($collectionWidget); | |||
}); | |||
} |
@@ -38,6 +38,10 @@ appOrder = new Vue({ | |||
{ | |||
name: 'maintenance', | |||
nameDisplay: 'Maintenance' | |||
}, | |||
{ | |||
name: 'lunch', | |||
nameDisplay: 'Repas du midi' | |||
} | |||
] | |||
}, window.addressValues, window.merchantPanelOrderValues); |
@@ -1,6 +1,8 @@ | |||
// Reference array sent to dynamic staticRenderFns | |||
var staticRenderFns = []; | |||
$(window).on('load', function () { | |||
/*var appProductFamily ; | |||
lcInitProductFamily() ;*/ | |||
Vue.component('product-unit-price', { | |||
mixins: [mixinUnit, mixinPrice, mixinTemplate], | |||
@@ -331,7 +333,6 @@ $(window).on('load', function () { | |||
watch: {} | |||
}); | |||
appProductFamily = new Vue({ | |||
el: '#lc-product-family-edit', | |||
mixins: [mixinReduction], | |||
@@ -426,6 +427,7 @@ $(window).on('load', function () { | |||
activeProducts: false, | |||
giftVoucherActive: false, | |||
productsQuantityAsTitle: false, | |||
section: null, | |||
formProducts: {}, | |||
currentSection: 'general', | |||
sectionsArray: [ | |||
@@ -487,6 +489,7 @@ $(window).on('load', function () { | |||
} | |||
} | |||
this.sectionHasChanged(); | |||
this.initLcSortableProductsList(); | |||
}); | |||
@@ -583,12 +586,19 @@ $(window).on('load', function () { | |||
if (typeof this.$refs.productUnitPrice !== 'undefined') { | |||
return this.$refs.productUnitPrice.behaviorPrice; | |||
} | |||
}, | |||
sectionHasChanged: function (){ | |||
$('.product-categories').find('.form-check-input:not(.none)').prop('disabled', true); | |||
$('.product-categories').find('.form-check-input[data-section="'+this.section+'"]:not(.none)').prop('disabled', false); | |||
} | |||
}, | |||
watch: { | |||
title: function () { | |||
this.updateChild() | |||
}, | |||
section: function (){ | |||
this.sectionHasChanged() | |||
}, | |||
propertyNoveltyExpirationDateActive: function () { | |||
if(!this.propertyNoveltyExpirationDateActive){ | |||
this.propertyNoveltyExpirationDate = null; | |||
@@ -616,5 +626,8 @@ $(window).on('load', function () { | |||
for (var key in formProductTemplate) { | |||
appProductFamily.formProducts[key] = formProductTemplate[key]; | |||
} | |||
}); | |||
function lcInitProductFamily() { | |||
} |
@@ -9,7 +9,9 @@ jQuery(document).ready(function () { | |||
dataType: "json", | |||
success: function (response) { | |||
setFlashMessages(response.flashMessages); | |||
$('body').append(response.data); | |||
$('body').append(response.data).ready(function () { | |||
initCollectionWidget(); | |||
}); | |||
$('#modal-user-address').modal('show'); | |||
$('#modal-user-address').on('hidden.bs.modal', function (e) { | |||
$('#modal-user-address').remove(); | |||
@@ -24,7 +26,6 @@ jQuery(document).ready(function () { | |||
appUserAddress = null; | |||
function initUserAddressForm(form, btn) { | |||
appUserAddress = null; | |||
$(form).find('button').off('click'); | |||
$(form).find('button').on('click', function () { | |||
if(checkFormValidity('#'+$(form).prop('id'))) { |
@@ -57,10 +57,13 @@ body#pdl-body .wrapper .content-wrapper{margin-top: 0; padding-top: 57px;} | |||
.dataTables_length, .dataTables_filter{padding: .75rem 1.25rem 0.25rem;} | |||
table.fixedHeader-floating{margin-top: 0px !important;} | |||
table th.sorting_asc, table th.sorting_desc{border-top:3px solid var(--success);} | |||
.card-body table.lc-table-list th.sorted, table th.sorting_asc, table th.sorting_desc{border-top:2px solid var(--success);} | |||
table th.sorting_asc, table th.sorting_desc{border-top:2px solid var(--success);} | |||
.card-body table.lc-table-list th.filtered{border-top:2px solid var(--primary);} | |||
/*.card-body table.lc-table-list th{border-top:3px solid var(--success);}*/ | |||
table th.filtered{border-top:3px solid var(--primary);} | |||
table th.filtered{border-top:2px solid var(--primary);} | |||
.card-body table.lc-table-list th.sorted, table th.sorting_asc, table th.sorting_desc{border-top:2px solid var(--success);} | |||
.card-body table.lc-table-list th.sorted.filtered{border-top:0px; position: relative;} | |||
.card-body table.lc-table-list th.sorted.filtered:after{ content: ''; height: 2px; position: absolute; left: 0; width: 100%; right: 0; top: -1px; background: linear-gradient(to right, var(--success) 0%, var(--success) 50%, var(--primary) 50%, var(--primary) 100%);} | |||
.lc-table-list thead a{color: #212529} | |||
@@ -148,6 +151,11 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0 | |||
#switch-merchant { | |||
min-width: 170px ; | |||
} | |||
/*************************** PAGINATION *******************************/ | |||
.pagination{justify-content: center;} | |||
.disabled .page-link{color: #343a40;} | |||
.disabled .page-link:hover, .page-link.current:hover{background-color: #fff; cursor: default;} | |||
/* Sortable */ | |||
@@ -231,7 +239,35 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0 | |||
.field-price .input-group.priceByRefUnitWithTax input,.field-price .input-group.priceByRefUnitWithTax .input-group-text{font-weight: bold; border-color: #222 } | |||
.input-group.multiplyingFactor input,.input-group.multiplyingFactor .input-group-text{font-weight: bold; border-color: #222 } | |||
.layout-ajax { | |||
#edit-productfamily-form { | |||
.card-sections { | |||
width: 100%; | |||
position: fixed; | |||
left: 0px; | |||
top: 0px; | |||
z-index: 10; | |||
} | |||
.form { | |||
padding-top: 50px; | |||
} | |||
.card-footer { | |||
display: none; | |||
} | |||
.in-advanced-editing-table { | |||
.form { | |||
padding-top: 0px ; | |||
} | |||
.card-sections, | |||
.row-note { | |||
display: none; | |||
} | |||
} | |||
} | |||
} | |||
/* ORDER */ | |||
@@ -334,3 +370,4 @@ color:#fff; | |||
-webkit-box-shadow: 0 0 12px #999; | |||
box-shadow: 0 0 12px #999; | |||
} | |||
@@ -31,6 +31,7 @@ group: | |||
Statistic: | |||
title: Statistiques | |||
ProductFamily: | |||
status: Espaces et statuts | |||
addresses: Livraisons & facturation | |||
main: Général | |||
products: Déclinaisons | |||
@@ -85,6 +86,7 @@ group: | |||
email: Email | |||
delivery: Livraison | |||
maintenance: Maintenance | |||
lunch: Repas du midi | |||
Address: | |||
listLoopBesancon: Adresses de Besançon à spécifier (lat / long) | |||
@@ -160,6 +162,8 @@ error: | |||
editStockNoQuantityDefault: "Le stock n'a pas été modifié pour le produit #%id% (Aucune quantité par défaut)" | |||
field: | |||
default: | |||
section: Espace | |||
unit: Unité | |||
placeholder: Choisissez une option | |||
deliveryPointSale: Lieu de livraison | |||
deliveryAvailabilty: Créneau de livraison | |||
@@ -288,6 +292,11 @@ field: | |||
purchaseOrderEmailContent: "Contenu par défaut de l'email envoyé aux producteurs" | |||
dateStart: Date de début | |||
dateEnd: Date de fin | |||
messageLunchOpen: Message (section ouverte) | |||
messageLunchClosed: Message (section fermée) | |||
displaySpecificDay: Disponible un jour spécifique | |||
groupUsers: Groupes | |||
ticketTypesNotification: Catégorie ticket | |||
PointSale: | |||
code: Code | |||
@@ -300,6 +309,7 @@ field: | |||
displayTotalWeightInPurchaseOrder: Afficher le poids total dans les bons de commande | |||
ProductFamily: | |||
sections: Espace où le produit est vendu | |||
taxRateInherited: Utiliser la TVA par défaut | |||
activeProducts: Activer les déclinaisons | |||
productsType: Type de déclinaisons | |||
@@ -416,6 +426,10 @@ field: | |||
quantityOrder: Quantité commandé | |||
quantityProduct: Quantité (en rapport à l'unité) | |||
unit: Unité | |||
OrderShopLunch: | |||
deliveryTypeOptions: | |||
point-sale: En ambassade | |||
home: À domicile | |||
OrderShop: | |||
hasReach: Étape atteinte | |||
deliveryTrucks: Véhicules de livraison | |||
@@ -466,6 +480,7 @@ field: | |||
type: Catégorie | |||
message: Votre réponse | |||
typeOptions: | |||
message-from-pdl: Messsage de l'équipe Place du Local | |||
general-question: Questions générales | |||
product-unavailable: Produit manquant | |||
product-error: Erreur sur un produit | |||
@@ -489,7 +504,8 @@ field: | |||
days: Par jour | |||
week: Par semaine | |||
month: Par mois | |||
User: | |||
isSaleAlwaysOpen: Commandes toujours ouvertes | |||
action: | |||
apply: Appliquer | |||
new: Créer %entity_label% | |||
@@ -522,6 +538,7 @@ action: | |||
logout: Me déconnecter | |||
address: Adresse utilisateur | |||
switch: Prendre la main | |||
order: | |||
addOrderProduct: Ajouter un produit | |||
addReductionCart: Ajouter une réduction | |||
@@ -538,6 +555,8 @@ action: | |||
add: Ajouter un pense-bête | |||
address: | |||
add: Ajouter une adresse | |||
ticket: | |||
writeToUser: Écrire à l'utilisateur | |||
resetting: | |||
check_email: | | |||
Un e-mail vous a été envoyé. Il contient un lien sur lequel il vous faudra cliquer pour réinitialiser votre mot de passe. Si vous ne recevez pas d'email, vérifiez votre dossier spam ou essayez à nouveau. |
@@ -4,24 +4,33 @@ | |||
{% if action.group is defined and action.group==true %} | |||
{% set dropdownAction = dropdownAction|merge({(loop.index0): action}) %} | |||
{% else %} | |||
{% set display_button = true %} | |||
{% if 'list' == action.name %} | |||
{% set action_href = request_parameters.referer|default('') ? request_parameters.referer|easyadmin_urldecode : path('easyadmin', request_parameters|merge({ action: 'list' })) %} | |||
{% elseif 'method' == action.type %} | |||
{% set action_href = path('easyadmin', request_parameters|merge({ action: action.name, id: item_id })) %} | |||
{% elseif 'route' == action.type %} | |||
{% set action_href = path(action.name, request_parameters|merge({ action: action.name, id: item_id })) %} | |||
{% elseif 'productfamily_advanced_editing' == action.type %} | |||
{% set action_href = path('easyadmin', request_parameters|merge({ action: action.action, id: item_id })) %} | |||
{% if action.name == 'products' and not item.activeProducts %} | |||
{% set display_button = false %} | |||
{% endif %} | |||
{% endif %} | |||
{{ include(action.template, { | |||
action: action, | |||
action_href: action_href, | |||
is_dropdown: is_dropdown|default(false), | |||
item: item, | |||
item_id: item_id, | |||
request_parameters: request_parameters, | |||
translation_domain: translation_domain, | |||
trans_parameters: trans_parameters, | |||
}, with_context = false) }} | |||
{% if display_button %} | |||
{{ include(action.template, { | |||
action: action, | |||
action_href: action_href, | |||
is_dropdown: is_dropdown|default(false), | |||
item: item, | |||
item_id: item_id, | |||
request_parameters: request_parameters, | |||
translation_domain: translation_domain, | |||
trans_parameters: trans_parameters, | |||
}, with_context = false) }} | |||
{% endif %} | |||
{% endif %} | |||
{% endfor %} | |||
{% if dropdownAction|length > 0 %} |
@@ -13,11 +13,11 @@ | |||
<td>{{ ticket.subject }}</td> | |||
<td> | |||
{% set value = ticket.status %} | |||
{% include '@LcShop/backend/default/list-fields/field_ticket_status.html.twig' %} | |||
{% include '@LcShop/backend/default/field/ticket_status.html.twig' %} | |||
</td> | |||
<td> | |||
{% set item = ticket %} | |||
{% include '@LcShop/backend/default/list-fields/field_ticket_last_message.html.twig' %} | |||
{% include '@LcShop/backend/default/field/ticket_last_message.html.twig' %} | |||
</td> | |||
<td> | |||
<a class="btn-sm btn-success" href="{{ path('easyadmin', {id: ticket.id, entity: 'Ticket', action: 'show'}) }}"> |
@@ -0,0 +1,103 @@ | |||
{% trans_default_domain 'EasyAdminBundle' %} | |||
{% set _paginator_request_parameters = _request_parameters|merge({'referer': null}) %} | |||
{% if paginator.haveToPaginate %} | |||
<div class="list-pagination"> | |||
<div class="row"> | |||
<div class="col-sm-3 hidden-xs list-pagination-counter"> | |||
{{ 'paginator.counter'|trans({ '%start%': paginator.currentPageOffsetStart, '%end%': paginator.currentPageOffsetEnd, '%results%': paginator.nbResults})|raw }} | |||
</div> | |||
<div class="col-xs-12 col-sm-9"> | |||
<ul class="pagination list-pagination-paginator {{ 1 == paginator.currentPage ? 'first-page' : '' }} {{ paginator.hasNextPage ? '' : 'last-page' }}"> | |||
{% if 1 == paginator.currentPage %} | |||
<li class="disabled"> | |||
<span class="page-link "> | |||
<i class="fa fa-angle-double-left"></i> | |||
</span> | |||
</li> | |||
{% else %} | |||
<li> | |||
<a class="page-link" | |||
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: 1 }) ) }}"> | |||
<i class="fa fa-angle-double-left"></i> | |||
</a> | |||
</li> | |||
{% endif %} | |||
{% if paginator.hasPreviousPage %} | |||
<li> | |||
<a class="page-link" | |||
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: paginator.previousPage }) ) }}"> | |||
<i class="fa fa-angle-left"></i> | |||
</a> | |||
</li> | |||
{% else %} | |||
<li class="disabled"> | |||
<span class="page-link"> | |||
<i class="fa fa-angle-left"></i> | |||
</span> | |||
</li> | |||
{% endif %} | |||
{# BEGIN DISPLAYING PAGE NUMBERS #} | |||
{# the number of pages that are displayed around the active page #} | |||
{% set nearbyPagesLimit = 8 %} | |||
{% if paginator.currentPage > 1 %} | |||
{% for i in range(paginator.currentPage-nearbyPagesLimit, paginator.currentPage-1) if ( i > 0 ) %} | |||
<li > | |||
<a class="page-link" | |||
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: i }) ) }}">{{ i }}</a> | |||
</li> | |||
{% endfor %} | |||
{% endif %} | |||
<li> | |||
<a class="current page-link">{{ paginator.currentPage }}</a> | |||
</li> | |||
{% if paginator.currentPage < paginator.nbPages %} | |||
{% for i in range(paginator.currentPage+1, paginator.currentPage + nearbyPagesLimit) if ( i <= paginator.nbPages ) %} | |||
<li> | |||
<a class="page-link" | |||
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: i }) ) }}">{{ i }}</a> | |||
</li> | |||
{% endfor %} | |||
{% endif %} | |||
{# END DISPLAYING PAGE NUMBERS #} | |||
{% if paginator.hasNextPage %} | |||
<li> | |||
<a class="page-link" | |||
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: paginator.nextPage }) ) }}"> | |||
<i class="fa fa-angle-right"></i> | |||
</a> | |||
</li> | |||
{% else %} | |||
<li class="disabled"> | |||
<span class="page-link"> | |||
<i class="fa fa-angle-right"></i> | |||
</span> | |||
</li> | |||
{% endif %} | |||
{% if paginator.currentPage < paginator.nbPages %} | |||
<li> | |||
<a class="page-link" | |||
href="{{ path('easyadmin', _paginator_request_parameters|merge({ page: paginator.nbPages }) ) }}"> | |||
<i class="fa fa-angle-double-right"></i> | |||
</a> | |||
</li> | |||
{% else %} | |||
<li class="disabled"> | |||
<span class="page-link"> | |||
<i class="fa fa-angle-double-right"></i> | |||
</span> | |||
</li> | |||
{% endif %} | |||
</ul> | |||
</div> | |||
</div> | |||
</div> | |||
{% endif %} |
@@ -0,0 +1,34 @@ | |||
{% form_theme form with easyadmin_config('design.form_theme') only %} | |||
{% set _entity_config = easyadmin_entity(app.request.query.get('entity')) %} | |||
{% set _entity_id = attribute(entity, _entity_config.primary_key_field_name) %} | |||
{% trans_default_domain _entity_config.translation_domain %} | |||
{% set _trans_parameters = { '%entity_name%': _entity_config.name|trans, '%entity_label%': _entity_config.label|trans, '%entity_id%': _entity_id } %} | |||
{% extends '@LcShop/backend/default/layout/layout-ajax.html.twig' %} | |||
{% block ajax %} | |||
{% block entity_form %} | |||
{{ form(form) }} | |||
{% endblock entity_form %} | |||
{% block head_stylesheets %} | |||
{{ parent() }} | |||
<link rel="stylesheet" | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/jquery-ui/jquery-ui.min.css') }}"> | |||
{% endblock %} | |||
{% block plugin_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery-ui/jquery-ui.min.js') }}"></script> | |||
<script type="text/javascript"> | |||
var CKEDITOR_BASEPATH = "{{ ckeditor_base_path("/bundles/fosckeditor/") }}"; | |||
</script> | |||
<script type="text/javascript" src="{{ asset('bundles/fosckeditor/ckeditor.js') }}"></script> | |||
{% endblock %} | |||
{% block script_javascript %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-edit.js') }}"></script> | |||
{% endblock %} | |||
{% endblock %} |
@@ -0,0 +1,3 @@ | |||
{% if link_parameters is defined %} | |||
<a href="{{ path('easyadmin', link_parameters|merge({entity: 'Supplier', referer: '' })) }}">{{ value|easyadmin_truncate }}</a> | |||
{% endif %} |
@@ -0,0 +1,9 @@ | |||
{% trans_default_domain 'EasyAdminBundle' %} | |||
{% block toggle %} | |||
<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-danger" data-propertyname="{{ field_options.property }}"> | |||
<input type="checkbox" class="custom-control-input" id="customSwitch{{ item.id }}-{{ field_options.property }}" {{ value == true ? 'checked' }}> | |||
<label class="custom-control-label" for="customSwitch{{ item.id }}-{{ field_options.property }}">{% block label %}{{ field_options.label }}{% endblock %}</label> | |||
</div> | |||
{% endblock %} | |||
@@ -1,5 +1,28 @@ | |||
{% trans_default_domain "lcshop" %} | |||
<div class="layout-ajax"> | |||
{% block ajax %} | |||
{% block head_stylesheets %} | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/fontawesome-free/css/all.min.css') }}"> | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/adminlte.css') }}"> | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/custom.css') }}"> | |||
{% endblock %} | |||
{% endblock %} | |||
{% block plugin_javascript %} | |||
<!-- jQuery --> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery/jquery.min.js') }}"></script> | |||
<!-- Bootstrap 4 --> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/bootstrap/bootstrap.bundle.min.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/toastr/toastr.min.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/select2/select2.full.min.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/bootstrap/bootstrap-switch.min.js') }}"></script> | |||
<!-- AdminLTE App --> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/adminlte.min.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/utils.js') }}"></script> | |||
{% endblock plugin_javascript %} | |||
{% block script_javascript %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-common.js') }}"></script> | |||
{% endblock script_javascript %} | |||
{% endblock %} | |||
</div> |
@@ -1,14 +0,0 @@ | |||
{% trans_default_domain 'EasyAdminBundle' %} | |||
<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-danger" data-propertyname="{{ field_options.property }}"> | |||
<input type="checkbox" class="custom-control-input" id="customSwitch{{ item.id }}-{{ field_options.property }}" {{ value == true ? 'checked' }}> | |||
<label class="custom-control-label" for="customSwitch{{ item.id }}-{{ field_options.property }}">{{ field_options.label }}</label> | |||
</div> | |||
{# | |||
{% if value == true %} | |||
<span class="badge badge-success">{{ 'label.true'|trans }}</span> | |||
{% else %} | |||
<span class="badge badge-danger">{{ 'label.false'|trans }}</span> | |||
{% endif %} | |||
#} |
@@ -12,6 +12,7 @@ | |||
sortField: app.request.get('sortField'), | |||
sortDirection: app.request.get('sortDirection'), | |||
page: app.request.get('page', 1), | |||
maxResults: app.request.get('maxResults', _entity_config.list.max_results), | |||
filters: app.request.get('filters', []), | |||
referer: null | |||
}) %} | |||
@@ -27,7 +28,7 @@ | |||
{% set _has_filters = _entity_config.list.filters|default(false) %} | |||
{% block body_id 'easyadmin-list-' ~ _entity_config.name %} | |||
{#{% block body_class 'list list-' ~ _entity_config.name|lower %}#} | |||
{# {% block body_class 'list list-' ~ _entity_config.name|lower %} #} | |||
{% block content_title %} | |||
{% apply spaceless %} | |||
@@ -42,7 +43,7 @@ | |||
{% endblock %} | |||
{% block global_actions %} | |||
{#{% if easyadmin_action_is_enabled_for_list_view('new', _entity_config.name) %} | |||
{# {% if easyadmin_action_is_enabled_for_list_view('new', _entity_config.name) %} | |||
{% set _action = easyadmin_get_action_for_list_view('new', _entity_config.name) %} | |||
{% block new_action %} | |||
<div class="button-action"> | |||
@@ -54,7 +55,7 @@ | |||
</a> | |||
</div> | |||
{% endblock new_action %} | |||
{% endif %}#} | |||
{% endif %} #} | |||
{% endblock global_actions %} | |||
{% block batch_actions %} | |||
@@ -86,15 +87,22 @@ | |||
{% set _fields_visible_by_user = fields|filter((metadata, field) => easyadmin_is_granted(metadata.permission)) %} | |||
{% set _number_of_hidden_results = 0 %} | |||
{% set _list_item_actions = easyadmin_get_actions_for_list_item(_entity_config.name) %} | |||
<div class="row"> | |||
<div class="row" id="{% block list_id %}{% endblock %}"> | |||
<div class="col-12"> | |||
<div class="card card-outline card-primary"> | |||
<div class="card-header"> | |||
{% block card_header %} | |||
<h2 class="card-title text-lg "> | |||
<div class="btn-group"> | |||
{% set itemsPerPage = [10,20,30,50,100,200] %} | |||
{% for itemPerPage in itemsPerPage %} | |||
<a href="{{ path('easyadmin', _request_parameters|merge({ maxResults: itemPerPage, page : "1" })) }}" | |||
class="btn btn-sm {{ paginator.maxPerPage == itemPerPage ? 'btn-outline-secondary' : 'btn-secondary' }}">{{ itemPerPage }}</a> | |||
{% endfor %} | |||
</div> | |||
{% block paginator_nb_results %} | |||
{#{{ "list.title"|trans({'%label%' : _entity_config['label']|lower }) }}#} | |||
{# {{ "list.title"|trans({'%label%' : _entity_config['label']|lower }) }} #} | |||
{% if paginator.nbResultsTotal != paginator.nbResults %} | |||
<span data-toggle="tooltip" title="{{ "list.nbResultsFiltered"|trans }}" | |||
class="badge badge-info">{{ paginator.nbResults }} <i | |||
@@ -208,8 +216,19 @@ | |||
{% set nextSortDirection = isSortingField ? (app.request.get('sortDirection') == 'DESC' ? 'ASC' : 'DESC') : 'DESC' %} | |||
{% set _column_label = metadata.label|trans(_trans_parameters) %} | |||
{% set _column_icon = isSortingField ? (nextSortDirection == 'DESC' ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %} | |||
{% set isFilteredField = false %} | |||
{% if filters_form[field] is defined and filters_form[field].vars.value is not empty %} | |||
{% if (metadata['dataType'] == 'datetime' or metadata['dataType'] == 'date') %} | |||
{% if filters_form[field]['dateStart'].vars.value is not empty and filters_form[field]['dateEnd'].vars.value is not empty %} | |||
{% set isFilteredField = true %} | |||
{% endif %} | |||
{% else %} | |||
{% set isFilteredField = true %} | |||
{% endif %} | |||
{% endif %} | |||
<th class="{{ isSortingField ? 'sorted' }} {{ metadata.virtual ? 'virtual' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
<th class="{{ isSortingField ? 'sorted' }} {{ isFilteredField ? 'filtered': '' }} {{ metadata.virtual ? 'virtual' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
{% if metadata.sortable %} | |||
<a href="{{ path('easyadmin', _request_parameters|merge({ page: 1, sortField: metadata.property, sortDirection: nextSortDirection })) }}"> | |||
{{ _column_label|raw }} <i class="fa fa-fw {{ _column_icon }}"></i> | |||
@@ -228,6 +247,7 @@ | |||
</tr> | |||
{% endblock table_head %} | |||
{% block table_filters %} | |||
{% set fieldAreNotEmpty = false %} | |||
{% if filters_form is defined %} | |||
<tr class="table-filters-line"> | |||
{% if _has_batch_actions %} | |||
@@ -236,6 +256,8 @@ | |||
<th> | |||
{% if filters_form[field] is defined %} | |||
{% if filters_form[field].vars.value is not null and filters_form[field].vars.value is not empty %}{% set fieldAreNotEmpty = true %}{% endif %} | |||
{% if metadata['dataType'] == 'datetime' or metadata['dataType'] == 'date' %} | |||
<div class="input-group input-group-sm"> | |||
<input type="text" | |||
@@ -273,8 +295,8 @@ | |||
aria-label="{{ "action.apply"|trans({}, 'lcshop') }}"> | |||
<i class="fa fa-search"></i> | |||
</button> | |||
{% if filters_form.vars.submitted %} | |||
<a href="{{ path('easyadmin', {action: app.request.get('action'), entity: _entity_config.name}) }}" | |||
{% if filters_form.vars.submitted or fieldAreNotEmpty %} | |||
<a href="{{ path('easyadmin', _request_parameters|merge({ 'filterClear' : 'clearAll', list_filter : null, referer : null })) }}" | |||
class="btn btn-sm btn-warning lc-reset-filters" | |||
data-toggle="tooltip" | |||
title="{{ "action.reset"|trans({}, 'lcshop') }}" | |||
@@ -305,7 +327,7 @@ | |||
{% else %} | |||
{# the empty string concatenation is needed when the primary key is an object (e.g. an Uuid object) #} | |||
{% set _item_id = '' ~ attribute(item, _entity_config.primary_key_field_name) %} | |||
<tr data-id="{{ _item_id }}"> | |||
<tr id="tr-entity-id-{{ _item_id }}" data-id="{{ _item_id }}"> | |||
{% if _has_batch_actions %} | |||
<td><input type="checkbox" class="form-batch-checkbox" | |||
value="{{ _item_id }}"></td> | |||
@@ -317,13 +339,15 @@ | |||
<td class="{{ isSortingField ? 'sorted' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
{% if (field == 'title' or field== 'id') and (metadata.dataType=="string" or metadata.dataType=="integer") %} | |||
{% if (field == 'title' or field== 'id') and (metadata.dataType=="string" or metadata.dataType=="integer") and _entity_config.name != 'ProductFamilyAdvancedEditing' %} | |||
<a class="link-as-text" | |||
href="{{ path('easyadmin', _request_parameters|merge({ action: 'edit', id: item.id })) }}"> | |||
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} | |||
</a> | |||
{% else %} | |||
{# {% if metadatafieldName =="supplier" %} | |||
{{ dump(metadata) }} | |||
{% endif %} #} | |||
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} | |||
{% endif %} | |||
</td> | |||
@@ -430,7 +454,7 @@ | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/daterange/daterangepicker.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/jquery.highlight.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/autocomplete/bootstrap-autocomplete.min.js') }}"></script> | |||
{#<script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/responsive.bootstrap4.min.js') }}"></script>#} | |||
{# <script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/responsive.bootstrap4.min.js') }}"></script> #} | |||
{% endblock %} | |||
{% block script_javascript %} | |||
@@ -439,6 +463,8 @@ | |||
<script type="text/javascript"> | |||
$(document).ready(function () { | |||
const toggles = document.querySelectorAll('.custom-switch input[type="checkbox"]'); | |||
for (i = 0; i < toggles.length; i++) { |
@@ -233,12 +233,12 @@ | |||
{% set _translation_domain = easyadmin.entity.translation_domain %} | |||
{% set _trans_parameters = { '%entity_name%': easyadmin.entity.name|trans(domain = _translation_domain), '%entity_label%': easyadmin.entity.label|trans(domain = _translation_domain) } %} | |||
{# the 'save' action is hardcoded for the 'edit' and 'new' views #} | |||
<button type="submit" name="save_and_leave" class="btn btn-primary action-save"> | |||
<span class="btn-label">{{ 'action.save'|trans(_trans_parameters, _translation_domain) }}</span> | |||
</button> | |||
{% if easyadmin.entity.name =='ProductFamily' %} | |||
<button name="submitAndStay" value="1" type="submit" class="btn btn-success action-save"> | |||
<button name="submitAndStay" value="1" type="submit" class="btn btn-success action-save action-save-and-stay"> | |||
<span class="btn-label">{{ 'action.saveAndStay'|trans(_trans_parameters, _translation_domain) }}</span> | |||
</button> | |||
{% endif %} |
@@ -45,7 +45,9 @@ | |||
<div v-show="currentSection == 'maintenance'" class="panel panel-default"> | |||
{% include '@LcShop/backend/merchant/panel_maintenance.html.twig' %} | |||
</div> | |||
<div v-show="currentSection == 'lunch'" class="panel panel-default"> | |||
{% include '@LcShop/backend/merchant/panel_lunch.html.twig' %} | |||
</div> | |||
</div> | |||
</div> |
@@ -0,0 +1,18 @@ | |||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||
<div class="row"> | |||
<div class="col-8"> | |||
{{ macros.card_start('Merchant.lunch','light') }} | |||
{% if form.merchantConfigs['message-lunch-open'] is defined %} | |||
<div class="col-12"> | |||
{{ form_row(form.merchantConfigs['message-lunch-open']) }} | |||
</div> | |||
{% endif %} | |||
{% if form.merchantConfigs['message-lunch-closed'] is defined %} | |||
<div class="col-12"> | |||
{{ form_row(form.merchantConfigs['message-lunch-closed']) }} | |||
</div> | |||
{% endif %} | |||
{{ macros.card_end() }} | |||
</div> | |||
</div> |
@@ -3,6 +3,17 @@ | |||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||
{% import '@LcShop/backend/order/macros.html.twig' as order_macros %} | |||
{% block global_actions %} | |||
{% if entity.user is not null %} | |||
<button id="btn-ticket-write-to-user" | |||
data-url="{{ path('easyadmin', {'entity': 'Ticket', 'action': 'new'}) }}" | |||
data-user="{{ entity.user.id }}" | |||
class="btn-sm btn-success" | |||
type="button"><i class="fa fa-pen-alt"></i> {{ "action.ticket.writeToUser"|trans }} | |||
</button> | |||
{% endif %} | |||
{% endblock %} | |||
{% block main %} | |||
<div class="lc-vue-js-container" id="lc-order-edit"> |
@@ -3,6 +3,18 @@ | |||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||
{% import '@LcShop/backend/order/macros.html.twig' as order_macros %} | |||
{% block global_actions %} | |||
{% if entity.user is not null %} | |||
<button id="btn-ticket-write-to-user" | |||
data-url="{{ path('easyadmin', {'entity': 'Ticket', 'action': 'new'}) }}" | |||
data-user="{{ entity.user.id }}" | |||
data-order="{{ entity.id }}" | |||
class="btn-sm btn-success" | |||
type="button"><i class="fa fa-pen-alt"></i> {{ "action.ticket.writeToUser"|trans }} | |||
</button> | |||
{% endif %} | |||
{% endblock %} | |||
{% block main %} | |||
<div class="lc-vue-js-container" id="lc-order-edit"> |
@@ -1,4 +1,6 @@ | |||
{% extends app.request.query.get('action') == 'edit' ? '@LcShop/backend/default/edit.html.twig' : '@LcShop/backend/default/new.html.twig' %} | |||
{% extends app.request.query.get('action') == 'edit' | |||
? (app.request.query.get('ajax') == 1 ? '@LcShop/backend/default/edit-ajax.html.twig' : '@LcShop/backend/default/edit.html.twig') | |||
: '@LcShop/backend/default/new.html.twig' %} | |||
{% block entity_form %} | |||
{% include '@LcShop/backend/productfamily/form.html.twig' %} | |||
@@ -20,5 +22,8 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/productfamily/vuejs-product-family.js')|lc_cache }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/productfamily/vuejs-product-family.js') }}"></script> | |||
<script> | |||
lcInitProductFamily() ; | |||
</script> | |||
{% endblock %} |
@@ -3,9 +3,8 @@ | |||
{% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %} | |||
{% set formValues = form.vars.value %} | |||
<div id="lc-product-family-edit"> | |||
<div class="card card-light"> | |||
<div id="lc-product-family-edit" class="{% if app.request.query.get('inAdvancedEditingTable') %}in-advanced-editing-table{% endif %}"> | |||
<div class="card card-light card-sections"> | |||
<div class="lc-vue-js-container card-header p-0 border-bottom-0"> | |||
<ul class="nav nav-tabs" id="nav-params"> | |||
<li class="nav-item" v-for="section in sectionsArray"> | |||
@@ -18,7 +17,6 @@ | |||
<span class="glyphicon glyphicon-triangle-bottom"></span> | |||
<i class="fa fa-exclamation-circle invalid-form"></i> | |||
</a> | |||
</li> | |||
</ul> | |||
</div> | |||
@@ -50,6 +48,9 @@ | |||
{% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %} | |||
{% if formValues.giftVoucherActive %}giftVoucherActive: "{{ formValues.giftVoucherActive }}",{% endif %} | |||
{% if formValues.productsQuantityAsTitle %}productsQuantityAsTitle: {{ formValues.productsQuantityAsTitle }},{% endif %} | |||
{% set current_section = app.request.query.get('currentSection') %} | |||
{% if current_section is defined and current_section|length > 0 %}currentSection: "{{ current_section }}",{% endif %} | |||
{% if form.sections.vars.value %}section: {{ form.sections.vars.value[0] }},{% endif %} | |||
}; | |||
multiplyingFactor = "{{ form.multiplyingFactor.vars.value }}" | |||
@@ -104,7 +105,7 @@ | |||
</div> | |||
</div> | |||
{% if entity.note|striptags !="" %} | |||
<div class="row"> | |||
<div class="row row-note"> | |||
{{ macros.startCard(12, 'ProductFamily.note', 'light') }} | |||
{{ entity.note|raw }} | |||
{{ macros.endCard() }} | |||
@@ -114,7 +115,6 @@ | |||
</div> | |||
{{ form_widget(form.stayOnPage, {"attr": {"v-model": "stayOnPage"}}) }} | |||
</div> | |||
{{ form_end(form) }} | |||
@@ -23,7 +23,7 @@ | |||
{{ productFamily.unit.unitReference }} | |||
{% endif %} | |||
</strong> | |||
</span> | |||
</span> | |||
<br /> | |||
{% endfor %} | |||
{% endmacro total_order_product_family %} |
@@ -3,13 +3,32 @@ | |||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||
<div class="row"> | |||
{{ macros.startCard(8, 'ProductFamily.main','light') }} | |||
<div class="col-12"> | |||
{{ macros.startCard(8, 'ProductFamily.status','light') }} | |||
<div class="col-6"> | |||
{{ form_row(form.status) }} | |||
</div> | |||
<div class="col-12"> | |||
<div class="col-6"> | |||
<label>Status de vente</label> | |||
{{ form_row(form.saleStatus) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_label(form.sections) }} | |||
{% for section in form.sections %} | |||
<div class="form-check"> | |||
<label class="form-check-label" for="{{ section.vars.id }}"> | |||
<input v-model="section" type="radio" id="{{ section.vars.id }}" name="{{ section.vars.full_name }}" class="form-check-input" value="{{ section.vars.value }}" {{ section.vars.checked == true ? 'checked="checked"' : '' }}> | |||
<span class="checkmark"></span> | |||
{{ section.vars.label }} | |||
</label> | |||
</div> | |||
{% endfor %} | |||
{% do form.sections.setRendered %} | |||
</div> | |||
{{ macros.endCard() }} | |||
{{ macros.startCard(8, 'ProductFamily.main','light') }} | |||
<div class="col-12"> | |||
{{ form_row(form.supplier) }} | |||
</div> | |||
@@ -41,7 +60,7 @@ | |||
<div class="col-12 product-categories"> | |||
{% for category in form.productCategories %} | |||
<div class="field {{ category.vars.disabled ? 'parent' }}"> | |||
<div class="field {{ category.vars.disabled ? 'parent' }}"> | |||
{{ form_row(category) }} | |||
</div> | |||
@@ -1,9 +1,9 @@ | |||
{% set lastMessage = item.ticketMessages.last %} | |||
{% if lastMessage.answerByAdmin != true %} | |||
<span class="badge badge-danger"> | |||
{% if lastMessage %} | |||
{% if lastMessage.answerByAdmin != true %} | |||
<span class="badge badge-danger"> | |||
New | |||
</span> | |||
</span> | |||
{% endif %} | |||
{{ lastMessage.createdAt|date('d/m/Y H:i') }} par {{ lastMessage.createdBy }} | |||
{% endif %} | |||
{{ lastMessage.createdAt|date('d/m/Y H:i') }} par {{ lastMessage.createdBy }} |
@@ -0,0 +1,38 @@ | |||
{% embed "@LcShop/backend/default/block/embed_modal.twig" %} | |||
{% trans_default_domain 'lcshop' %} | |||
{% block id %}modal-new-ticket{% endblock %} | |||
{% block title %}{{ "action.ticket.writeToUser"|trans }}{% endblock %} | |||
{% block form_start %} | |||
{{ form_start(form, {'attr': { 'id' : 'newTicket', 'action': path('easyadmin', {'entity' : 'Ticket', 'action': 'new'})}}) }} | |||
{% form_theme form '@LcShop/backend/form/custom_modal_bootstrap_4.html.twig' %} | |||
{% endblock %} | |||
{% block content %} | |||
<div class="col"> | |||
{{ form_row(form.user) }} | |||
{{ form_row(form.subject) }} | |||
{% if form.orderId.vars.value is not empty %} | |||
<p> | |||
<strong>Ce ticket concernera la commande #{{ form.orderId.vars.value }}</strong><br /> | |||
<i>Si vous ne le souhaitez pas, écrivez à l'utilisateur depuis l'onglet utilisateur</i> | |||
</p> | |||
{% endif %} | |||
{{ form_rest(form) }} | |||
</div> | |||
{% endblock %} | |||
{% block footer %} | |||
{{ parent() }} | |||
<button type="button" class="btn btn-primary btn-save" >{{ 'action.send'|trans }}</button> | |||
{#{{ form_rest(form) }}#} | |||
{% endblock %} | |||
{% block form_end %} | |||
{{ form_end(form) }} | |||
{% endblock %} | |||
{% endembed %} |
@@ -1,31 +1,44 @@ | |||
{% extends app.request.query.get('action') == 'edit' ? '@LcShop/backend/default/edit.html.twig' : '@LcShop/backend/default/new.html.twig' %} | |||
{% extends app.request.query.get('action') == 'edit' ? '@LcShop/backend/default/edit.html.twig' : '@LcShop/backend/default/new.html.twig' %} | |||
{% trans_default_domain 'lcshop' %} | |||
{% block global_actions %} | |||
<button id="btn-ticket-write-to-user" | |||
data-url="{{ path('easyadmin', {'entity': 'Ticket', 'action': 'new'}) }}" | |||
data-user="{{ entity.id }}" | |||
class="btn-sm btn-success" | |||
type="button"><i class="fa fa-pen-alt"></i> {{ "action.ticket.writeToUser"|trans }}</button> | |||
{% endblock %} | |||
{% block entity_form %} | |||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||
{{ form_start(form) }} | |||
{% form_theme form '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||
<div class="row"> | |||
<div class="col-7"> | |||
{{ macros.card_start() }} | |||
<div class="col"> | |||
{% for field in form.children %} | |||
{{ form_row(field) }} | |||
{% endfor %} | |||
</div> | |||
{{ macros.card_end() }} | |||
</div> | |||
<div class="col-7"> | |||
{{ macros.card_start() }} | |||
<div class="col"> | |||
{% for field in form.children %} | |||
{{ form_row(field) }} | |||
{% endfor %} | |||
</div> | |||
{{ macros.card_end() }} | |||
</div> | |||
<div class="col-5"> | |||
<div class="row" id="user-addresses"> | |||
{% for address in entity.addresses %} | |||
{% if address.status >=0 %} | |||
{% include '@LcShop/backend/user/block_useraddress.html.twig' %} | |||
{% endif %} | |||
{% endfor %} | |||
{% for address in entity.addresses %} | |||
{% if address.status >=0 %} | |||
{% include '@LcShop/backend/user/block_useraddress.html.twig' %} | |||
{% endif %} | |||
{% endfor %} | |||
</div> | |||
<button type="button" data-url="{{ path('easyadmin', {"action": 'editAddressUser', 'entity': 'User', 'id': entity.id, 'addressId': 'new'}) }}" | |||
class="btn btn-primary btn-add-user-address" ><i class="fa fa-plus"></i> {{ 'action.address.add'|trans }} | |||
<button type="button" | |||
data-url="{{ path('easyadmin', {"action": 'editAddressUser', 'entity': 'User', 'id': entity.id, 'addressId': 'new'}) }}" | |||
class="btn btn-primary btn-add-user-address"><i | |||
class="fa fa-plus"></i> {{ 'action.address.add'|trans }} | |||
</button> | |||
</div> |
@@ -1,6 +1,15 @@ | |||
{% extends '@LcShop/backend/default/show.html.twig' %} | |||
{% trans_default_domain 'lcshop' %} | |||
{% block global_actions %} | |||
<button id="btn-ticket-write-to-user" | |||
data-url="{{ path('easyadmin', {'entity': 'Ticket', 'action': 'new'}) }}" | |||
data-user="{{ entity.user.id }}" | |||
class="btn-sm btn-success" | |||
type="button"><i class="fa fa-pen-alt"></i> {{ "action.ticket.writeToUser"|trans }}</button> | |||
{% endblock %} | |||
{% block main %} | |||
<div class="row"> | |||
@@ -38,10 +47,10 @@ | |||
<td class="sorted">{{ creditHistory.id }}</td> | |||
<td class="association">{{ creditHistory.type }}</td> | |||
<td class="">{{ creditHistory.amountInherited }} €</td> | |||
<td class="">{{ creditHistory.meanPaymentInherited }}</td> | |||
<td class="">{{ creditHistory.meanPaymentInherited }}</td> | |||
<td class="">{{ creditHistory.paidAtInherited |date('d-m-y') }}</td> | |||
<td class="">{{ creditHistory.referenceInherited }}</td> | |||
<td class="">{{ creditHistory.commentInherited }}</td> | |||
<td class="">{{ creditHistory.referenceInherited }}</td> | |||
<td class="">{{ creditHistory.commentInherited }}</td> | |||
</tr> | |||
{% else %} | |||
@@ -64,7 +73,8 @@ | |||
{% block head_stylesheets %} | |||
{{ parent() }} | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/datatables/fixedHeader.dataTables.min.css') }}"> | |||
<link rel="stylesheet" | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/datatables/fixedHeader.dataTables.min.css') }}"> | |||
<link rel="stylesheet" | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/datatables/dataTables.bootstrap4.min.css') }}"> | |||
{% endblock %} |
@@ -13,12 +13,15 @@ use Lc\ShopBundle\Context\OrderStatusHistoryInterface; | |||
use Lc\ShopBundle\Context\PriceUtilsInterface; | |||
use Lc\ShopBundle\Context\ProductFamilyUtilsInterface; | |||
use Lc\ShopBundle\Context\ReductionCreditInterface; | |||
use Lc\ShopBundle\Context\SectionInterface; | |||
use Lc\ShopBundle\Context\SectionUtilsInterface; | |||
use Lc\ShopBundle\Context\UserUtilsInterface; | |||
use Lc\ShopBundle\Model\ProductFamily; | |||
use Lc\ShopBundle\Services\CreditUtils; | |||
use Lc\ShopBundle\Services\DocumentUtils; | |||
use Lc\ShopBundle\Services\UserUtils; | |||
use Lc\ShopBundle\Services\Utils; | |||
use Lc\ShopBundle\Services\UtilsManager; | |||
use Symfony\Component\Routing\RouterInterface; | |||
use Symfony\Component\Security\Core\Security; | |||
@@ -45,10 +48,11 @@ class OrderUtils | |||
protected $utils; | |||
protected $creditUtils; | |||
protected $router; | |||
protected $sectionUtils ; | |||
public function __construct(EntityManagerInterface $em, Security $security, RouterInterface $router, UserUtilsInterface $userUtils, | |||
MerchantUtilsInterface $merchantUtils, PriceUtilsInterface $priceUtils, ProductFamilyUtilsInterface $productFamilyUtils, | |||
DocumentUtils $documentUtils, Utils $utils, CreditUtils $creditUtils) | |||
DocumentUtils $documentUtils, Utils $utils, CreditUtils $creditUtils, SectionUtilsInterface $sectionUtils) | |||
{ | |||
$this->em = $em; | |||
$this->security = $security; | |||
@@ -64,10 +68,9 @@ class OrderUtils | |||
$this->utils = $utils; | |||
$this->creditUtils = $creditUtils; | |||
$this->router = $router; | |||
$this->sectionUtils = $sectionUtils ; | |||
} | |||
public function createOrderShop($params) | |||
{ | |||
//TODO vérifier que l'utilisateur n'a pas déjà une commande en cours | |||
@@ -93,6 +96,15 @@ class OrderUtils | |||
throw new \ErrorException('La commande doit être liée à un merchant.'); | |||
} | |||
// pour le moment, à la création, on lie simplement la commande à la section "Marché" | |||
$section = $this->sectionUtils->getSectionMarket() ; | |||
if($section) { | |||
$orderShop->setSection($section) ; | |||
} | |||
else { | |||
throw new \ErrorException('La commande doit être liée à une section.'); | |||
} | |||
$orderShop = $this->changeOrderStatus('cart', $orderShop); | |||
return $orderShop; | |||
@@ -100,10 +112,8 @@ class OrderUtils | |||
public function addOrderProduct($orderShop, $orderProductAdd, $persist = true) | |||
{ | |||
$return = false; | |||
if (!$orderShop) { | |||
$user = $this->security->getUser(); | |||
$visitor = $this->userUtils->getVisitorCurrent(); | |||
@@ -111,7 +121,7 @@ class OrderUtils | |||
$orderShop = $this->createOrderShop([ | |||
'user' => $user, | |||
'visitor' => $visitor, | |||
'merchant' => $this->merchantUtils->getMerchantCurrent() | |||
'merchant' => $this->merchantUtils->getMerchantCurrent(), | |||
]); | |||
} | |||
@@ -2,7 +2,6 @@ | |||
namespace Lc\ShopBundle\Services\Order; | |||
use Lc\ShopBundle\Context\OrderShopInterface; | |||
use Lc\ShopBundle\Model\OrderStatus; | |||
@@ -64,10 +63,12 @@ trait OrderUtilsCartTrait | |||
} | |||
if($createIfNotExist && !$orderShop) { | |||
$merchant = $this->merchantUtils->getMerchantCurrent() ; | |||
$orderShop = $this->createOrderShop([ | |||
'user' => $user, | |||
'visitor' => $visitor, | |||
'merchant' => $this->merchantUtils->getMerchantCurrent() | |||
'merchant' => $merchant, | |||
]); | |||
} | |||
@@ -65,16 +65,33 @@ trait OrderUtilsStockTrait | |||
} | |||
$allCategoriesSalesOff = true; | |||
$unavailableSpecificDay = false; | |||
foreach ($product->getProductFamily()->getProductCategories() as $category){ | |||
if($category->getParent()) { | |||
if($category->getSaleStatus() && $category->getParent()->getSaleStatus()) | |||
$allCategoriesSalesOff = false; | |||
} | |||
else { | |||
if($category->getSaleStatus()) $allCategoriesSalesOff = false; | |||
if($category->getSaleStatus()) { | |||
$allCategoriesSalesOff = false; | |||
} | |||
} | |||
// specific day | |||
$displaySpecificDay = $category->getDisplaySpecificDay() ; | |||
if($displaySpecificDay && $displaySpecificDay != date('N')) { | |||
$unavailableSpecificDay = true; | |||
} | |||
} | |||
if($allCategoriesSalesOff) { | |||
return false; | |||
} | |||
if($unavailableSpecificDay) { | |||
return false; | |||
} | |||
if($allCategoriesSalesOff) return false; | |||
return true ; | |||
} |
@@ -79,19 +79,42 @@ class ProductPriceUtils | |||
public function getBuyingPrice(ProductPropertyInterface $product) | |||
{ | |||
if ($product->getBehaviorPriceInherited() == 'by-piece') { | |||
return $product->getBuyingPriceInherited(); | |||
return $product->getBuyingPriceInherited() ; | |||
} | |||
elseif ($product->getBehaviorPriceInherited() == 'by-reference-unit') { | |||
if ($product->getQuantityInherited() > 0) { | |||
return $product->getBuyingPriceByRefUnitInherited() * ($product->getQuantityInherited() / $product->getUnitInherited()->getCoefficient()); | |||
}else{ | |||
} | |||
else { | |||
return 0; | |||
} | |||
} | |||
} | |||
public function getMultiplyingFactor(ProductPropertyInterface $product){ | |||
public function getBuyingPriceWithTax(ProductPropertyInterface $product) | |||
{ | |||
return $this->applyTax( | |||
$this->getBuyingPrice($product), | |||
$product->getTaxRateInherited()->getValue() | |||
); | |||
} | |||
public function getBuyingPriceByRefUnit(ProductPropertyInterface $product) | |||
{ | |||
return $product->getBuyingPriceByRefUnitInherited() ; | |||
} | |||
public function getBuyingPriceByRefUnitWithTax(ProductPropertyInterface $product) | |||
{ | |||
return $this->applyTax( | |||
$this->getBuyingPriceByRefUnit($product), | |||
$product->getTaxRateInherited()->getValue() | |||
); | |||
} | |||
public function getMultiplyingFactor(ProductPropertyInterface $product) | |||
{ | |||
return $this->round($this->getPriceWithTax($product) / $this->getBuyingPrice($product)); | |||
} | |||
@@ -181,4 +181,19 @@ class ProductFamilyUtils | |||
} | |||
} | |||
public function getMultiplyingFactor($productFamily) | |||
{ | |||
if($productFamily->getBehaviorPrice() == ProductFamily::BEHAVIOR_PRICE_BY_PIECE) { | |||
if($productFamily->getBuyingPrice() > 0) { | |||
return number_format($this->priceUtils->getPriceWithTax($productFamily) / $productFamily->getBuyingPrice(), 3) ; | |||
} | |||
} | |||
elseif($productFamily->getBehaviorPrice() == ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) { | |||
if($productFamily->getBuyingPriceByRefUnit() > 0) { | |||
return number_format($this->priceUtils->getPriceByRefUnitWithTax($productFamily) / $productFamily->getBuyingPriceByRefUnit(), 3) ; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,37 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Services ; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Http\Discovery\Exception\NotFoundException; | |||
use Lc\ShopBundle\Context\MerchantUtilsInterface; | |||
use Lc\ShopBundle\Context\SectionInterface; | |||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | |||
class SectionUtils | |||
{ | |||
protected $em ; | |||
protected $merchantUtils ; | |||
protected $sectionRepository ; | |||
public function __construct(EntityManagerInterface $em, MerchantUtilsInterface $merchantUtils) | |||
{ | |||
$this->em = $em ; | |||
$this->sectionRepository = $this->em->getRepository($this->em->getClassMetadata(SectionInterface::class)->getName()) ; | |||
$this->merchantUtils = $merchantUtils ; | |||
} | |||
public function getSection($devAlias) | |||
{ | |||
$section = $this->sectionRepository->findOneBy([ | |||
'merchant' => $this->merchantUtils->getMerchantCurrent(), | |||
'devAlias' => $devAlias | |||
]) ; | |||
if(!$section) { | |||
throw new NotFoundException('La section '.$devAlias.' est introuvable') ; | |||
} | |||
return $section ; | |||
} | |||
} |
@@ -63,20 +63,33 @@ class TicketUtils | |||
$ticketMessage->setStatus(1) ; | |||
$ticketMessage->setTicket($ticket) ; | |||
$ticketMessage->setMessage($params['message']) ; | |||
if(isset($params['createByAdmin']) && $params['createByAdmin'])$ticketMessage->setAnswerByAdmin(true); | |||
$this->em->persist($ticketMessage); | |||
$this->em->flush() ; | |||
// envoi email au client | |||
$this->mailUtils->send([ | |||
MailUtils::SUBJECT => 'Nouvelle demande', | |||
MailUtils::TO_EMAIL => $email, | |||
MailUtils::CONTENT_TEMPLATE => 'mail/ticket-new', | |||
MailUtils::CONTENT_DATA => [ | |||
'firstname' => $firstname, | |||
'ticket' => $ticket | |||
], | |||
]) ; | |||
if(isset($params['createByAdmin']) && $params['createByAdmin']) { | |||
// envoi email au client | |||
$this->mailUtils->send([ | |||
MailUtils::SUBJECT => 'Vous avez reçu un nouveau message', | |||
MailUtils::TO_EMAIL => $email, | |||
MailUtils::CONTENT_TEMPLATE => 'mail/ticket-new-by-admin', | |||
MailUtils::CONTENT_DATA => [ | |||
'firstname' => $firstname, | |||
'ticket' => $ticket | |||
], | |||
]); | |||
}else{ | |||
$this->mailUtils->send([ | |||
MailUtils::SUBJECT => 'Nouvelle demande', | |||
MailUtils::TO_EMAIL => $email, | |||
MailUtils::CONTENT_TEMPLATE => 'mail/ticket-new', | |||
MailUtils::CONTENT_DATA => [ | |||
'firstname' => $firstname, | |||
'ticket' => $ticket | |||
], | |||
]); | |||
} | |||
$this->notifyAdmin($ticket, $ticketMessage); |
@@ -559,4 +559,13 @@ class Utils | |||
]); | |||
} | |||
public function urlEncryptData($datas){ | |||
$key = 'secretToken'; | |||
foreach ($datas as $data) { | |||
$key .= $data; | |||
} | |||
return md5($key); | |||
} | |||
} |
@@ -8,6 +8,7 @@ use Lc\ShopBundle\Context\MerchantUtilsInterface; | |||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||
use Lc\ShopBundle\Context\PriceUtilsInterface; | |||
use Lc\ShopBundle\Context\ProductFamilyUtilsInterface; | |||
use Lc\ShopBundle\Context\SectionUtilsInterface; | |||
use Lc\ShopBundle\Context\Services\StatisticsUtilsInterface; | |||
use Lc\ShopBundle\Context\UserUtilsInterface; | |||
use League\Flysystem\Util; | |||
@@ -27,6 +28,7 @@ class UtilsManager | |||
protected $ticketUtils ; | |||
protected $statisticsUtils; | |||
protected $pointLocationUtils ; | |||
protected $sectionUtils ; | |||
public function __construct( | |||
Utils $utils, | |||
@@ -41,7 +43,8 @@ class UtilsManager | |||
MailUtils $mailUtils, | |||
TicketUtils $ticketUtils, | |||
PointLocationUtils $pointLocationUtils, | |||
UtilsProcess $utilsProcess | |||
UtilsProcess $utilsProcess, | |||
SectionUtilsInterface $sectionUtils | |||
) | |||
{ | |||
$this->utils = $utils ; | |||
@@ -57,6 +60,7 @@ class UtilsManager | |||
$this->ticketUtils = $ticketUtils ; | |||
$this->pointLocationUtils = $pointLocationUtils ; | |||
$this->utilsProcess = $utilsProcess ; | |||
$this->sectionUtils = $sectionUtils ; | |||
} | |||
public function getUtils(): Utils | |||
@@ -124,4 +128,9 @@ class UtilsManager | |||
return $this->utilsProcess ; | |||
} | |||
public function getSectionUtils(): SectionUtilsInterface | |||
{ | |||
return $this->sectionUtils ; | |||
} | |||
} |