Ver código fonte

Corretifs edition produits

feature/export_comptable
Fab 4 anos atrás
pai
commit
6f713c7704
13 arquivos alterados com 624 adições e 360 exclusões
  1. +37
    -4
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +78
    -65
      ShopBundle/Repository/OrderShopRepository.php
  3. +2
    -0
      ShopBundle/Resources/public/css/backend/custom.css
  4. +23
    -43
      ShopBundle/Resources/public/js/backend/script/default/utils.js
  5. +36
    -6
      ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js
  6. +27
    -7
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  7. +5
    -4
      ShopBundle/Resources/translations/lcshop.fr.yaml
  8. +1
    -22
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  9. +3
    -0
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  10. +132
    -0
      ShopBundle/Resources/views/backend/productfamily/macros.html.twig
  11. +78
    -1
      ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig
  12. +185
    -205
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig
  13. +17
    -3
      ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig

+ 37
- 4
ShopBundle/Controller/Backend/ProductFamilyController.php Ver arquivo

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

use App\Entity\Product;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\ProductCategoryInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Context\ReductionCatalogInterface;
@@ -14,6 +15,7 @@ use Lc\ShopBundle\Model\ProductFamily;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\Response;

class ProductFamilyController extends AdminController
@@ -252,6 +254,25 @@ class ProductFamilyController extends AdminController
$easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item'];




$orderShopRepo = $this->em->getRepository(OrderShopInterface::class);

$totalProductOrdered = array();
foreach ($entity->getProducts() as $product) {
$currentWeekNumber = $this->orderUtils->getWeekNumberCurrent();
//Les commandes sont ouvertes ont récupèrent les commandes en cours et celle de la semaine dernière
if($this->orderUtils->isOpenSale()) {
$totalProductOrdered[$product->getId()][$currentWeekNumber] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId());
$totalProductOrdered[$product->getId()][$currentWeekNumber - 1] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber - 1, $product->getId());
}else{
$totalProductOrdered[$product->getId()][$currentWeekNumber] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId());
}
}



if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) {
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue'));
$fieldsMetadata = $this->entity['list']['fields'];
@@ -278,7 +299,12 @@ class ProductFamilyController extends AdminController
ksort($sortableProductsField);

$editForm->handleRequest($this->request);
if ($editForm->isSubmitted() && $editForm->isValid()) {

if( $editForm->isSubmitted() && count($entity->getProductCategories()) == 0){
$editForm->get('productCategories')->addError(new FormError('Vous devez choisir au moins une catégorie'));
}

if ($editForm->isSubmitted() && $editForm->isValid() && count($entity->getProductCategories())>0) {

$this->processUploadedFiles($editForm);

@@ -296,7 +322,8 @@ class ProductFamilyController extends AdminController
'entity_fields' => $fields,
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
'sortableProductsField' => $sortableProductsField
'sortableProductsField' => $sortableProductsField,
'totalProductOrdered' => $totalProductOrdered
];

return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]);
@@ -318,7 +345,12 @@ class ProductFamilyController extends AdminController

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

if ($newForm->isSubmitted() && $newForm->isValid()) {

if( $newForm->isSubmitted() && array_search(true, $newForm->get('productCategories')->getData()->toArray())===false){
$newForm->get('productCategories')->addError(new FormError('Vous devez choisir au moins une catégorie'));
}

if ($newForm->isSubmitted() && $newForm->isValid() && array_search(true, $newForm->get('productCategories')->getData()->toArray())!==false) {
$this->processUploadedFiles($newForm);

$this->dispatch(EasyAdminEvents::PRE_PERSIST, ['entity' => $entity]);
@@ -342,7 +374,8 @@ class ProductFamilyController extends AdminController
'entity_fields' => $fields,
'entity' => $entity,
'categories' => $categories,
'sortableProductsField' => array()
'sortableProductsField' => array(),
'totalProductOrdered' => array()
];

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

+ 78
- 65
ShopBundle/Repository/OrderShopRepository.php Ver arquivo

@@ -26,7 +26,8 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
protected $statusAliasAsCart = array('cart', 'waiting-payment-online', 'waiting-payment-credit', 'waiting-payment-on-delivery', 'error-payment-online');


public function countValidOrderWithReductionCredit($reductionCredit, $user){
public function countValidOrderWithReductionCredit($reductionCredit, $user)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
@@ -39,7 +40,8 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
}


public function countValidOrderWithReductionCart($reductionCart){
public function countValidOrderWithReductionCart($reductionCart)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
@@ -50,7 +52,8 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
}


public function countValidOrderWithReductionCartPerUser($reductionCart, $user){
public function countValidOrderWithReductionCartPerUser($reductionCart, $user)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
@@ -63,7 +66,8 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
}


public function filterOrderValid(?QueryBuilder $query) :QueryBuilder {
public function filterOrderValid(?QueryBuilder $query): QueryBuilder
{

$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias IN (:alias)');
@@ -83,27 +87,26 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt

public function filterIsOffCircuit($query, $isOffCircuit)
{
if($isOffCircuit) {
$query->andWhere('e.isOffCircuit = 1') ;
}
else {
$query->andWhere('e.isOffCircuit IS NULL OR e.isOffCircuit = 0') ;
if ($isOffCircuit) {
$query->andWhere('e.isOffCircuit = 1');
} else {
$query->andWhere('e.isOffCircuit IS NULL OR e.isOffCircuit = 0');
}

return $query ;
return $query;
}

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


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

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

$query = $this->filterOrderCart($query);
@@ -111,109 +114,119 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
$query->leftJoin('e.orderReductionCarts', 'orderReductionCarts')
->addSelect('orderReductionCarts');

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

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

return null ;
return null;
}

public function findAllBy($params = [])
{
$query = $this->findByMerchantQuery() ;
$query = $this->findByMerchantQuery();

if(isset($params['count']) && $params['count']) {
$query->select('count(e.id)') ;
if (isset($params['count']) && $params['count']) {
$query->select('count(e.id)');
}

if(isset($params['dateStart']) || isset($params['dateEnd'])) {
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate' ;
if (isset($params['dateStart']) || isset($params['dateEnd'])) {
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate';
}

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

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

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

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

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

$query->leftJoin('complementaryOrderShops.orderStatus', 'complementaryOrderStatus');
$query->andWhere('complementaryOrderStatus.alias IN (:statusAliasValid)');
$query->setParameter('statusAliasValid', $this->statusAliasAsValid);
}

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

if(isset($params['isOffCircuit'])) {
$query = $this->filterIsOffCircuit($query, true) ;
if (isset($params['isOffCircuit'])) {
$query = $this->filterIsOffCircuit($query, true);
}

if(isset($params['isCircuit'])) {
$query = $this->filterIsOffCircuit($query, false) ;
$query->leftJoin('e.deliveryPointSale', 'pointSale') ;
$query->andWhere('e.deliveryPointSale IS NULL OR pointSale.isDepository = 0') ;
if (isset($params['isCircuit'])) {
$query = $this->filterIsOffCircuit($query, false);
$query->leftJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('e.deliveryPointSale IS NULL OR pointSale.isDepository = 0');
}

if(isset($params['isDepository'])) {
$query = $this->filterIsOffCircuit($query, false) ;
$query->innerJoin('e.deliveryPointSale', 'pointSale') ;
$query->andWhere('pointSale.isDepository = 1') ;
if (isset($params['isDepository'])) {
$query = $this->filterIsOffCircuit($query, false);
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale.isDepository = 1');
}

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

$query->leftJoin('e.deliveryAvailabilityZone', 'deliveryAvailabilityZone') ;
$query->leftJoin('deliveryAvailabilityZone.deliverySlot', 'deliverySlotZone') ;
$query->leftJoin('e.deliveryAvailabilityZone', 'deliveryAvailabilityZone');
$query->leftJoin('deliveryAvailabilityZone.deliverySlot', 'deliverySlotZone');

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

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

public function findLastOrderValidOfWeek($weekNumber){
public function findLastOrderValidOfWeek($weekNumber)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.weekNumber = :weekNumber');
$query->setParameter('weekNumber', $weekNumber);
$query->orderBy('e.validationDate','DESC');
$query->orderBy('e.validationDate', 'DESC');
$query->setMaxResults(1);

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

}

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

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

}
}

+ 2
- 0
ShopBundle/Resources/public/css/backend/custom.css Ver arquivo

@@ -144,6 +144,7 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0
/* ProductFamily */

.field-unit-quantity{border-bottom: 2px dotted #eee; padding-bottom: 10px; margin-bottom: 20px;}
.field-reduction-apply{border-top: 2px dotted #eee; padding-top: 10px; margin-top: 20px;}

.new-productfamily #nav-params,
.edit-productfamily #nav-params {
@@ -208,6 +209,7 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0
.product-form.modal .form-check-label{font-style: italic; color: #666; text-align: left;}
.products-collection-table .inherited{color: #888; font-style: italic; font-weight: initial;}
.products-collection-table td{position: relative;}
.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;}
.products-collection-table .btn-empty-field{position: absolute; right: 3px; font-size: 0.7rem; top: 5px; padding: 0px;}
#lc-product-family-edit .products-collection-table {table-layout:fixed;}
#lc-product-family-edit .products-collection-table tr{border-bottom: 1px solid #dee2e6;}

+ 23
- 43
ShopBundle/Resources/public/js/backend/script/default/utils.js Ver arquivo

@@ -1,46 +1,3 @@

/* ProductFamily */


/*function initLcTaxPriceWidget() {
lcTaxPriceInit() ;
$('#productfamily_price').change(lcTaxPriceEventPrice);
$('#productfamily_priceWithTax').change(lcTaxPriceEventPriceWithTax);
}

function lcTaxPriceInit() {
lcTaxPriceUpdate('priceWithTax') ;
$('#productfamily_price').val(parseFloat($('#productfamily_price').val()).toFixed(3));
}

function lcTaxPriceEventPrice() {
lcTaxPriceUpdate('priceWithTax') ;
}

function lcTaxPriceEventPriceWithTax() {
lcTaxPriceUpdate('price') ;
}

function lcTaxGetTaxRate() {
taxRate = $('#productfamily_taxRate').find('option:selected').data('tax-rate-value');
if(typeof taxRate == 'undefined') {
taxRate = 0 ;
}
return taxRate ;
}

function lcTaxPriceUpdate(priceType) {
var taxRate = lcTaxGetTaxRate() ;
if(priceType == 'priceWithTax') {
$('#productfamily_priceWithTax').val(getPriceWithTax($('#productfamily_price').val(), taxRate));
}
else {
$('#productfamily_price').val(getPrice($('#productfamily_priceWithTax').val(), taxRate));
}
}*/



/**
* Retourne un prix sans taxe sur base du prix avec tax
*
@@ -63,6 +20,29 @@ function getPriceWithTax(priceWithoutTax, taxRate) {
return parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1)).toFixed(2);
}

function getMargin(price, buyingPrice){
return parseFloat(price - buyingPrice).toFixed(2);
}

function getMarginPercent(price, buyingPrice){
return parseFloat(((price - buyingPrice) / buyingPrice) * 100).toFixed(2);
}

function applyReductionPercent(price, percentage)
{
return applyPercent(price, -percentage);
}

function applyReductionAmount(price, amount)
{
return parseFloat(price - amount).toFixed(2);
}

function applyPercent(price, percentage)
{
return parseFloat(price * (percentage / 100 + 1)).toFixed(2);
}


function formatNumber(number, toFixed){
if(number)return Number(number.replace(',', '.')).toFixed(toFixed);

+ 36
- 6
ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js Ver arquivo

@@ -17,11 +17,27 @@ let mixinPrice = {

},
computed: {
/*priceWithTaxAndReduction:function () {
if(this.productFamily.reductionActive){
log(this.productFamily.value);
}
}*/
marginProfit: function () {
return getMargin(this.priceValue,this.buyingPriceValue);
},
marginProfitPercent:function () {
return getMarginPercent(this.priceValue, this.buyingPriceValue);
},
marginProfitWithReduction: function () {
var price = this.$parent.applyReduction(this.priceValue, this.priceWithTaxValue, this.taxRateValue, false);
return getMargin(price, this.buyingPriceValue);
},
marginProfitPercentWithReduction:function () {
var price = this.$parent.applyReduction(this.priceValue, this.priceWithTaxValue, this.taxRateValue, false);
return getMarginPercent(price, this.buyingPriceValue);
},
finalPriceWithTax: function () {
return getPriceWithTax(parseFloat((this.priceByRefUnitValue * this.quantityValue) / this.unitCoefficient).toFixed(4), this.taxRateValue);
},
finalPriceWithTaxAndReduction(){
return this.$parent.applyReduction(this.priceValue, this.priceWithTaxValue, this.taxRateValue, true);
}

},
mounted: function () {

@@ -376,6 +392,20 @@ let mixinReduction = {

select = setSelect2($(this.$refs[refFiltered]))

},
applyReduction: function(price, priceWithTax, taxRateValue, returnWithTax){
if (this.reductionUnit == 'percent') {
if(returnWithTax) return applyReductionPercent(priceWithTax, this.reductionValue);
else return applyReductionPercent(price, this.reductionValue);
} else if (this.reductionUnit == 'amount'){
if(this.reductionBehaviorTaxRate == 'tax-included') {
if(returnWithTax) return applyReductionAmount(priceWithTax, this.reductionValue);
else return getPrice(applyReductionAmount(priceWithTax, this.reductionValue), taxRateValue);
}else if(this.reductionBehaviorTaxRate == 'tax-excluded') {
if(returnWithTax) return getPriceWithTax(applyReductionAmount(price, this.reductionValue), taxRateValue);
else return applyReductionAmount(price, this.reductionValue);
}
}
}
},
watch: {
@@ -402,4 +432,4 @@ let mixinReduction = {
},

}
};
};

+ 27
- 7
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js Ver arquivo

@@ -159,9 +159,6 @@ Vue.component('product-form', {
},
behaviorPriceValue: function () {
return this.productFamily.behaviorPrice;
},
finalPriceWithTax: function () {
return getPriceWithTax(parseFloat((this.priceByRefUnitValue * this.quantityValue) / this.unitCoefficient).toFixed(4), this.taxRateValue);
}
},
data() {
@@ -204,25 +201,36 @@ Vue.component('product-form', {
$(this.$el).find('input, select').on('keydown', function (e) {
if (e.keyCode == 13 || e.keyCode == 9) e.preventDefault();

//GAUCHE
//ENTRER
if(e.keyCode == 13){
log(e.keyCode);
$(this).blur();;
}
// shift + [+]
if (e.shiftKey && e.keyCode == 107) {
e.preventDefault()
app.$parent.addProductForm();
}
//GAUCHE (tab + shift)
if (e.shiftKey && e.keyCode == 9) {
e.preventDefault();
$prevField = $(this).parents('td').prevAll('td:visible').first().find('input, select');
app.setFocusOnField($prevField.data('ref'), $prevField.data('y'));

//DROITE (tab)
} else if (e.keyCode == '9') {
e.preventDefault();
$nextField = $(this).parents('td').nextAll('td:visible').first().find('input, select');
app.setFocusOnField($nextField.data('ref'), $nextField.data('y'));
}

//BAS
//BAS (flèche bas)
if (e.keyCode == '40') {
y = parseInt($(this).data('y')) + 1;
if (y >= app.$parent.$refs['productForm'].length) y = 0;
app.$parent.$refs['productForm'][y].setFocusOnField($(this).data('ref'), y);
}
//HAUT
//HAUT (flèche haut
if (e.keyCode == '38') {
y = parseInt($(this).data('y')) - 1;
if (y == -1) y = app.$parent.$refs['productForm'].length - 1;
@@ -276,7 +284,8 @@ Vue.component('product-form', {
}
},
modalProductForm: function () {
$('#modal-extends-product').modal('show')
log($('#modal-extends-product-'+this.keyForm));
$('#modal-extends-product-'+this.keyForm).modal('show')
},
},
watch: {}
@@ -308,6 +317,8 @@ appProductFamily = new Vue({
'priceByRefUnitWithTax': this.$refs.productUnitPrice.priceByRefUnitWithTax,
'taxRateValue': this.$refs.productUnitPrice.taxRateValue,
'supplierTaxRateValue': this.$refs.productUnitPrice.supplierTaxRateValue,
'marginProfit': this.$refs.productUnitPrice.marginProfit,
'marginProfitPercent': this.$refs.productUnitPrice.marginProfitPercent,

/*'taxRate': this.$refs.productUnitPrice.taxRate,
'supplierTaxRate': this.$refs.productUnitPrice.supplierTaxRate,
@@ -460,6 +471,15 @@ appProductFamily = new Vue({
}
});

var allowLeave = false;
$('#edit-productfamily-form').on('submit', function () {
allowLeave =true;
})
$(window).bind('beforeunload', function(e){
if(!allowLeave){
return 'Êtes vous sur de vouloir quitter ?';
}
});

$(window).on('load', function () {
for (i = 0; i < window.formProductTemplate.length; i++) {

+ 5
- 4
ShopBundle/Resources/translations/lcshop.fr.yaml Ver arquivo

@@ -33,6 +33,7 @@ group:
note: Note interne
parameters: Paramètres
initReduction: Réduction
export: Note à l'export
ReductionCatalog:
info: Informations principal
conditions: Condictions d'application
@@ -235,8 +236,8 @@ field:
displayPriceUnitRef: Afficher le prix par unité de référence
behaviorPrice: Travailler avec des tarifs
behaviorPriceOptions:
byPiece: À la pièce
byRefUnit: Par unité de référence
by-piece: À la pièce
by-reference-unit: Par unité de référence
behaviorCountStockOptions:
by-measure: Gérer le stock par unité de référence
by-product-family: Gérer le stock par produit (à l'unité)
@@ -253,8 +254,8 @@ field:
natureProgres: Nature & progrès
behaviorExpirationDate: Gèrer
behaviorExpirationDateOptions:
productFamily: Par produit
product: Par déclinaisons
by-product-family: Par produit
by-product: Par déclinaisons
taxRate: TVA
unit: Unité
behaviorAddToCartOptions:

+ 1
- 22
ShopBundle/Resources/views/backend/default/block/macros.html.twig Ver arquivo

@@ -27,27 +27,6 @@



{% macro product_field(colspan, field, field_name, field_display = false, display_suffix="",attr="") %}

{% if field_display == false %}{% set field_display = field_name %}{% endif %}

<td {{ attr|raw }} colspan="{{ colspan }}" class="{{ field_name }}">
<div class="value" v-show="{{ field_name }}Inherited == false" v-on:click="setFocusOnField('{{ field_name }}Inherited', keyForm)">
<div v-if="{{ field_name }}">
{% verbatim %}{{ {% endverbatim %}{{ field_display }} {% verbatim %}}}{% endverbatim %}{{ display_suffix }}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.{% endverbatim %}{{ field_display }} {% verbatim %}}}{% endverbatim %}{{ display_suffix }}
</div>
</div>
<div v-show="{{ field_name }}Inherited == true">
{{ form_widget(field, {'attr' : {'v-model' : field_name , 'v-on:focusout': field_name~'Inherited = false', '@change' : field_name~'Updated', 'data-ref': field_name~'Inherited', ':data-y' : "keyForm" }}) }}
</div>
<button v-show="{{ field_name }}" v-on:click="{{ field_name }} = null; {{ field_name }}Inherited = false; "
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</td>
{% endmacro %}

{% macro priceField(field, fieldTax, fieldName, behaviorPriceValue) %}
<div class="form-group field-price col-12" v-show="behaviorPrice == '{{ behaviorPriceValue }}'">
<div class="row">
@@ -167,7 +146,7 @@
{% macro reductionCatalogForm(form) %}
{{ _self.startCard(6, 'ReductionCatalog.info') }}
<div class="col-12">
{{ form_row(form.title) }}
{{ form_row(form.title, {'attr' : {":required": "reductionActive"}}) }}
</div>
{{ _self.fieldReductionUnit(form) }}
{{ _self.fieldReductionValue(form) }}

+ 3
- 0
ShopBundle/Resources/views/backend/productfamily/form.html.twig Ver arquivo

@@ -1,5 +1,7 @@
{{ form_start(form, {"attr": {'@change' : 'formUpdated'}}) }}
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
{% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %}

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

<div id="lc-product-family-edit">
@@ -33,6 +35,7 @@
window.appProductFamilyValues = {
{% if formValues.title %}title: "{{ formValues.title }}",{% endif %}
{% if form.behaviorCountStock.vars.value %}behaviorCountStock: "{{ form.behaviorCountStock.vars.value }}",{% endif %}
{% if form.behaviorStockWeek.vars.value %}behaviorStockWeek: "{{ form.behaviorStockWeek.vars.value }}",{% endif %}
{% if formValues.availableQuantity %}availableQuantity: "{{ formValues.availableQuantity }}",{% endif %}
{% if formValues.availableQuantityDefault %}availableQuantityDefault: "{{ formValues.availableQuantityDefault }}",{% endif %}
{% if formValues.propertyOrganicLabel %}propertyOrganicLabelActive: true,{% endif %}

+ 132
- 0
ShopBundle/Resources/views/backend/productfamily/macros.html.twig Ver arquivo

@@ -0,0 +1,132 @@
{% trans_default_domain 'lcshop' %}

{% macro total_order_product(totalProductOrdered) %}
{% for weekNumber, weekNumberQuantity in totalProductOrdered %}
<span class="text-success"><i class="fa fa-calendar"></i> {{ weekNumber }}</span>
<span class="text-info"><i class="fa fa-shopping-basket"></i>
<strong>{{ weekNumberQuantity['quantity'] is null ? 0 : weekNumberQuantity['quantity']}}</strong></span>
<br />
{% endfor %}
{% endmacro total_order_product %}

{% macro product_field(colspan, field, field_name, field_display = false, display_suffix="",attr="") %}

{% if field_display == false %}{% set field_display = field_name %}{% endif %}

<td {{ attr|raw }} colspan="{{ colspan }}" class="{{ field_name }}">
<div class="value" v-show="{{ field_name }}Inherited == false" v-on:click="setFocusOnField('{{ field_name }}Inherited', keyForm)">
<div v-if="{{ field_name }}">
{% verbatim %}{{ {% endverbatim %}{{ field_display }} {% verbatim %}}}{% endverbatim %}{{ display_suffix }}
{% if field_name == 'priceWithTax' %}
<br />
<span class="text-danger" v-show="productFamily.reductionActive">{% verbatim %}{{ finalPriceWithTaxAndReduction }}{% endverbatim %}€</span>
{% endif %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.{% endverbatim %}{{ field_display }} {% verbatim %}}}{% endverbatim %}{{ display_suffix }}
{% if field_name == 'priceWithTax' %}
<br />
<span class="text-danger" v-show="productFamily.reductionActive">{% verbatim %}{{ finalPriceWithTaxAndReduction }}{% endverbatim %}€</span>
{% endif %}

</div>
</div>
<div v-show="{{ field_name }}Inherited == true">
{{ form_widget(field, {'attr' : {'v-model' : field_name , 'v-on:focusout': field_name~'Inherited = false', '@change' : field_name~'Updated', 'data-ref': field_name~'Inherited', ':data-y' : "keyForm" }}) }}
</div>
<button v-show="{{ field_name }}" v-on:click="{{ field_name }} = null; {{ field_name }}Inherited = false; "
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</td>
{% endmacro %}

{% macro product_row(product, totalProductOrdered) %}

<tr class="lc-draggable">
<td><i class="fa fa-fw fa-sort"></i></td>
{{ _self.product_field(4, product.title, 'title') }}
{{ _self.product_field(2, product.quantity, 'quantity') }}
{{ _self.product_field(2, product.unit, 'unit', 'unitWording') }}
{{ _self.product_field(3, product.buyingPriceByRefUnit, 'buyingPriceByRefUnit',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}
{{ _self.product_field(3, product.buyingPriceByRefUnitWithTax, 'buyingPriceByRefUnitWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}
{{ _self.product_field(3, product.buyingPrice, 'buyingPrice',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') ~ '\'"') }}
{{ _self.product_field(3, product.buyingPriceWithTax, 'buyingPriceWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') ~ '\'"') }}

<td colspan="3" v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'">
{% verbatim %}{{ buyingPriceWithTax }}{% endverbatim %}€
</td>

{{ _self.product_field(3, product.multiplyingFactor, 'multiplyingFactor') }}
{{ _self.product_field(3, product.priceByRefUnit, 'priceByRefUnit',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}
{{ _self.product_field(3, product.priceByRefUnitWithTax, 'priceByRefUnitWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}

<td colspan="3" v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'">
{% verbatim %}{{ finalPriceWithTax }}{% endverbatim %}€
<span class="text-danger" v-show="productFamily.reductionActive">{% verbatim %}{{ finalPriceWithTaxAndReduction }}{% endverbatim %}€</span>
</td>

{{ _self.product_field(3, product.price, 'price', false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') ~ '\'"') }}
{{ _self.product_field(3, product.priceWithTax, 'priceWithTax', false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') ~ '\'"') }}

<td colspan="2">
<span v-if="productFamily.reductionActive" class="text-danger">
{% verbatim %}{{ marginProfitWithReduction }}{% endverbatim %}€<br />
{% verbatim %}{{ marginProfitPercentWithReduction }}{% endverbatim %}%
</span>
<span v-else>
{% verbatim %}{{ marginProfit }}{% endverbatim %}€<br />
{% verbatim %}{{ marginProfitPercent }}{% endverbatim %}%
</span>
</td>

{{ _self.product_field(2, product.propertyExpirationDate, 'propertyExpirationDate','propertyExpirationDateValue', '', 'v-show="productFamily.behaviorExpirationDate== \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') ~ '\'"') }}

{{ _self.product_field(2, product.availableQuantity, 'availableQuantity',false, '', 'v-show="productFamily.behaviorCountStock== \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') ~ '\'"') }}
{{ _self.product_field(2, product.availableQuantityDefault, 'availableQuantityDefault',false, '', 'v-show="productFamily.behaviorCountStock== \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') ~ '\' && productFamily.behaviorStockWeek!= \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') ~ '\'"') }}


<td colspan="2" v-show="productFamily.behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || productFamily.behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'">

{{ _self.total_order_product(totalProductOrdered) }}

</td>
<td colspan="2">
<button type="button" class="btn-remove-product btn-sm btn-info" @click="modalProductForm()">
<i class="fa fa-edit"></i>
</button>
<button type="button" class="btn-remove-product btn-sm btn-danger" @click="deleteProductForm()">
<i class="fa fa-trash"></i>
</button>
{{ form_widget(product.position, {'attr' : {'class': "field-position"}}) }}


<div class="modal fade show" :id="'modal-extends-product-'+keyForm">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4>{{ "group.ProductFamily.productsExtend"|trans }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="col">
{{ form_row(product.exportTitle) }}
</div>
<div class="col">
{{ form_row(product.exportNote) }}

</div>

</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-info float-right" data-dismiss="modal">Ok</button>
</div>
</div>
<!-- /.modal-content -->
</div>
</div>


</td>
</tr>
{% endmacro %}

+ 78
- 1
ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig Ver arquivo

@@ -70,7 +70,7 @@

<div class="form-group field-price col-12">
<div class="row">
<div class="col-6 align-content-center">
<div class="col-6">
<div class="form-widget">
{{ form_label(form.multiplyingFactor) }}
<div class="input-group">
@@ -82,6 +82,33 @@
</div>

</div>
<div class="col-6">
<div class="row">
<div class="col-12">
<label>Marge</label>
</div>
<div class="col-6">
<div class="form-widget">
<div class="input-group">
<input class="form-control" disabled :value="productFamily.marginProfit">
<div class="input-group-append">
<span class="input-group-text">€</span>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="form-widget">
<div class="input-group">
<input class="form-control" disabled :value="productFamily.marginProfitPercent">
<div class="input-group-append">
<span class="input-group-text">%</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@@ -89,6 +116,56 @@
{{ macros.priceField(form.price, form.priceWithTax, 'price', 'by-piece') }}
{{ macros.priceField(form.priceByRefUnit, form.priceByRefUnitWithTax, 'priceByRefUnit', 'by-reference-unit') }}


<div class="form-group field-reduction-apply col-12" v-show="reductionActive">
<div class="row">
<div class="col-12 align-content-center">
<h6>Réduction appliqué</h6>
</div>
<div class="col-6">
<div class="row">
<div class="col-12">
<label>Marge</label>
</div>
<div class="col-6">
<div class="form-widget">
<div class="input-group text-danger">
<input class="form-control text-danger" disabled :value="marginProfitWithReduction">
<div class="input-group-append">
<span class="input-group-text">€</span>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="form-widget">
<div class="input-group">
<input class="form-control text-danger" disabled
:value="marginProfitPercentWithReduction">
<div class="input-group-append">
<span class="input-group-text">%</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-6">
<label>Prix de vente TTC</label>
<div class="form-widget">
<div class="input-group text-danger">
<input class="form-control text-danger" disabled :value="finalPriceWithTaxAndReduction">
<div class="input-group-append">
<span class="input-group-text">€</span>
</div>
</div>
</div>

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


{{ macros.endCard() }}

</div>

+ 185
- 205
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig Ver arquivo

@@ -1,237 +1,217 @@
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
{% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %}
{% trans_default_domain 'lcshop' %}
{% macro printProductRow(product) %}

<tr class="lc-draggable">
<td><i class="fa fa-fw fa-sort"></i></td>
{{ macros.product_field(2, product.title, 'title') }}
{{ macros.product_field(1, product.quantity, 'quantity') }}
{{ macros.product_field(1, product.unit, 'unit', 'unitWording') }}
{{ macros.product_field(2, product.buyingPrice, 'buyingPrice',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') ~ '\'"') }}
{{ macros.product_field(2, product.buyingPriceWithTax, 'buyingPriceWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') ~ '\'"') }}
{{ macros.product_field(2, product.buyingPriceByRefUnit, 'buyingPriceByRefUnit',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}
{{ macros.product_field(2, product.buyingPriceByRefUnitWithTax, 'buyingPriceByRefUnitWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}
{{ macros.product_field(2, product.multiplyingFactor, 'multiplyingFactor') }}
{{ macros.product_field(2, product.priceByRefUnit, 'priceByRefUnit',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}
{{ macros.product_field(2, product.priceByRefUnitWithTax, 'priceByRefUnitWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}

<td colspan="2" v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'">
{% verbatim %}{{ finalPriceWithTax }}{% endverbatim %}€
</td>

{{ macros.product_field(2, product.price, 'price', false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') ~ '\'"') }}
{{ macros.product_field(2, product.priceWithTax, 'priceWithTax', false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') ~ '\'"') }}

{{ macros.product_field(1, product.availableQuantity, 'availableQuantity',false, '', 'v-show="productFamily.behaviorCountStock== \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') ~ '\'"') }}
{{ macros.product_field(1, product.availableQuantityDefault, 'availableQuantityDefault',false, '', 'v-show="productFamily.behaviorCountStock== \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') ~ '\' && productFamily.behaviorStockWeek!= \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') ~ '\'"') }}

{{ macros.product_field(2, product.propertyExpirationDate, 'propertyExpirationDate','propertyExpirationDateValue', '', 'v-show="productFamily.behaviorExpirationDate== \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') ~ '\'"') }}

<td>
<button type="button" class="btn-remove-product btn-sm btn-info" @click="modalProductForm()">
<i class="fa fa-edit"></i>
</button>
<button type="button" class="btn-remove-product btn-sm btn-danger" @click="deleteProductForm()">
<i class="fa fa-trash"></i>
</button>
{{ form_widget(product.position, {'attr' : {'class': "field-position"}}) }}


<div class="modal fade show" id="modal-extends-product">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4>{{ "group.ProductFamily.productsExtend"|trans }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="col">
{{ form_row(product.exportTitle) }}
</div>
<div class="col">
{{ form_row(product.exportNote) }}

</div>

</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-info float-right" data-dismiss="modal">Ok</button>
</div>
</div>
<!-- /.modal-content -->
</div>
</div>


</td>
</tr>
{% endmacro %}

{% import _self as formMacros %}
{#{% import _self as formMacros %}#}
<div class="row">
{{ macros.startCard(12, 'ProductFamily.products', 'light', true) }}

<table class="table datagrid sortable lc-sortable-products products-collection-table"
:data-index="formProductArray.length"
data-prototype="{{ formMacros.printProductRow(form.products.vars.prototype)|e('html_attr') }}">
<thead>
<tr>
<th>
</th>
<th colspan="2" class="string">
Titre
</th>
<th colspan="1" class="string ">
Quantité
</th>
<th colspan="1" class="quantity">
Unité
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" colspan="2" class="buyingPriceByRefUnit">
PA HT / ${ getUnitReference() }
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" colspan="2" class="priceByRefUnit">
PA TTC / ${ getUnitReference() }
</th>

<th colspan="2" class="price" v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
PA HT
</th>
<th colspan="2" class="price" v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
PA TTC
</th>
<th colspan="2" class="">
Coef
</th>


<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" colspan="2" class="">
PV HT / ${ getUnitReference() }
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" colspan="2" class="price">
PV TTC / ${ getUnitReference() }
</th>

<th colspan="2" class="price" v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
PV HT
</th>
<th colspan="2" class="price">
PV TTC
</th>

<th v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
Stock
</th>
<th v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
Stock par défaut
</th>
<th colspan="2" class="" v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
<span style="text-transform: uppercase"> ${typeExpirationDate}</span>
</th>
<th class="">
Action
</th>
</tr>
</thead>
<tbody class="products-collection">

<template v-for="(formProduct, key) in formProductArray">

<product-form ref="productForm" v-bind:product-family="productFamily" :template="formProduct"
:key-form="key"></product-form>
</template>

</tbody>
<tfoot>
<table class="table datagrid sortable lc-sortable-products products-collection-table"
:data-index="formProductArray.length"
data-prototype="{{ product_family_macros.product_row(form.products.vars.prototype)|e('html_attr') }}">
<thead>
<tr>
<th>
Rappel
</th>
<th colspan="2" class="string">
${title}
<th colspan="4" class="string">
Titre
</th>
<th colspan="1" class="string ">
${productFamily.quantity}
<th colspan="2" class="string ">
Quantité
</th>
<th colspan="1" class="quantity">
${productFamily.unitWording}
<th colspan="2" class="quantity">
Unité
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" colspan="2" class="buyingPriceByRefUnit">
${productFamily.buyingPriceByRefUnit}
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="buyingPriceByRefUnit">
PA HT / ${ getUnitReference() }
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" colspan="2" class="priceByRefUnit">
${productFamily.buyingPriceByRefUnitWithTax}
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="priceByRefUnit">
PA TTC / ${ getUnitReference() }
</th>

<th colspan="2" class="price" v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
${productFamily.buyingPrice}
<th colspan="3" class="price"
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
PA HT
</th>
<th colspan="2" class="price" v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
${productFamily.buyingPriceWithTax}
<th colspan="3" class="price">
PA TTC
</th>
<th colspan="2" class="">
${productFamily.multiplyingFactor}
<th colspan="3" class="">
Coef
</th>


<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" colspan="2" class="">
${productFamily.priceByRefUnit}
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="">
PV HT / ${ getUnitReference() }
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" colspan="2" class="price">
${productFamily.priceByRefUnitWithTax}
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="price">
PV TTC / ${ getUnitReference() }
</th>

<th colspan="2" class="price" v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
${productFamily.price}
<th colspan="3" class="price"
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
PV HT
</th>
<th colspan="3" class="price">
PV TTC
</th>
<th colspan="2" class="price">
${productFamily.priceWithTax}
<th colspan="2">
Marge HT
</th>

<th v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
<th colspan="2" class=""
v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
<span style="text-transform: uppercase"> ${typeExpirationDate}</span>
</th>
<th v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
<th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
Stock
</th>
<th colspan="2" class="" v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
${propertyExpirationDate}
<th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
Stock par défaut
</th>
<th class="">

<th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'">
Semaine / Commandés
</th>
</tfoot>
</table>
<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span
class="fa fa-plus"></span> Ajouter une déclinaison
</button>
<div class="clearfix"></div>

{{ macros.endCard() }}
</div>
{% do form.products.setRendered %}

<script>
window.productForm = new Array();
window.formProductTemplate = new Array();

{% for keyForm,i in sortableProductsField %}
{% set product = form.products[i] %}

window.productForm[{{ keyForm }}] = {
{% if product.vars.value.title %}title: "{{ product.vars.value.title }}",{% endif %}
{% if product.vars.value.quantity %}quantity: "{{ product.vars.value.quantity }}",{% endif %}
{% if product.vars.value.unit %}unit: {{ product.vars.value.unit.id }},{% endif %}
{% if product.vars.value.buyingPrice %}buyingPrice: parseFloat({{ product.vars.value.buyingPrice }}).toFixed(3),{% endif %}
{% if product.vars.value.buyingPriceByRefUnit %}buyingPriceByRefUnit: parseFloat({{ product.vars.value.buyingPriceByRefUnit }}).toFixed(3),{% endif %}
{% if product.vars.value.price %}price: parseFloat({{ product.vars.value.price }}).toFixed(3),{% endif %}
{% if product.vars.value.priceByRefUnit %}priceByRefUnit: parseFloat({{ product.vars.value.priceByRefUnit }}).toFixed(3),{% endif %}
{% if product.vars.value.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %}
{% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %}
{% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %}
{#{% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %}#}
};
window.formProductTemplate[{{ keyForm }}] = '{{ formMacros.printProductRow(product)|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
{% endfor %}
<th colspan="2" class="">
Action
</th>
</tr>
</thead>
<tbody class="products-collection">

<template v-for="(formProduct, key) in formProductArray">

<product-form ref="productForm" v-bind:product-family="productFamily" :template="formProduct"
:key-form="key"></product-form>
</template>

</tbody>
<tfoot>
<th>
Rappel
</th>
<th colspan="4" class="string">
${title}
</th>
<th colspan="2" class="string ">
${productFamily.quantity}
</th>
<th colspan="2" class="quantity">
${productFamily.unitWording}
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="buyingPriceByRefUnit">
${productFamily.buyingPriceByRefUnit}
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="priceByRefUnit">
${productFamily.buyingPriceByRefUnitWithTax}
</th>

<th colspan="3" class="price"
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
${productFamily.buyingPrice}
</th>
<th colspan="3" class="price">
${productFamily.buyingPriceWithTax}
</th>
<th colspan="3" class="">
${productFamily.multiplyingFactor}
</th>


<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="">
${productFamily.priceByRefUnit}
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="price">
${productFamily.priceByRefUnitWithTax}
</th>

<th colspan="3" class="price"
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
${productFamily.price}
</th>
<th colspan="3" class="price">
${productFamily.priceWithTax}
</th>
<th colspan="2" class="price">
${productFamily.marginProfit}€<br />
${productFamily.marginProfitPercent}%
</td>

</script>
<th colspan="2" class=""
v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
${propertyExpirationDate}
</th>

<th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
</th>
<th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
</th>
<th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'">
</th>

<th colspan="2" class="">

</th>
</tfoot>
</table>

<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span
class="fa fa-plus"></span> Ajouter une déclinaison
</button>
<p>
<strong>Aide à l'utilisation - Raccourci clavier</strong>
<ul>
<li><strong>TAB</strong> : Champ suivant</li>
<li><strong>SHIFT + TAB</strong> : Champ précédent</li>
<li><strong>FLÈCHE BAS</strong> : Déclinaison suivante</li>
<li><strong>FLÈCHE HAUT</strong> : Déclinaison précédente</li>
<li><strong>SHIFT + [+]</strong> : Ajout d'une nouvelle déclinaison</li>
</ul>
</p>

<div class="clearfix"></div>

{{ macros.endCard() }}
</div>
{% do form.products.setRendered %}

<script>
window.productForm = new Array();
window.formProductTemplate = new Array();

{% for keyForm,i in sortableProductsField %}
{% set product = form.products[i] %}

window.productForm[{{ keyForm }}] = {
{% if product.vars.value.title %}title: "{{ product.vars.value.title }}",{% endif %}
{% if product.vars.value.quantity %}quantity: "{{ product.vars.value.quantity }}",{% endif %}
{% if product.vars.value.unit %}unit: {{ product.vars.value.unit.id }},{% endif %}
{% if product.vars.value.buyingPrice %}buyingPrice: parseFloat({{ product.vars.value.buyingPrice }}).toFixed(3),{% endif %}
{% if product.vars.value.buyingPriceByRefUnit %}buyingPriceByRefUnit: parseFloat({{ product.vars.value.buyingPriceByRefUnit }}).toFixed(3),{% endif %}
{% if product.vars.value.price %}price: parseFloat({{ product.vars.value.price }}).toFixed(3),{% endif %}
{% if product.vars.value.priceByRefUnit %}priceByRefUnit: parseFloat({{ product.vars.value.priceByRefUnit }}).toFixed(3),{% endif %}
{% if product.vars.value.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %}
{% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %}
{% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %}
{#{% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %}#}
};
window.formProductTemplate[{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
{% endfor %}

</script>


+ 17
- 3
ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig Ver arquivo

@@ -1,7 +1,7 @@
{% trans_default_domain 'lcshop' %}


{% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %}
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}

<div class="row">
{{ macros.startCard(8, 'ProductFamily.stock', 'light') }}

@@ -35,6 +35,7 @@
</div>
{{ form_help(form.availableQuantity) }}
</div>

</div>
<div 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') }}') && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
{{ form_label(form.availableQuantityDefault) }}
@@ -48,7 +49,11 @@
{{ form_help(form.availableQuantityDefault) }}
</div>
</div>

<p v-show="behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY') }}' ">
{% for quantityProductsOrder in totalProductOrdered %}
{{ product_family_macros.total_order_product(quantityProductsOrder) }}
{% endfor %}
</p>
</div>

{{ macros.endCard() }}
@@ -63,4 +68,13 @@
{{ macros.endCard() }}


{{ macros.startCard(8, 'ProductFamily.export', 'light') }}
<div class="col">
{{ form_row(form.exportTitle) }}
{{ form_row(form.exportNote) }}
</div>

{{ macros.endCard() }}


</div>

Carregando…
Cancelar
Salvar