Bladeren bron

Merge branch 'develop'

master
Guillaume 4 jaren geleden
bovenliggende
commit
73f21a1338
53 gewijzigde bestanden met toevoegingen van 664 en 656 verwijderingen
  1. +28
    -2
      ShopBundle/Controller/AddressApiController.php
  2. +37
    -3
      ShopBundle/Controller/Backend/AdminController.php
  3. +1
    -1
      ShopBundle/Controller/Backend/MerchantController.php
  4. +1
    -1
      ShopBundle/Controller/Backend/OrderController.php
  5. +98
    -0
      ShopBundle/Controller/Backend/ProductFamilyController.php
  6. +2
    -0
      ShopBundle/Controller/Backend/ReminderController.php
  7. +15
    -0
      ShopBundle/Controller/Backend/TicketController.php
  8. +47
    -0
      ShopBundle/EventSubscriber/InitializeEventSubscriber.php
  9. +7
    -0
      ShopBundle/Form/Frontend/TicketType.php
  10. +0
    -1
      ShopBundle/Listener/MailLoggerListener.php
  11. +10
    -3
      ShopBundle/Model/ProductFamily.php
  12. +1
    -1
      ShopBundle/Model/User.php
  13. +3
    -0
      ShopBundle/Repository/ProductFamilyRepository.php
  14. +0
    -0
      ShopBundle/Resources/public/css/backend/adminlte/adminlte.min.css
  15. +0
    -0
      ShopBundle/Resources/public/css/backend/adminlte/adminlte.min.css.map
  16. +0
    -0
      ShopBundle/Resources/public/css/backend/adminlte/plugins/noty/plugin-noty-animate.css
  17. +4
    -0
      ShopBundle/Resources/public/js/backend/script/default/init-common.js
  18. +8
    -3
      ShopBundle/Resources/public/js/backend/script/default/init-sort.js
  19. +1
    -1
      ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js
  20. +13
    -0
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  21. +0
    -37
      ShopBundle/Resources/public/js/backend/script/supplier/vuejs-supplier.js
  22. +2
    -1
      ShopBundle/Resources/translations/lcshop.fr.yaml
  23. +13
    -7
      ShopBundle/Resources/views/backend/default/block/action.html.twig
  24. +7
    -0
      ShopBundle/Resources/views/backend/default/block/action_duplicate_other_hub.html.twig
  25. +3
    -0
      ShopBundle/Resources/views/backend/default/block/embed_box.twig
  26. +27
    -6
      ShopBundle/Resources/views/backend/default/block/flash_messages.html.twig
  27. +1
    -1
      ShopBundle/Resources/views/backend/default/layout/layout.html.twig
  28. +4
    -2
      ShopBundle/Resources/views/backend/default/list-fields/field_product_family_available_quantity.html.twig
  29. +2
    -2
      ShopBundle/Resources/views/backend/default/list-fields/field_toggle.html.twig
  30. +3
    -0
      ShopBundle/Resources/views/backend/default/list-fields/list_association_users.html.twig
  31. +6
    -1
      ShopBundle/Resources/views/backend/merchant/panel_delivery.html.twig
  32. +145
    -79
      ShopBundle/Resources/views/backend/order/macros.html.twig
  33. +2
    -2
      ShopBundle/Resources/views/backend/order/show-cart.html.twig
  34. +2
    -2
      ShopBundle/Resources/views/backend/order/show-order.html.twig
  35. +2
    -3
      ShopBundle/Resources/views/backend/order/show.html.twig
  36. +8
    -0
      ShopBundle/Resources/views/backend/productcategory/action_sort_productfamily.html.twig
  37. +4
    -0
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  38. +2
    -2
      ShopBundle/Resources/views/backend/productfamily/panel_property.html.twig
  39. +1
    -1
      ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig
  40. +0
    -13
      ShopBundle/Resources/views/backend/supplier/edit.html.twig
  41. +0
    -42
      ShopBundle/Resources/views/backend/supplier/form.html.twig
  42. +0
    -17
      ShopBundle/Resources/views/backend/supplier/panel_address.html.twig
  43. +0
    -23
      ShopBundle/Resources/views/backend/supplier/panel_general.html.twig
  44. +0
    -14
      ShopBundle/Resources/views/backend/supplier/panel_seo.html.twig
  45. +1
    -0
      ShopBundle/Services/MerchantUtils.php
  46. +16
    -0
      ShopBundle/Services/Order/OrderUtils.php
  47. +69
    -0
      ShopBundle/Services/PointLocationUtils.php
  48. +23
    -13
      ShopBundle/Services/Price/OrderProductPriceUtils.php
  49. +7
    -2
      ShopBundle/Services/Price/PriceUtilsTrait.php
  50. +0
    -368
      ShopBundle/Services/PriceUtils.phpOld
  51. +1
    -1
      ShopBundle/Services/UserUtils.php
  52. +28
    -0
      ShopBundle/Services/Utils.php
  53. +9
    -1
      ShopBundle/Services/UtilsManager.php

ShopBundle/Controller/CitiesController.php → ShopBundle/Controller/AddressApiController.php Bestand weergeven

@@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class CitiesController extends AbstractController
class AddressApiController extends AbstractController
{
protected $utils ;

@@ -17,7 +17,7 @@ class CitiesController extends AbstractController
$this->utils = $utils ;
}

public function index(Request $request) : JsonResponse
public function cities(Request $request) : JsonResponse
{
$term = $request->get('term') ;
$context = $request->get('context') ;
@@ -58,5 +58,31 @@ class CitiesController extends AbstractController
return new JsonResponse($return) ;
}

public function addresses(Request $request) : JsonResponse
{
$return = [] ;
$address = $request->get('address') ;
$context = $request->get('context') ;
$results = $this->utils->callAddressApi($address) ;

foreach($results as $result) {
if($result->getStreetNumber() && strlen($result->getStreetNumber()) > 0) {
$streetNameNumber = $result->getStreetNumber().' '.$result->getStreetName() ;
$return[] = [
'label' => $streetNameNumber,
'value' => $streetNameNumber,
'latitude' => $result->getCoordinates()->getLatitude(),
'longitude' => $result->getCoordinates()->getLongitude()
] ;
}
}

if($context == 'frontend') {
$return = [
'items' => $return
] ;
}

return new JsonResponse($return) ;
}
}

+ 37
- 3
ShopBundle/Controller/Backend/AdminController.php Bestand weergeven

@@ -176,7 +176,7 @@ class AdminController extends EasyAdminController

if ($this->filtersForm->isSubmitted() && $this->filtersForm->isValid()) {
foreach ($listFields as $field) {
if ($this->filtersForm->has($field['property'])) {
if ($this->filtersForm->has($field['property'])) {
switch ($field['dataType']) {
case 'option':
case 'integer':
@@ -344,13 +344,14 @@ class AdminController extends EasyAdminController
foreach ($positionForm->get('entities')->getData() as $elm) {
$this->dispatch(EasyAdminEvents::PRE_UPDATE, ['entity' => $entity]);
$entity = $repo->find($elm['id']);

$entity->setPosition($elm['position']);
$this->em->persist($entity);
$this->dispatch(EasyAdminEvents::POST_UPDATE, ['entity' => $entity]);
$latsPos = $elm['position'];

}
dump($latsPos);

//die();
//die();
//to do récupérer les élements hors ligne et incrémenter position
/*foreach ($repo->findBy(array('status'=> false)) as $offlineEntity) {
@@ -608,5 +609,38 @@ class AdminController extends EasyAdminController

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

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() ;

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

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

$newEntity = clone $entity ;

if($newEntity instanceof ImageInterface){
$newEntity->setImage(null);
}


if ($hub) {
$newEntity->setMerchant($hub);
$user->setMerchant($hub);
$this->em->persist($user);
}
$this->em->persist($newEntity) ;
$this->em->flush() ;

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

return $this->redirect($redirectUrl) ;
}

}


+ 1
- 1
ShopBundle/Controller/Backend/MerchantController.php Bestand weergeven

@@ -100,7 +100,7 @@ class MerchantController extends AdminController
$em->persist($user);
$em->flush();

return $this->redirect($merchant->getMerchantConfig('url').'admin/dashboard') ;
return $this->redirect($merchant->getMerchantConfig('url').'admin/dashboard?hubredirection=true') ;
}
}


+ 1
- 1
ShopBundle/Controller/Backend/OrderController.php Bestand weergeven

@@ -418,7 +418,7 @@ class OrderController extends AdminController
],
]);

$this->utils->addFlash('success', 'success.order.removeReductionCredit');
$this->utils->addFlash('success', 'success.order.sendPaymentLink');
} else {
$this->utils->addFlash('error', $formOrderSendPaymentLink->getErrors());
}

+ 98
- 0
ShopBundle/Controller/Backend/ProductFamilyController.php Bestand weergeven

@@ -12,6 +12,7 @@ use Lc\ShopBundle\Context\ProductCategoryInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Context\ReductionCatalogInterface;
use Lc\ShopBundle\Context\TaxRateInterface;
use Lc\ShopBundle\Form\Backend\Common\AbstractEditPositionType;
use Lc\ShopBundle\Form\Backend\Common\ReductionCatalogType;
use Lc\ShopBundle\Form\Backend\ProductFamily\ProductType;
use Lc\ShopBundle\Model\ProductFamily;
@@ -439,5 +440,102 @@ class ProductFamilyController extends AdminController



//hack utilisé pour filter sur les catégories lors du tri des produits par sous cat
//A améliorer à l'occas
protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null)
{
$productCategoryId = false;

if (isset($dqlFilter['productCategoryId'])) $productCategoryId = $dqlFilter['productCategoryId'];
if(isset($dqlFilter['filter']))$dqlFilter = $dqlFilter['filter'];

$queryBuilder = parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter);

$queryBuilder->leftJoin('entity.productCategories', 'product_categories');

if ($productCategoryId) {
$queryBuilder->andWhere('product_categories.id = :cat');
$queryBuilder->setParameter('cat', $productCategoryId);
}

return $queryBuilder;
}

public function sortByProductCategoryAction(){
$this->dispatch(EasyAdminEvents::PRE_LIST);
$entity = null;

//Replace this with query builder function, do not use finAll of easyAdmin
if ($this->request->query->get('productCategoryId')) {
if(!is_array($this->entity['list']['dql_filter'])) {
$this->entity['list']['dql_filter'] = array('filter' => $this->entity['list']['dql_filter']);
}
$this->entity['list']['dql_filter']['productCategoryId'] = $this->request->query->get('productCategoryId');
$easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item'];
}else{
throw new \ErrorException('Action impossible') ;
}

if ($this->entity['list']['dql_filter']['filter']) $this->entity['list']['dql_filter']['filter'] .= sprintf(' AND entity.status = 1');
else $this->entity['list']['dql_filter']['filter'] .= sprintf(' entity.status = 1');

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

$paginator = $this->findAll($this->entity['class'], $this->request->query->get('page', 1), 500, 'position', 'asc', $this->entity['list']['dql_filter']);

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

$positionForm = $this->createFormBuilder(array('entities', $paginator->getCurrentPageResults()))
->add('entities', CollectionType::class, array(
'required' => true,
'allow_add' => true,
'entry_type' => AbstractEditPositionType::class,
))
->getForm();

$positionForm->handleRequest($this->request);

if ($positionForm->isSubmitted() && $positionForm->isValid()) {
$class = $this->entity['class'];
$repo = $this->em->getRepository($class);

$latsPos = 0;
foreach ($positionForm->get('entities')->getData() as $elm) {
$this->dispatch(EasyAdminEvents::PRE_UPDATE, ['entity' => $entity]);
$entity = $repo->find($elm['id']);
$entity->setPosition($elm['position']);
$this->em->persist($entity);
$this->dispatch(EasyAdminEvents::POST_UPDATE, ['entity' => $entity]);
$latsPos = $elm['position'];

}

//die();
//to do récupérer les élements hors ligne et incrémenter position
/*foreach ($repo->findBy(array('status'=> false)) as $offlineEntity) {
$latsPos++;
$offlineEntity->setPosition($latsPos);
$this->em->persist($offlineEntity);
}*/
$this->em->flush();

$this->addFlash('success', 'Position modifié', array(), 'mweb');

return $this->redirectToReferrer();

}

$parameters = [
'paginator' => $paginator,
'fields' => $fields,
'batch_form' => $this->createBatchForm($this->entity['name'])->createView(),
'delete_form_template' => $this->createDeleteForm($this->entity['name'], '__id__')->createView(),
'postion_form' => $positionForm->createView(),
'entity' => $entity,
'sortable' => true
];
return $this->executeDynamicMethod('render<EntityName>Template', ['sortable', "@LcShop/backend/default/sortable.html.twig", $parameters]);
}
}


+ 2
- 0
ShopBundle/Controller/Backend/ReminderController.php Bestand weergeven

@@ -37,6 +37,8 @@ class ReminderController extends AdminController
if($this->request->isXmlHttpRequest()) {
$response['flashMessages'] = $this->utils->getFlashMessages();
return new Response(json_encode($response));
}else{
return parent::redirectToReferrer();
}
}


+ 15
- 0
ShopBundle/Controller/Backend/TicketController.php Bestand weergeven

@@ -7,6 +7,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use FOS\UserBundle\Model\UserManagerInterface;
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;
@@ -24,6 +25,20 @@ class TicketController extends AdminController
}


protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null)
{

$queryBuilder = parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter);

if ($this->filtersForm->get('status')->getData() === null) {
$queryBuilder->andWhere('entity.status LIKE :open OR entity.status LIKE :beingprocessed');
$queryBuilder->setParameter('open', Ticket::TICKET_STATUS_OPEN);
$queryBuilder->setParameter('beingprocessed', Ticket::TICKET_STATUS_BEING_PROCESSED);
}

return $queryBuilder;
}

public function showAction()
{
$this->dispatch(EasyAdminEvents::PRE_SHOW);

+ 47
- 0
ShopBundle/EventSubscriber/InitializeEventSubscriber.php Bestand weergeven

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

namespace Lc\ShopBundle\EventSubscriber;

use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\SortableInterface;
use Lc\ShopBundle\Context\StatusInterface;
use Lc\ShopBundle\Context\TreeInterface;
use Lc\ShopBundle\Services\Utils;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\GenericEvent;


class InitializeEventSubscriber implements EventSubscriberInterface
{
public $merchantUtils;
public $utils;

public function __construct(MerchantUtilsInterface $merchantUtils, Utils $utils)
{
$this->merchantUtils = $merchantUtils;
$this->utils = $utils;
}

public static function getSubscribedEvents()
{
return array(
'easy_admin.post_initialize' => array('postInitialize'),
);
}


public function postInitialize(GenericEvent $event)
{
$request = $event->getArgument('request');

if($request->query->get('hubredirection')){
$this->utils->addFlash('alert', "Vous êtes maintenant sur le hub de ".$this->merchantUtils->getMerchantCurrent()->getTitle());

}
}


}

+ 7
- 0
ShopBundle/Form/Frontend/TicketType.php Bestand weergeven

@@ -81,6 +81,13 @@ class TicketType extends AbstractType
'translation_domain' => 'lcshop',
]) ;
}
else {
// captcha (honey pot)
$builder->add('body', TextType::class, [
'label' => 'Body',
'required' => false,
]) ;
}

$builder->add('subject', TextType::class, [
'label' => 'Sujet'

+ 0
- 1
ShopBundle/Listener/MailLoggerListener.php Bestand weergeven

@@ -36,7 +36,6 @@ class MailLoggerUtil implements Swift_Events_SendListener
: void
{

dump('ncnnc');
$level = $this->getLogLevel($evt);
$message = $evt->getMessage();


+ 10
- 3
ShopBundle/Model/ProductFamily.php Bestand weergeven

@@ -591,10 +591,17 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
{
$count = 0;

$count += (int)strlen($this->getPropertyAllergens()) > 0;
$count += (int)strlen($this->getPropertyComposition()) > 0;
$count += (int)strlen($this->getPropertyFragrances()) > 0;
$count += (int)strlen($this->getPropertyOrganicLabel()) > 0;
$count += (int)strlen($this->getPropertyWeight()) > 0;
$count += (int)strlen($this->getPropertyFragrances()) > 0;
$count += (int)strlen($this->getPropertyComposition()) > 0;
$count += (int)strlen($this->getPropertyAllergens()) > 0;
$count += (int)strlen($this->getPropertyAlcoholLevel()) > 0;
$count += (int)strlen($this->getPropertyCharacteristics()) > 0;
$count += (int)strlen($this->getPropertyFeature()) > 0;
$count += (int)strlen($this->getPropertyPackaging()) > 0;
$count += (int)strlen($this->getPropertyQuantity()) > 0;
$count += (int)strlen($this->getPropertyVariety()) > 0;
$count += (int)($this->getPropertyExpirationDate() != null);

return $count;

+ 1
- 1
ShopBundle/Model/User.php Bestand weergeven

@@ -116,7 +116,7 @@ abstract class User extends UserModelFOS

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

public function getSummary()

+ 3
- 0
ShopBundle/Repository/ProductFamilyRepository.php Bestand weergeven

@@ -27,6 +27,8 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
$query->innerJoin('e.products', 'pfp');
$query->addSelect('pfp') ;

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

return $query ;
}

@@ -61,6 +63,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
$query->setParameter('category', $category->getId());

$query->andWhere('e.status = 1');
$query->orderBy('e.position', 'ASC');

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

+ 0
- 0
ShopBundle/Resources/public/css/backend/adminlte/adminlte.min.css Bestand weergeven


+ 0
- 0
ShopBundle/Resources/public/css/backend/adminlte/adminlte.min.css.map Bestand weergeven


+ 0
- 0
ShopBundle/Resources/public/css/backend/adminlte/plugins/noty/plugin-noty-animate.css Bestand weergeven


+ 4
- 0
ShopBundle/Resources/public/js/backend/script/default/init-common.js Bestand weergeven

@@ -18,6 +18,10 @@ function initNotice() {
$('#lc-flash-messages .notice').each(function (i, notice) {
generateNotice($(notice).find('.type').html(), $(notice).find('.message').html());
});

$('#lc-flash-alert .modal').each(function (i, modal) {
$(modal).modal('show');
});
}

function initButtonConfirm() {

+ 8
- 3
ShopBundle/Resources/public/js/backend/script/default/init-sort.js Bestand weergeven

@@ -14,6 +14,7 @@ function initLcSortableList() {
prototype = $('#form_entities').data('prototype');

$('.lc-sortable tr.lc-draggable').each(function (index, li) {

// instead be a number based on how many items we have
var newForm = prototype.replace(/__name__/g, index);

@@ -22,9 +23,13 @@ function initLcSortableList() {

$(li).append(newForm);
$(li).find('#form_entities_' + index + '_id').val($(li).data('id'));
if ($('.lc-sortable').data('parent-position') !== '') val = $('.lc-sortable').data('parent-position') + '.' + index
else val = index;

if ($('.lc-sortable').data('parent-position') !== '') {
//Ajout d'un 0 initial pour les nuémros <10
indexAsString = index.toString().padStart(2, '0');
val = $('.lc-sortable').data('parent-position') + '.' + indexAsString
} else {
val = index;
}
$(li).find('#form_entities_' + index + '_position').val(val);
});


+ 1
- 1
ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js Bestand weergeven

@@ -8,7 +8,7 @@ Vue.component('order-product', {
computed: {},
mounted: function () {
this.setFields()
log(this);
},
methods: {
setFields: function () {

+ 13
- 0
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js Bestand weergeven

@@ -419,7 +419,9 @@ $(window).on('load', function () {
behaviorExpirationDate: null,
propertyAllergens: null,
propertyOrganicLabelActive: false,
propertyOrganicLabel: null,
propertyNoveltyExpirationDateActive: false,
propertyNoveltyExpirationDate:null,
activeProducts: false,

formProducts: {},
@@ -578,6 +580,17 @@ $(window).on('load', function () {
title: function () {
this.updateChild()
},
propertyNoveltyExpirationDateActive: function () {
if(!this.propertyNoveltyExpirationDateActive){
this.propertyNoveltyExpirationDate = null;
}
},
propertyOrganicLabelActive: function () {
if(!this.propertyOrganicLabelActive){
this.propertyOrganicLabel = null;
$(this.$refs['propertyOrganicLabel']).val('').trigger('change');
}
}
}
});


+ 0
- 37
ShopBundle/Resources/public/js/backend/script/supplier/vuejs-supplier.js Bestand weergeven

@@ -1,37 +0,0 @@
// Reference array sent to dynamic staticRenderFns
var staticRenderFns = [];

appOrder = new Vue({
el: '#lc-supplier-edit',
delimiters: ['${', '}'],
data() {
return Object.assign(
{
addressType: null,
currentSection:'general',
sectionsArray: [
{
name: 'general',
nameDisplay: 'Général'
},
{
name: 'address',
nameDisplay: 'Adresse'
},
{
name: 'seo',
nameDisplay: 'SEO'
}
]
}, window.addressValues);
},
mounted: function () {},
methods: {
changeSection: function (section) {
this.currentSection = section.name;
},
},
watch: {}
});



+ 2
- 1
ShopBundle/Resources/translations/lcshop.fr.yaml Bestand weergeven

@@ -13,7 +13,7 @@ list:
send: Envoyer
duplicate: Dupliquer
duplicateOtherHub: Dupliquer sur un autre hub
sortProductFamily: Trier les produits de cette catégorie
group:
main: Général
address: Adresse
@@ -99,6 +99,7 @@ success:
addReductionCredit: L'avoir a bien été généré
removeReductionCredit: L'avoir a bien été généré
removeReductionCart: La réduction a bien été supprimé
sendPaymentLink: Le lien de paiement a bien été envoyé
credit:
debited: Le compte prépayé a bien été débité
added: Le compte a bien été crédité

+ 13
- 7
ShopBundle/Resources/views/backend/default/block/action.html.twig Bestand weergeven

@@ -1,13 +1,19 @@

{% if is_dropdown %}
<a class="btn dropdown-item {{ action.css_class|default('btn-default') }}" href="{{ action_href }}" target="{{ action.target }}">
{%- if action.icon %}<i class="fa fa-fw fa-{{ action.icon }}"></i> {% endif -%}
{{ action.label|trans(arguments = trans_parameters|merge({ '%entity_id%': item_id }), domain = translation_domain) }}
</a>
<a class="btn dropdown-item {{ action.css_class|default('btn-default') }}"
href="{{ action_href }}{{ action.hub is defined ? '&hub='~action.hub : '' }}" target="{{ action.target }}">
{%- if action.icon %}<i class="fa fa-fw fa-{{ action.icon }}"></i> {% endif -%}
{{ action.label|trans(arguments = trans_parameters|merge({ '%entity_id%': item_id }), domain = translation_domain) }}
</a>
{% else %}
<a class="btn {{ is_dropdown|default(false) ? 'dropdown-item' }} {{ action.css_class|default('btn-default') }}" data-toggle="tooltip"
{% if action.hub is defined %}
{% set trad = action.label~action.hub|uc_first %}
{% else %}
{% set trad = action.label %}
{% endif %}
<a class="btn {{ is_dropdown|default(false) ? 'dropdown-item' }} {{ action.css_class|default('btn-default') }}"
data-toggle="tooltip"
title="{{ action.label|trans(arguments = trans_parameters|merge({ '%entity_id%': item_id }), domain = translation_domain) }}"
href="{{ action_href }}" target="{{ action.target }}">
href="{{ action_href }}{{ action.hub is defined ? '&hub='~action.hub : '' }}" target="{{ action.target }}">
{%- if action.icon %}<i class="fa fa-fw fa-{{ action.icon }}"></i> {% endif -%}
</a>
{% endif %}

+ 7
- 0
ShopBundle/Resources/views/backend/default/block/action_duplicate_other_hub.html.twig Bestand weergeven

@@ -0,0 +1,7 @@
{% for merchant in get_merchants() %}
{% if merchant != merchantUtils.getMerchantUser %}

{% set action = action|merge({ 'hub': merchant.devAlias }) %}
{% include '@LcShop/backend/default/block/action.html.twig' %}
{% endif %}
{% endfor %}

+ 3
- 0
ShopBundle/Resources/views/backend/default/block/embed_box.twig Bestand weergeven

@@ -4,9 +4,12 @@
<i class="fa fa-{% block icon %}bg-info{% endblock %}"></i></span>

<div class="info-box-content">
{% block infoBox %}
<span class="info-box-text">{% block label %}{% endblock %}</span>
<strong>{% block value %}{% endblock %}</strong>
{% endblock %}
<div class="float-right"> {% block button %}{% endblock %}

</div>
</div>
</div>

+ 27
- 6
ShopBundle/Resources/views/backend/default/block/flash_messages.html.twig Bestand weergeven

@@ -1,15 +1,36 @@
{% if app.session is not null and app.session.started %}
{% set _flash_messages = app.session.flashbag.all %}
{% if _flash_messages['alert'] is defined and _flash_messages['alert']|length > 0 %}
<div id="lc-flash-alert">
{% for alert in _flash_messages['alert'] %}

<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content bg-danger">
<div class="modal-header">
<h4 class="modal-title">{{ alert|trans|striptags }}</h4>
</div>
<div class="modal-footer align-right">
<button type="button" data-dismiss="modal" class="btn btn-outline-light">OK</button>
</div>
</div>
</div>
</div>
{% endfor %}
</div>

{% endif %}
{% if _flash_messages|length > 0 %}
<div id="lc-flash-messages">
{% for label, messages in _flash_messages %}
{% for message in messages %}
<div class="notice">
<span class="type">{{ label }}</span>
<span class="message"> {{ message|trans|striptags }}</span>
</div>
{% endfor %}
{% if label != 'alert' %}
{% for message in messages %}
<div class="notice">
<span class="type">{{ label }}</span>
<span class="message"> {{ message|trans|striptags }}</span>
</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
{% endif %}

+ 1
- 1
ShopBundle/Resources/views/backend/default/layout/layout.html.twig Bestand weergeven

@@ -80,7 +80,7 @@
<ul class="navbar-nav ml-auto lc-navbar">


{% set _user_name = easyadmin_read_property(app.user, easyadmin_config('user.name_property_path'))|default('user.unnamed'|trans(domain = 'EasyAdminBundle')) %}
{% set _user_name = app.user.name %}
{% set _logout_path = easyadmin_logout_path() %}
<li class="content-top navbar-custom-menu">
{% block header_custom_menu %}

+ 4
- 2
ShopBundle/Resources/views/backend/default/list-fields/field_product_family_available_quantity.html.twig Bestand weergeven

@@ -32,7 +32,7 @@
{% endif %}

{% macro no_stock(behaviorStockWeek) %}
<span class="badge badge-danger">
<span class="badge badge-warning">
{{ _self.badge_stock_renewable(behaviorStockWeek) }}
Pas de stock
</span>
@@ -51,8 +51,10 @@
{% macro badge_stock_start(value) %}
{% if value > 0 %}
{% set badge_class = 'badge-success' %}
{% elseif value == 0%}
{% set badge_class = 'badge-warning' %}
{% else %}
{% set badge_class = 'badge-danger' %}
{% set badge_class = 'badge-secondary' %}
{% endif %}
<span class="badge {{ badge_class }}">
{% endmacro %}

+ 2
- 2
ShopBundle/Resources/views/backend/default/list-fields/field_toggle.html.twig Bestand weergeven

@@ -1,8 +1,8 @@
{% trans_default_domain 'EasyAdminBundle' %}

<div class="custom-control custom-switch" data-propertyname="{{ field_options.property }}">
<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 }}">{{ 'label.true'|trans }}</label>
<label class="custom-control-label" for="customSwitch{{ item.id }}-{{ field_options.property }}">{{ field_options.label }}</label>
</div>
{#


+ 3
- 0
ShopBundle/Resources/views/backend/default/list-fields/list_association_users.html.twig Bestand weergeven

@@ -0,0 +1,3 @@
{% for val in value %}
<span class="badge badge-secondary">{{ val.getSummary }}</span>
{% endfor %}

+ 6
- 1
ShopBundle/Resources/views/backend/merchant/panel_delivery.html.twig Bestand weergeven

@@ -14,7 +14,12 @@
<div class="col-12">
{{ form_row(form.deliveryTaxRate) }}
</div>
<div class="col-12">
{{ form_row(form.merchantConfigs['bike-delivery']) }}
</div>
<div class="col-12">
{{ form_row(form.merchantConfigs['bike-delivery-url-map']) }}
</div>
{{ macros.card_end() }}
</div>

</div>

+ 145
- 79
ShopBundle/Resources/views/backend/order/macros.html.twig Bestand weergeven

@@ -11,13 +11,18 @@
<th colspan="2">
<span>Produits / Producteurs</span>
</th>
<th v-if="order.countComplementaryOrderShops > 0">Compléments</th>
<th>
<span v-if="order.countComplementaryOrderShops > 0">Compléments</span>
</th>

<th>
<span>Prix HT à l'unité</span>
<span>Prix achat HT </span>
</th>
<th>
<span>Prix HT</span>
</th>
<th>
<span>Prix TTC à l'unité </span>
<span>Prix TTC </span>
</th>
<th>
<span>Marge </span>
@@ -53,33 +58,36 @@
{% macro productsTemplate(form_order_products=null) %}
<tr :class=" orderProduct.isRedelivery ? 'redelivery order-product-item' : 'order-product-item'">
<td :class="editionMode ? '' : 'hidden'">
<input type="checkbox" :value="orderProduct.id" class="order-product-checkbox" />
<input type="checkbox" :value="orderProduct.id" class="order-product-checkbox"/>
</td>
<td colspan="2">
<a :href="orderProduct.editLink" target="_blank">
<img :src="orderProduct.image" :alt="orderProduct.title" />
{% verbatim %}{{orderProduct.title}}{% endverbatim %}
<span v-show="orderProduct.hasRedelivery">
- <i class="fa fa-undo" data-toggle="tooltip" :title="orderProduct.redeliveryOrderShop" ></i>
<img :src="orderProduct.image" :alt="orderProduct.title"/>
{% verbatim %}{{orderProduct.title}}{% endverbatim %}
<span v-show="orderProduct.hasRedelivery">
- <i class="fa fa-undo" data-toggle="tooltip" :title="orderProduct.redeliveryOrderShop"></i>
</span>

<span v-show="orderProduct.isRedelivery">
- <i class="fa fa-undo" data-toggle="tooltip" title="Ce produit est une relivraison" ></i>
<span v-show="orderProduct.isRedelivery">
- <i class="fa fa-undo" data-toggle="tooltip" title="Ce produit est une relivraison"></i>
</span>
</a>
</td>
<td>
<span v-if="orderProduct.complementaryReference"> {% verbatim %}{{orderProduct.complementaryReference}}{% endverbatim %}</span>
<span v-if="orderProduct.complementaryReference"> {% verbatim %}{{orderProduct.complementaryReference}}{% endverbatim %}</span>
</td>
<td>
{% verbatim %}{{orderProduct.buyingPrice}}{% endverbatim %} €
</td>
<td>
{% verbatim %}{{orderProduct.price}}{% endverbatim %}€
</td>
<td>
{% verbatim %}{{orderProduct.priceWithTax}}{% endverbatim %}€
{% verbatim %}{{orderProduct.priceWithTax}}{% endverbatim %}
</td>
<td>
{% verbatim %}{{orderProduct.totalMargin}}{% endverbatim %}€ /
{% verbatim %}{{orderProduct.marginPercent}}{% endverbatim %}%
{% verbatim %}{{orderProduct.totalMargin}}{% endverbatim %} € /
{% verbatim %}{{orderProduct.marginPercent}}{% endverbatim %} %
</td>
<td>
{% verbatim %}{{orderProduct.availableQuantity}}{% endverbatim %}
@@ -102,19 +110,22 @@
{% endif %}
</td>
<td>
{% verbatim %}{{orderProduct.totalWithTaxAndReduction}}{% endverbatim %}€
{% verbatim %}{{orderProduct.totalWithTaxAndReduction}}{% endverbatim %}
</td>
<td :class="editionMode ? '' : 'hidden'">
<div class="dropdown" :class="editionMode ? '' : 'hidden'">
<button class="btn-sm btn-info dropdown-toggle" type="button" id="dropdownMenu" data-toggle="dropdown" aria-expanded="false">
<div class="dropdown" :class="editionMode ? '' : 'hidden'">
<button class="btn-sm btn-info dropdown-toggle" type="button" id="dropdownMenu"
data-toggle="dropdown" aria-expanded="false">
Actions
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu">
<button v-show="modalExist('#modal-add-redelivery-order-product') && orderProduct.hasRedelivery == false" type="button" class="dropdown-item" @click="modalAddRedeliveryOrderProduct">
<button v-show="modalExist('#modal-add-redelivery-order-product') && orderProduct.hasRedelivery == false"
type="button" class="dropdown-item" @click="modalAddRedeliveryOrderProduct">
Générer une relivraison
</button>

<button v-show="modalExist('#modal-add-reduction-credit')" type="button" class="dropdown-item" @click="modalAddReductionCredit" >
<button v-show="modalExist('#modal-add-reduction-credit')" type="button" class="dropdown-item"
@click="modalAddReductionCredit">
Générer un avoir
</button>
</div>
@@ -149,7 +160,7 @@
<tbody>
<tr>
<th>Total produits TTC</th>
<td>${order.totalOrderProductsWithTax}€</td>
<td>${order.totalOrderProductsWithTax} €</td>
</tr>
<template v-for="(orderReductionCart, key) in order.orderReductionCarts">
<tr>
@@ -161,7 +172,7 @@
<i class="fa fa-trash"></i>
</button>
</th>
<td>${orderReductionCart.amount}€</td>
<td>${orderReductionCart.amount} €</td>
</tr>
</template>
<template v-for="(orderReductionCredit, key) in order.orderReductionCredits">
@@ -174,25 +185,25 @@
<i class="fa fa-trash"></i>
</button>
</th>
<td>${orderReductionCredit.amount}€</td>
<td>${orderReductionCredit.amount} €</td>
</tr>
</template>
<tr>
<th>Total produits après réductions TTC</th>
<td>${order.totalOrderProductsWithTaxAndReductions}€</td>
<td>${order.totalOrderProductsWithTaxAndReductions} €</td>
</tr>
<tr>
<th>Total marge produits</th>
<td>${order.totalMargin}€ <br /> ${order.totalMarginPercent}%</td>
<td>${order.totalMargin} € <br/> ${order.totalMarginPercent} %</td>
</tr>

<tr>
<th>Frais de livraisons TTC</th>
<td>${order.deliveryPriceWithTaxAndReduction}€</td>
<td>${order.deliveryPriceWithTaxAndReduction} €</td>
</tr>
<tr>
<th>Total TTC</th>
<td>${order.totalWithTax}€</td>
<td>${order.totalWithTax} €</td>
</tr>

</tbody>
@@ -217,11 +228,22 @@


{% macro box_user_info() %}
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
{% set value = ' <a v-if="order.user" :href="order.userLink" target="_blank" v-html="order.user"></a>
<span v-else v-html="order.visitor"></span>' %}
{{ macros.box_info('bg-info', 'user',"field.default.user"|trans({}, 'lcshop'), value) }}

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


@@ -233,16 +255,13 @@
{% trans_default_domain 'lcshop' %}
{% block class %}bg-info{% endblock %}
{% block icon %}credit-card{% endblock %}
{% block label %}{{ "field.OrderShop.reference"|trans({}, 'lcshop')}}{% endblock %}
{% block label %}{{ "field.OrderShop.reference"|trans({}, 'lcshop') }}{% endblock %}
{% block value %}
${order.reference}<br />
${order.reference}<br/>
<span v-if="order.countComplementaryOrderShops > 0">
${order.countComplementaryOrderShops} commande(s) complémentaire(s)
</span>
{% endblock %}
{% block button %}
{{ order_macros.order_modal_button('#modal-order-delivery-address') }}
{% endblock %}
{% endembed %}
{% endmacro %}

@@ -257,9 +276,54 @@


{% macro box_total_order() %}
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
{% embed '@LcShop/backend/default/block/embed_box.twig' %}
{% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
{% trans_default_domain 'lcshop' %}
{% block class %}bg-danger{% endblock %}
{% block icon %}euro-sign{% endblock %}
{% block infoBox %}
<table style="width: 100%">
<tr>
<td>
Total produits TTC :<i class="icon info" data-toggle="tooltip" title="Après reduction"></i>
</td>
<td>
<strong class="float-right"> ${order.totalOrderProductsWithTaxAndReductions} €</strong><br/>
</td>
</tr>

<tr>
<td>
Total marge produits :
</td>
<td>
<strong class="float-right">${order.totalMargin} € / ${order.totalMarginPercent} %</strong><br/>
</td>
</tr>

<tr>
<td>
Frais de livraisons TTC :
</td>
<td>
<strong class="float-right">${order.deliveryPriceWithTaxAndReduction} €</strong><br/>
</td>
</tr>

<tr>
<td>
Total commandes :
</td>
<td>
<strong class="float-right"> ${order.totalWithTax} €</strong><br/>
</td>
</tr>


</table>

{{ macros.box_info('bg-danger', 'euro-sign',"field.OrderShop.total"|trans({}, 'lcshop'), ' ${order.totalWithTax} €') }}
{% endblock %}
{% endembed %}

{% endmacro %}

@@ -290,7 +354,7 @@
{% trans_default_domain 'lcshop' %}
{% block class %}bg-success{% endblock %}
{% block icon %}map-marked-alt{% endblock %}
{% block label %}{{ "field.default.deliveryAddress"|trans({}, 'lcshop')}}{% endblock %}
{% block label %}{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }}{% endblock %}
{% block value %}
<div v-if="order.deliveryAddress">
<address v-html="order.deliveryAddress">
@@ -352,48 +416,49 @@
</div>' %}

{{ macros.card_start("OrderShop.payment", 'danger card-outline', false, tools) }}
<table class="table table-striped" style="margin-bottom: 15px">
<tbody>
<thead>
<table class="table table-striped" style="margin-bottom: 15px">
<tbody>
<thead>
<tr>
<th v-if="order.countComplementaryOrderShops > 0">Référence</th>
<th>Mode de règlement</th>
<th>Date</th>
<th>Montant</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<template v-for="(orderPayment, i) in order.orderPayments">
<tr>
<th v-if="order.countComplementaryOrderShops > 0">Référence</th>
<th>Mode de règlement</th>
<th>Date</th>
<th>Montant</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<template v-for="(orderPayment, i) in order.orderPayments">
<tr>
<td v-if="order.countComplementaryOrderShops > 0">
${orderPayment.orderReference}
</td>
<td>${orderPayment.meanPaymentText}</td>
<td>${orderPayment.paidAtText}</td>
<td>${orderPayment.amount}</td>
<td v-if="order.countComplementaryOrderShops > 0">
${orderPayment.orderReference}
</td>
<td>${orderPayment.meanPaymentText}</td>
<td>${orderPayment.paidAtText}</td>
<td>${orderPayment.amount}</td>

<td>
<button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')" class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)">
<i class="fa fa-pen"></i>
</button>
<button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
type="button" class="btn-sm btn-danger"
@click="modalDeleteOrderPayment(orderPayment.id)">
<i class="fa fa-trash"></i>
</button>
</td>
</tr>
</template>
</tbody>
</table>
<div class="col-11">
{{ _self.order_modal_button('#modal-order-payment', 'btn-info', "action.order.addOrderPayment") }}
<td>
<button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)">
<i class="fa fa-pen"></i>
</button>
<button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
type="button" class="btn-sm btn-danger"
@click="modalDeleteOrderPayment(orderPayment.id)">
<i class="fa fa-trash"></i>
</button>
</td>
</tr>
</template>
</tbody>
</table>
<div class="col-11">
{{ _self.order_modal_button('#modal-order-payment', 'btn-info', "action.order.addOrderPayment") }}

<strong class="float-right">Total règlement : ${order.totalOrderPaid} €</strong>
<strong class="float-right">Total règlement : ${order.totalOrderPaid} €</strong>

{#TODO: afficher si la commande est règlé et afficher une alerte si le montant des paiments est supérieur au montant total de la commande#}
</div>
{#TODO: afficher si la commande est règlé et afficher une alerte si le montant des paiments est supérieur au montant total de la commande#}
</div>
{{ macros.card_end() }}
{% endmacro %}

@@ -424,7 +489,8 @@
<td>Facture</td>
<td>${orderDocument.reference}</td>
<td>
<a :href="'./?entity=Document&action=downloadInvoice&id='+orderDocument.id" class="btn-sm btn-default">Télécharger</a>
<a :href="'./?entity=Document&action=downloadInvoice&id='+orderDocument.id"
class="btn-sm btn-default">Télécharger</a>
</td>
</tr>
</template>
@@ -508,7 +574,7 @@
{% trans_default_domain 'lcshop' %}
{% block class %}bg-success{% endblock %}
{% block icon %}info{% endblock %}
{% block label %}{{ "field.OrderShop.status"|trans({}, 'lcshop')}}{% endblock %}
{% block label %}{{ "field.OrderShop.status"|trans({}, 'lcshop') }}{% endblock %}
{% block value %}
<strong> ${order.orderStatus}</strong>
{% endblock %}

+ 2
- 2
ShopBundle/Resources/views/backend/order/show-cart.html.twig Bestand weergeven

@@ -11,10 +11,10 @@
{{ order_macros.box_user_info() }}
</div>
<div class="col-3">
{{ order_macros.box_validation_date() }}
{{ order_macros.box_total_order() }}
</div>
<div class="col-3">
{{ order_macros.box_total_order() }}
{{ order_macros.box_validation_date() }}
</div>

<div class="col-3">

+ 2
- 2
ShopBundle/Resources/views/backend/order/show-order.html.twig Bestand weergeven

@@ -11,10 +11,10 @@
{{ order_macros.box_user_info() }}
</div>
<div class="col-3">
{{ order_macros.box_validation_date() }}
{{ order_macros.box_total_order() }}
</div>
<div class="col-3">
{{ order_macros.box_total_order() }}
{{ order_macros.box_validation_date() }}
</div>

<div class="col-3">

+ 2
- 3
ShopBundle/Resources/views/backend/order/show.html.twig Bestand weergeven

@@ -14,12 +14,11 @@
{{ order_macros.box_user_info() }}
</div>
<div class="col-3">
{{ order_macros.box_validation_date() }}
{{ order_macros.box_total_order() }}
</div>
<div class="col-3">
{{ order_macros.box_total_order() }}
{{ order_macros.box_validation_date() }}
</div>

<div class="col-3">
{{ order_macros.box_status() }}
</div>

+ 8
- 0
ShopBundle/Resources/views/backend/productcategory/action_sort_productfamily.html.twig Bestand weergeven

@@ -0,0 +1,8 @@

{% if item.getChildrens()|length == 0 %}
<a class="btn {{ is_dropdown|default(false) ? 'dropdown-item' }} {{ action.css_class|default('btn-default') }}" data-toggle="tooltip"
title="{{ action.label|trans(arguments = trans_parameters|merge({ '%entity_id%': item_id }), domain = translation_domain) }}"
href="{{ path('easyadmin', {action: 'sortByProductCategory', entity: 'ProductFamily', productCategoryId: item.id, referer: app.request.requestUri|url_encode }) }}" target="{{ action.target }}">
{%- if action.icon %}<i class="fa fa-fw fa-{{ action.icon }}"></i> {% endif -%}
</a>
{% endif %}

+ 4
- 0
ShopBundle/Resources/views/backend/productfamily/form.html.twig Bestand weergeven

@@ -39,7 +39,11 @@
{% if formValues.availableQuantity %}availableQuantity: "{{ formValues.availableQuantity }}",{% endif %}
{% if formValues.availableQuantityDefault %}availableQuantityDefault: "{{ formValues.availableQuantityDefault }}",{% endif %}
{% if formValues.propertyOrganicLabel %}propertyOrganicLabelActive: true,{% endif %}
{% if formValues.propertyOrganicLabel %}propertyOrganicLabel: "{{ formValues.propertyOrganicLabel }}",{% endif %}

{% if formValues.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDateActive: true,{% endif %}
{% if formValues.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDate: "{{ formValues.propertyNoveltyExpirationDate|date('Y-m-d') }}",{% endif %}

{% if formValues.typeExpirationDate %}typeExpirationDate: "{{ formValues.typeExpirationDate }}",{% endif %}
{% if formValues.behaviorExpirationDate %}behaviorExpirationDate: "{{ formValues.behaviorExpirationDate }}",{% endif %}
{% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate }}",{% endif %}

+ 2
- 2
ShopBundle/Resources/views/backend/productfamily/panel_property.html.twig Bestand weergeven

@@ -17,7 +17,7 @@
<td>{{ form_widget(form.propertyNoveltyExpirationDateActive, {"attr" : {'v-model' : 'propertyNoveltyExpirationDateActive'}}) }}</td>
<td>
<div v-show="propertyNoveltyExpirationDateActive == true">
{{ form_widget(form.propertyNoveltyExpirationDate) }}
{{ form_widget(form.propertyNoveltyExpirationDate, {"attr" : {'v-model' : 'propertyNoveltyExpirationDate'}}) }}
</div>
</td>
</tr>
@@ -25,7 +25,7 @@
<td>{{ form_widget(form.propertyOrganicLabelActive, {"attr" : {'v-model' : 'propertyOrganicLabelActive' } }) }}</td>
<td>
<div class="form-widget" v-show="propertyOrganicLabelActive == true">
{{ form_widget(form.propertyOrganicLabel) }}
{{ form_widget(form.propertyOrganicLabel, {"attr" : {'v-model' : 'propertyOrganicLabel', 'ref': 'propertyOrganicLabel'}}) }}
</div>
</td>
</tr>

+ 1
- 1
ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig Bestand weergeven

@@ -61,7 +61,7 @@
{{ form_help(form.availableQuantityDefault) }}
</div>
</div>
<p v-show="behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY') }}' || behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}' ">
<p v-show="behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY') }}' || behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}' || behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED') }}' ">
{{ product_family_macros.total_order_product_family(totalProductOrdered['total'], entity) }}
</p>
</div>

+ 0
- 13
ShopBundle/Resources/views/backend/supplier/edit.html.twig Bestand weergeven

@@ -1,13 +0,0 @@
{% extends app.request.query.get('action') == 'edit' ? '@LcShop/backend/default/edit.html.twig' : '@LcShop/backend/default/new.html.twig' %}

{% block entity_form %}
{% include '@LcShop/backend/supplier/form.html.twig' %}
{% endblock entity_form %}


{% block script_javascript %}
{{ parent() }}
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %}
<script src="{{ asset('bundles/lcshop/js/backend/script/supplier/vuejs-supplier.js') }}"></script>

{% endblock %}

+ 0
- 42
ShopBundle/Resources/views/backend/supplier/form.html.twig Bestand weergeven

@@ -1,42 +0,0 @@
{{ form_start(form) }}
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}

{% set formValues = form.vars.value %}

<div id="lc-supplier-edit">
<div class="card card-light">
<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">
<button type="button"
:class="'btn '+((currentSection == section.name) ? 'btn btn-primary' : 'btn ')"
@click="changeSection(section)">
${ section.nameDisplay }
<span class="glyphicon glyphicon-triangle-bottom"></span>
<i class="fa fa-exclamation-circle invalid-form"></i>
</button>

</li>
</ul>
</div>
</div>
<div class="form ">

<div v-show="currentSection == 'general'" class="panel panel-default">
{% include '@LcShop/backend/supplier/panel_general.html.twig' %}
</div>
<div v-show="currentSection == 'address'" class="panel panel-default">
{% include '@LcShop/backend/supplier/panel_address.html.twig' %}
</div>
<div v-show="currentSection == 'seo'" class="panel panel-default">
{% include '@LcShop/backend/supplier/panel_seo.html.twig' %}
</div>

</div>

</div>
{{ form_end(form) }}





+ 0
- 17
ShopBundle/Resources/views/backend/supplier/panel_address.html.twig Bestand weergeven

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

<div class="row">
<div class="col-8">
{{ macros.card_start('Merchant.address','light') }}
{% do form.address.civility.setRendered %}
{% do form.address.firstname.setRendered %}
{% do form.address.lastname.setRendered %}
{% do form.address.phone.setRendered %}
{% do form.address.latitude.setRendered %}
{% do form.address.longitude.setRendered %}
{% do form.address.deliveryInfos.setRendered %}
{% include '@LcShop/backend/default/block/form_address.html.twig' with {'form' : form.address}%}
{{ macros.card_end() }}
</div>
</div>

+ 0
- 23
ShopBundle/Resources/views/backend/supplier/panel_general.html.twig Bestand weergeven

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

<div class="row">
<div class="col-8">
{{ macros.card_start('Merchant.main','light') }}
<div class="col-12">
{{ form_row(form.title) }}
</div>
<div class="col-12">
{{ form_row(form.subtitle) }}
</div>
<div class="col-12">
{{ form_row(form.kmsHub) }}
</div>
<div class="col-12">
{{ form_row(form.imageFile) }}
</div>
<div class="col-12">
{{ form_row(form.description) }}
</div>
{{ macros.card_end() }}
</div>
</div>

+ 0
- 14
ShopBundle/Resources/views/backend/supplier/panel_seo.html.twig Bestand weergeven

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

<div class="row">
<div class="col-8">
{{ macros.card_start('Merchant.seo','light') }}
<div class="col-12">
{{ form_row(form.metaTitle) }}
</div>
<div class="col-12">
{{ form_row(form.metaDescription) }}
</div>
{{ macros.card_end() }}
</div>
</div>

+ 1
- 0
ShopBundle/Services/MerchantUtils.php Bestand weergeven

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

use App\Entity\UserMerchant;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\MerchantInterface;
use Lc\ShopBundle\Context\UserMerchantInterface;
use Symfony\Component\Security\Core\Security;


+ 16
- 0
ShopBundle/Services/Order/OrderUtils.php Bestand weergeven

@@ -338,6 +338,22 @@ class OrderUtils
return false ;
}

public function getOrderProductsByProductFamilyInCart($productFamily)
{
$arrayOrderProducts = [] ;
$orderShop = $this->getCartCurrent() ;

if($orderShop) {
foreach($orderShop->getOrderProducts() as $orderProduct) {
if($orderProduct->getProduct()->getProductFamily() == $productFamily) {
$arrayOrderProducts[] = $orderProduct ;
}
}
}

return $arrayOrderProducts ;
}

public function groupOrderProductsByProductFamily($orderProducts)
{
$orderProductsByProductFamily = [];

+ 69
- 0
ShopBundle/Services/PointLocationUtils.php Bestand weergeven

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

namespace Lc\ShopBundle\Services ;

class PointLocationUtils {

var $pointOnVertex = true; // Check if the point sits exactly on one of the vertices?

function pointLocation() {
}

function pointInPolygon($point, $polygon, $pointOnVertex = true) {
$this->pointOnVertex = $pointOnVertex;

// Transform string coordinates into arrays with x and y values
$point = $this->pointStringToCoordinates($point);
$vertices = array();
foreach ($polygon as $vertex) {
$vertices[] = $this->pointStringToCoordinates($vertex);
}

// Check if the point sits exactly on a vertex
if ($this->pointOnVertex == true and $this->pointOnVertex($point, $vertices) == true) {
return "vertex";
}

// Check if the point is inside the polygon or on the boundary
$intersections = 0;
$vertices_count = count($vertices);

for ($i=1; $i < $vertices_count; $i++) {
$vertex1 = $vertices[$i-1];
$vertex2 = $vertices[$i];
if ($vertex1['y'] == $vertex2['y'] and $vertex1['y'] == $point['y'] and $point['x'] > min($vertex1['x'], $vertex2['x']) and $point['x'] < max($vertex1['x'], $vertex2['x'])) { // Check if point is on an horizontal polygon boundary
return "boundary";
}
if ($point['y'] > min($vertex1['y'], $vertex2['y']) and $point['y'] <= max($vertex1['y'], $vertex2['y']) and $point['x'] <= max($vertex1['x'], $vertex2['x']) and $vertex1['y'] != $vertex2['y']) {
$xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x'];
if ($xinters == $point['x']) { // Check if point is on the polygon boundary (other than horizontal)
return "boundary";
}
if ($vertex1['x'] == $vertex2['x'] || $point['x'] <= $xinters) {
$intersections++;
}
}
}
// If the number of edges we passed through is odd, then it's in the polygon.
if ($intersections % 2 != 0) {
return "inside";
} else {
return "outside";
}
}

function pointOnVertex($point, $vertices) {
foreach($vertices as $vertex) {
if ($point == $vertex) {
return true;
}
}

}

function pointStringToCoordinates($pointString) {
$coordinates = explode(" ", $pointString);
return array("x" => $coordinates[0], "y" => $coordinates[1]);
}

}

+ 23
- 13
ShopBundle/Services/Price/OrderProductPriceUtils.php Bestand weergeven

@@ -13,23 +13,31 @@ use Lc\ShopBundle\Context\ReductionCatalogInterface;

class OrderProductPriceUtils
{
use PriceUtilsTrait ;
use PriceUtilsTrait;

protected $productPriceUtils ;
protected $productPriceUtils;

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

public function getPrice(OrderProductInterface $orderProduct)
public function getPrice(OrderProductInterface $orderProduct, $round = false)
{
return $orderProduct->getPrice();
if ($round) {
return $this->round($orderProduct->getPrice());
} else {
return $orderProduct->getPrice();
}
}

public function getBuyingPrice(OrderProductInterface $orderProduct)
public function getBuyingPrice(OrderProductInterface $orderProduct, $round = false)
{
return $orderProduct->getBuyingPrice();
if ($round) {
return $this->round($orderProduct->getBuyingPrice());
} else {
return $orderProduct->getBuyingPrice();
}
}

public function getPriceWithTax(OrderProductInterface $orderProduct)
@@ -50,7 +58,7 @@ class OrderProductPriceUtils

}

public function getPriceWithReduction(OrderProductInterface $orderProduct)
public function getPriceWithReduction(OrderProductInterface $orderProduct, $round = true)
{
return $this->applyReductionCatalog(
$orderProduct,
@@ -58,7 +66,8 @@ class OrderProductPriceUtils
$this->getPriceWithTax($orderProduct),
1,
null,
false
false,
$round
);

}
@@ -75,14 +84,14 @@ class OrderProductPriceUtils

public function getMargin(OrderProductInterface $orderProduct)
{
return $this->getPriceWithReduction($orderProduct) - $this->getBuyingPrice($orderProduct);
return $this->round($this->getPriceWithReduction($orderProduct, false) - $this->getBuyingPrice($orderProduct));
}

public function getMarginPercent(OrderProductInterface $orderProduct)
{
if($this->getBuyingPrice($orderProduct)) {
if ($this->getBuyingPrice($orderProduct)) {
return $this->round(($this->getMargin($orderProduct) / $this->getPriceWithReduction($orderProduct)) * 100);
}else{
} else {
return 0;
}
}
@@ -132,7 +141,8 @@ class OrderProductPriceUtils
}

//inclus toujours les réductions catalogues
public function getTotalTaxes(OrderProductInterface $orderProduct){
public function getTotalTaxes(OrderProductInterface $orderProduct)
{
return $this->getTotalWithTaxAndReduction($orderProduct) - $this->getTotalWithReduction($orderProduct);
}
}

+ 7
- 2
ShopBundle/Services/Price/PriceUtilsTrait.php Bestand weergeven

@@ -42,7 +42,7 @@ trait PriceUtilsTrait
return round((($price * $percent)) / 100, 2);
}

public function applyReductionCatalog($entity, $price, $priceWithTax, $quantity = 1, $reductionCatalog = null, $withTax = true): ?float
public function applyReductionCatalog($entity, $price, $priceWithTax, $quantity = 1, $reductionCatalog = null, $withTax = true, $round = true): ?float
{

if ($reductionCatalog) {
@@ -99,8 +99,13 @@ trait PriceUtilsTrait
} else {
$priceReturn = $this->applyPercentNegative($priceWithTax, $entity->getTaxRateInherited()->getValue());
}
if($round){
return $this->round($priceReturn);
}else{
return $priceReturn;
}


return $this->round($priceReturn);
}



+ 0
- 368
ShopBundle/Services/PriceUtils.phpOld Bestand weergeven

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

namespace Lc\ShopBundle\Services;

use Doctrine\Common\Collections\Collection;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Context\ProductInterface;
use Lc\ShopBundle\Context\ProductPropertyInterface;
use Lc\ShopBundle\Context\ReductionCatalogInterface;

class PriceUtilsOld
{

public function getPrice($entity)
{
if ($entity instanceof ProductPropertyInterface) {
if ($entity->getBehaviorPriceInherited() == 'by-piece') {
return $entity->getPriceInherited();
} elseif ($entity->getBehaviorPriceInherited() == 'by-reference-unit') {
if ($entity->getQuantityInherited() > 0) {
return $entity->getPriceByRefUnitInherited() * ($entity->getQuantityInherited() / $entity->getUnitInherited()->getCoefficient());
}
}
}

if ($entity instanceof OrderProductInterface) {
return $entity->getPrice();
}

return null;
}

public function getPriceWithTax($entity)
{
return $this->applyTax(
$this->getPrice($entity),
$entity->getTaxRateInherited()->getValue()
);
}

public function getPriceWithTaxAndReduction($entity)
{
return $this->getPriceWithTaxAndReductionCatalog(
$entity,
$this->getPrice($entity),
$this->getPriceWithTax($entity)
);
}

public function getPriceByRefUnit($entity)
{
if ($entity instanceof ProductPropertyInterface) {
if ($entity->getBehaviorPriceInherited() == 'by-piece') {
return ($this->getPrice($entity) * $entity->getUnitInherited()->getCoefficient()) / $entity->getQuantityInherited();
} elseif ($entity->getBehaviorPriceInherited() == 'by-reference-unit') {
return $entity->getPriceByRefUnitInherited();
}
}

if ($entity instanceof OrderProductInterface) {
return ($this->getPrice($entity) * $entity->getUnitInherited()->getCoefficient()) / $entity->getQuantityProduct();
}

return null;
}

public function getPriceByRefUnitWithTax($entity)
{
return $this->applyTax(
$this->getPriceByRefUnit($entity),
$entity->getTaxRateInherited()->getValue()
);
}

public function getPriceByRefUnitWithTaxAndReduction($entity)
{
return $this->getPriceWithTaxAndReductionCatalog(
$entity,
$this->getPriceByRefUnit($entity),
$this->getPriceByRefUnitWithTax($entity)
);
}

public function getTotal($entity)
{
if ($entity instanceof OrderProductInterface) {
return $entity->getQuantityOrder() * $this->getPrice($entity);
}
if ($entity instanceof OrderShopInterface) {
$total = 0;
foreach ($entity->getOrderProducts() as $orderProduct) {
$total += $this->getTotal($orderProduct);
}
return $total;
}
return null;
}

public function getTotalWithTax($entity)
{
if ($entity instanceof OrderProductInterface) {
return $this->applyTax(
$this->getTotal($entity),
$entity->getTaxRateInherited()->getValue()
);
}
if ($entity instanceof OrderShopInterface) {
$total = 0;
foreach ($entity->getOrderProducts() as $orderProduct) {
$total += $this->getTotalWithTax($orderProduct);
}
return $total;
}

//C'est bizzare ce truc là
//if($entity instanceof OrderShopInterface) {
// return $this->getTotalOrderProducts($entity->getOrderProducts(), true) ;
//}
return null;
}

public function getTotalWithTaxAndReduction($entity)
{
if ($entity instanceof OrderProductInterface) {
return $this->getPriceWithTaxAndReductionCatalog(
$entity,
$this->getTotal($entity),
$this->getTotalWithTax($entity)
);
}

if ($entity instanceof OrderShopInterface) {
return $this->getTotalOrderProductsWithTaxAndReduction($entity->getOrderProducts(), true, true);
}
}

public function getTotalWithReduction($entity)
{
if ($entity instanceof OrderProductInterface) {
return $this->getPriceWithReductionCatalog(
$entity,
$this->getTotal($entity),
$this->getTotalWithTax($entity)
);
}

if ($entity instanceof OrderShopInterface) {
return $this->getTotalOrderProductsWithReduction($entity->getOrderProducts(), true, true);
}
}

public function getTotalOrderProductsWithReductionCart(OrderShopInterface $order)
{
$this->_getTotalOrderProductsWithReductionCartGeneric($order, false);
}

public function getTotalOrderProductsWithTaxAndReductionCart(OrderShopInterface $order)
{
$this->_getTotalOrderProductsWithReductionCartGeneric($order, true);
}

private function _getTotalOrderProductsWithReductionCartGeneric(OrderShopInterface $order, $withTax = true)
{

if ($withTax) {
$priceToReturn = $this->getTotalOrderProductsWithTaxAndReductionCatalog($order);
}
else {
$priceToReturn = $this->getTotalOrderProductsWithReductionCatalog($order);
}
foreach ($order->getOrderReductionCarts() as $orderReductionCart) {
if ($orderReductionCart->getUnit() == 'percent') {

$priceToReturn = $this->applyReductionPercent(
$priceToReturn,
$orderReductionCart->getValue
);
} else if ($orderReductionCart->getUnit() == 'amount') {
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-inlcluded') {
$priceToReturn =
$this->applyReductionAmount(
$priceToReturn,
$orderReductionCart->getValue()
);
}
}
}
}


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

public function getTotalOrderProductsWithTax($entity)
{
return $this->getSumOrderProductsDispatch($entity, true);
}

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

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

public function getTotalOrderProductsWithReductionCatalog($entity)
{
return $this->getSumOrderProductsDispatch($entity, false, true);
}

public function getTotalOrderProductsWithTaxAndReductionCatalog($entity)
{
return $this->getSumOrderProductsDispatch($entity, true, true);
}

public function getSumOrderProductsDispatch($entity, $withTax = false, $withReductionCatalog = false)
{
if ($entity instanceof OrderShopInterface) {
return $this->getSumOrderProducts($entity->getOrderProducts(), $withTax, $withReductionCatalog);
}
if ($entity instanceof Collection || is_array($entity)) {
return $this->getSumOrderProducts($entity, $withTax, $withReductionCatalog);
}
}

public function getSumOrderProducts($orderProducts, $withTax = false, $withReductionCatalog = false)
{
$total = 0;
foreach ($orderProducts as $orderProduct) {
if ($withTax && $withReductionCatalog) {
$total += $this->getTotalWithTaxAndReduction($orderProduct);
} elseif ($withTax) {
$total += $this->getTotalWithTax($orderProduct);
} elseif ($withReductionCatalog) {
$total += $this->getTotalWithReduction($orderProduct);
} else {
$total += $this->getTotal($orderProduct);
}
}
return $total;
}

public function getPriceWithTaxAndReductionCatalog($entity, $price, $priceWithTax, $reductionCatalog = null)
{
return $this->getPriceWithReductionCatalogGeneric($entity, $price, $priceWithTax, $reductionCatalog, true);
}

public function getPriceWithReductionCatalog($entity, $price, $priceWithTax, $reductionCatalog = null)
{
return $this->getPriceWithReductionCatalogGeneric($entity, $price, $priceWithTax, $reductionCatalog, false);
}

public function getPriceWithReductionCatalogGeneric($entity, $price, $priceWithTax, $reductionCatalog = null, $withTax = true): ?float
{
if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit();
$reductionCatalogBehaviorTaxRate = $reductionCatalog->getBehaviorTaxRate();
} else {
if ($entity instanceof ProductPropertyInterface) {
$reductionCatalog = $entity->getReductionCatalogInherited();

if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit();
$reductionCatalogBehaviorTaxRate = $reductionCatalog->getBehaviorTaxRate();
}
}

if ($entity instanceof OrderProductInterface) {
$orderProductReductionCatalog = $entity->getOrderProductReductionCatalog();
if ($orderProductReductionCatalog) {
$reductionCatalogValue = $orderProductReductionCatalog->getValue();
$reductionCatalogUnit = $orderProductReductionCatalog->getUnit();
$reductionCatalogBehaviorTaxRate = $orderProductReductionCatalog->getBehaviorTaxRate();
}
}
}

if (isset($reductionCatalogValue) && isset($reductionCatalogUnit) && isset($reductionCatalogBehaviorTaxRate)) {
if ($reductionCatalogUnit == 'percent') {
$priceWithTax = $this->applyReductionPercent(
$priceWithTax,
$reductionCatalogValue
);
} elseif ($reductionCatalogUnit == 'amount') {
if ($reductionCatalogBehaviorTaxRate == 'tax-excluded') {
$priceWithTax = $this->applyTax(
$this->applyReductionAmount(
$price,
$reductionCatalogValue
),
$entity->getTaxRateInherited()->getValue()
);
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') {
$priceWithTax = $this->applyReductionAmount(
$priceWithTax,
$reductionCatalogValue
);
}
}
}

if ($withTax) {
$priceReturn = $priceWithTax;
} else {
$priceReturn = $this->applyPercentNegative($priceWithTax, $entity->getTaxRateInherited()->getValue());
}

return $this->round($priceReturn);
}

public function getTotalTaxes($entity)
{
if ($entity instanceof OrderProductInterface) {
return $this->getTotalWithReduction($entity) * ($entity->getTaxRateInherited()->getValue() / 100);
}

if ($entity instanceof OrderShopInterface) {
$totalTaxes = 0;
foreach ($entity->getOrderProducts() as $orderProduct) {
$totalTaxes += $this->getTotalTaxes($orderProduct);
}
return $totalTaxes;
}

return 0;
}

public function applyTax($price, $taxRateValue)
{
return $this->round($this->applyPercent($price, $taxRateValue));
}

public function applyReductionPercent($price, $percentage)
{
return $this->applyPercent($price, -$percentage);
}

public function applyReductionAmount($price, $amount)
{
return $price - $amount;
}

public function applyPercent($price, $percentage)
{
return $price * ($percentage / 100 + 1);
}

public function applyPercentNegative($price, $percentage)
{
return $price / ($percentage / 100 + 1);
}

public function round($price)
{
return round((($price * 100)) / 100, 2);
}

}


+ 1
- 1
ShopBundle/Services/UserUtils.php Bestand weergeven

@@ -105,4 +105,4 @@ class UserUtils
$this->em->flush() ;
}

}
}

+ 28
- 0
ShopBundle/Services/Utils.php Bestand weergeven

@@ -5,6 +5,10 @@ namespace Lc\ShopBundle\Services;
use Cocur\Slugify\Slugify;
use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Configuration\ConfigManager;
use Geocoder\Model\Coordinates;
use Geocoder\Provider\Addok\Addok;
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\ReverseQuery;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\PageInterface;
use Lc\ShopBundle\Context\PointSaleInterface;
@@ -15,6 +19,7 @@ use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Context\UserPointSaleInterface;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpClient\HttplugClient;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -255,6 +260,29 @@ class Utils
return $result;
}

public function getGeocoderProvider()
{
$symfonyClient = new HttplugClient();
$provider = new Addok($symfonyClient, 'https://api-adresse.data.gouv.fr') ;
return $provider ;
}

public function callAddressApi($query)
{
$provider = $this->getGeocoderProvider() ;;
$query = GeocodeQuery::create($query)->withData('type', 'housenumber');
$results = $provider->geocodeQuery($query);
return $results->all() ;
}

public function callReverseAddressApi($latitude, $longitude)
{
$provider = $this->getGeocoderProvider() ;;
$query = ReverseQuery::create(new Coordinates($latitude, $longitude));
$results = $provider->reverseQuery($query);
return $results->all() ;
}

public function getZipByCity($city, $code = null)
{
$zip = null;

+ 9
- 1
ShopBundle/Services/UtilsManager.php Bestand weergeven

@@ -23,6 +23,7 @@ class UtilsManager
protected $mailUtils ;
protected $ticketUtils ;
protected $statisticsUtils;
protected $pointLocationUtils ;

public function __construct(
Utils $utils,
@@ -35,7 +36,8 @@ class UtilsManager
CreditUtils $creditUtils,
DocumentUtils $documentUtils,
MailUtils $mailUtils,
TicketUtils $ticketUtils
TicketUtils $ticketUtils,
PointLocationUtils $pointLocationUtils
)
{
$this->utils = $utils ;
@@ -49,6 +51,7 @@ class UtilsManager
$this->documentUtils = $documentUtils ;
$this->mailUtils = $mailUtils ;
$this->ticketUtils = $ticketUtils ;
$this->pointLocationUtils = $pointLocationUtils ;
}

public function getUtils(): Utils
@@ -106,4 +109,9 @@ class UtilsManager
return $this->ticketUtils ;
}

public function getPointLocationUtils(): PointLocationUtils
{
return $this->pointLocationUtils ;
}

}

Laden…
Annuleren
Opslaan