Browse Source

fix bug suppression decli

feature/export_comptable
Fab 4 years ago
parent
commit
1e15537a74
2 changed files with 18 additions and 26 deletions
  1. +11
    -19
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  2. +7
    -7
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig

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



Vue.component('product-unit-price', { Vue.component('product-unit-price', {
mixins: [mixinUnit, mixinPrice, mixinTemplate], mixins: [mixinUnit, mixinPrice, mixinTemplate],
props: ['template', 'keyForm'],
props: ['template', 'key'],
data() { data() {
return Object.assign({ return Object.assign({
behaviorPrice: 'by-piece', behaviorPrice: 'by-piece',


Vue.component('product-form', { Vue.component('product-form', {
mixins: [mixinUnit, mixinPrice, mixinTemplate], mixins: [mixinUnit, mixinPrice, mixinTemplate],
props: ['template', 'keyForm', 'productFamily'],
props: ['template', 'keyForm','productFamily'],
computed: { computed: {
taxRateValue: function () { taxRateValue: function () {
return this.productFamily.taxRateValue; return this.productFamily.taxRateValue;
return Object.assign( return Object.assign(
{ {
title: null, title: null,
position: 0,
fieldToUpdate: ['title', 'unit', 'quantity', 'price'], fieldToUpdate: ['title', 'unit', 'quantity', 'price'],
price: null, price: null,
priceWithTax: null, priceWithTax: null,
}, window.productForm[this.keyForm]) }, window.productForm[this.keyForm])
}, },
mounted: function () { mounted: function () {
log(this.keyForm);

//INIT VAR //INIT VAR
updateSortableProducts(); updateSortableProducts();
//this.setUnitSelect2(); //this.setUnitSelect2();
} }


}); });
this.init();


//METHOD //METHOD
//this.updateProductForm(); //this.updateProductForm();
this.init(); this.init();
}, },
saveProductForm: function () { saveProductForm: function () {
$('#form-product-modal-' + this.keyForm).modal('hide');
$('#form-product-modal-' + this.key).modal('hide');
}, },
deleteProductForm: function () { deleteProductForm: function () {
if (confirm('Êtes-vous sur de cette action ?')) { if (confirm('Êtes-vous sur de cette action ?')) {
log(this.keyForm);
log(this.$parent.formProductArray);
//this.$parent.formProductArray.splice(this.keyForm, 1);
//this.$delete(this.$parent.formProductArray, this.keyForm)
var niche = arrayRemove(this.$parent.formProductArray, this.$parent.formProductArray[this.keyForm]);
this.$parent.formProductArray = niche;


this.$delete(this.$parent.formProductArray, this.keyForm)
} }
}, },
modalProductForm: function () { modalProductForm: function () {


$('#modal-extends-product-'+this.keyForm).modal('show')
$('#modal-extends-product-'+this.key).modal('show')
}, },
}, },
watch: {} watch: {}
propertyNoveltyExpirationDateActive: false, propertyNoveltyExpirationDateActive: false,
activeProducts: false, activeProducts: false,


formProductArray: [],
formProductArray: {},
formProductKey: [],
currentSection: 'general', currentSection: 'general',
sectionsArray: [ sectionsArray: [
{ {
var prototype = $collectionHolder.data('prototype'); var prototype = $collectionHolder.data('prototype');
var newForm = prototype; var newForm = prototype;
newForm = newForm.replace(/__name__/g, this.indexFormProduct); newForm = newForm.replace(/__name__/g, this.indexFormProduct);
this.formProductArray.push(newForm);
this.formProductArray[this.indexFormProduct] = newForm;
this.indexFormProduct++; this.indexFormProduct++;


//updateSortableProducts(); //updateSortableProducts();
$(window).on('load', function () { $(window).on('load', function () {
for (var key in formProductTemplate) { for (var key in formProductTemplate) {
log(key); log(key);
//log(formProductTemplate[key]);

appProductFamily.formProductArray[key] = formProductTemplate[key]; appProductFamily.formProductArray[key] = formProductTemplate[key];
appProductFamily.formProductKey[key] =key;
appProductFamily.indexFormProduct++; appProductFamily.indexFormProduct++;
} }
}); });

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

</thead> </thead>
<tbody class="products-collection"> <tbody class="products-collection">


<template v-for="(formProduct, blop) in formProductArray" >
<product-form ref="productForm" v-bind:product-family="productFamily" :template="formProduct"
v-bind:key-form="blop"></product-form>
<template>
<product-form v-for="(formProduct, blop) in formProductArray" v-bind:key="formProductKey[blop]"
:key-form="formProductKey[blop]" ref="productForm" v-bind:product-family="productFamily"
:template="formProduct"></product-form>
</template> </template>

</tbody> </tbody>
<tfoot> <tfoot>
<th> <th>
${productFamily.priceWithTax} ${productFamily.priceWithTax}
</th> </th>
<th colspan="2" class="price"> <th colspan="2" class="price">
${productFamily.marginProfit}€<br />
${productFamily.marginProfit}€<br/>
${productFamily.marginProfitPercent}% ${productFamily.marginProfitPercent}%
</td> </td>


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

<script> <script>
window.productForm = new Array(); window.productForm = new Array();
window.formProductTemplate = new Array(); window.formProductTemplate = new Array();
{% for keyForm,i in sortableProductsField %} {% for keyForm,i in sortableProductsField %}
{% set product = form.products[i] %} {% set product = form.products[i] %}



window.productForm[{{ keyForm }}] = { window.productForm[{{ keyForm }}] = {
{% if product.vars.value.position %}position: "{{ product.vars.value.position }}",{% endif %}
{% 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 %}

Loading…
Cancel
Save