'expanded' => true | 'expanded' => true | ||||
)); | )); | ||||
$formBuilder->add('behaviorBuyingPrice', ChoiceType::class, array( | |||||
$formBuilder->add('behaviorPrice', ChoiceType::class, array( | |||||
'empty_data' => 'by-piece', | 'empty_data' => 'by-piece', | ||||
'choices' => array( | 'choices' => array( | ||||
'field.ProductFamily.behaviorBuyingPriceOptions.byPiece' => 'by-piece', | |||||
'field.ProductFamily.behaviorBuyingPriceOptions.byRefUnit' => 'by-reference-unit' | |||||
'field.ProductFamily.behaviorPriceOptions.byPiece' => 'by-piece', | |||||
'field.ProductFamily.behaviorPriceOptions.byRefUnit' => 'by-reference-unit' | |||||
), | ), | ||||
'translation_domain' => 'lcshop', | 'translation_domain' => 'lcshop', | ||||
'multiple' => false, | 'multiple' => false, |
namespace Lc\ShopBundle\Form; | namespace Lc\ShopBundle\Form; | ||||
use CKSource\Bundle\CKFinderBundle\Form\Type\CKFinderFileChooserType; | |||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use FOS\CKEditorBundle\Form\Type\CKEditorType; | |||||
use Lc\ShopBundle\Context\ProductFamilyInterface; | |||||
use Lc\ShopBundle\Context\ProductInterface; | use Lc\ShopBundle\Context\ProductInterface; | ||||
use Lc\ShopBundle\Context\TaxRateInterface; | |||||
use Lc\ShopBundle\Context\UnitInterface; | use Lc\ShopBundle\Context\UnitInterface; | ||||
use Lc\ShopBundle\Services\Utils; | use Lc\ShopBundle\Services\Utils; | ||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | |||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||||
use Symfony\Component\Form\Extension\Core\Type\DateType; | use Symfony\Component\Form\Extension\Core\Type\DateType; | ||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | use Symfony\Component\Form\Extension\Core\Type\HiddenType; | ||||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | use Symfony\Component\Form\Extension\Core\Type\NumberType; | ||||
use function PHPSTORM_META\type; | |||||
use Symfony\Component\Form\AbstractType; | use Symfony\Component\Form\AbstractType; | ||||
use Symfony\Component\Form\Extension\Core\Type\TextType; | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||||
use Symfony\Component\Form\FormBuilderInterface; | use Symfony\Component\Form\FormBuilderInterface; |
*/ | */ | ||||
protected $product; | protected $product; | ||||
/** | |||||
* @ORM\Column(type="integer") | |||||
*/ | |||||
protected $quantityOrder; | |||||
/** | /** | ||||
* @ORM\Column(type="float") | * @ORM\Column(type="float") | ||||
*/ | */ | ||||
protected $quantity; | |||||
protected $quantityProduct; | |||||
/** | /** | ||||
* @ORM\Column(type="string", length=255) | * @ORM\Column(type="string", length=255) | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getQuantity(): ?float | |||||
public function getQuantityOrder(): ?int | |||||
{ | |||||
return $this->quantityOrder; | |||||
} | |||||
public function setQuantityOrder(int $quantityOrder): self | |||||
{ | |||||
$this->quantityOrder = $quantityOrder; | |||||
return $this; | |||||
} | |||||
public function getQuantityProduct(): ?float | |||||
{ | { | ||||
return $this->quantity; | |||||
return $this->quantityProduct; | |||||
} | } | ||||
public function setQuantity(float $quantity): self | |||||
public function setQuantityProduct(float $quantityProduct): self | |||||
{ | { | ||||
$this->quantity = $quantity; | |||||
$this->quantityProduct = $quantityProduct; | |||||
return $this; | return $this; | ||||
} | } |
/** | /** | ||||
* @ORM\Column(type="string", length=31) | * @ORM\Column(type="string", length=31) | ||||
*/ | */ | ||||
protected $behaviorBuyingPrice; | |||||
protected $behaviorPrice; | |||||
/** | |||||
* @ORM\Column(type="boolean") | |||||
*/ | |||||
protected $displayPriceByRefUnit; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
} | } | ||||
public function getBehaviorBuyingPrice(): ?string | |||||
{ | |||||
return $this->behaviorBuyingPrice; | |||||
} | |||||
public function setBehaviorBuyingPrice(?string $behaviorBuyingPrice): self | |||||
{ | |||||
$this->behaviorBuyingPrice = $behaviorBuyingPrice; | |||||
return $this; | |||||
} | |||||
public function getDisplayPriceByRefUnit(): ?bool | |||||
public function getBehaviorPrice(): ?string | |||||
{ | { | ||||
return $this->displayPriceByRefUnit; | |||||
return $this->behaviorPrice; | |||||
} | } | ||||
public function setDisplayPriceByRefUnit(?bool $displayPriceByRefUnit): self | |||||
public function setBehaviorPrice(?string $behaviorPrice): self | |||||
{ | { | ||||
$this->displayPriceByRefUnit = $displayPriceByRefUnit; | |||||
$this->behaviorPrice = $behaviorPrice; | |||||
return $this; | return $this; | ||||
} | } |
/** | /** | ||||
* @ORM\Column(type="float", nullable=true) | * @ORM\Column(type="float", nullable=true) | ||||
*/ | */ | ||||
protected $quantity; | |||||
protected $buyingPriceByRefUnit; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $priceByRefUnit; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $quantity = 1; //par défaut valeur à 1 | |||||
/** | /** | ||||
* @ORM\Column(type="float", nullable=true) | * @ORM\Column(type="float", nullable=true) | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getBuyingPriceByRefUnit(): ?float | |||||
{ | |||||
return $this->buyingPriceByRefUnit; | |||||
} | |||||
public function setBuyingPriceByRefUnit(?float $buyingPriceByRefUnit): self | |||||
{ | |||||
$this->buyingPriceByRefUnit = $buyingPriceByRefUnit; | |||||
return $this; | |||||
} | |||||
public function getPriceByRefUnit(): ?float | |||||
{ | |||||
return $this->priceByRefUnit; | |||||
} | |||||
public function setPriceByRefUnit(?float $priceByRefUnit): self | |||||
{ | |||||
$this->priceByRefUnit = $priceByRefUnit; | |||||
return $this; | |||||
} | |||||
public function getQuantity(): ?float | public function getQuantity(): ?float | ||||
{ | { | ||||
return $this->quantity; | return $this->quantity; |
assets: | assets: | ||||
favicon: '/assets/img/backend/favicon-pdl.png' | favicon: '/assets/img/backend/favicon-pdl.png' | ||||
js: | js: | ||||
- '/bundles/cksourceckfinder/ckfinder/ckfinder.js' | |||||
- '/bundles/lcshop/js/backend/script/setup-ckfinder.js' | |||||
- '/bundles/lcshop/js/backend/script/custom.js' | - '/bundles/lcshop/js/backend/script/custom.js' | ||||
css: | css: | ||||
- '/bundles/lcshop/css/backend/jquery-ui.min.css' | - '/bundles/lcshop/css/backend/jquery-ui.min.css' | ||||
form_theme: | form_theme: | ||||
- '@LcShop/backend/form/custom_bootstrap_4.html.twig' | - '@LcShop/backend/form/custom_bootstrap_4.html.twig' | ||||
- '@LcShop/backend/form/ckeditor_widget.html.twig' | - '@LcShop/backend/form/ckeditor_widget.html.twig' | ||||
- '@LcShop/backend/form/ckfinder_widget.html.twig' | |||||
list: | list: | ||||
max_results: 30 | max_results: 30 | ||||
actions: | actions: |
.lc-sortable div:last-child{display: none;} | .lc-sortable div:last-child{display: none;} | ||||
/* Ckfinder */ | /* Ckfinder */ | ||||
/* | |||||
.lc-ckfinder-wrap{width: 240px; height: 170px; position: relative;} | .lc-ckfinder-wrap{width: 240px; height: 170px; position: relative;} | ||||
.lc-ckfinder-wrap .lc-ckfinder-illu-wrap{position:relative; : 100%; height: 139px; display: flex; align-items: center; justify-content: center; background: #eee; background-size: contain;} | .lc-ckfinder-wrap .lc-ckfinder-illu-wrap{position:relative; : 100%; height: 139px; display: flex; align-items: center; justify-content: center; background: #eee; background-size: contain;} | ||||
.lc-ckfinder-wrap .lc-ckfinder-remove{border: 0px; font-size: 1.8rem; position: absolute;z-index: 2; color:#dc3545; top: -20px; right: -20px; background: 0; display: none;} | .lc-ckfinder-wrap .lc-ckfinder-remove{border: 0px; font-size: 1.8rem; position: absolute;z-index: 2; color:#dc3545; top: -20px; right: -20px; background: 0; display: none;} | ||||
.lc-ckfinder-wrap .lc-ckfinder-button{width: 100%; bottom: 0px; left: 0; position: absolute;} | .lc-ckfinder-wrap .lc-ckfinder-button{width: 100%; bottom: 0px; left: 0; position: absolute;} | ||||
*/ | |||||
/* VUES JS */ | /* VUES JS */ | ||||
.nav-item .btn {padding-right: 15px; position: relative;} | .nav-item .btn {padding-right: 15px; position: relative;} |
function initDeleteAction() { | function initDeleteAction() { | ||||
$('.action-delete').each(function (){ | $('.action-delete').each(function (){ | ||||
log($(this)); | |||||
$(this).on('click', function (e) { | $(this).on('click', function (e) { | ||||
e.preventDefault(); | e.preventDefault(); | ||||
log('ncnecd') | |||||
const id = $(this).parents('tr').first().data('id'); | const id = $(this).parents('tr').first().data('id'); | ||||
$('#modal-delete').modal({backdrop: true, keyboard: true}) | $('#modal-delete').modal({backdrop: true, keyboard: true}) |
let mixinPrice = { | let mixinPrice = { | ||||
data() { | |||||
return Object.assign({ | |||||
price: null, | |||||
priceWithTax: null, | |||||
buyingPrice: null, | |||||
buyingPriceWithTax: null, | |||||
buyingPriceByRefUnit: null, | |||||
buyingPriceByRefUnitWithTax: null, | |||||
differentSupplierTaxRate: null, | |||||
multiplyingFactor: null, | |||||
priceByRefUnit: null, | |||||
priceByRefUnitWithTax: null, | |||||
taxRate: null, | |||||
supplierTaxRate: null | |||||
}, window.mixinPriceValues); | |||||
data() { | |||||
return Object.assign({ | |||||
price: null, | |||||
priceWithTax: null, | |||||
buyingPrice: null, | |||||
buyingPriceWithTax: null, | |||||
buyingPriceByRefUnit: null, | |||||
buyingPriceByRefUnitWithTax: null, | |||||
differentSupplierTaxRate: null, | |||||
multiplyingFactor: null, | |||||
priceByRefUnit: null, | |||||
priceByRefUnitWithTax: null, | |||||
taxRate: null, | |||||
supplierTaxRate: null | |||||
}, window.mixinPriceValues); | |||||
}, | |||||
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') | |||||
} | |||||
}, | |||||
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') | |||||
} | |||||
}, | }, | ||||
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') | |||||
} | |||||
}, | |||||
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 () { | |||||
this.buyingPriceUpdated(); | |||||
this.priceUpdated(); | |||||
this.unitUpdated(); | |||||
}, | }, | ||||
priceUpdated: function () { | |||||
if(this.price) { | |||||
this.setPriceWithTax(); | |||||
this.setMultiplyingFactor(); | |||||
this.setPriceByRefUnit(); | |||||
this.setPriceByRefUnitWithTax(); | |||||
} | |||||
mounted: function () { | |||||
}, | }, | ||||
methods: { | |||||
init: function () { | |||||
this.buyingPriceUpdated(); | |||||
this.priceUpdated(); | |||||
this.unitUpdated(); | |||||
}, | |||||
priceUpdated: function () { | |||||
if(this.price) { | |||||
this.setPriceWithTax(); | |||||
this.setMultiplyingFactor(); | |||||
this.setPriceByRefUnit(); | |||||
this.setPriceByRefUnitWithTax(); | |||||
} | |||||
}, | |||||
buyingPriceUpdated: function () { | |||||
if(this.buyingPrice) { | |||||
this.setBuyingPriceWithTax(); | |||||
this.setMultiplyingFactor(); | |||||
this.setBuyingPriceByRefUnit(); | |||||
this.setBuyingPriceByRefUnitWithTax(); | |||||
} | |||||
}, | |||||
unitUpdated: function () { | |||||
if(this.unit) { | |||||
this.setPriceByRefUnit(); | |||||
this.setPriceByRefUnitWithTax(); | |||||
//this.setBuyingPriceByRefUnit(); | |||||
//this.setBuyingPriceByRefUnitWithTax(); | |||||
} | |||||
}, | |||||
quantityUpdated: function () { | |||||
if(this.quantity) { | |||||
this.setPriceByRefUnit(); | |||||
this.setPriceByRefUnitWithTax(); | |||||
// this.setBuyingPriceByRefUnit(); | |||||
// this.setBuyingPriceByRefUnitWithTax(); | |||||
} | |||||
}, | |||||
buyingPriceUpdated: function () { | |||||
if(this.buyingPrice) { | |||||
this.setBuyingPriceWithTax(); | |||||
this.setMultiplyingFactor(); | |||||
this.setBuyingPriceByRefUnit(); | |||||
this.setBuyingPriceByRefUnitWithTax(); | |||||
} | |||||
}, | |||||
//Toutes les fonctions ci-dessous ne font que mettre à jour les price et buyingPrice | |||||
buyingPriceWithTaxUpdated: function () { | |||||
this.setBuyingPriceFromBuyingPriceWithTax(); | |||||
this.buyingPriceUpdated(); | |||||
}, | |||||
buyingPriceByRefUnitUpdated: function () { | |||||
this.setBuyingPriceFromBuyingPriceByRefUnit(); | |||||
this.buyingPriceUpdated(); | |||||
}, | |||||
buyingPriceByRefUnitWithTaxUpdated: function () { | |||||
this.setBuyingPriceByRefUnitFromBuyingPriceByRefUnitWithTax(); | |||||
this.buyingPriceByRefUnitUpdated(); | |||||
}, | |||||
multiplyingFactorUpdated: function () { | |||||
this.setPriceFromMultiplyingFactor(); | |||||
this.priceUpdated(); | |||||
}, | |||||
priceWithTaxUpdated: function () { | |||||
this.setPriceFromPriceWithTax(); | |||||
this.priceUpdated(); | |||||
}, | |||||
priceByRefUnitUpdated: function () { | |||||
this.setPriceFromPriceByRefUnit(); | |||||
this.priceUpdated(); | |||||
}, | |||||
priceByRefUnitWithTaxUpdated: function () { | |||||
this.setPriceByRefUnitFromTax(); | |||||
this.priceByRefUnitUpdated(); | |||||
}, | |||||
unitUpdated: function () { | |||||
/*if(this.unit) { | |||||
this.setPriceByRefUnit(); | |||||
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(); | |||||
} | |||||
// this.setBuyingPriceByRefUnit(); | |||||
// this.setBuyingPriceByRefUnitWithTax(); | |||||
}, | |||||
//SETTER | |||||
setBuyingPriceFromBuyingPriceByRefUnit:function(){ | |||||
this.buyingPrice = parseFloat((this.buyingPriceByRefUnit * this.quantityValue) / this.unitCoefficient).toFixed(2); | |||||
}, | |||||
setBuyingPriceFromBuyingPriceWithTax: function () { | |||||
if (this.buyingPriceWithTax) { | |||||
this.buyingPriceWithTax = parseFloat(this.buyingPriceWithTax.replace(',', '.')).toFixed(2); | |||||
this.buyingPrice = getPrice(this.buyingPriceWithTax, this.supplierTaxRateValue); | |||||
} | |||||
}, | |||||
setBuyingPriceWithTax: function () { | |||||
if (this.buyingPrice) { | |||||
this.buyingPrice = parseFloat(this.buyingPrice.replace(',', '.')).toFixed(3); | |||||
this.buyingPriceWithTax = getPriceWithTax(this.buyingPrice, this.supplierTaxRateValue); | |||||
} | |||||
}, | |||||
setBuyingPriceByRefUnitFromBuyingPriceByRefUnitWithTax: function () { | |||||
if (this.buyingPriceByRefUnitWithTax) { | |||||
this.buyingPriceByRefUnitWithTax = parseFloat(this.buyingPriceByRefUnitWithTax.replace(',', '.')).toFixed(2); | |||||
this.buyingPriceByRefUnit = getPrice(this.buyingPriceByRefUnitWithTax, this.supplierTaxRateValue); | |||||
} | |||||
}, | |||||
setBuyingPriceByRefUnit: function () { | |||||
if (this.unitCoefficient && this.quantityValue) { | |||||
this.buyingPriceByRefUnit = parseFloat((this.buyingPriceValue / this.quantityValue) * this.unitCoefficient).toFixed(2); | |||||
} | |||||
}, | |||||
setBuyingPriceByRefUnitWithTax: function () { | |||||
if (this.buyingPriceByRefUnit) { | |||||
this.buyingPriceByRefUnit = parseFloat(this.buyingPriceByRefUnit.replace(',', '.')).toFixed(3); | |||||
this.buyingPriceByRefUnitWithTax = getPriceWithTax(this.buyingPriceByRefUnit, this.supplierTaxRateValue); | |||||
} | |||||
}, | |||||
setMultiplyingFactor: function () { | |||||
if (this.priceWithTax || this.buyingPrice) { | |||||
this.multiplyingFactor = parseFloat(this.priceWithTaxValue / this.buyingPriceValue).toFixed(3); | |||||
} | |||||
}, | |||||
setPriceByRefUnitFromTax: function () { | |||||
if (this.priceByRefUnitWithTax) { | |||||
this.priceByRefUnitWithTax = parseFloat(this.priceByRefUnitWithTax.replace(',', '.')).toFixed(2); | |||||
this.priceByRefUnit = getPrice(this.priceByRefUnitWithTax, this.taxRateValue); | |||||
} | |||||
}, | |||||
setPriceByRefUnit: function () { | |||||
if (this.unitCoefficient && this.quantityValue) { | |||||
this.priceByRefUnit = parseFloat((this.priceValue / this.quantityValue) * this.unitCoefficient).toFixed(2); | |||||
} | |||||
}, | |||||
setPriceByRefUnitWithTax: function () { | |||||
if (this.unitCoefficient && this.quantityValue) { | |||||
this.priceByRefUnitWithTax = parseFloat((this.priceWithTaxValue / this.quantityValue) * this.unitCoefficient).toFixed(2); | |||||
} | |||||
}, | |||||
//Toutes les fonctions ci-dessous ne font que mettre à jour les price et buyingPrice | |||||
buyingPriceWithTaxUpdated: function () { | |||||
this.setBuyingPriceFromBuyingPriceWithTax(); | |||||
this.buyingPriceUpdated(); | |||||
}, | |||||
buyingPriceByRefUnitUpdated: function () { | |||||
this.setBuyingPriceFromBuyingPriceByRefUnit(); | |||||
this.buyingPriceUpdated(); | |||||
}, | |||||
buyingPriceByRefUnitWithTaxUpdated: function () { | |||||
this.setBuyingPriceByRefUnitFromBuyingPriceByRefUnitWithTax(); | |||||
this.buyingPriceByRefUnitUpdated(); | |||||
}, | |||||
multiplyingFactorUpdated: function () { | |||||
this.setPriceFromMultiplyingFactor(); | |||||
this.priceUpdated(); | |||||
}, | |||||
priceWithTaxUpdated: function () { | |||||
this.setPriceFromPriceWithTax(); | |||||
this.priceUpdated(); | |||||
}, | |||||
priceByRefUnitUpdated: function () { | |||||
this.setPriceFromPriceByRefUnit(); | |||||
this.priceUpdated(); | |||||
}, | |||||
priceByRefUnitWithTaxUpdated: function () { | |||||
this.setPriceByRefUnitFromTax(); | |||||
this.priceByRefUnitUpdated(); | |||||
}, | |||||
setPriceFromMultiplyingFactor: function () { | |||||
this.price = getPrice(this.buyingPriceValue * this.multiplyingFactor, this.taxRateValue); | |||||
}, | |||||
setPriceFromPriceByRefUnit: function () { | |||||
this.price = parseFloat((this.priceByRefUnit * this.quantityValue) / this.unitCoefficient).toFixed(2); | |||||
//SETTER | |||||
setBuyingPriceFromBuyingPriceByRefUnit:function(){ | |||||
this.buyingPrice = parseFloat((this.buyingPriceByRefUnit * this.quantityValue) / this.unitCoefficient).toFixed(2); | |||||
}, | |||||
setBuyingPriceFromBuyingPriceWithTax: function () { | |||||
if (this.buyingPriceWithTax) { | |||||
this.buyingPriceWithTax = parseFloat(this.buyingPriceWithTax.replace(',', '.')).toFixed(2); | |||||
this.buyingPrice = getPrice(this.buyingPriceWithTax, this.supplierTaxRateValue); | |||||
} | |||||
}, | |||||
setBuyingPriceWithTax: function () { | |||||
if (this.buyingPrice) { | |||||
this.buyingPrice = parseFloat(this.buyingPrice.replace(',', '.')).toFixed(3); | |||||
this.buyingPriceWithTax = getPriceWithTax(this.buyingPrice, this.supplierTaxRateValue); | |||||
} | |||||
}, | |||||
setBuyingPriceByRefUnitFromBuyingPriceByRefUnitWithTax: function () { | |||||
if (this.buyingPriceByRefUnitWithTax) { | |||||
this.buyingPriceByRefUnitWithTax = parseFloat(this.buyingPriceByRefUnitWithTax.replace(',', '.')).toFixed(2); | |||||
this.buyingPriceByRefUnit = getPrice(this.buyingPriceByRefUnitWithTax, this.supplierTaxRateValue); | |||||
} | |||||
}, | |||||
setBuyingPriceByRefUnit: function () { | |||||
if (this.unitCoefficient && this.quantityValue) { | |||||
this.buyingPriceByRefUnit = parseFloat((this.buyingPriceValue / this.quantityValue) * this.unitCoefficient).toFixed(2); | |||||
} | |||||
}, | |||||
setBuyingPriceByRefUnitWithTax: function () { | |||||
if (this.buyingPriceByRefUnit) { | |||||
this.buyingPriceByRefUnit = parseFloat(this.buyingPriceByRefUnit.replace(',', '.')).toFixed(3); | |||||
this.buyingPriceByRefUnitWithTax = getPriceWithTax(this.buyingPriceByRefUnit, this.supplierTaxRateValue); | |||||
} | |||||
}, | |||||
setMultiplyingFactor: function () { | |||||
if (this.priceWithTax || this.buyingPrice) { | |||||
this.multiplyingFactor = parseFloat(this.priceWithTaxValue / this.buyingPriceValue).toFixed(3); | |||||
} | |||||
}, | |||||
setPriceByRefUnitFromTax: function () { | |||||
if (this.priceByRefUnitWithTax) { | |||||
this.priceByRefUnitWithTax = parseFloat(this.priceByRefUnitWithTax.replace(',', '.')).toFixed(2); | |||||
this.priceByRefUnit = getPrice(this.priceByRefUnitWithTax, this.taxRateValue); | |||||
} | |||||
}, | |||||
setPriceByRefUnit: function () { | |||||
if (this.unitCoefficient && this.quantityValue) { | |||||
this.priceByRefUnit = parseFloat((this.priceValue / this.quantityValue) * this.unitCoefficient).toFixed(2); | |||||
} | |||||
}, | |||||
setPriceByRefUnitWithTax: function () { | |||||
if (this.unitCoefficient && this.quantityValue) { | |||||
this.priceByRefUnitWithTax = parseFloat((this.priceWithTaxValue / this.quantityValue) * this.unitCoefficient).toFixed(2); | |||||
} | |||||
}, | |||||
setPriceFromMultiplyingFactor: function () { | |||||
this.price = getPrice(this.buyingPriceValue * this.multiplyingFactor, this.taxRateValue); | |||||
}, | |||||
setPriceFromPriceByRefUnit: function () { | |||||
this.price = parseFloat((this.priceByRefUnitValue * this.quantityValue) / this.unitCoefficient).toFixed(2); | |||||
}, | |||||
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); | |||||
}, | |||||
setPriceWithTax() { | |||||
if (this.price) { | |||||
this.price = parseFloat(this.price.replace(',', '.')).toFixed(3); | |||||
this.priceWithTax = getPriceWithTax(this.price, this.taxRateValue); | |||||
} | |||||
}, | |||||
}, | }, | ||||
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); | |||||
}, | |||||
setPriceWithTax() { | |||||
if (this.price) { | |||||
this.price = parseFloat(this.price.replace(',', '.')).toFixed(3); | |||||
this.priceWithTax = getPriceWithTax(this.price, this.taxRateValue); | |||||
} | |||||
}, | |||||
}, | |||||
watch: {} | |||||
watch: {} | |||||
}; | |||||
} | |||||
; | |||||
let mixinUnit = { | let mixinUnit = { | ||||
data() { | data() { |
mixins: [mixinUnit, mixinPrice, mixinTemplate], | mixins: [mixinUnit, mixinPrice, mixinTemplate], | ||||
props: ['template', 'keyForm'], | props: ['template', 'keyForm'], | ||||
data() { | data() { | ||||
return Object.assign({}, window.productUnitPriceValues); | |||||
return Object.assign({ | |||||
behaviorPrice:null, | |||||
activeProducts: false, | |||||
}, window.productUnitPriceValues); | |||||
}, | }, | ||||
computed: { | computed: { | ||||
}, | }, | ||||
unitValue: function () { | unitValue: function () { | ||||
return this.unit; | return this.unit; | ||||
}, | |||||
behaviorPriceValue:function(){ | |||||
return this.behaviorPrice; | |||||
} | } | ||||
}, | }, | ||||
mounted: function () { | mounted: function () { | ||||
this.init(); | this.init(); | ||||
if (this.price) return this.price; | if (this.price) return this.price; | ||||
else return this.productFamily.price; | else return this.productFamily.price; | ||||
}, | }, | ||||
priceByRefUnitValue:function(){ | |||||
if (this.priceByRefUnit) return this.priceByRefUnit; | |||||
else return this.productFamily.priceByRefUnit; | |||||
}, | |||||
priceByRefUnitWithTaxValue:function(){ | |||||
if (this.priceByRefUnitWithTax) return this.priceByRefUnitWithTax; | |||||
else return this.productFamily.priceByRefUnitWithTax; | |||||
}, | |||||
quantityValue: function () { | quantityValue: function () { | ||||
if (this.quantity) return this.quantity; | if (this.quantity) return this.quantity; | ||||
else return this.productFamily.quantity; | else return this.productFamily.quantity; | ||||
else return this.productFamily.unit; | else return this.productFamily.unit; | ||||
}, | }, | ||||
propertyExpirationDateFormated: function () { | propertyExpirationDateFormated: function () { | ||||
if (this.propertyExpirationDate) return getDateFormatted(this.propertyExpirationDate, '-') | if (this.propertyExpirationDate) return getDateFormatted(this.propertyExpirationDate, '-') | ||||
else return getDateFormatted(this.productFamily.propertyExpirationDate, '-') | else return getDateFormatted(this.productFamily.propertyExpirationDate, '-') | ||||
}, | |||||
behaviorPriceValue:function(){ | |||||
return this.productFamily.behaviorPrice; | |||||
} | } | ||||
}, | }, | ||||
data() { | data() { | ||||
mounted: function () { | mounted: function () { | ||||
//INIT VAR | //INIT VAR | ||||
updateSortableProducts(); | updateSortableProducts(); | ||||
$(this.$el).find('select').each(function (i, select) { | |||||
setSelect2($(select)); | |||||
}); | |||||
this.setUnitSelect2(); | |||||
//METHOD | //METHOD | ||||
this.updateProductView(); | this.updateProductView(); | ||||
}, | }, | ||||
methods: { | methods: { | ||||
setUnitSelect2:function(){ | |||||
$(this.$el).find('select').each(function (i, select) { | |||||
setSelect2($(select)); | |||||
}); | |||||
}, | |||||
titleUpdated:function(){}, | titleUpdated:function(){}, | ||||
availableQuantityUpdated:function(){}, | availableQuantityUpdated:function(){}, | ||||
availableQuantityDefaultUpdated:function(){}, | availableQuantityDefaultUpdated:function(){}, | ||||
} | } | ||||
}, | }, | ||||
}, | }, | ||||
watch: { | |||||
/*titleInherited: function (val) { | |||||
if (val) this.title = null; | |||||
}, | |||||
unitInherited: function (val) { | |||||
if (val) this.unit = null; | |||||
}, | |||||
quantityInherited: function (val) { | |||||
if (val) this.quantity = null; | |||||
}, | |||||
priceInherited: function (val) { | |||||
if (val) this.price = null; | |||||
},*/ | |||||
} | |||||
watch: {} | |||||
}); | }); | ||||
return { | return { | ||||
'title': this.title, | 'title': this.title, | ||||
'behaviorCountStock': this.behaviorCountStock, | 'behaviorCountStock': this.behaviorCountStock, | ||||
'behaviorBuyingPrice': this.behaviorBuyingPrice, | |||||
'displayPriceByRefUnit': this.displayPriceByRefUnit, | |||||
'behaviorPrice': this.$refs.productUnitPrice.behaviorPrice, | |||||
'unit': this.$refs.productUnitPrice.unit, | 'unit': this.$refs.productUnitPrice.unit, | ||||
'unitWording': this.$refs.productUnitPrice.unitWording, | 'unitWording': this.$refs.productUnitPrice.unitWording, | ||||
'quantity': this.$refs.productUnitPrice.quantity, | 'quantity': this.$refs.productUnitPrice.quantity, | ||||
}, | }, | ||||
unitReference: function () { | unitReference: function () { | ||||
this.getUnitReference(); | this.getUnitReference(); | ||||
} | } | ||||
}, | }, | ||||
data() { | data() { | ||||
{ | { | ||||
indexFormProduct: 0, | indexFormProduct: 0, | ||||
title: null, | title: null, | ||||
activeProducts: false, | |||||
isNovelty: null, | isNovelty: null, | ||||
isOrganic: null, | isOrganic: null, | ||||
propertyExpirationDate: null, | propertyExpirationDate: null, | ||||
behaviorCountStock: null, | behaviorCountStock: null, | ||||
behaviorBuyingPrice:null, | |||||
displayPriceByRefUnit: false, | |||||
typeExpirationDate: null, | typeExpirationDate: null, | ||||
behaviorExpirationDate: null, | behaviorExpirationDate: null, | ||||
propertyAllergens: null, | propertyAllergens: null, | ||||
if (typeof this.$refs.productUnitPrice !== 'undefined') { | if (typeof this.$refs.productUnitPrice !== 'undefined') { | ||||
return this.$refs.productUnitPrice.unitReference; | return this.$refs.productUnitPrice.unitReference; | ||||
} | } | ||||
}, | |||||
isProductsActice: function () { | |||||
if (typeof this.$refs.productUnitPrice !== 'undefined') { | |||||
return this.$refs.productUnitPrice.activeProducts; | |||||
} | |||||
}, | |||||
getBehaviorPrice: function () { | |||||
if (typeof this.$refs.productUnitPrice !== 'undefined') { | |||||
return this.$refs.productUnitPrice.behaviorPrice; | |||||
} | |||||
} | } | ||||
}, | }, | ||||
watch: { | watch: { |
propertyMain: Caractéristiques principales | propertyMain: Caractéristiques principales | ||||
propertySecondary: Caractéristiques secondaires | propertySecondary: Caractéristiques secondaires | ||||
note: Note interne | note: Note interne | ||||
parameters: Paramètres | |||||
ReductionCatalog: | ReductionCatalog: | ||||
info: Informations principal | info: Informations principal | ||||
conditions: Condictions d'application | conditions: Condictions d'application | ||||
propertyPackaging: Conditionnement | propertyPackaging: Conditionnement | ||||
propertyWeightQuantity: Poids/quantité | propertyWeightQuantity: Poids/quantité | ||||
displayPriceUnitRef: Afficher le prix par unité de référence | displayPriceUnitRef: Afficher le prix par unité de référence | ||||
behaviorBuyingPrice: Affichage du prix d'achat | |||||
behaviorBuyingPriceOptions: | |||||
behaviorPrice: Travailler avec des tarifs | |||||
behaviorPriceOptions: | |||||
byPiece: À la pièce | byPiece: À la pièce | ||||
byRefUnit: Par unité de référence | byRefUnit: Par unité de référence | ||||
behaviorCountStockOptions: | behaviorCountStockOptions: |
{% macro startCard(col, zone = "default", card ='primary', fullWidth = false ) %} | {% macro startCard(col, zone = "default", card ='primary', fullWidth = false ) %} | ||||
{% if col > 0 %}<div class="col-{{ col }}">{% endif %} | |||||
<div class="card card-{{ card }}"> | |||||
<div class="card-header"> | |||||
<h3 class="card-title"> | |||||
{% set label = "group."~zone %} | |||||
{{ label|trans({}, 'lcshop')|raw }} | |||||
</h3> | |||||
</div> | |||||
<div class="card-body {{ fullWidth == true ? 'p-0' : 'row' }}"> | |||||
{% if col > 0 %} | |||||
<div class="col-{{ col }}">{% endif %} | |||||
<div class="card card-{{ card }}"> | |||||
<div class="card-header"> | |||||
<h3 class="card-title"> | |||||
{% set label = "group."~zone %} | |||||
{{ label|trans({}, 'lcshop')|raw }} | |||||
</h3> | |||||
</div> | |||||
<div class="card-body {{ fullWidth == true ? 'p-0' : 'row' }}"> | |||||
{% endmacro %} | |||||
{% endmacro %} | |||||
{% macro endCard(noCol = false) %} | |||||
{% macro endCard(noCol = false) %} | |||||
</div> | </div> | ||||
</div> | </div> | ||||
{% if noCol == false %}</div>{% endif %} | {% if noCol == false %}</div>{% endif %} | ||||
{{ 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> | ||||
</td> | </td> | ||||
{% endmacro %} | |||||
{% macro priceField(field, fieldTax, fieldName, behaviorPriceValue) %} | |||||
<div class="form-group field-price col-12" v-show="behaviorPrice == '{{ behaviorPriceValue }}'"> | |||||
<div class="row"> | |||||
<div class="col-12"> | |||||
{{ form_label(field) }} | |||||
</div> | |||||
<div class="col-6"> | |||||
<div class="form-widget"> | |||||
<div class="input-group"> | |||||
{{ form_widget(field, {'attr' : {'v-model': fieldName, '@change' : fieldName~'Updated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ HT | |||||
{% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %} | |||||
</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="col-6"> | |||||
<div class="input-group"> | |||||
{{ form_widget(fieldTax, {'attr' : {'v-model': fieldName ~ 'WithTax', '@change' : fieldName~'WithTaxUpdated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ TTC | |||||
{% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %} | |||||
</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
{% endmacro %} | {% endmacro %} |
{% block plugin_javascript %} | {% block plugin_javascript %} | ||||
{{ parent() }} | {{ parent() }} | ||||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery-ui/jquery-ui.min.js') }}"></script> | <script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery-ui/jquery-ui.min.js') }}"></script> | ||||
<script src="{{ asset('bundles/cksourceckfinder/ckfinder/ckfinder.js') }}"></script> | |||||
{% endblock %} | {% endblock %} | ||||
{% block script_javascript %} | {% block script_javascript %} |
{% block plugin_javascript %} | {% block plugin_javascript %} | ||||
{{ parent() }} | {{ parent() }} | ||||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery-ui/jquery-ui.min.js') }}"></script> | <script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery-ui/jquery-ui.min.js') }}"></script> | ||||
<script src="{{ asset('bundles/cksourceckfinder/ckfinder/ckfinder.js') }}"></script> | |||||
{% endblock %} | {% endblock %} | ||||
{% block script_javascript %} | {% block script_javascript %} |
<ul class="nav nav-tabs" id="nav-params"> | <ul class="nav nav-tabs" id="nav-params"> | ||||
<li class="nav-item" v-for="section in sectionsArray"> | <li class="nav-item" v-for="section in sectionsArray"> | ||||
<button type="button" | <button type="button" | ||||
v-if="(section.name == 'products' && activeProducts == true) || (section.name != 'products')" | |||||
v-if="(section.name == 'products' && isProductsActice() == true) || (section.name != 'products')" | |||||
:class="'btn '+((currentSection == section.name) ? 'btn btn-primary' : 'btn ')" | :class="'btn '+((currentSection == section.name) ? 'btn btn-primary' : 'btn ')" | ||||
@click="changeSection(section)"> | @click="changeSection(section)"> | ||||
${ section.nameDisplay } | ${ section.nameDisplay } | ||||
{% if form.behaviorCountStock.vars.value %}behaviorCountStock: "{{ form.behaviorCountStock.vars.value }}",{% endif %} | {% if form.behaviorCountStock.vars.value %}behaviorCountStock: "{{ form.behaviorCountStock.vars.value }}",{% endif %} | ||||
{% if formValues.availableQuantity %}availableQuantity: "{{ formValues.availableQuantity }}",{% endif %} | {% if formValues.availableQuantity %}availableQuantity: "{{ formValues.availableQuantity }}",{% endif %} | ||||
{% if formValues.availableQuantityDefault %}availableQuantityDefault: "{{ formValues.availableQuantityDefault }}",{% endif %} | {% if formValues.availableQuantityDefault %}availableQuantityDefault: "{{ formValues.availableQuantityDefault }}",{% endif %} | ||||
{% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %} | |||||
{% if formValues.displayPriceByRefUnit == true %}displayPriceByRefUnit: {{ formValues.displayPriceByRefUnit }},{% endif %} | |||||
{% if formValues.behaviorBuyingPrice %}behaviorBuyingPrice: "{{ formValues.behaviorBuyingPrice }}",{% endif %} | |||||
{% if formValues.propertyOrganicLabel %}propertyOrganicLabelActive: true,{% endif %} | {% if formValues.propertyOrganicLabel %}propertyOrganicLabelActive: true,{% endif %} | ||||
{% if formValues.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDateActive: true,{% endif %} | {% if formValues.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDateActive: true,{% endif %} | ||||
{% if formValues.typeExpirationDate %}typeExpirationDate: "{{ formValues.typeExpirationDate }}",{% endif %} | {% if formValues.typeExpirationDate %}typeExpirationDate: "{{ formValues.typeExpirationDate }}",{% endif %} | ||||
{% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate|date('d/m/Y') }}",{% endif %} | {% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate|date('d/m/Y') }}",{% endif %} | ||||
}; | }; | ||||
window.productUnitPriceValues = { | window.productUnitPriceValues = { | ||||
{% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %} | |||||
{% if formValues.behaviorPrice %}behaviorPrice: "{{ formValues.behaviorPrice }}",{% 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 %} |
</div> | </div> | ||||
{{ macros.endCard() }} | {{ macros.endCard() }} | ||||
{{ macros.startCard(4, 'ProductFamily.products','light') }} | |||||
<div class="col-12"> | |||||
{{ form_row(form.activeProducts, {"attr": {"v-model": 'activeProducts'}}) }} | |||||
</div> | |||||
<div class="col-12" v-show="activeProducts == true"> | |||||
{{ form_row(form.productsType) }} | |||||
{{ form_row(form.behaviorAddToCart) }} | |||||
</div> | |||||
{{ macros.endCard(true) }} | |||||
{{ macros.startCard(0, 'ProductFamily.categories','light') }} | |||||
{{ macros.startCard(4, 'ProductFamily.categories','light') }} | |||||
<div class="col-12 product-categories"> | <div class="col-12 product-categories"> | ||||
{% for category in form.productCategories %} | {% for category in form.productCategories %} |
<product-unit-price ref="productUnitPrice" inline-template key-form="productfamily"> | <product-unit-price ref="productUnitPrice" inline-template key-form="productfamily"> | ||||
<div class="row"> | <div class="row"> | ||||
{{ macros.startCard(4, 'ProductFamily.unit','light') }} | |||||
{{ macros.startCard(4, 'ProductFamily.parameters','light') }} | |||||
<div class="col-12"> | |||||
{{ form_row(form.activeProducts, {"attr": {"v-model": 'activeProducts'}}) }} | |||||
</div> | |||||
<div class="col-12" v-show="activeProducts == true"> | |||||
{{ form_row(form.productsType) }} | |||||
{{ form_row(form.behaviorAddToCart) }} | |||||
</div> | |||||
<div class="col-12 form-group"> | |||||
{{ form_label(form.behaviorPrice) }} | |||||
{% for field in form.behaviorPrice %} | |||||
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorPrice'}}) }} | |||||
{% endfor %} | |||||
</div> | |||||
{{ macros.endCard(true) }} | |||||
{{ macros.startCard(0, 'ProductFamily.unit','light') }} | |||||
<div class="col-12"> | <div class="col-12"> | ||||
{{ form_row(form.unit, {"attr":{'v-model': 'unit', '@change': "unitUpdated"}}) }} | {{ form_row(form.unit, {"attr":{'v-model': 'unit', '@change': "unitUpdated"}}) }} | ||||
</div> | </div> | ||||
{{ macros.endCard() }} | {{ macros.endCard() }} | ||||
{{ macros.startCard(8, 'ProductFamily.price','light') }} | {{ macros.startCard(8, 'ProductFamily.price','light') }} | ||||
<div class="form-group field-price col-12"> | |||||
<div class="row"> | |||||
<div class="col-12 form-group"> | |||||
{{ form_label(form.behaviorBuyingPrice) }} | |||||
{% for field in form.behaviorBuyingPrice %} | |||||
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorBuyingPrice'}}) }} | |||||
{% endfor %} | |||||
</div> | |||||
<div class="col-12"> | |||||
{{ form_label(form.buyingPrice) }} | |||||
</div> | |||||
<div class="col-6" v-show="behaviorBuyingPrice == 'by-piece'"> | |||||
<div class="form-widget"> | |||||
<div class="input-group"> | |||||
{{ form_widget(form.buyingPrice, {'attr' : {'v-model': 'buyingPrice', '@change' : 'buyingPriceUpdated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ HT {#${ unitReference }#}</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="col-6" v-show="behaviorBuyingPrice == 'by-piece'"> | |||||
<div class="form-widget"> | |||||
<div class="input-group"> | |||||
{{ form_widget(form.buyingPriceWithTax, {'attr' : {'v-model': 'buyingPriceWithTax', '@change' : 'buyingPriceWithTaxUpdated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ TTC</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="col-6" v-show="behaviorBuyingPrice == 'by-reference-unit'"> | |||||
<div class="form-widget"> | |||||
<div class="input-group"> | |||||
{{ form_widget(form.buyingPriceByRefUnit, {'attr' : {'v-model': 'buyingPriceByRefUnit', '@change' : 'buyingPriceByRefUnitUpdated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ HT / ${ unitReference }</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="col-6" v-show="behaviorBuyingPrice == 'by-reference-unit'"> | |||||
<div class="form-widget"> | |||||
<div class="input-group"> | |||||
{{ form_widget(form.buyingPriceByRefUnitWithTax, {'attr' : {'v-model': 'buyingPriceByRefUnitWithTax', '@change' : 'buyingPriceByRefUnitWithTaxUpdated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ TTC/ ${ unitReference }</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
{{ macros.priceField(form.buyingPrice, form.buyingPriceWithTax, 'buyingPrice', 'by-piece') }} | |||||
{{ macros.priceField(form.buyingPriceByRefUnit, form.buyingPriceByRefUnitWithTax, 'buyingPriceByRefUnit', 'by-reference-unit') }} | |||||
<div class="form-group field-price col-12"> | <div class="form-group field-price col-12"> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col-6 align-content-center"> | <div class="col-6 align-content-center"> | ||||
</div> | </div> | ||||
<div class="form-group field-price col-12"> | |||||
<div class="row"> | |||||
<div class="col-12"> | |||||
{{ form_label(form.price) }} | |||||
</div> | |||||
<div class="col-6"> | |||||
<div class="form-widget"> | |||||
<div class="input-group"> | |||||
{{ form_widget(form.price, {'attr' : {'v-model': 'price', '@change' : 'priceUpdated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ HT</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="col-6"> | |||||
<div class="input-group"> | |||||
{{ form_widget(form.priceWithTax, {'attr' : {'v-model': 'priceWithTax', '@change' : 'priceWithTaxUpdated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ TTC</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="form-group field-price col-12" v-show="unit != 'piece'"> | |||||
{{ form_row(form.displayPriceByRefUnit, {"attr": {"v-model": 'displayPriceByRefUnit'}}) }} | |||||
</div> | |||||
{{ macros.priceField(form.price, form.priceWithTax, 'price', 'by-piece') }} | |||||
{{ macros.priceField(form.priceByRefUnit, form.priceByRefUnitWithTax, 'priceByRefUnit', 'by-reference-unit') }} | |||||
<div class="form-group field-price col-12" v-show="displayPriceByRefUnit == true && unit != 'piece'"> | |||||
<div class="row"> | |||||
<div class="col-12"> | |||||
{{ form_label(form.priceByRefUnit) }} | |||||
</div> | |||||
<div class="col-6"> | |||||
<div class="form-widget"> | |||||
<div class="input-group"> | |||||
{{ form_widget(form.priceByRefUnit, {'attr' : {'v-model': 'priceByRefUnit', '@change' : 'priceByRefUnitUpdated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ HT / ${ unitReference }</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="col-6"> | |||||
<div class="input-group"> | |||||
{{ form_widget(form.priceByRefUnitWithTax, {'attr' : {'v-model': 'priceByRefUnitWithTax', '@change' : 'priceByRefUnitWithTaxUpdated'}}) }} | |||||
<div class="input-group-append"> | |||||
<span class="input-group-text">€ TTC / ${ unitReference }</span> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
{{ macros.endCard() }} | {{ macros.endCard() }} | ||||
</div> | </div> |
{{ macros.productField(2, product.title, 'title') }} | {{ macros.productField(2, product.title, 'title') }} | ||||
{{ macros.productField(1, product.quantity, 'quantity') }} | {{ macros.productField(1, product.quantity, 'quantity') }} | ||||
{{ macros.productField(2, product.unit, 'unit', 'unitWording') }} | {{ macros.productField(2, product.unit, 'unit', 'unitWording') }} | ||||
{{ macros.productField(2, product.buyingPrice, 'buyingPrice',false, '€', 'v-show="productFamily.behaviorBuyingPrice == \'by-piece\'"') }} | |||||
{{ macros.productField(2, product.buyingPriceWithTax, 'buyingPriceWithTax',false, '€', 'v-show="productFamily.behaviorBuyingPrice == \'by-piece\'"') }} | |||||
{{ macros.productField(2, product.buyingPriceByRefUnit, 'buyingPriceByRefUnit',false, '€', 'v-show="productFamily.behaviorBuyingPrice == \'by-reference-unit\'"') }} | |||||
{{ macros.productField(2, product.buyingPriceByRefUnitWithTax, 'buyingPriceByRefUnitWithTax',false, '€', 'v-show="productFamily.behaviorBuyingPrice == \'by-reference-unit\'"') }} | |||||
{{ macros.productField(2, product.buyingPrice, 'buyingPrice',false, '€', 'v-show="productFamily.behaviorPrice == \'by-piece\'"') }} | |||||
{{ macros.productField(2, product.buyingPriceWithTax, 'buyingPriceWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'by-piece\'"') }} | |||||
{{ macros.productField(2, product.buyingPriceByRefUnit, 'buyingPriceByRefUnit',false, '€', 'v-show="productFamily.behaviorPrice == \'by-reference-unit\'"') }} | |||||
{{ macros.productField(2, product.buyingPriceByRefUnitWithTax, 'buyingPriceByRefUnitWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'by-reference-unit\'"') }} | |||||
{{ macros.productField(2, product.multiplyingFactor, 'multiplyingFactor') }} | {{ macros.productField(2, product.multiplyingFactor, 'multiplyingFactor') }} | ||||
{{ macros.productField(2, product.price, 'price') }} | |||||
{{ macros.productField(2, product.priceWithTax, 'priceWithTax') }} | |||||
{{ macros.productField(2, product.priceByRefUnit, 'priceByRefUnit',false, '€', 'v-show="productFamily.displayPriceByRefUnit == true"') }} | |||||
{{ macros.productField(2, product.priceByRefUnitWithTax, 'priceByRefUnitWithTax',false, '€', 'v-show="productFamily.displayPriceByRefUnit == true"') }} | |||||
{{ macros.productField(2, product.priceByRefUnit, 'priceByRefUnit',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'"> | |||||
{% verbatim %}{{ priceWithTaxValue }}{% 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.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.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','propertyExpirationDateFormated', '', 'v-show="productFamily.behaviorExpirationDate== \'by-product\'"') }} | ||||
<th colspan="2" class="quantity"> | <th colspan="2" class="quantity"> | ||||
Unité | Unité | ||||
</th> | </th> | ||||
<th v-show="behaviorBuyingPrice == 'by-reference-unit'" colspan="2" class="buyingPriceByRefUnit"> | |||||
<th v-show="getBehaviorPrice() == 'by-reference-unit'" colspan="2" class="buyingPriceByRefUnit"> | |||||
PA HT / ${ getUnitReference() } | PA HT / ${ getUnitReference() } | ||||
</th> | </th> | ||||
<th v-show="behaviorBuyingPrice == 'by-reference-unit'" colspan="2" class="priceByRefUnit"> | |||||
<th v-show="getBehaviorPrice() == 'by-reference-unit'" colspan="2" class="priceByRefUnit"> | |||||
PA TTC / ${ getUnitReference() } | PA TTC / ${ getUnitReference() } | ||||
</th> | </th> | ||||
<th v-show="behaviorBuyingPrice == 'by-piece'" colspan="2" class="price"> | |||||
<th colspan="2" class="price" v-show="getBehaviorPrice() =='by-piece'"> | |||||
PA HT | PA HT | ||||
</th> | </th> | ||||
<th v-show="behaviorBuyingPrice == 'by-piece'" colspan="2" class="price"> | |||||
<th colspan="2" class="price" v-show="getBehaviorPrice() =='by-piece'"> | |||||
PA TTC | PA TTC | ||||
</th> | </th> | ||||
<th colspan="2" class=""> | <th colspan="2" class=""> | ||||
Coef | Coef | ||||
</th> | </th> | ||||
<th colspan="2" class="price"> | |||||
<th v-show="getBehaviorPrice() == 'by-reference-unit'" colspan="2" class=""> | |||||
PV HT / ${ getUnitReference() } | |||||
</th> | |||||
<th v-show="getBehaviorPrice() == 'by-reference-unit'" colspan="2" class="price"> | |||||
PV TTC / ${ getUnitReference() } | |||||
</th> | |||||
<th colspan="2" class="price" v-show="getBehaviorPrice() =='by-piece'"> | |||||
PV HT | PV HT | ||||
</th> | </th> | ||||
<th colspan="2" class="price"> | <th colspan="2" class="price"> | ||||
PV TTC | PV TTC | ||||
</th> | </th> | ||||
<th v-show="displayPriceByRefUnit == true" colspan="2" class="priceByRefUnit"> | |||||
PV HT / ${ getUnitReference() } | |||||
</th> | |||||
<th v-show="displayPriceByRefUnit == true" colspan="2" class="priceByRefUnit"> | |||||
PV TTC / ${ getUnitReference() } | |||||
</th> | |||||
<th v-show="behaviorCountStock== 'by-product'"> | <th v-show="behaviorCountStock== 'by-product'"> | ||||
Stock | Stock |
{{ form_label(form.behaviorCountStock) }} | {{ form_label(form.behaviorCountStock) }} | ||||
{% for field in form.behaviorCountStock %} | {% for field in form.behaviorCountStock %} | ||||
{% if field.vars.value == "by-product" %} | {% if field.vars.value == "by-product" %} | ||||
<div v-if="activeProducts == true"> | |||||
<div v-if="isProductsActice() == true"> | |||||
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorCountStock'}}) }} | {{ form_widget(field, {"attr" : {"v-model" : 'behaviorCountStock'}}) }} | ||||
</div> | </div> | ||||
{% else %} | {% else %} |