|
|
|
|
|
|
|
|
|
|
|
|
|
|
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++; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |