Browse Source

Form produits intégration prix par unité de référence (travail en cours)

feature/export_comptable
Fab 4 years ago
parent
commit
dc782b3c4f
14 changed files with 221 additions and 138 deletions
  1. +6
    -0
      ShopBundle/Controller/Admin/ProductFamilyController.php
  2. +2
    -4
      ShopBundle/Form/ProductType.php
  3. +1
    -1
      ShopBundle/Model/OrderAmountMin.php
  4. +1
    -1
      ShopBundle/Model/ProductFamily.php
  5. +1
    -1
      ShopBundle/Model/ProductPropertyTrait.php
  6. +5
    -1
      ShopBundle/Resources/public/css/backend/custom.css
  7. +5
    -0
      ShopBundle/Resources/public/js/backend/script/default/utils.js
  8. +120
    -70
      ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js
  9. +41
    -31
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  10. +3
    -1
      ShopBundle/Resources/translations/lcshop.fr.yaml
  11. +3
    -2
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  12. +4
    -0
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  13. +25
    -24
      ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig
  14. +4
    -2
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig

+ 6
- 0
ShopBundle/Controller/Admin/ProductFamilyController.php View File

'expanded' => true 'expanded' => true
)); ));


dump(floatval( $this->merchantUtils->getMerchantConfig('multiplying-factor')));
$formBuilder->add('multiplyingFactor', NumberType::class, array(
'mapped'=> false,
'data'=> floatval($this->merchantUtils->getMerchantConfig('multiplying-factor')),
));

$formBuilder->add('propertyOrganicLabel', ChoiceType::class, array( $formBuilder->add('propertyOrganicLabel', ChoiceType::class, array(
'choices' => array( 'choices' => array(
'field.ProductFamily.organicLabelOptions.ab' => 'ab', 'field.ProductFamily.organicLabelOptions.ab' => 'ab',

+ 2
- 4
ShopBundle/Form/ProductType.php View File



$builder->add('buyingPriceByRefUnit', NumberType::class, array( $builder->add('buyingPriceByRefUnit', NumberType::class, array(
'label' => 'Prix d\'achat', 'label' => 'Prix d\'achat',
'required'=>false,
'mapped' => false
'required'=>false
)); ));


$builder->add('buyingPriceByRefUnitWithTax', NumberType::class, array( $builder->add('buyingPriceByRefUnitWithTax', NumberType::class, array(
)); ));


$builder->add('priceByRefUnit', NumberType::class, array( $builder->add('priceByRefUnit', NumberType::class, array(
'required'=>false,
'mapped' => false
'required'=>false
)); ));


$builder->add('priceByRefUnitWithTax', NumberType::class, array( $builder->add('priceByRefUnitWithTax', NumberType::class, array(

+ 1
- 1
ShopBundle/Model/OrderAmountMin.php View File

/** /**
* @ORM\Column(type="float") * @ORM\Column(type="float")
*/ */
private $orderAmountMin;
protected $orderAmountMin;


public function getOrderAmountMin(): ?float public function getOrderAmountMin(): ?float
{ {

+ 1
- 1
ShopBundle/Model/ProductFamily.php View File

/** /**
* @ORM\Column(type="string", length=255, nullable=true) * @ORM\Column(type="string", length=255, nullable=true)
*/ */
private $warningMessageType;
protected $warningMessageType;


/** /**
* @ORM\Column(type="text", nullable=true) * @ORM\Column(type="text", nullable=true)

+ 1
- 1
ShopBundle/Model/ProductPropertyTrait.php View File

/** /**
* @ORM\Column(type="float", nullable=true) * @ORM\Column(type="float", nullable=true)
*/ */
protected $quantity = 1; //par défaut valeur à 1
protected $quantity;


/** /**
* @ORM\Column(type="float", nullable=true) * @ORM\Column(type="float", nullable=true)

+ 5
- 1
ShopBundle/Resources/public/css/backend/custom.css View File



/* ProductFamily */ /* ProductFamily */


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

.new-productfamily #nav-params, .new-productfamily #nav-params,
.edit-productfamily #nav-params { .edit-productfamily #nav-params {
margin-bottom: 30px ; margin-bottom: 30px ;
.autoresize textarea{height: auto; min-height: 38px;} .autoresize textarea{height: auto; min-height: 38px;}





/* ORDER */ /* ORDER */


.table-order-summary{width: 100%;} .table-order-summary{width: 100%;}
.product-form-modal{display: none;} .product-form-modal{display: none;}
.product-form.modal .form-check-label{font-style: italic; color: #666; text-align: left;} .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 .inherited{color: #888; font-style: italic; font-weight: initial;}
.products-collection-table td{}
.products-collection-table td{position: relative;}
.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 {table-layout:fixed;}
#lc-product-family-edit .products-collection-table tr{border-bottom: 1px solid #dee2e6;} #lc-product-family-edit .products-collection-table tr{border-bottom: 1px solid #dee2e6;}
#lc-product-family-edit .products-collection-table th{font-size:13px; border-left: 1px solid #dee2e6; border-top: 1px solid #dee2e6; text-align: center;} #lc-product-family-edit .products-collection-table th{font-size:13px; border-left: 1px solid #dee2e6; border-top: 1px solid #dee2e6; text-align: center;}

+ 5
- 0
ShopBundle/Resources/public/js/backend/script/default/utils.js View File

return parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1)).toFixed(2); return parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1)).toFixed(2);
} }



function formatNumber(number, toFixed){
return Number(number).toFixed(toFixed);
}

/** /**
* Formate un prix en l'arrondissant et en ajoutant le sigle de la monnaie * Formate un prix en l'arrondissant et en ajoutant le sigle de la monnaie
* *

+ 120
- 70
ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js View File

}, },
methods: { methods: {
init: function () { init: function () {
if (this.behaviorPriceValue == 'by-piece') {
this.initByPiece();
} else if (this.behaviorPriceValue == 'by-reference-unit') {
this.initByRefUnit();
}
},
initByPiece: function () {
this.buyingPriceUpdated(); this.buyingPriceUpdated();
this.priceUpdated(); this.priceUpdated();
this.unitUpdated();
}, },


priceUpdated: function () {
if(this.price) {
this.setPriceWithTax();
this.setMultiplyingFactor();
this.setPriceByRefUnit();
this.setPriceByRefUnitWithTax();
}
initByRefUnit: function () {
this.buyingPriceByRefUnitUpdated();
this.priceByRefUnitUpdated();
}, },




buyingPriceUpdated: function () { buyingPriceUpdated: function () {
if(this.buyingPrice) {
if (this.buyingPrice) {
this.buyingPrice = formatNumber(this.buyingPrice, 4)
this.setBuyingPriceWithTax(); this.setBuyingPriceWithTax();
this.setMultiplyingFactor();
//Mise à jour dans le panel price
if (this.priceValue == null) {
this.setPriceFromMultiplyingFactor();
this.priceUpdated();
} else {
this.setMultiplyingFactor();
}
this.setBuyingPriceByRefUnit(); this.setBuyingPriceByRefUnit();
this.setBuyingPriceByRefUnitWithTax(); this.setBuyingPriceByRefUnitWithTax();
} }
}, },


unitUpdated: function () {
/*if(this.unit) {
buyingPriceByRefUnitUpdated: function () {
if (this.buyingPriceByRefUnit) {
this.buyingPriceByRefUnit = formatNumber(this.buyingPriceByRefUnit, 4)
this.setBuyingPriceByRefUnitWithTax();
if (this.priceByRefUnitValue == null) {
this.setPriceByRefUnitFromMultiplyingFactor();
this.priceByRefUnitUpdated();
} else {
this.setMultiplyingFactor();
}
this.setBuyingPriceFromBuyingPriceByRefUnit();
this.setBuyingPriceWithTax();
}
},


priceUpdated: function () {
if (this.price) {
this.price = formatNumber(this.priceByRefUnit, 4)
this.setPriceWithTax();
this.setMultiplyingFactor();
this.setPriceByRefUnit(); this.setPriceByRefUnit();
this.setPriceByRefUnitWithTax(); this.setPriceByRefUnitWithTax();
//this.setBuyingPriceByRefUnit();
//this.setBuyingPriceByRefUnitWithTax();
}*/
}
}, },
quantityUpdated: function () {
/*if(this.quantity ) {
if(this.behaviorPriceValue == 'by-piece'){
this.setPriceByRefUnit();
this.setPriceByRefUnitWithTax();
*/
if(this.behaviorPriceValue == 'by-reference-unit'){
this.setPriceFromPriceByRefUnit();
this.setPriceWithTax();
//this.priceUpdated();
priceByRefUnitUpdated: function () {
if (this.priceByRefUnit) {
this.priceByRefUnit = formatNumber(this.priceByRefUnit, 4)
this.setPriceByRefUnitWithTax();
this.setMultiplyingFactor();
this.setPriceFromPriceByRefUnit();
this.setPriceWithTax();
} }

// this.setBuyingPriceByRefUnit();
// this.setBuyingPriceByRefUnitWithTax();
}, },


//Toutes les fonctions ci-dessous ne font que mettre à jour les price et buyingPrice //Toutes les fonctions ci-dessous ne font que mettre à jour les price et buyingPrice
buyingPriceWithTaxUpdated: function () { buyingPriceWithTaxUpdated: function () {
this.buyingPriceWithTax = formatNumber(this.buyingPriceWithTax, 2)
this.setBuyingPriceFromBuyingPriceWithTax(); this.setBuyingPriceFromBuyingPriceWithTax();
this.buyingPriceUpdated(); this.buyingPriceUpdated();
}, },
buyingPriceByRefUnitUpdated: function () {
this.setBuyingPriceFromBuyingPriceByRefUnit();
this.buyingPriceUpdated();
},
buyingPriceByRefUnitWithTaxUpdated: function () { buyingPriceByRefUnitWithTaxUpdated: function () {
this.buyingPriceByRefUnitWithTax = formatNumber(this.buyingPriceByRefUnitWithTax, 2)

this.setBuyingPriceByRefUnitFromBuyingPriceByRefUnitWithTax(); this.setBuyingPriceByRefUnitFromBuyingPriceByRefUnitWithTax();
this.buyingPriceByRefUnitUpdated(); this.buyingPriceByRefUnitUpdated();
}, },
multiplyingFactorUpdated: function () {
this.setPriceFromMultiplyingFactor();
this.priceUpdated();
},

priceWithTaxUpdated: function () { priceWithTaxUpdated: function () {
this.priceWithTax = formatNumber(this.priceWithTax, 2)
this.setPriceFromPriceWithTax(); this.setPriceFromPriceWithTax();
this.priceUpdated(); this.priceUpdated();
}, },
priceByRefUnitUpdated: function () {
this.setPriceFromPriceByRefUnit();
this.priceUpdated();
},

priceByRefUnitWithTaxUpdated: function () { priceByRefUnitWithTaxUpdated: function () {
this.priceByRefUnitWithTax = formatNumber(this.priceByRefUnitWithTax, 2)
this.setPriceByRefUnitFromTax(); this.setPriceByRefUnitFromTax();
this.priceByRefUnitUpdated(); this.priceByRefUnitUpdated();
}, },




//SETTER
setBuyingPriceFromBuyingPriceByRefUnit:function(){
this.buyingPrice = parseFloat((this.buyingPriceByRefUnit * this.quantityValue) / this.unitCoefficient).toFixed(2);
unitUpdated: function () {
this.quantityUpdated();
}, },
quantityUpdated: function () {
if(this.quantity) {
if (this.behaviorPriceValue == 'by-piece') {
this.setBuyingPriceByRefUnit();
this.setBuyingPriceByRefUnitWithTax();
this.setPriceByRefUnit();
this.setPriceByRefUnitWithTax();
} else if (this.behaviorPriceValue == 'by-reference-unit') {
this.setPriceFromPriceByRefUnit();
this.setPriceWithTax();
this.setBuyingPriceFromBuyingPriceByRefUnit();
this.setBuyingPriceWithTax();
}
}
},
multiplyingFactorUpdated: function () {
if (this.behaviorPriceValue == 'by-piece') {
this.setPriceFromMultiplyingFactor();
this.setPriceWithTax();
} else if (this.behaviorPriceValue == 'by-reference-unit') {
this.setPriceByRefUnitFromMultiplyingFactor();
this.setPriceByRefUnitWithTax();
}
},
//NEW VERSION

setBuyingPriceFromBuyingPriceWithTax: function () { setBuyingPriceFromBuyingPriceWithTax: function () {
if (this.buyingPriceWithTax) { if (this.buyingPriceWithTax) {
this.buyingPriceWithTax = parseFloat(this.buyingPriceWithTax.replace(',', '.')).toFixed(2);
this.buyingPrice = getPrice(this.buyingPriceWithTax, this.supplierTaxRateValue); this.buyingPrice = getPrice(this.buyingPriceWithTax, this.supplierTaxRateValue);
} }
}, },
setBuyingPriceWithTax: function () { setBuyingPriceWithTax: function () {
if (this.buyingPrice) { if (this.buyingPrice) {
this.buyingPrice = parseFloat(this.buyingPrice.replace(',', '.')).toFixed(3);
this.buyingPriceWithTax = getPriceWithTax(this.buyingPrice, this.supplierTaxRateValue); this.buyingPriceWithTax = getPriceWithTax(this.buyingPrice, this.supplierTaxRateValue);
} }
}, },

setPriceFromMultiplyingFactor: function () {
this.price = getPrice(this.buyingPriceValue * this.multiplyingFactor, this.taxRateValue);
},
setPriceWithTax() {
if (this.price) {
this.priceWithTax = getPriceWithTax(this.price, this.taxRateValue);
}
},

setPriceByRefUnitFromMultiplyingFactor: function () {
this.priceByRefUnit = getPrice(this.buyingPriceByRefUnitValue * this.multiplyingFactorValue, this.taxRateValue);
},

//SETTER
setBuyingPriceFromBuyingPriceByRefUnit: function () {
this.buyingPrice = parseFloat((this.buyingPriceByRefUnit * this.quantityValue) / this.unitCoefficient).toFixed(4);
},

setBuyingPriceByRefUnitFromBuyingPriceByRefUnitWithTax: function () { setBuyingPriceByRefUnitFromBuyingPriceByRefUnitWithTax: function () {
if (this.buyingPriceByRefUnitWithTax) { if (this.buyingPriceByRefUnitWithTax) {
this.buyingPriceByRefUnitWithTax = parseFloat(this.buyingPriceByRefUnitWithTax.replace(',', '.')).toFixed(2);
this.buyingPriceByRefUnit = getPrice(this.buyingPriceByRefUnitWithTax, this.supplierTaxRateValue); this.buyingPriceByRefUnit = getPrice(this.buyingPriceByRefUnitWithTax, this.supplierTaxRateValue);
} }
}, },
setBuyingPriceByRefUnit: function () { setBuyingPriceByRefUnit: function () {
if (this.unitCoefficient && this.quantityValue) { if (this.unitCoefficient && this.quantityValue) {
this.buyingPriceByRefUnit = parseFloat((this.buyingPriceValue / this.quantityValue) * this.unitCoefficient).toFixed(2);
this.buyingPriceByRefUnit = parseFloat((this.buyingPriceValue / this.quantityValue) * this.unitCoefficient).toFixed(4);
} }
}, },
setBuyingPriceByRefUnitWithTax: function () { setBuyingPriceByRefUnitWithTax: function () {
if (this.buyingPriceByRefUnit) { if (this.buyingPriceByRefUnit) {
this.buyingPriceByRefUnit = parseFloat(this.buyingPriceByRefUnit.replace(',', '.')).toFixed(3);
this.buyingPriceByRefUnitWithTax = getPriceWithTax(this.buyingPriceByRefUnit, this.supplierTaxRateValue); this.buyingPriceByRefUnitWithTax = getPriceWithTax(this.buyingPriceByRefUnit, this.supplierTaxRateValue);
} }
}, },
setMultiplyingFactor: function () { setMultiplyingFactor: function () {
if (this.priceWithTax || this.buyingPrice) {
this.multiplyingFactor = parseFloat(this.priceWithTaxValue / this.buyingPriceValue).toFixed(3);
if (this.behaviorPriceValue == 'by-piece') {
if (this.priceWithTax || this.buyingPrice) {
this.multiplyingFactor = parseFloat(this.priceWithTaxValue / this.buyingPriceValue).toFixed(4);
}
} else if (this.behaviorPriceValue == 'by-reference-unit') {
if (this.priceByRefUnitWithTax || this.buyingPriceByRefUnit) {
this.multiplyingFactor = parseFloat(this.priceByRefUnitWithTaxValue / this.buyingPriceByRefUnitValue).toFixed(4);
}
} }
}, },
setPriceByRefUnitFromTax: function () { setPriceByRefUnitFromTax: function () {
if (this.priceByRefUnitWithTax) { if (this.priceByRefUnitWithTax) {
this.priceByRefUnitWithTax = parseFloat(this.priceByRefUnitWithTax.replace(',', '.')).toFixed(2);
this.priceByRefUnit = getPrice(this.priceByRefUnitWithTax, this.taxRateValue); this.priceByRefUnit = getPrice(this.priceByRefUnitWithTax, this.taxRateValue);
} }
}, },
setPriceByRefUnit: function () { setPriceByRefUnit: function () {
if (this.unitCoefficient && this.quantityValue) { if (this.unitCoefficient && this.quantityValue) {
this.priceByRefUnit = parseFloat((this.priceValue / this.quantityValue) * this.unitCoefficient).toFixed(2);
this.priceByRefUnit = parseFloat((this.priceValue / this.quantityValue) * this.unitCoefficient).toFixed(4);
} }
}, },
setPriceByRefUnitWithTax: function () {
if (this.unitCoefficient && this.quantityValue) {
this.priceByRefUnitWithTax = parseFloat((this.priceWithTaxValue / this.quantityValue) * this.unitCoefficient).toFixed(2);
setPriceByRefUnitWithTax() {
if (this.priceByRefUnit) {
this.priceByRefUnitWithTax = getPriceWithTax(this.priceByRefUnit, this.taxRateValue);
} }
}, },

setPriceFromMultiplyingFactor: function () {
this.price = getPrice(this.buyingPriceValue * this.multiplyingFactor, this.taxRateValue);
},
setPriceFromPriceByRefUnit: function () { setPriceFromPriceByRefUnit: function () {
this.price = parseFloat((this.priceByRefUnitValue * this.quantityValue) / this.unitCoefficient).toFixed(2);
this.price = parseFloat((this.priceByRefUnitValue * this.quantityValue) / this.unitCoefficient).toFixed(4);
}, },
setPriceFromPriceWithTax: function () { setPriceFromPriceWithTax: function () {
if (typeof this.priceWithTax != "number") {
this.priceWithTax = parseFloat(this.priceWithTax.replace(',', '.'));
}
this.priceWithTax = this.priceWithTax.toFixed(2);
this.price = getPrice(this.priceWithTax, this.taxRateValue); this.price = getPrice(this.priceWithTax, this.taxRateValue);
}, },
setPriceWithTax() {
if (this.price) {
this.price = parseFloat(this.price.replace(',', '.')).toFixed(3);
this.priceWithTax = getPriceWithTax(this.price, this.taxRateValue);
}
},
emptyPrice:function () {
this.price=null;
this.priceInherited = true;
}
}, },
watch: {} watch: {}



+ 41
- 31
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js View File

props: ['template', 'keyForm'], props: ['template', 'keyForm'],
data() { data() {
return Object.assign({ return Object.assign({
behaviorPrice:null,
behaviorPrice: 'by-piece',
activeProducts: false, activeProducts: false,
}, window.productUnitPriceValues); }, window.productUnitPriceValues);


buyingPriceWithTaxValue: function () { buyingPriceWithTaxValue: function () {
return this.buyingPriceWithTax; return this.buyingPriceWithTax;
}, },
buyingPriceByRefUnitValue:function(){
return this.buyingPriceByRefUnit;
},
buyingPriceByRefUnitWithTaxValue:function(){
return this.buyingPriceByRefUnitWithTax;
},
multiplyingFactorValue:function(){
return this.multiplyingFactor;
},
priceWithTaxValue: function () { priceWithTaxValue: function () {
return this.priceWithTax; return this.priceWithTax;
}, },
priceValue: function () { priceValue: function () {
return this.price; return this.price;
}, },
priceByRefUnitValue:function(){
return this.priceByRefUnit;
},
priceByRefUnitWithTaxValue:function(){
return this.priceByRefUnitWithTax;
},
quantityValue: function () { quantityValue: function () {
return this.quantity; return this.quantity;
}, },
}, },
watch: { watch: {
taxRate: function () { taxRate: function () {
this.setBuyingPriceWithTax();
this.setPriceWithTax();
this.setMultiplyingFactor();
this.setPriceByUnitRefWithTax();
//this.setBuyingPriceWithTax();
//this.setPriceWithTax();
//this.setMultiplyingFactor();
//this.setPriceByUnitRefWithTax();
}, },
supplierTaxRate: function () { supplierTaxRate: function () {
this.setBuyingPriceWithTax();
//this.setBuyingPriceWithTax();
} }
} }
}); });
if (this.buyingPriceWithTax) return this.buyingPriceWithTax; if (this.buyingPriceWithTax) return this.buyingPriceWithTax;
else return this.productFamily.buyingPriceWithTax; else return this.productFamily.buyingPriceWithTax;
}, },
buyingPriceByRefUnitValue:function(){
if (this.buyingPriceByRefUnit) return this.buyingPriceByRefUnit;
else return this.productFamily.buyingPriceByRefUnit;
},
buyingPriceByRefUnitWithTaxValue:function(){
if (this.buyingPriceByRefUnitWithTax) return this.buyingPriceByRefUnitWithTax;
else return this.productFamily.buyingPriceByRefUnitWithTax;
},
multiplyingFactorValue:function(){
if (this.multiplyingFactor) return this.multiplyingFactor;
else return this.productFamily.multiplyingFactor;
},
priceWithTaxValue: function () { priceWithTaxValue: function () {
if (this.priceWithTax) return this.priceWithTax; if (this.priceWithTax) return this.priceWithTax;
else return this.productFamily.priceWithTax; else return this.productFamily.priceWithTax;
}, },
behaviorPriceValue:function(){ behaviorPriceValue:function(){
return this.productFamily.behaviorPrice; return this.productFamily.behaviorPrice;
},
finalPriceWithTax:function () {
return getPriceWithTax(parseFloat((this.priceByRefUnitValue * this.quantityValue) / this.unitCoefficient).toFixed(4), this.taxRateValue);
} }
}, },
data() { data() {
mounted: function () { mounted: function () {
//INIT VAR //INIT VAR
updateSortableProducts(); updateSortableProducts();
this.setUnitSelect2();
//this.setUnitSelect2();




//METHOD //METHOD
this.updateProductForm();
this.updateProductView();
//this.updateProductForm();
//this.updateProductView();
}, },
methods: { methods: {
setUnitSelect2:function(){ setUnitSelect2:function(){
availableQuantityUpdated:function(){}, availableQuantityUpdated:function(){},
availableQuantityDefaultUpdated:function(){}, availableQuantityDefaultUpdated:function(){},
propertyExpirationDateUpdated:function(){}, propertyExpirationDateUpdated:function(){},
updateLine: function(){
this.init();
},

updateProductForm: function () { updateProductForm: function () {
this.init(); this.init();
}, },

updateProductView: function () {


/*if (this.unitValue == 'piece') {
$('.priceByRefUnit').hide();
} else {
$('.priceByRefUnit').show();
}
if (this.productFamily.behaviorCountStock == 'by-product-family' || this.productFamily.behaviorCountStock == 'by-quantity') {
$('.products-collection-table').find('.stock').hide();
} else {
$('.products-collection-table').find('.stock').show();
$('#product-item-' + this.keyForm).find('.stock').html(this.availableQuantity + ' / ' + this.unitReference);
}*/
},
saveProductForm: function () { saveProductForm: function () {
this.updateProductView();
$('#form-product-modal-' + this.keyForm).modal('hide'); $('#form-product-modal-' + this.keyForm).modal('hide');
}, },
deleteProductForm: function () { deleteProductForm: function () {
propertyNoveltyExpirationDateActive: false, propertyNoveltyExpirationDateActive: false,


formProductArray: [], formProductArray: [],
currentSection: 'general',
currentSection: 'price',
sectionsArray: [ sectionsArray: [
{ {
name: 'general', name: 'general',
if (typeof this.$refs.productForm !== 'undefined') { if (typeof this.$refs.productForm !== 'undefined') {
for (i = 0; i < this.$refs.productForm.length; i++) { for (i = 0; i < this.$refs.productForm.length; i++) {
this.$refs.productForm[i].updateProductForm(); this.$refs.productForm[i].updateProductForm();
this.$refs.productForm[i].updateProductView();
} }
} }
}, },

+ 3
- 1
ShopBundle/Resources/translations/lcshop.fr.yaml View File

addresses: Livraisons & facturation addresses: Livraisons & facturation
main: Général main: Général
products: Déclinaisons products: Déclinaisons
price: Prix
priceAndUnit: Tarifs / Unités / Quantités
categories: Catégories categories: Catégories
unit: Unité & quantité unit: Unité & quantité
tax: TVA tax: TVA
productsTypeHelp: 'Volume / Pods / Varieté / Parfum ...' productsTypeHelp: 'Volume / Pods / Varieté / Parfum ...'
buyingPrice: Prix d'achat buyingPrice: Prix d'achat
multiplyingFactor: Coefficiant multiplicateur multiplyingFactor: Coefficiant multiplicateur
multiplyingFactorHelp: La mise à jour de ce champ modifiera le prix de vente HT et TTC
priceByRefUnit: Prix de vente / unité de référence priceByRefUnit: Prix de vente / unité de référence
buyingPriceByRefUnit: Prix d'achat / unité de référence
availableQuantity: Quantité disponible availableQuantity: Quantité disponible
availableQuantityDefault: Quantité disponible par défaut availableQuantityDefault: Quantité disponible par défaut
quantity: Quantité quantity: Quantité

+ 3
- 2
ShopBundle/Resources/views/backend/default/block/macros.html.twig View File



{% if fieldDisplay == false %}{% set fieldDisplay = fieldName %}{% endif %} {% if fieldDisplay == false %}{% set fieldDisplay = fieldName %}{% endif %}


<td {{ attr|raw }} colspan="{{ colspan }}" class="{{ fieldName }}" v-on:click="{{ fieldName }}Inherited = true">
<div v-show="{{ fieldName }}Inherited == false">
<td {{ attr|raw }} colspan="{{ colspan }}" class="{{ fieldName }}" >
<div v-show="{{ fieldName }}Inherited == false" v-on:click="{{ fieldName }}Inherited = true">
<div v-if="{{ fieldName }}"> <div v-if="{{ fieldName }}">
{% verbatim %}{{ {% endverbatim %}{{ fieldDisplay }} {% verbatim %}}}{% endverbatim %}{{ displaySuffix }} {% verbatim %}{{ {% endverbatim %}{{ fieldDisplay }} {% verbatim %}}}{% endverbatim %}{{ displaySuffix }}
</div> </div>
<div v-show="{{ fieldName }}Inherited == true"> <div v-show="{{ fieldName }}Inherited == true">
{{ form_widget(field, {'attr' : {'v-model' : fieldName , 'v-on:focusout': fieldName~'Inherited = false', '@change' : fieldName~'Updated'}}) }} {{ form_widget(field, {'attr' : {'v-model' : fieldName , 'v-on:focusout': fieldName~'Inherited = false', '@change' : fieldName~'Updated'}}) }}
</div> </div>
<button v-show="{{ fieldName }}" v-on:click="{{ fieldName }} = null; {{ fieldName }}Inherited = false; " class="btn btn-empty-field" type="button"> <i class="fa fa-undo"></i> </button>
</td> </td>
{% endmacro %} {% endmacro %}



+ 4
- 0
ShopBundle/Resources/views/backend/productfamily/form.html.twig View File

{% if formValues.behaviorExpirationDate %}behaviorExpirationDate: "{{ formValues.behaviorExpirationDate }}",{% endif %} {% if formValues.behaviorExpirationDate %}behaviorExpirationDate: "{{ formValues.behaviorExpirationDate }}",{% endif %}
{% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate|date('d/m/Y') }}",{% endif %} {% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate|date('d/m/Y') }}",{% endif %}
}; };
multiplyingFactor = "{{ form.multiplyingFactor.vars.value }}"
window.productUnitPriceValues = { window.productUnitPriceValues = {
{% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %} {% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %}
{% if formValues.behaviorPrice %}behaviorPrice: "{{ formValues.behaviorPrice }}",{% endif %} {% if formValues.behaviorPrice %}behaviorPrice: "{{ formValues.behaviorPrice }}",{% endif %}
{% if form.multiplyingFactor.vars.value %}multiplyingFactor: parseFloat(multiplyingFactor.replace(',', '.')),{% endif %}
{% if formValues.unit %}unit: parseInt({{ formValues.unit.id }}),{% endif %} {% if formValues.unit %}unit: parseInt({{ formValues.unit.id }}),{% endif %}
{% if formValues.quantity %}quantity: parseFloat({{ formValues.quantity }}),{% endif %} {% if formValues.quantity %}quantity: parseFloat({{ formValues.quantity }}),{% endif %}
{% if formValues.taxRate %}taxRate: parseInt({{ formValues.taxRate.id }}),{% endif %} {% if formValues.taxRate %}taxRate: parseInt({{ formValues.taxRate.id }}),{% endif %}
{% if formValues.price %}price: parseFloat({{ formValues.price }}).toFixed(3),{% endif %} {% if formValues.price %}price: parseFloat({{ formValues.price }}).toFixed(3),{% endif %}
{% if formValues.priceByRefUnit %}priceByRefUnit: parseFloat({{ formValues.priceByRefUnit }}).toFixed(3),{% endif %}
{% if formValues.buyingPrice %}buyingPrice: parseFloat({{ formValues.buyingPrice }}).toFixed(3),{% endif %} {% if formValues.buyingPrice %}buyingPrice: parseFloat({{ formValues.buyingPrice }}).toFixed(3),{% endif %}
{% if formValues.buyingPriceByRefUnit %}buyingPriceByRefUnit: parseFloat({{ formValues.buyingPriceByRefUnit }}).toFixed(3),{% endif %}
{% if formValues.supplierTaxRate %}supplierTaxRate: parseInt({{ formValues.supplierTaxRate.id }}),{% endif %} {% if formValues.supplierTaxRate %}supplierTaxRate: parseInt({{ formValues.supplierTaxRate.id }}),{% endif %}
{% if form.supplierTaxRate.vars.value != 0 %}differentSupplierTaxRate: true{% endif %} {% if form.supplierTaxRate.vars.value != 0 %}differentSupplierTaxRate: true{% endif %}
} }

+ 25
- 24
ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig View File

{{ form_row(form.behaviorAddToCart) }} {{ form_row(form.behaviorAddToCart) }}
</div> </div>


<div class="col-12 form-group">
<div class="col-12 form-group" v-show="activeProducts == true">
{{ form_label(form.behaviorPrice) }} {{ form_label(form.behaviorPrice) }}
{% for field in form.behaviorPrice %} {% for field in form.behaviorPrice %}
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorPrice'}}) }} {{ form_widget(field, {"attr" : {"v-model" : 'behaviorPrice'}}) }}
</div> </div>
{{ macros.endCard(true) }} {{ macros.endCard(true) }}


{{ macros.startCard(0, 'ProductFamily.unit','light') }}
<div class="col-12">
{{ form_row(form.unit, {"attr":{'v-model': 'unit', '@change': "unitUpdated"}}) }}
</div>

<div class="col-12">
<div class="form-group field-weight">
{{ form_label(form.quantity) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.quantity, {'attr' : {'v-model': 'quantity', '@change': "quantityUpdated"}}) }}
<div class="input-group-append">
<span class="input-group-text">${ unitWording }</span>
</div>
</div>
{{ form_help(form.quantity) }}
</div>
</div>
</div>

{{ macros.endCard(true) }}

{{ macros.startCard(0, 'ProductFamily.tax','light') }} {{ macros.startCard(0, 'ProductFamily.tax','light') }}
<div class="col-12"> <div class="col-12">
{{ form_row(form.taxRate, {'attr': {'v-model':'taxRate'}}) }} {{ form_row(form.taxRate, {'attr': {'v-model':'taxRate'}}) }}


{{ macros.endCard() }} {{ macros.endCard() }}


{{ macros.startCard(8, 'ProductFamily.price','light') }}
{{ macros.startCard(8, 'ProductFamily.priceAndUnit','light') }}


<div class="col-12 field-unit-quantity">
<div class="row">
<div class="col-6">
{{ form_row(form.unit, {"attr":{'v-model': 'unit', '@change': "unitUpdated"}}) }}
</div>


<div class="col-6">
<div class="form-group field-weight">
{{ form_label(form.quantity) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.quantity, {'attr' : {'v-model': 'quantity', '@change': "quantityUpdated"}}) }}
<div class="input-group-append">
<span class="input-group-text">${ unitWording }</span>
</div>
</div>
{{ form_help(form.quantity) }}
</div>
</div>
</div>
</div>
</div>


{{ macros.priceField(form.buyingPrice, form.buyingPriceWithTax, 'buyingPrice', 'by-piece') }} {{ macros.priceField(form.buyingPrice, form.buyingPriceWithTax, 'buyingPrice', 'by-piece') }}



+ 4
- 2
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig View File

{{ macros.productField(2, product.priceByRefUnitWithTax, 'priceByRefUnitWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'by-reference-unit\'"') }} {{ macros.productField(2, product.priceByRefUnitWithTax, 'priceByRefUnitWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'by-reference-unit\'"') }}


<td colspan="2" v-show="productFamily.behaviorPrice == 'by-reference-unit'"> <td colspan="2" v-show="productFamily.behaviorPrice == 'by-reference-unit'">
{% verbatim %}{{ priceWithTaxValue }}{% endverbatim %}€
{% verbatim %}{{ finalPriceWithTax }}{% endverbatim %}€
</td> </td>
{{ macros.productField(2, product.price, 'price', false, '€', 'v-show="productFamily.behaviorPrice == \'by-piece\'"') }} {{ macros.productField(2, product.price, 'price', false, '€', 'v-show="productFamily.behaviorPrice == \'by-piece\'"') }}
{{ macros.productField(2, product.priceWithTax, 'priceWithTax', false, '€', 'v-show="productFamily.behaviorPrice == \'by-piece\'"') }} {{ macros.productField(2, product.priceWithTax, 'priceWithTax', false, '€', 'v-show="productFamily.behaviorPrice == \'by-piece\'"') }}
{% if product.vars.value.title %}title: "{{ product.vars.value.title }}",{% endif %} {% 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.quantity %}quantity: "{{ product.vars.value.quantity }}",{% endif %}
{% if product.vars.value.unit %}unit: {{ product.vars.value.unit.id }},{% endif %} {% if product.vars.value.unit %}unit: {{ product.vars.value.unit.id }},{% endif %}
{% if product.vars.value.buyingPrice %}buyingPrice: "{{ product.vars.value.buyingPrice }}",{% 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.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.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %}
{% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %} {% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %}
{#{% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %}#} {#{% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %}#}

Loading…
Cancel
Save