瀏覽代碼

Form produits intégration prix par unité de référence (travail en cours)

master
Fab 4 年之前
父節點
當前提交
53536e4e16
共有 21 個檔案被更改,包括 400 行新增403 行删除
  1. +3
    -3
      ShopBundle/Controller/Admin/ProductFamilyController.php
  2. +0
    -7
      ShopBundle/Form/ProductType.php
  3. +22
    -5
      ShopBundle/Model/OrderProduct.php
  4. +5
    -21
      ShopBundle/Model/ProductFamily.php
  5. +36
    -1
      ShopBundle/Model/ProductPropertyTrait.php
  6. +0
    -3
      ShopBundle/Resources/config/easy_admin/base.yaml
  7. +2
    -0
      ShopBundle/Resources/public/css/backend/custom.css
  8. +0
    -2
      ShopBundle/Resources/public/js/backend/script/default/init-list.js
  9. +185
    -178
      ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js
  10. +37
    -26
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  11. +3
    -2
      ShopBundle/Resources/translations/lcshop.fr.yaml
  12. +46
    -11
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  13. +0
    -1
      ShopBundle/Resources/views/backend/default/edit.html.twig
  14. +0
    -1
      ShopBundle/Resources/views/backend/default/new.html.twig
  15. +0
    -0
      ShopBundle/Resources/views/backend/form/ckfinder_widget.html.twigTODELETE
  16. +3
    -4
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  17. +1
    -11
      ShopBundle/Resources/views/backend/productfamily/panel_general.html.twig
  18. +28
    -107
      ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig
  19. +28
    -19
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig
  20. +1
    -1
      ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig
  21. +0
    -0
      ShopBundle/Services/CustomCKFinderAuth.phpRENAME

+ 3
- 3
ShopBundle/Controller/Admin/ProductFamilyController.php 查看文件

@@ -83,11 +83,11 @@ class ProductFamilyController extends AdminController
'expanded' => true
));

$formBuilder->add('behaviorBuyingPrice', ChoiceType::class, array(
$formBuilder->add('behaviorPrice', ChoiceType::class, array(
'empty_data' => 'by-piece',
'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',
'multiple' => false,

+ 0
- 7
ShopBundle/Form/ProductType.php 查看文件

@@ -2,21 +2,14 @@

namespace Lc\ShopBundle\Form;

use CKSource\Bundle\CKFinderBundle\Form\Type\CKFinderFileChooserType;
use Doctrine\ORM\EntityManagerInterface;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Context\ProductInterface;
use Lc\ShopBundle\Context\TaxRateInterface;
use Lc\ShopBundle\Context\UnitInterface;
use Lc\ShopBundle\Services\Utils;
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\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use function PHPSTORM_META\type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

+ 22
- 5
ShopBundle/Model/OrderProduct.php 查看文件

@@ -23,10 +23,15 @@ abstract class OrderProduct implements PriceInterface
*/
protected $product;

/**
* @ORM\Column(type="integer")
*/
protected $quantityOrder;

/**
* @ORM\Column(type="float")
*/
protected $quantity;
protected $quantityProduct;

/**
* @ORM\Column(type="string", length=255)
@@ -118,14 +123,26 @@ abstract class OrderProduct implements PriceInterface
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;
}

+ 5
- 21
ShopBundle/Model/ProductFamily.php 查看文件

@@ -141,12 +141,8 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
/**
* @ORM\Column(type="string", length=31)
*/
protected $behaviorBuyingPrice;
protected $behaviorPrice;

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

public function __construct()
{
@@ -584,26 +580,14 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
}


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

+ 36
- 1
ShopBundle/Model/ProductPropertyTrait.php 查看文件

@@ -18,7 +18,17 @@ trait ProductPropertyTrait
/**
* @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)
@@ -48,6 +58,31 @@ trait ProductPropertyTrait
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
{
return $this->quantity;

+ 0
- 3
ShopBundle/Resources/config/easy_admin/base.yaml 查看文件

@@ -11,8 +11,6 @@ easy_admin:
assets:
favicon: '/assets/img/backend/favicon-pdl.png'
js:
- '/bundles/cksourceckfinder/ckfinder/ckfinder.js'
- '/bundles/lcshop/js/backend/script/setup-ckfinder.js'
- '/bundles/lcshop/js/backend/script/custom.js'
css:
- '/bundles/lcshop/css/backend/jquery-ui.min.css'
@@ -20,7 +18,6 @@ easy_admin:
form_theme:
- '@LcShop/backend/form/custom_bootstrap_4.html.twig'
- '@LcShop/backend/form/ckeditor_widget.html.twig'
- '@LcShop/backend/form/ckfinder_widget.html.twig'
list:
max_results: 30
actions:

+ 2
- 0
ShopBundle/Resources/public/css/backend/custom.css 查看文件

@@ -101,6 +101,7 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0
.lc-sortable div:last-child{display: none;}

/* Ckfinder */
/*

.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;}
@@ -109,6 +110,7 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0
.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;}
*/

/* VUES JS */
.nav-item .btn {padding-right: 15px; position: relative;}

+ 0
- 2
ShopBundle/Resources/public/js/backend/script/default/init-list.js 查看文件

@@ -10,10 +10,8 @@ jQuery(document).ready(function () {
function initDeleteAction() {

$('.action-delete').each(function (){
log($(this));
$(this).on('click', function (e) {
e.preventDefault();
log('ncnecd')
const id = $(this).parents('tr').first().data('id');

$('#modal-delete').modal({backdrop: true, keyboard: true})

+ 185
- 178
ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js 查看文件

@@ -1,197 +1,204 @@
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 = {
data() {

+ 37
- 26
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js 查看文件

@@ -6,7 +6,10 @@ Vue.component('product-unit-price', {
mixins: [mixinUnit, mixinPrice, mixinTemplate],
props: ['template', 'keyForm'],
data() {
return Object.assign({}, window.productUnitPriceValues);
return Object.assign({
behaviorPrice:null,
activeProducts: false,
}, window.productUnitPriceValues);

},
computed: {
@@ -27,7 +30,11 @@ Vue.component('product-unit-price', {
},
unitValue: function () {
return this.unit;
},
behaviorPriceValue:function(){
return this.behaviorPrice;
}

},
mounted: function () {
this.init();
@@ -71,6 +78,14 @@ Vue.component('product-form', {
if (this.price) return this.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 () {
if (this.quantity) return this.quantity;
else return this.productFamily.quantity;
@@ -80,9 +95,11 @@ Vue.component('product-form', {
else return this.productFamily.unit;
},
propertyExpirationDateFormated: function () {

if (this.propertyExpirationDate) return getDateFormatted(this.propertyExpirationDate, '-')
else return getDateFormatted(this.productFamily.propertyExpirationDate, '-')
},
behaviorPriceValue:function(){
return this.productFamily.behaviorPrice;
}
},
data() {
@@ -120,9 +137,7 @@ Vue.component('product-form', {
mounted: function () {
//INIT VAR
updateSortableProducts();
$(this.$el).find('select').each(function (i, select) {
setSelect2($(select));
});
this.setUnitSelect2();


//METHOD
@@ -130,6 +145,11 @@ Vue.component('product-form', {
this.updateProductView();
},
methods: {
setUnitSelect2:function(){
$(this.$el).find('select').each(function (i, select) {
setSelect2($(select));
});
},
titleUpdated:function(){},
availableQuantityUpdated:function(){},
availableQuantityDefaultUpdated:function(){},
@@ -166,21 +186,7 @@ Vue.component('product-form', {
}
},
},
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: {}
});


@@ -192,8 +198,7 @@ appProductFamily = new Vue({
return {
'title': this.title,
'behaviorCountStock': this.behaviorCountStock,
'behaviorBuyingPrice': this.behaviorBuyingPrice,
'displayPriceByRefUnit': this.displayPriceByRefUnit,
'behaviorPrice': this.$refs.productUnitPrice.behaviorPrice,
'unit': this.$refs.productUnitPrice.unit,
'unitWording': this.$refs.productUnitPrice.unitWording,
'quantity': this.$refs.productUnitPrice.quantity,
@@ -215,7 +220,6 @@ appProductFamily = new Vue({
},
unitReference: function () {
this.getUnitReference();

}
},
data() {
@@ -224,13 +228,10 @@ appProductFamily = new Vue({
{
indexFormProduct: 0,
title: null,
activeProducts: false,
isNovelty: null,
isOrganic: null,
propertyExpirationDate: null,
behaviorCountStock: null,
behaviorBuyingPrice:null,
displayPriceByRefUnit: false,
typeExpirationDate: null,
behaviorExpirationDate: null,
propertyAllergens: null,
@@ -305,6 +306,16 @@ appProductFamily = new Vue({
if (typeof this.$refs.productUnitPrice !== 'undefined') {
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: {

+ 3
- 2
ShopBundle/Resources/translations/lcshop.fr.yaml 查看文件

@@ -34,6 +34,7 @@ group:
propertyMain: Caractéristiques principales
propertySecondary: Caractéristiques secondaires
note: Note interne
parameters: Paramètres
ReductionCatalog:
info: Informations principal
conditions: Condictions d'application
@@ -155,8 +156,8 @@ field:
propertyPackaging: Conditionnement
propertyWeightQuantity: Poids/quantité
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
byRefUnit: Par unité de référence
behaviorCountStockOptions:

+ 46
- 11
ShopBundle/Resources/views/backend/default/block/macros.html.twig 查看文件

@@ -1,17 +1,18 @@
{% 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>
{% if noCol == false %}</div>{% endif %}
@@ -35,4 +36,38 @@
{{ form_widget(field, {'attr' : {'v-model' : fieldName , 'v-on:focusout': fieldName~'Inherited = false', '@change' : fieldName~'Updated'}}) }}
</div>
</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 %}

+ 0
- 1
ShopBundle/Resources/views/backend/default/edit.html.twig 查看文件

@@ -45,7 +45,6 @@
{% block plugin_javascript %}
{{ parent() }}
<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 %}

{% block script_javascript %}

+ 0
- 1
ShopBundle/Resources/views/backend/default/new.html.twig 查看文件

@@ -32,7 +32,6 @@
{% block plugin_javascript %}
{{ parent() }}
<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 %}

{% block script_javascript %}

ShopBundle/Resources/views/backend/form/ckfinder_widget.html.twig → ShopBundle/Resources/views/backend/form/ckfinder_widget.html.twigTODELETE 查看文件


+ 3
- 4
ShopBundle/Resources/views/backend/productfamily/form.html.twig 查看文件

@@ -8,7 +8,7 @@
<ul class="nav nav-tabs" id="nav-params">
<li class="nav-item" v-for="section in sectionsArray">
<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 ')"
@click="changeSection(section)">
${ section.nameDisplay }
@@ -37,9 +37,6 @@
{% if form.behaviorCountStock.vars.value %}behaviorCountStock: "{{ form.behaviorCountStock.vars.value }}",{% endif %}
{% 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 %}
@@ -47,6 +44,8 @@
{% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate|date('d/m/Y') }}",{% endif %}
};
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.quantity %}quantity: parseFloat({{ formValues.quantity }}),{% endif %}
{% if formValues.taxRate %}taxRate: parseInt({{ formValues.taxRate.id }}),{% endif %}

+ 1
- 11
ShopBundle/Resources/views/backend/productfamily/panel_general.html.twig 查看文件

@@ -29,18 +29,8 @@
</div>

{{ 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">
{% for category in form.productCategories %}

+ 28
- 107
ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig 查看文件

@@ -3,7 +3,26 @@

<product-unit-price ref="productUnitPrice" inline-template key-form="productfamily">
<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">
{{ form_row(form.unit, {"attr":{'v-model': 'unit', '@change': "unitUpdated"}}) }}
</div>
@@ -39,60 +58,13 @@
{{ macros.endCard() }}

{{ 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="row">
<div class="col-6 align-content-center">
@@ -111,60 +83,9 @@
</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() }}

</div>

+ 28
- 19
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig 查看文件

@@ -36,15 +36,20 @@
{{ 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.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.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.availableQuantityDefault, 'availableQuantityDefault',false, '', 'v-show="productFamily.behaviorCountStock== \'by-product\'"') }}
{{ macros.productField(2, product.propertyExpirationDate, 'propertyExpirationDate','propertyExpirationDateFormated', '', 'v-show="productFamily.behaviorExpirationDate== \'by-product\'"') }}
@@ -78,34 +83,38 @@
<th colspan="2" class="quantity">
Unité
</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() }
</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() }
</th>

<th v-show="behaviorBuyingPrice == 'by-piece'" colspan="2" class="price">
<th colspan="2" class="price" v-show="getBehaviorPrice() =='by-piece'">
PA HT
</th>
<th v-show="behaviorBuyingPrice == 'by-piece'" colspan="2" class="price">
<th colspan="2" class="price" v-show="getBehaviorPrice() =='by-piece'">
PA TTC
</th>
<th colspan="2" class="">
Coef
</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
</th>
<th colspan="2" class="price">
PV TTC
</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'">
Stock

+ 1
- 1
ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig 查看文件

@@ -9,7 +9,7 @@
{{ form_label(form.behaviorCountStock) }}
{% for field in form.behaviorCountStock %}
{% if field.vars.value == "by-product" %}
<div v-if="activeProducts == true">
<div v-if="isProductsActice() == true">
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorCountStock'}}) }}
</div>
{% else %}

ShopBundle/Services/CustomCKFinderAuth.php → ShopBundle/Services/CustomCKFinderAuth.phpRENAME 查看文件


Loading…
取消
儲存