Ver código fonte

fix bug suppression decli

feature/export_comptable
Fab 4 anos atrás
pai
commit
1e15537a74
2 arquivos alterados com 18 adições e 26 exclusões
  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 Ver arquivo

@@ -4,7 +4,7 @@ var staticRenderFns = [];

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

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

//INIT VAR
updateSortableProducts();
//this.setUnitSelect2();
@@ -240,7 +239,7 @@ Vue.component('product-form', {
}

});
this.init();

//METHOD
//this.updateProductForm();
@@ -277,23 +276,16 @@ Vue.component('product-form', {
this.init();
},
saveProductForm: function () {
$('#form-product-modal-' + this.keyForm).modal('hide');
$('#form-product-modal-' + this.key).modal('hide');
},
deleteProductForm: function () {
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 () {

$('#modal-extends-product-'+this.keyForm).modal('show')
$('#modal-extends-product-'+this.key).modal('show')
},
},
watch: {}
@@ -388,7 +380,8 @@ appProductFamily = new Vue({
propertyNoveltyExpirationDateActive: false,
activeProducts: false,

formProductArray: [],
formProductArray: {},
formProductKey: [],
currentSection: 'general',
sectionsArray: [
{
@@ -445,7 +438,7 @@ appProductFamily = new Vue({
var prototype = $collectionHolder.data('prototype');
var newForm = prototype;
newForm = newForm.replace(/__name__/g, this.indexFormProduct);
this.formProductArray.push(newForm);
this.formProductArray[this.indexFormProduct] = newForm;
this.indexFormProduct++;

//updateSortableProducts();
@@ -492,9 +485,8 @@ $(window).bind('beforeunload', function(e){
$(window).on('load', function () {
for (var key in formProductTemplate) {
log(key);
//log(formProductTemplate[key]);

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

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

@@ -87,12 +87,11 @@
</thead>
<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>

</tbody>
<tfoot>
<th>
@@ -145,7 +144,7 @@
${productFamily.priceWithTax}
</th>
<th colspan="2" class="price">
${productFamily.marginProfit}€<br />
${productFamily.marginProfit}€<br/>
${productFamily.marginProfitPercent}%
</td>

@@ -189,7 +188,6 @@
{{ macros.endCard() }}
</div>
{% do form.products.setRendered %}

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


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.quantity %}quantity: "{{ product.vars.value.quantity }}",{% endif %}
{% if product.vars.value.unit %}unit: {{ product.vars.value.unit.id }},{% endif %}

Carregando…
Cancelar
Salvar