@@ -46,7 +46,8 @@ class ProductFamilyController extends AdminController | |||
$reductionCatalogRepo = $this->em->getRepository(ReductionCatalogInterface::class); | |||
$reductionCatalogClass = $this->em->getClassMetadata(ReductionCatalogInterface::class); | |||
$reductionCatalog = $reductionCatalogRepo->findOneByProductFamily($entity); | |||
$reductionCatalog = $reductionCatalogRepo->findOneBy(array('status'=>false, 'productFamily'=>$entity)); | |||
if($reductionCatalog == null)$reductionCatalog = new $reductionCatalogClass->name; | |||
$formBuilder->add('reductionCatalog', ReductionCatalogType::class,array( | |||
'mapped'=>false, |
@@ -115,9 +115,8 @@ class ProductType extends AbstractType | |||
'required' => false, | |||
)); | |||
$builder->add('propertyExpirationDate', DateType::class, array( | |||
'required' => false, | |||
'widget'=> 'single_text' | |||
$builder->add('propertyExpirationDate', TextType::class, array( | |||
'required' => false | |||
)); | |||
$builder->add('position', HiddenType::class); |
@@ -129,12 +129,12 @@ trait ProductPropertyTrait | |||
return $this; | |||
} | |||
public function getPropertyExpirationDate(): ?\DateTimeInterface | |||
public function getPropertyExpirationDate(): ?string | |||
{ | |||
return $this->propertyExpirationDate; | |||
} | |||
public function setPropertyExpirationDate(?\DateTimeInterface $propertyExpirationDate): self | |||
public function setPropertyExpirationDate(?string $propertyExpirationDate): self | |||
{ | |||
$this->propertyExpirationDate = $propertyExpirationDate; | |||
@@ -17,27 +17,14 @@ let mixinPrice = { | |||
}, | |||
computed: { | |||
taxRateValue: function () { | |||
if (this.taxRate) { | |||
return this.taxRatesList[this.taxRate]['value']; | |||
} else if (this.taxRate == null || this.taxRate == "undefined") { | |||
return this.taxRatesList['default']['value']; | |||
} else { | |||
log('ERREUR : pas de taxRate') | |||
/*priceWithTaxAndReduction:function () { | |||
if(this.productFamily.reductionActive){ | |||
log(this.productFamily.value); | |||
} | |||
}, | |||
supplierTaxRateValue: function () { | |||
if (this.supplierTaxRate) { | |||
return this.taxRatesList[this.supplierTaxRate]['value']; | |||
} else if (this.supplierTaxRate == null || this.supplierTaxRate == "undefined") { | |||
return this.taxRateValue; | |||
} else { | |||
log('ERREUR : pas de supplier taxRate') | |||
} | |||
}, | |||
}*/ | |||
}, | |||
mounted: function () { | |||
}, | |||
methods: { | |||
init: function () { | |||
@@ -125,7 +112,6 @@ let mixinPrice = { | |||
priceWithTaxUpdated: function () { | |||
this.priceWithTax = formatNumber(this.priceWithTax, 2); | |||
log(this.priceWithTax); | |||
this.setPriceFromPriceWithTax(); | |||
this.priceUpdated(); | |||
}, | |||
@@ -341,9 +327,11 @@ let mixinTemplate = { | |||
let mixinReduction = { | |||
data() { | |||
log(window.mixinReductionValues); | |||
return Object.assign({ | |||
reductionActive: true, | |||
reductionUnit:null, | |||
reductionBehaviorTaxRate:null, | |||
reductionValue:null, | |||
reductionPermanent: true, | |||
reductionUsersActive: false, | |||
reductionGroupUsersActive: false, |
@@ -48,7 +48,25 @@ Vue.component('product-unit-price', { | |||
}, | |||
behaviorPriceValue:function(){ | |||
return this.behaviorPrice; | |||
} | |||
}, | |||
taxRateValue: function () { | |||
if (this.taxRate) { | |||
return this.taxRatesList[this.taxRate]['value']; | |||
} else if (this.taxRate == null || this.taxRate == "undefined") { | |||
return this.taxRatesList['default']['value']; | |||
} else { | |||
log('ERREUR : pas de taxRate') | |||
} | |||
}, | |||
supplierTaxRateValue: function () { | |||
if (this.supplierTaxRate) { | |||
return this.taxRatesList[this.supplierTaxRate]['value']; | |||
} else if (this.supplierTaxRate == null || this.supplierTaxRate == "undefined") { | |||
return this.taxRateValue; | |||
} else { | |||
log('ERREUR : pas de supplier taxRate') | |||
} | |||
}, | |||
}, | |||
mounted: function () { | |||
@@ -61,6 +79,7 @@ Vue.component('product-unit-price', { | |||
this.setPriceWithTax(); | |||
this.setPriceByRefUnitWithTax(); | |||
this.setMultiplyingFactor(); | |||
this.$parent.updateChild(); | |||
}, | |||
supplierTaxRate: function () { | |||
this.setBuyingPriceWithTax(); | |||
@@ -84,11 +103,11 @@ Vue.component('product-form', { | |||
mixins: [mixinUnit, mixinPrice, mixinTemplate], | |||
props: ['template', 'keyForm', 'productFamily'], | |||
computed: { | |||
taxRate: function () { | |||
return this.productFamily.taxRate; | |||
taxRateValue: function () { | |||
return this.productFamily.taxRateValue; | |||
}, | |||
supplierTaxRate: function () { | |||
return this.productFamily.supplierTaxRate; | |||
supplierTaxRateValue: function () { | |||
return this.productFamily.supplierTaxRateValue; | |||
}, | |||
buyingPriceValue: function () { | |||
if (this.buyingPrice) return this.buyingPrice; | |||
@@ -134,9 +153,9 @@ Vue.component('product-form', { | |||
if (this.unit) return this.unit; | |||
else return this.productFamily.unit; | |||
}, | |||
propertyExpirationDateFormated: function () { | |||
if (this.propertyExpirationDate) return getDateFormatted(this.propertyExpirationDate, '-') | |||
else return getDateFormatted(this.productFamily.propertyExpirationDate, '-') | |||
propertyExpirationDateValue: function () { | |||
if (this.propertyExpirationDate) return this.propertyExpirationDate; | |||
else return this.productFamily.propertyExpirationDate; | |||
}, | |||
behaviorPriceValue:function(){ | |||
return this.productFamily.behaviorPrice; | |||
@@ -235,12 +254,19 @@ appProductFamily = new Vue({ | |||
'buyingPriceByRefUnitWithTax': this.$refs.productUnitPrice.buyingPriceByRefUnitWithTax, | |||
'priceByRefUnit': this.$refs.productUnitPrice.priceByRefUnit, | |||
'priceByRefUnitWithTax': this.$refs.productUnitPrice.priceByRefUnitWithTax, | |||
'taxRate': this.$refs.productUnitPrice.taxRate, | |||
'taxRateValue': this.$refs.productUnitPrice.taxRateValue, | |||
'supplierTaxRateValue': this.$refs.productUnitPrice.supplierTaxRateValue, | |||
/*'taxRate': this.$refs.productUnitPrice.taxRate, | |||
'supplierTaxRate': this.$refs.productUnitPrice.supplierTaxRate, | |||
*/ | |||
'multiplyingFactor': this.$refs.productUnitPrice.multiplyingFactor, | |||
'taxRateValue': this.$refs.productUnitPrice.taxRateValue, | |||
'propertyExpirationDate': this.propertyExpirationDate, | |||
'behaviorExpirationDate': this.behaviorExpirationDate | |||
'behaviorExpirationDate': this.behaviorExpirationDate, | |||
'reductionActive': this.reductionActive, | |||
'reductionUnit': this.reductionUnit, | |||
'reductionValue': this.reductionValue, | |||
'reductionBehaviorTaxRate': this.reductionBehaviorTaxRate | |||
}; | |||
}else{ | |||
return { |
@@ -84,14 +84,14 @@ | |||
</div> | |||
#} | |||
<div class="col-12"> | |||
{{ form_row(form.behaviorTaxRate, {"attr" : {":required": "reductionActive"}}) }} | |||
{{ form_row(form.behaviorTaxRate, {"attr" : {":required": "reductionActive", 'v-model' : 'reductionBehaviorTaxRate'}}) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.unit, {"attr" : {":required": "reductionActive"}}) }} | |||
{{ form_row(form.unit, {"attr" : {":required": "reductionActive", 'v-model' : 'reductionUnit'}}) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.value, {"attr" : {":required": "reductionActive"}}) }} | |||
{{ form_row(form.value, {"attr" : {":required": "reductionActive", 'v-model' : 'reductionValue'}}) }} | |||
</div> | |||
@@ -185,6 +185,9 @@ | |||
window.mixinReductionValues = { | |||
{% if formValues.status == false and isProductFamilyForm %}reductionActive: false,{% endif %} | |||
{% if formValues.permanent is not null and formValues.permanent == false %}reductionPermanent: false,{% endif %} | |||
{% if formValues.behaviorTaxRate %}reductionBehaviorTaxRate: '{{ formValues.behaviorTaxRate }}',{% endif %} | |||
{% if formValues.value %}reductionValue: parseFloat({{ formValues.value }}),{% endif %} | |||
{% if formValues.unit %}reductionUnit: "{{ formValues.unit }}",{% endif %} | |||
{% if formValues.users is not empty %}reductionUsersActive: true,{% endif %} | |||
{% if formValues.groupUsers is not empty %}reductionGroupUsersActive: true,{% endif %} | |||
{% if formValues.productFamilies is not empty %}reductionProductFamiliesActive: true,{% endif %} |
@@ -41,7 +41,7 @@ | |||
{% if formValues.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDateActive: true,{% endif %} | |||
{% if formValues.typeExpirationDate %}typeExpirationDate: "{{ formValues.typeExpirationDate }}",{% 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 }}",{% endif %} | |||
{% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %} | |||
}; |
@@ -47,12 +47,13 @@ | |||
<td colspan="2" v-show="productFamily.behaviorPrice == 'by-reference-unit'"> | |||
{% verbatim %}{{ finalPriceWithTax }}{% endverbatim %}€ | |||
</td> | |||
{{ 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.availableQuantity, 'availableQuantity',false, '', 'v-show="productFamily.behaviorCountStock== \'by-product\'"') }} | |||
{{ macros.productField(2, product.availableQuantityDefault, 'availableQuantityDefault',false, '', 'v-show="productFamily.behaviorCountStock== \'by-product\'"') }} | |||
{{ macros.productField(2, product.propertyExpirationDate, 'propertyExpirationDate','propertyExpirationDateFormated', '', 'v-show="productFamily.behaviorExpirationDate== \'by-product\'"') }} | |||
{{ macros.productField(2, product.propertyExpirationDate, 'propertyExpirationDate','propertyExpirationDateValue', '', 'v-show="productFamily.behaviorExpirationDate== \'by-product\'"') }} | |||
<td> | |||
<button type="button" class="btn-remove-product btn btn-default" @click="deleteProductForm()"> | |||
@@ -115,7 +116,6 @@ | |||
PV TTC | |||
</th> | |||
<th v-show="behaviorCountStock== 'by-product'"> | |||
Stock | |||
</th> | |||
@@ -191,7 +191,7 @@ | |||
Stock par défaut | |||
</th> | |||
<th colspan="2" class="" v-show="behaviorExpirationDate== 'by-product'"> | |||
${typeExpirationDate} | |||
${propertyExpirationDate} | |||
</th> | |||
<th class=""> | |||
@@ -224,6 +224,7 @@ | |||
{% 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 }}'; |