@@ -80,6 +80,8 @@ class OrderController extends AdminController | |||
public function updateEntity($entity) | |||
{ | |||
//SI PAS DE problème après le 23/05/2021 à supprimer | |||
die('Une erreur est survenue, merci de contacter FAB : Erreur ligne 80 LC =>OrderController '); | |||
foreach ($entity->getOrderProducts() as $orderProduct) { | |||
//dump($orderProduct); | |||
$orderProduct->setCreatedBy($this->getUser()); |
@@ -102,7 +102,11 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor | |||
public function findByTerms($terms, $maxResults = false) | |||
{ | |||
$query = $this->findByMerchantQuery() ; | |||
$query = $this->joinRelations($query) ; | |||
$query->leftJoin('e.productCategories', 'cat'); | |||
$query->addSelect('cat') ; | |||
$query->orderBy('e.position', 'ASC'); | |||
$query->andWhere('e.status = 1'); | |||
$query->andWhere('e.title LIKE :terms OR cat.title LIKE :terms'); |
@@ -862,3 +862,42 @@ table.products-collection-table tr.disabled { | |||
#ticket-list .btn-sm { | |||
display: block; | |||
} | |||
/* line 307, ../../sass/backend/custom.scss */ | |||
#toast-container { | |||
width: 350px; | |||
} | |||
/* line 308, ../../sass/backend/custom.scss */ | |||
.toast { | |||
float: right; | |||
} | |||
/* line 310, ../../sass/backend/custom.scss */ | |||
#toast-container:before:hover { | |||
opacity: 1; | |||
cursor: pointer; | |||
} | |||
/* line 314, ../../sass/backend/custom.scss */ | |||
#toast-close-all { | |||
border: 0; | |||
position: absolute; | |||
pointer-events: auto; | |||
z-index: 999999999999999999999; | |||
background: #BD362F; | |||
border-radius: 3px; | |||
color: #fff; | |||
opacity: 0.8; | |||
top: 2px; | |||
width: 50px; | |||
height: 50px; | |||
font-size: 30px; | |||
left: 0px; | |||
text-align: center; | |||
-webkit-text-shadow: 0 1px 0 #fff; | |||
text-shadow: 0 1px 0 #fff; | |||
-moz-box-shadow: 0 0 12px #999; | |||
-webkit-box-shadow: 0 0 12px #999; | |||
box-shadow: 0 0 12px #999; | |||
} |
@@ -149,17 +149,35 @@ function userNotAllowToEdit() { | |||
function setFlashMessages(flashMessages){ | |||
var currentFlash =new Array(); | |||
for (var type in flashMessages) { | |||
for (var key in flashMessages[type]) { | |||
generateNotice(type, flashMessages[type][key]); | |||
if(!currentFlash.includes(flashMessages[type][key])) { | |||
currentFlash.push(flashMessages[type][key]); | |||
generateNotice(type, flashMessages[type][key]); | |||
} | |||
} | |||
} | |||
} | |||
function generateNotice(type, text) { | |||
toastr.options.timeOut = 30000; | |||
toastr.options.timeOut = 3000; | |||
toastr.options.onHidden = function() { | |||
if($('#toast-container .toast').length==0)$('#toast-close-all').remove(); | |||
}; | |||
//toastr.options.preventDuplicates = true; | |||
toastr[type](text); | |||
if($('#toast-close-all').length==0) { | |||
$('#toast-container').prepend('<button id="toast-close-all"><i class="fa fa-times"></i></button>'); | |||
} | |||
$('#toast-close-all').off('click'); | |||
$('#toast-close-all').on('click', function (){ | |||
toastr.remove(); | |||
if($('#toast-container .toast').length==0)$('#toast-close-all').remove(); | |||
}); | |||
/*var n = noty({ | |||
text: text, | |||
type: type, |
@@ -302,3 +302,33 @@ table.products-collection-table tr.disabled{opacity: 0.5} | |||
display: block ; | |||
} | |||
} | |||
#toast-container { width: 350px;} | |||
.toast{float: right} | |||
#toast-container:before:hover { | |||
opacity:1; | |||
cursor:pointer; | |||
} | |||
#toast-close-all { | |||
border:0; | |||
position: absolute; | |||
pointer-events: auto; | |||
z-index: 999999999999999999999; | |||
background: #BD362F; | |||
border-radius: 3px; | |||
color:#fff; | |||
opacity:0.8; | |||
top: 2px; | |||
width: 50px; | |||
height: 50px; | |||
font-size: 30px; | |||
left: 0px; | |||
text-align: center; | |||
-webkit-text-shadow: 0 1px 0 #fff; | |||
text-shadow: 0 1px 0 #fff; | |||
-moz-box-shadow: 0 0 12px #999; | |||
-webkit-box-shadow: 0 0 12px #999; | |||
box-shadow: 0 0 12px #999; | |||
} |
@@ -116,7 +116,7 @@ success: | |||
common: | |||
fieldChange: Le champ a bien été modifié | |||
productFamily: | |||
editStock: Le stock a bien été modifié | |||
editStock: "Stocks renouveler pour : %count% produits" | |||
error: | |||
form: | |||
submitted: Une erreur est survenue à la soumission du formulaire | |||
@@ -155,6 +155,7 @@ error: | |||
notAdded: Le crédit n'a pas été ajouté | |||
productFamily: | |||
editStock: Le stock n'a pas été modifié, une erreur est survenue | |||
editStockNoQuantityDefault: "Le stock n'a pas été modifié pour le produit #%id% (Aucune quantité par défaut)" | |||
field: | |||
default: | |||
placeholder: Choisissez une option |
@@ -1,7 +1,6 @@ | |||
{% set dropdownAction ={} %} | |||
{% for action in actions %} | |||
{% if action.group is defined and action.group==true %} | |||
{% set dropdownAction = dropdownAction|merge({(loop.index0): action}) %} | |||
{% else %} |
@@ -22,6 +22,7 @@ | |||
{% endif %} | |||
{% if _flash_messages|length > 0 %} | |||
<div id="lc-flash-messages"> | |||
{% for label, messages in _flash_messages %} | |||
{% if label != 'alert' %} | |||
{% for message in messages %} |
@@ -62,5 +62,5 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-edit.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-edit.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -23,7 +23,6 @@ | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/select2/select2-bootstrap.min.css') }}"> | |||
<link rel="stylesheet" | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/bootstrap/bootstrap-switch.min.css') }}"> | |||
<!-- Theme style --> | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/toastr/toastr.min.css') }}"> | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/adminlte.css') }}"> | |||
@@ -34,9 +33,9 @@ | |||
{% endblock %} | |||
{% block head_custom_stylesheets %} | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/custom.css') }}"> | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/custom.css')|lc_cache }}"> | |||
{% for asset_css in easyadmin_config('design.assets.css') %} | |||
<link rel="stylesheet" href="{{ asset(asset_css) }}"> | |||
<link rel="stylesheet" href="{{ asset(asset_css)|lc_cache }}"> | |||
{% endfor %} | |||
{% endblock head_custom_stylesheets %} | |||
@@ -252,11 +251,11 @@ | |||
<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> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/utils.js')|lc_cache }}"></script> | |||
{% endblock plugin_javascript %} | |||
{% block script_javascript %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-common.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-common.js')|lc_cache }}"></script> | |||
{% endblock script_javascript %} | |||
{% block add_script_javascript %}{% endblock add_script_javascript %} |
@@ -284,5 +284,5 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-list-datatable.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-list-datatable.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -1,6 +1,6 @@ | |||
{#{{ value|date('U')}}#} | |||
{# {{ value|date('U')}} #} | |||
{% if field_options.format == "d/m/Y h:i A e" %} | |||
{% if field_options.format == "d/m/Y h:i A e" or field_options.format == null %} | |||
{% set format = "d/m/Y H:i" %} | |||
{% else %} | |||
{% set format = field_options.format %} |
@@ -148,6 +148,28 @@ | |||
</a> | |||
{% endif %} | |||
{% if _entity_config['list']['btn_history_purchase_order'] is defined %} | |||
<a class="float-right btn-sm btn-info" | |||
href="{{ path('easyadmin', { entity: 'PurchaseOrder', action: 'list' }) }}"> | |||
<i class="fa fa-history"></i> Historiques des bons de commandes | |||
</a> | |||
{% endif %} | |||
{% if _entity_config['list']['btn_week_purchase_order'] is defined %} | |||
<a class="float-right btn-sm btn-info" | |||
href="{{ path('easyadmin', { entity: 'SupplierOrderPurchase', action: 'list' }) }}"> | |||
<i class="fa fa-tractor"></i> Bons de commandes de la semaine | |||
</a> | |||
{% endif %} | |||
{% if _entity_config['list']['btn_add_purchase_order'] is defined %} | |||
<a class="float-right btn-sm btn-primary" | |||
href="{{ path('easyadmin', { entity: 'PurchaseOrder', action: 'new' }) }}"> | |||
<i class="fa fa-plus"></i> Créer un bon de commande | |||
</a> | |||
{% endif %} | |||
{% if _entity_config['list']['edit_position'] is defined %} | |||
<a class="float-right btn-sm btn-success action-sort" | |||
href="{{ path('easyadmin', _request_parameters|merge({ action: 'sort' })) }}"> | |||
@@ -296,8 +318,9 @@ | |||
<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") %} | |||
<a class="link-as-text" | |||
href="{{ path('easyadmin', {'action':'edit', 'entity':_entity_config.name, 'id': item.id}) }}"> | |||
href="{{ path('easyadmin', _request_parameters|merge({ action: 'edit', id: item.id })) }}"> | |||
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} | |||
</a> | |||
{% else %} | |||
@@ -412,7 +435,7 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-list.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-list.js')|lc_cache }}"></script> | |||
<script type="text/javascript"> |
@@ -40,7 +40,7 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-edit.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-edit.js')|lc_cache }}"></script> | |||
{# | |||
<script type="text/javascript"> |
@@ -127,5 +127,5 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-sort.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-sort.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -8,6 +8,6 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/merchant/vuejs-merchant.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/merchant/vuejs-merchant.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -98,5 +98,5 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/order/vuejs-order.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/order/vuejs-order.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -117,5 +117,5 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/order/vuejs-order.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/order/vuejs-order.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -113,5 +113,5 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/order/vuejs-order.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/order/vuejs-order.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -311,6 +311,6 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('assets/js/backend/script/productfamily/vuejs-advanced-edition-product-family.js') }}"></script> | |||
<script src="{{ asset('assets/js/backend/script/productfamily/vuejs-advanced-edition-product-family.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -20,5 +20,5 @@ | |||
{% 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') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/productfamily/vuejs-product-family.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -18,5 +18,5 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/reductioncart/vuejs-reduction-cart.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/reductioncart/vuejs-reduction-cart.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -18,5 +18,5 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/reductioncatalog/vuejs-reduction-catalog.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/reductioncatalog/vuejs-reduction-catalog.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -87,6 +87,6 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/ticket/init-edit.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/ticket/init-edit.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -41,6 +41,6 @@ | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/user/init-edit.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/user/init-edit.js')|lc_cache }}"></script> | |||
{% endblock %} |
@@ -82,7 +82,7 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-list.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-list.js')|lc_cache }}"></script> | |||
{% endblock %} | |||
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Services ; | |||
namespace Lc\ShopBundle\Services; | |||
use App\Entity\Product; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
@@ -13,62 +13,62 @@ use Lc\ShopBundle\Model\ProductFamily; | |||
class ProductFamilyUtils | |||
{ | |||
protected $priceUtils ; | |||
protected $em ; | |||
protected $priceUtils; | |||
protected $em; | |||
public function __construct(PriceUtilsInterface $priceUtils, EntityManagerInterface $em) | |||
{ | |||
$this->priceUtils = $priceUtils ; | |||
$this->priceUtils = $priceUtils; | |||
$this->em = $em; | |||
} | |||
public function getCheapestProduct($productFamily) | |||
{ | |||
$priceUtils = $this->priceUtils ; | |||
$priceUtils = $this->priceUtils; | |||
return $this->getCheapestOrMostExpensiveProduct($productFamily, function ($a, $b) use ($priceUtils) { | |||
return $priceUtils->getPriceWithTaxAndReduction($a) > $priceUtils->getPriceWithTaxAndReduction($b) ; | |||
return $priceUtils->getPriceWithTaxAndReduction($a) > $priceUtils->getPriceWithTaxAndReduction($b); | |||
}, true); | |||
} | |||
public function getCheapestProductByRefUnit($productFamily) | |||
{ | |||
$priceUtils = $this->priceUtils ; | |||
$priceUtils = $this->priceUtils; | |||
return $this->getCheapestOrMostExpensiveProduct($productFamily, function ($a, $b) use ($priceUtils) { | |||
return $priceUtils->getPriceByRefUnitWithTaxAndReduction($a) > $priceUtils->getPriceByRefUnitWithTaxAndReduction($b) ; | |||
return $priceUtils->getPriceByRefUnitWithTaxAndReduction($a) > $priceUtils->getPriceByRefUnitWithTaxAndReduction($b); | |||
}, false); | |||
} | |||
public function getMostExpensiveProductByRefUnit($productFamily) | |||
{ | |||
$priceUtils = $this->priceUtils ; | |||
$priceUtils = $this->priceUtils; | |||
return $this->getCheapestOrMostExpensiveProduct($productFamily, function ($a, $b) use ($priceUtils) { | |||
return $priceUtils->getPriceByRefUnitWithTaxAndReduction($a) < $priceUtils->getPriceByRefUnitWithTaxAndReduction($b) ; | |||
return $priceUtils->getPriceByRefUnitWithTaxAndReduction($a) < $priceUtils->getPriceByRefUnitWithTaxAndReduction($b); | |||
}, false); | |||
} | |||
private function getCheapestOrMostExpensiveProduct($productFamily, $comparisonFunction, $returnSelfIfNotActiveProducts) | |||
{ | |||
if($productFamily->getActiveProducts()) { | |||
if ($productFamily->getActiveProducts()) { | |||
$products = $productFamily->getProductsOnline()->getValues(); | |||
if (count($products) > 0) { | |||
usort($products, $comparisonFunction); | |||
return $products[0]; | |||
} | |||
}else{ | |||
} else { | |||
return $productFamily->getOriginProduct(); | |||
} | |||
if ($returnSelfIfNotActiveProducts) { | |||
return $productFamily; | |||
} | |||
else { | |||
} else { | |||
return false; | |||
} | |||
} | |||
public function processBeforePersistProductFamily($productFamily, $editForm=false, $clone =false){ | |||
if($editForm){ | |||
public function processBeforePersistProductFamily($productFamily, $editForm = false, $clone = false) | |||
{ | |||
if ($editForm) { | |||
$this->processReductionCatalog($productFamily, $editForm); | |||
$this->processCategories($productFamily); | |||
} | |||
@@ -102,16 +102,21 @@ class ProductFamilyUtils | |||
} | |||
} | |||
protected function processCloneProduct($productFamily) | |||
{ | |||
foreach ($productFamily->getProducts() as $i => $product) { | |||
$newProduct = clone $product; | |||
$newProduct->setProductFamily($productFamily); | |||
$this->em->persist($newProduct); | |||
$productFamily->addProduct($newProduct); | |||
} | |||
} | |||
protected function processProducts($entity, $clone = false) | |||
{ | |||
if($clone) { | |||
foreach ($entity->getProducts() as $i => $product) { | |||
$newProduct = clone $product; | |||
$newProduct->setProductFamily($entity); | |||
$this->em->persist($newProduct); | |||
$entity->addProduct($newProduct); | |||
} | |||
}else { | |||
if ($clone) { | |||
$this->processCloneProduct($entity); | |||
} else { | |||
//Récupère le product origin | |||
$originProducts = $this->em->getRepository(ProductInterface::class)->findBy(array( | |||
'productFamily' => $entity->getId(), | |||
@@ -144,8 +149,8 @@ class ProductFamilyUtils | |||
foreach ($entity->getProducts() as $product) { | |||
$product->setProductFamily($entity); | |||
if($entity->getProductsQuantityAsTitle() && $product->getStatus()>=1){ | |||
$product->setTitle(str_replace('.', ',',$product->getQuantityInherited()).$product->getUnitInherited()->getWording()); | |||
if ($entity->getProductsQuantityAsTitle() && $product->getStatus() >= 1) { | |||
$product->setTitle(str_replace('.', ',', $product->getQuantityInherited()) . $product->getUnitInherited()->getWording()); | |||
} | |||
$this->em->persist($product); |