Explorar el Código

Correctif backoffice productFamily

master
Fab hace 4 años
padre
commit
0d015299b4
Se han modificado 15 ficheros con 378 adiciones y 227 borrados
  1. +8
    -0
      ShopBundle/Context/OrderAmountMinInterface.php
  2. +11
    -0
      ShopBundle/Controller/Admin/ProductFamilyController.php
  3. +22
    -0
      ShopBundle/Form/ProductType.php
  4. +26
    -0
      ShopBundle/Model/OrderAmountMin.php
  5. +4
    -1
      ShopBundle/Model/PointSale.php
  6. +36
    -0
      ShopBundle/Model/ProductFamily.php
  7. +1
    -1
      ShopBundle/Repository/BaseRepository.php
  8. +10
    -0
      ShopBundle/Repository/PointSaleRepository.php
  9. +134
    -51
      ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js
  10. +23
    -19
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  11. +9
    -2
      ShopBundle/Resources/translations/lcshop.fr.yaml
  12. +20
    -0
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  13. +2
    -0
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  14. +42
    -13
      ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig
  15. +30
    -140
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig

+ 8
- 0
ShopBundle/Context/OrderAmountMinInterface.php Ver fichero

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderAmountMinInterface
{

}

+ 11
- 0
ShopBundle/Controller/Admin/ProductFamilyController.php Ver fichero

@@ -81,6 +81,17 @@ class ProductFamilyController extends AdminController
'expanded' => true
));

$formBuilder->add('behaviorBuyingPrice', ChoiceType::class, array(
'empty_data' => 'by-piece',
'choices' => array(
'field.ProductFamily.behaviorBuyingPriceOptions.byPiece' => 'by-piece',
'field.ProductFamily.behaviorBuyingPriceOptions.byRefUnit' => 'by-reference-unit'
),
'translation_domain' => 'lcshop',
'multiple' => false,
'expanded' => true
));

$formBuilder->add('propertyOrganicLabel', ChoiceType::class, array(
'choices' => array(
'field.ProductFamily.organicLabelOptions.ab' => 'ab',

+ 22
- 0
ShopBundle/Form/ProductType.php Ver fichero

@@ -86,12 +86,34 @@ class ProductType extends AbstractType
'required' => false,
'mapped' => false
));

$builder->add('buyingPriceByRefUnit', NumberType::class, array(
'label' => 'Prix d\'achat',
'required'=>false,
'mapped' => false
));

$builder->add('buyingPriceByRefUnitWithTax', NumberType::class, array(
'label' => 'Prix d\'achat TTC',
'required' => false,
'mapped' => false
));
$builder->add('multiplyingFactor', NumberType::class, array(
'label' => 'Coefficiant de multiplication',
'mapped'=>false,
'required'=>false
));

$builder->add('priceByRefUnit', NumberType::class, array(
'required'=>false,
'mapped' => false
));

$builder->add('priceByRefUnitWithTax', NumberType::class, array(
'required' => false,
'mapped' => false
));

$builder->add('availableQuantity', NumberType::class, array(
'label' => 'Quantité disponible',
'required' => false,

+ 26
- 0
ShopBundle/Model/OrderAmountMin.php Ver fichero

@@ -0,0 +1,26 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

trait OrderAmountMin
{
/**
* @ORM\Column(type="float")
*/
private $orderAmountMin;

public function getOrderAmountMin(): ?float
{
return $this->orderAmountMin;
}

public function setOrderAmountMin(float $orderAmountMin): self
{
$this->orderAmountMin = $orderAmountMin;

return $this;
}

}

+ 4
- 1
ShopBundle/Model/PointSale.php Ver fichero

@@ -6,12 +6,15 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
use Lc\ShopBundle\Context\OrderAmountMinInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class PointSale extends AbstractDocumentEntity implements FilterMultipleMerchantsInterface
abstract class PointSale extends AbstractDocumentEntity implements FilterMultipleMerchantsInterface, OrderAmountMinInterface
{

use OrderAmountMin;
/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="pointSales")
*/

+ 36
- 0
ShopBundle/Model/ProductFamily.php Ver fichero

@@ -134,6 +134,16 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
*/
protected $behaviorAddToCart;

/**
* @ORM\Column(type="string", length=31)
*/
protected $behaviorBuyingPrice;

/**
* @ORM\Column(type="boolean")
*/
protected $displayPriceByRefUnit;

public function __construct()
{
$this->productCategories = new ArrayCollection();
@@ -551,6 +561,32 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
return $this;
}


public function getBehaviorBuyingPrice(): ?string
{
return $this->behaviorBuyingPrice;
}

public function setBehaviorBuyingPrice(?string $behaviorBuyingPrice): self
{
$this->behaviorBuyingPrice = $behaviorBuyingPrice;

return $this;
}

public function getDisplayPriceByRefUnit(): ?bool
{
return $this->displayPriceByRefUnit;
}

public function setDisplayPriceByRefUnit(?bool $displayPriceByRefUnit): self
{
$this->displayPriceByRefUnit = $displayPriceByRefUnit;

return $this;
}


public function hasProductsWithVariousWeight()
{
if ($this->getActiveProducts()) {

+ 1
- 1
ShopBundle/Repository/BaseRepository.php Ver fichero

@@ -6,6 +6,7 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\StatusInterface;

@@ -50,7 +51,6 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository
if ($criteria['merchant'] === false) unset($criteria['merchant']);
}


return parent::findBy($criteria, $orderBy, $limit, $offset);

}

+ 10
- 0
ShopBundle/Repository/PointSaleRepository.php Ver fichero

@@ -30,4 +30,14 @@ class PointSaleRepository extends BaseRepository implements DefaultRepositoryInt
->getResult() ;
}

public function findAllByMerchant()
{
return $this->createQueryBuilder('e')
->where(':currentMerchant MEMBER OF e.merchants')
->andWhere('e.status = 1')
->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent())
->getQuery()
->getResult() ;
}

}

+ 134
- 51
ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js Ver fichero

@@ -5,31 +5,33 @@ let mixinPrice = {
priceWithTax: null,
buyingPrice: null,
buyingPriceWithTax: null,
buyingPriceByRefUnit: null,
buyingPriceByRefUnitWithTax: null,
differentSupplierTaxRate: null,
multiplyingFactor: null,
priceByRefUnit: null,
priceByRefUnitWithTax: null,
taxRate: null,
supplierTaxRate: null,
priceByRefUnitWithTax: null
supplierTaxRate: null
}, window.mixinPriceValues);

},
computed: {
taxRateValue: function () {
if(this.taxRate) {
if (this.taxRate) {
return this.taxRatesList[this.taxRate]['value'];
}else if (this.taxRate == null || this.taxRate == "undefined"){
} else if (this.taxRate == null || this.taxRate == "undefined") {
return this.taxRatesList['default']['value'];
}else{
} else {
log('ERREUR : pas de taxRate')
}
},
supplierTaxRateValue: function () {
if(this.supplierTaxRate) {
if (this.supplierTaxRate) {
return this.taxRatesList[this.supplierTaxRate]['value'];
}else if (this.supplierTaxRate == null || this.supplierTaxRate == "undefined"){
} else if (this.supplierTaxRate == null || this.supplierTaxRate == "undefined") {
return this.taxRateValue;
}else{
} else {
log('ERREUR : pas de supplier taxRate')
}
},
@@ -38,73 +40,154 @@ let mixinPrice = {
mounted: function () {
},
methods: {
/*changeTaxRate: function () {
this.$emit('tax-rate-change');
this.changePriceWithTax();
},*/

changeBuyingPrice: function () {
this.buyingPriceUpdate('buyingPrice');
},
changeBuyingPriceWithTax: function () {
this.buyingPriceUpdate('buyingPriceWithTax');
init: function () {
this.buyingPriceUpdated();
this.priceUpdated();
this.unitUpdated();
},
changePrice: function () {

this.priceUpdate('price');
this.setMultiplyingFactor();
priceUpdated: function () {
if(this.price) {
this.setPriceWithTax();
this.setMultiplyingFactor();
this.setPriceByRefUnit();
this.setPriceByRefUnitWithTax();
}
},
changePriceWithTax: function () {

this.priceUpdate('priceWithTax');
this.setMultiplyingFactor();

buyingPriceUpdated: function () {
if(this.buyingPrice) {
this.setBuyingPriceWithTax();
this.setMultiplyingFactor();
this.setBuyingPriceByRefUnit();
this.setBuyingPriceByRefUnitWithTax();
}
},
priceUpdate: function (priceType) {

if (priceType == 'priceWithTax' && this.price) {
this.price = parseFloat(this.price.replace(',', '.')).toFixed(3);
this.priceWithTax = getPriceWithTax(this.price, this.taxRateValue);
} else if (this.priceWithTax) {
if (typeof this.priceWithTax != "number") {
this.priceWithTax = parseFloat(this.priceWithTax.replace(',', '.'));
}
this.priceWithTax = this.priceWithTax.toFixed(2);
this.price = getPrice(this.priceWithTax, this.taxRateValue);
unitUpdated: function () {
if(this.unit) {
this.setPriceByRefUnit();
this.setPriceByRefUnitWithTax();
//this.setBuyingPriceByRefUnit();
//this.setBuyingPriceByRefUnitWithTax();
}
this.priceByRefUnitUpdate();
},
buyingPriceUpdate: function (priceType) {
quantityUpdated: function () {
if(this.quantity) {
this.setPriceByRefUnit();
this.setPriceByRefUnitWithTax();
// 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();
},

if (priceType == 'buyingPriceWithTax' && this.buyingPrice) {

this.buyingPrice = parseFloat(this.buyingPrice.replace(',', '.')).toFixed(3);
this.buyingPriceWithTax = getPriceWithTax(this.buyingPrice, this.supplierTaxRateValue);
} else if (this.buyingPriceWithTax) {
//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);
}
this.setMultiplyingFactor();
this.priceByRefUnitUpdate();
},
updateMultiplyingFactor: function () {

this.priceWithTax = this.buyingPriceValue * this.multiplyingFactor;
this.priceUpdate('price');
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) {
if (this.priceWithTax || this.buyingPrice) {
this.multiplyingFactor = parseFloat(this.priceWithTaxValue / this.buyingPriceValue).toFixed(3);
}
},
priceByRefUnitUpdate: function () {

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.priceByRefUnit * 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);
}
},
},
watch: {}


+ 23
- 19
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js Ver fichero

@@ -30,24 +30,18 @@ Vue.component('product-unit-price', {
}
},
mounted: function () {

this.priceUpdate('priceWithTax');
this.buyingPriceUpdate('buyingPriceWithTax');
this.init();
},
watch: {
taxRate: function () {
this.changePriceWithTax();
this.changeBuyingPriceWithTax();
this.setBuyingPriceWithTax();
this.setPriceWithTax();
this.setMultiplyingFactor();
this.setPriceByUnitRefWithTax();
},
supplierTaxRate: function () {
this.changeBuyingPriceWithTax();
this.setBuyingPriceWithTax();
}
/*log($('.product-form.modal .select-unit'));
$('.product-form.modal .select-unit').find('option:selected').each(function(i,elm){
$(this).prop("selected", false);
});
log($('.product-form.modal .select-unit'));*/

}
});

@@ -112,6 +106,10 @@ Vue.component('product-form', {
multiplyingFactorInherited: false,
buyingPriceInherited: false,
buyingPriceWithTaxInherited: false,
buyingPriceByRefUnitInherited: false,
buyingPriceByRefUnitWithTaxInherited: false,
priceByRefUnitInherited:false,
priceByRefUnitWithTaxInherited:false,
expirationDateInherited: false,
availableQuantityInherited: false,
availableQuantityDefaultInherited: false,
@@ -132,15 +130,15 @@ Vue.component('product-form', {
this.updateProductView();
},
methods: {
titleUpdated:function(){},
availableQuantityUpdated:function(){},
availableQuantityDefaultUpdated:function(){},
propertyExpirationDateUpdated:function(){},
updateLine: function(){
this.changePriceWithTax();
this.changeBuyingPriceWithTax();
this.init();
},
updateProductForm: function () {

this.changePriceWithTax();
this.changeBuyingPriceWithTax();
//EDIT UNIT
this.init();
},

updateProductView: function () {
@@ -194,12 +192,17 @@ appProductFamily = new Vue({
return {
'title': this.title,
'behaviorCountStock': this.behaviorCountStock,
'behaviorBuyingPrice': this.behaviorBuyingPrice,
'displayPriceByRefUnit': this.displayPriceByRefUnit,
'unit': this.$refs.productUnitPrice.unit,
'unitWording': this.$refs.productUnitPrice.unitWording,
'quantity': this.$refs.productUnitPrice.quantity,
'price': this.$refs.productUnitPrice.price,
'priceWithTax': this.$refs.productUnitPrice.priceWithTax,
'buyingPrice': this.$refs.productUnitPrice.buyingPrice,
'buyingPriceWithTax': this.$refs.productUnitPrice.buyingPriceWithTax,
'buyingPriceByRefUnit': this.$refs.productUnitPrice.buyingPriceByRefUnit,
'buyingPriceByRefUnitWithTax': this.$refs.productUnitPrice.buyingPriceByRefUnitWithTax,
'priceByRefUnit': this.$refs.productUnitPrice.priceByRefUnit,
'priceByRefUnitWithTax': this.$refs.productUnitPrice.priceByRefUnitWithTax,
'taxRate': this.$refs.productUnitPrice.taxRate,
@@ -226,7 +229,8 @@ appProductFamily = new Vue({
isOrganic: null,
propertyExpirationDate: null,
behaviorCountStock: null,

behaviorBuyingPrice:null,
displayPriceByRefUnit: false,
typeExpirationDate: null,
behaviorExpirationDate: null,
propertyAllergens: null,

+ 9
- 2
ShopBundle/Resources/translations/lcshop.fr.yaml Ver fichero

@@ -77,7 +77,7 @@ field:
enabled: Activé
zips: Codes postaux
cities: Villes
orderPriceMin: Montant minimum de commande
orderAmountMin: Montant minimum de commande
deliveryPrice: Montant de la livraison
typeExpirationDate: Type de date d'expiration
dlc: DLC
@@ -121,7 +121,9 @@ field:
subscribeNewsletter: S'inscrire à la newsletter
send: Envoyer
isSent: Envoyée

PointSale:
code: Code
codeHelp: Code utilisé pour retrouver l'ambassade dans le tunnel de commande (Non sensible à la casse)
Supplier:
user: Utilisateur lié

@@ -145,6 +147,11 @@ field:
propertyCharacteristics: Caractéristiques
propertyPackaging: Conditionnement
propertyWeightQuantity: Poids/quantité
displayPriceUnitRef: Afficher le prix par unité de référence
behaviorBuyingPrice: Affichage du prix d'achat
behaviorBuyingPriceOptions:
byPiece: À la pièce
byRefUnit: Par unité de référence
behaviorCountStockOptions:
byQuantity: Gérer le stock par quantité
byProductFamily: Gérer le stock par produit (à l'unité)

+ 20
- 0
ShopBundle/Resources/views/backend/default/block/macros.html.twig Ver fichero

@@ -16,3 +16,23 @@ v
</div>
{% if noCol == false %}</div>{% endif %}
{% endmacro %}


{% macro productField(colspan, field, fieldName, fieldDisplay = false, displaySuffix="",attr="") %}

{% if fieldDisplay == false %}{% set fieldDisplay = fieldName %}{% endif %}

<td {{ attr|raw }} colspan="{{ colspan }}" class="{{ fieldName }}" v-on:click="{{ fieldName }}Inherited = true">
<div v-show="{{ fieldName }}Inherited == false">
<div v-if="{{ fieldName }}">
{% verbatim %}{{ {% endverbatim %}{{ fieldDisplay }} {% verbatim %}}}{% endverbatim %}{{ displaySuffix }}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.{% endverbatim %}{{ fieldDisplay }} {% verbatim %}}}{% endverbatim %}{{ displaySuffix }}
</div>
</div>
<div v-show="{{ fieldName }}Inherited == true">
{{ form_widget(field, {'attr' : {'v-model' : fieldName , 'v-on:focusout': fieldName~'Inherited = false', '@change' : fieldName~'Updated'}}) }}
</div>
</td>
{% endmacro %}

+ 2
- 0
ShopBundle/Resources/views/backend/productfamily/form.html.twig Ver fichero

@@ -38,6 +38,8 @@
{% if formValues.availableQuantity %}availableQuantity: "{{ formValues.availableQuantity }}",{% 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.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDateActive: true,{% endif %}
{% if formValues.typeExpirationDate %}typeExpirationDate: "{{ formValues.typeExpirationDate }}",{% endif %}

+ 42
- 13
ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig Ver fichero

@@ -5,7 +5,7 @@
<div class="row">
{{ macros.startCard(4, 'ProductFamily.unit','light') }}
<div class="col-12">
{{ form_row(form.unit, {"attr":{'v-model': 'unit', '@change': "priceByRefUnitUpdate"}}) }}
{{ form_row(form.unit, {"attr":{'v-model': 'unit', '@change': "unitUpdated"}}) }}
</div>

<div class="col-12">
@@ -13,7 +13,7 @@
{{ form_label(form.quantity) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.quantity, {'attr' : {'v-model': 'quantity', '@change': "priceByRefUnitUpdate"}}) }}
{{ form_widget(form.quantity, {'attr' : {'v-model': 'quantity', '@change': "quantityUpdated"}}) }}
<div class="input-group-append">
<span class="input-group-text">${ unitWording }</span>
</div>
@@ -41,29 +41,56 @@
{{ 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">

<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' : 'changeBuyingPriceWithTax'}}) }}
{{ 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">
<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' : 'changeBuyingPrice'}}) }}
{{ 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>
<div class="form-group field-price col-12">
@@ -72,7 +99,7 @@
<div class="form-widget">
{{ form_label(form.multiplyingFactor) }}
<div class="input-group">
{{ form_widget(form.multiplyingFactor, {'attr': {'v-model':'multiplyingFactor', '@change' : 'updateMultiplyingFactor'}}) }}
{{ form_widget(form.multiplyingFactor, {'attr': {'v-model':'multiplyingFactor', '@change' : 'multiplyingFactorUpdated'}}) }}
<div class="input-group-append">
<span class="input-group-text">X</span>
</div>
@@ -92,7 +119,7 @@
<div class="col-6">
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.price, {'attr' : {'v-model': 'price', '@change' : 'changePriceWithTax'}}) }}
{{ form_widget(form.price, {'attr' : {'v-model': 'price', '@change' : 'priceUpdated'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ HT</span>
</div>
@@ -101,7 +128,7 @@
</div>
<div class="col-6">
<div class="input-group">
{{ form_widget(form.priceWithTax, {'attr' : {'v-model': 'priceWithTax', '@change' : 'changePrice'}}) }}
{{ form_widget(form.priceWithTax, {'attr' : {'v-model': 'priceWithTax', '@change' : 'priceWithTaxUpdated'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ TTC</span>
</div>
@@ -109,9 +136,11 @@
</div>
</div>
</div>


<div class="form-group field-price col-12" v-show="unit != 'piece'">
{{ form_row(form.displayPriceByRefUnit, {"attr": {"v-model": 'displayPriceByRefUnit'}}) }}
</div>

<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) }}
@@ -119,7 +148,7 @@
<div class="col-6">
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.priceByRefUnit, {'attr' : {'v-model': 'priceByRefUnit', 'readonly':'readonly'}}) }}
{{ form_widget(form.priceByRefUnit, {'attr' : {'v-model': 'priceByRefUnit', '@change' : 'priceByRefUnitUpdated'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ HT / ${ unitReference }</span>
</div>
@@ -128,7 +157,7 @@
</div>
<div class="col-6">
<div class="input-group">
{{ form_widget(form.priceByRefUnitWithTax, {'attr' : {'v-model': 'priceByRefUnitWithTax','readonly':'readonly'}}) }}
{{ form_widget(form.priceByRefUnitWithTax, {'attr' : {'v-model': 'priceByRefUnitWithTax', '@change' : 'priceByRefUnitWithTaxUpdated'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ TTC / ${ unitReference }</span>
</div>

+ 30
- 140
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig Ver fichero

@@ -4,7 +4,7 @@

<tr class="lc-draggable">
<td><i class="fa fa-fw fa-sort"></i></td>
<td colspan="2" class="title" v-on:click="titleInherited = true">
{#<td colspan="2" class="title" v-on:click="titleInherited = true">
<div v-show="titleInherited == false">
<div v-if="title" class="blop">
{% verbatim %}{{ title }}{% endverbatim %}
@@ -16,21 +16,9 @@
<div v-show="titleInherited == true">
{{ form_widget(product.title, {'attr' : {'v-model' : 'title', 'v-on:focusout': 'titleInherited = false'}}) }}
</div>
</td>
</td>#}

<td colspan="1" class="quantity" v-on:click="quantityInherited = true">
<div v-show="quantityInherited == false">
<div v-if="quantity" class="blop">
{% verbatim %}{{ quantity }}{% endverbatim %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.quantity }}{% endverbatim %}
</div>
</div>
<div v-show="quantityInherited == true">
{{ form_widget(product.quantity, {'attr' : {'v-model' : 'quantity', 'v-on:focusout': 'quantityInherited = false', '@change' : 'updateLine'}}) }}
</div>
</td>
{#

<td colspan="2" class="unit" v-on:click="unitInherited = true">
<div v-show="unitInherited == false">
@@ -44,127 +32,22 @@
<div v-show="unitInherited == true">
{{ form_widget(product.unit, {'attr' : {'v-model' : 'unit', 'v-on:focusout': 'unitInherited = false', '@change' : 'updateLine'}}) }}
</div>
</td>

<td colspan="2" class="buyingPrice" v-on:click="buyingPriceInherited = true">
<div v-show="buyingPriceInherited == false">
<div v-if="buyingPrice" class="blop">
{% verbatim %}{{ buyingPrice }}€{% endverbatim %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.buyingPrice }}€{% endverbatim %}
</div>
</div>
<div v-show="buyingPriceInherited == true">
{{ form_widget(product.buyingPrice, {'attr' : {'v-model' : 'buyingPrice', 'v-on:focusout': 'buyingPriceInherited = false', '@change' : 'changeBuyingPriceWithTax'}}) }}
</div>
</td>
<td colspan="2" class="buyingPriceWithTax" v-on:click="buyingPriceWithTaxInherited = true">
<div v-show="buyingPriceWithTaxInherited == false">
<div v-if="buyingPriceWithTax" class="blop">
{% verbatim %}{{ buyingPriceWithTax }}€{% endverbatim %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.buyingPriceWithTax }}€{% endverbatim %}
</div>
</div>
<div v-show="buyingPriceWithTaxInherited == true">
{{ form_widget(product.buyingPriceWithTax, {'attr' : {'v-model' : 'buyingPriceWithTax', 'v-on:focusout': 'buyingPriceWithTaxInherited = false' , '@change' : 'changeBuyingPrice'}}) }}
</div>
</td>

<td colspan="2" class="multiplyingFactor" v-on:click="multiplyingFactorInherited = true">
<div v-show="multiplyingFactorInherited == false">
<div v-if="multiplyingFactor">
{% verbatim %}{{ multiplyingFactor }}{% endverbatim %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.multiplyingFactor }}{% endverbatim %}
</div>
</div>
<div v-show="multiplyingFactorInherited == true">
{{ form_widget(product.multiplyingFactor, {'attr' : {'v-model' : 'multiplyingFactor', 'v-on:focusout': 'multiplyingFactorInherited = false', '@change' : 'updateMultiplyingFactor'}}) }}
</div>
</td>

<td colspan="2" class="price" v-on:click="priceInherited = true">
<div v-show="priceInherited == false">
<div v-if="price">
{% verbatim %}{{ price }}€{% endverbatim %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.price }}€{% endverbatim %}
</div>
</div>
<div v-show="priceInherited == true">
{{ form_widget(product.price, {'attr' : {'v-model' : 'price', 'v-on:focusout': 'priceInherited = false', '@change' : 'changePriceWithTax'}}) }}
</div>
</td>

<td colspan="2" class="priceWithTax" v-on:click="priceWithTaxInherited = true">
<div v-show="priceWithTaxInherited == false">
<div v-if="priceWithTax">
{% verbatim %}{{ priceWithTax }}€{% endverbatim %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.priceWithTax }}€{% endverbatim %}
</div>
</div>
<div v-show="priceWithTaxInherited == true">
{{ form_widget(product.priceWithTax, {'attr' : {'v-model' : 'priceWithTax', 'v-on:focusout': 'priceWithTaxInherited = false', '@change' : 'changePrice'}}) }}
</div>
</td>

{# <td colspan="2" class="priceByRefUnit">
{% verbatim %}{{ priceByRefUnit }}€{% endverbatim %}
</td>
<td colspan="2" class="priceByRefUnit priceByRefUnitWithTax">
{% verbatim %}{{ priceByRefUnitWithTax }}€{% endverbatim %}
</td>#}


<td v-show="productFamily.behaviorCountStock== 'by-product'" class="stock availableQuantity " v-on:click="availableQuantityInherited = true">
<div v-show="availableQuantityInherited == false">
<div v-if="availableQuantity">
{% verbatim %}{{ availableQuantity }}{% endverbatim %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.availableQuantity }}{% endverbatim %}
</div>

</div>
<div v-show="availableQuantityInherited == true">
{{ form_widget(product.availableQuantity, {'attr' : {'v-model' : 'availableQuantity', 'v-on:focusout': 'availableQuantityInherited = false'}}) }}
</div>
</td>

<td v-show="productFamily.behaviorCountStock== 'by-product'" class="stock availableQuantityDefault" v-on:click="availableQuantityDefaultInherited = true">
<div v-show="availableQuantityDefaultInherited == false">
<div v-if="availableQuantityDefault">
{% verbatim %}{{ availableQuantityDefault }}{% endverbatim %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ productFamily.availableQuantityDefault }}{% endverbatim %}
</div>
</div>
<div v-show="availableQuantityDefaultInherited == true">
{{ form_widget(product.availableQuantityDefault, {'attr' : {'v-model' : 'availableQuantityDefault', 'v-on:focusout': 'availableQuantityDefaultInherited = false'}}) }}
</div>
</td>

<td v-show="productFamily.behaviorExpirationDate== 'by-product'" colspan="2" v-on:click="propertyExpirationDateInherited = true">
<div v-show="propertyExpirationDateInherited == false">
<div v-if="propertyExpirationDate">
{% verbatim %}{{ propertyExpirationDateFormated }}{% endverbatim %}
</div>
<div v-else class="inherited">
{% verbatim %}{{ propertyExpirationDateFormated }}{% endverbatim %}
</div>
</div>
<div v-show="propertyExpirationDateInherited == true">
{{ form_widget(product.propertyExpirationDate, {'attr' : {'v-model' : 'propertyExpirationDate', 'v-on:focusout': 'propertyExpirationDateInherited = false'}}) }}
</div>
</td>
{{ macros.productField(2, product.title, 'title') }}
{{ macros.productField(1, product.quantity, 'quantity') }}
{{ 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.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.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\'"') }}

<td>
<button type="button" class="btn-remove-product btn btn-default" @click="deleteProductForm()">
@@ -195,10 +78,17 @@
<th colspan="2" class="quantity">
Unité
</th>
<th colspan="2" class="price">
<th v-show="behaviorBuyingPrice == 'by-reference-unit'" colspan="2" class="buyingPriceByRefUnit">
PA HT / ${ getUnitReference() }
</th>
<th v-show="behaviorBuyingPrice == 'by-reference-unit'" colspan="2" class="priceByRefUnit">
PA TTC / ${ getUnitReference() }
</th>

<th v-show="behaviorBuyingPrice == 'by-piece'" colspan="2" class="price">
PA HT
</th>
<th colspan="2" class="price">
<th v-show="behaviorBuyingPrice == 'by-piece'" colspan="2" class="price">
PA TTC
</th>
<th colspan="2" class="">
@@ -210,12 +100,12 @@
<th colspan="2" class="price">
PV TTC
</th>
{# <th colspan="2" class="priceByRefUnit">
<th v-show="displayPriceByRefUnit == true" colspan="2" class="priceByRefUnit">
PV HT / ${ getUnitReference() }
</th>
<th colspan="2" class="priceByRefUnit">
<th v-show="displayPriceByRefUnit == true" colspan="2" class="priceByRefUnit">
PV TTC / ${ getUnitReference() }
</th>#}
</th>

<th v-show="behaviorCountStock== 'by-product'">
Stock

Cargando…
Cancelar
Guardar