Browse Source

[Backend] Evol déclinaisons

feature/tableau_edition_avancee
Fab 4 years ago
parent
commit
aa557c9314
10 changed files with 98 additions and 33 deletions
  1. +17
    -0
      ShopBundle/Model/ProductFamily.php
  2. +1
    -0
      ShopBundle/Resources/public/css/backend/custom.css
  3. +0
    -1
      ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js
  4. +13
    -7
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  5. +1
    -1
      ShopBundle/Resources/public/sass/backend/custom.scss
  6. +1
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  7. +1
    -0
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  8. +1
    -1
      ShopBundle/Resources/views/backend/productfamily/macros.html.twig
  9. +59
    -23
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig
  10. +4
    -0
      ShopBundle/Services/ProductFamilyUtils.php

+ 17
- 0
ShopBundle/Model/ProductFamily.php View File

*/ */
protected $productsType; protected $productsType;


/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $productsQuantityAsTitle;

/** /**
* @ORM\Column(type="string", length=255, nullable=true) * @ORM\Column(type="string", length=255, nullable=true)
*/ */
return $this; return $this;
} }


public function getProductsQuantityAsTitle(): ?bool
{
return $this->productsQuantityAsTitle;
}

public function setProductsQuantityAsTitle(bool $productsQuantityAsTitle): self
{
$this->productsQuantityAsTitle = $productsQuantityAsTitle;

return $this;
}

public function getProductsType(): ?string public function getProductsType(): ?string
{ {
return $this->productsType; return $this->productsType;

+ 1
- 0
ShopBundle/Resources/public/css/backend/custom.css View File

border-top: 1px solid #dee2e6; border-top: 1px solid #dee2e6;
text-align: center; text-align: center;
border-bottom: 2px solid #dee2e6; border-bottom: 2px solid #dee2e6;
position: relative;
} }


/* line 252, ../../sass/backend/custom.scss */ /* line 252, ../../sass/backend/custom.scss */

+ 0
- 1
ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js View File

if (this.behaviorPriceValue == 'by-piece') { if (this.behaviorPriceValue == 'by-piece') {
this.setBuyingPriceByRefUnit(); this.setBuyingPriceByRefUnit();
this.setBuyingPriceByRefUnitWithTax(); this.setBuyingPriceByRefUnitWithTax();
log('ncihe');
this.setPriceByRefUnit(); this.setPriceByRefUnit();
this.setPriceByRefUnitWithTax(); this.setPriceByRefUnitWithTax();
} else if (this.behaviorPriceValue == 'by-reference-unit') { } else if (this.behaviorPriceValue == 'by-reference-unit') {

+ 13
- 7
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js View File



this.$nextTick(function () { this.$nextTick(function () {


log(this.status);
if (this.status == 0) { if (this.status == 0) {
$(this.$el).addClass('disabled'); $(this.$el).addClass('disabled');
} }
if (field == 'unitInherited') { if (field == 'unitInherited') {
$('select[data-ref="' + field + '"]').eq(y).focus(); $('select[data-ref="' + field + '"]').eq(y).focus();
} else { } else {
$('input[data-ref="' + field + '"]').eq(y).focus();
log('blop');
$('input[data-ref="' + field + '"]').eq(y).focus().select();
} }
}); });


var app = this; var app = this;
$(this.$el).find('input, select').off('keydown'); $(this.$el).find('input, select').off('keydown');
$(this.$el).find('input, select').on('keydown', function (e) { $(this.$el).find('input, select').on('keydown', function (e) {
if (e.keyCode == 13 || e.keyCode == 9) e.preventDefault();
if (e.keyCode == 13 || e.keyCode == 9 || e.keyCode ==40 || e.keyCode==38) e.preventDefault();


//ENTRER //ENTRER
if (e.keyCode == 13) { if (e.keyCode == 13) {
if (e.shiftKey && e.keyCode == 9) { if (e.shiftKey && e.keyCode == 9) {
e.preventDefault(); e.preventDefault();
$prevField = $(this).parents('td').prevAll('td:visible').first().find('input, select'); $prevField = $(this).parents('td').prevAll('td:visible').first().find('input, select');
log($prevField);
if($prevField.length == 0){ if($prevField.length == 0){
$prevField = $(this).parents('td').prevAll('td:visible').first().prevAll('td:visible').first().find('input, select'); $prevField = $(this).parents('td').prevAll('td:visible').first().prevAll('td:visible').first().find('input, select');


'supplierTaxRateValue': this.$refs.productUnitPrice.supplierTaxRateValue, 'supplierTaxRateValue': this.$refs.productUnitPrice.supplierTaxRateValue,
'marginProfit': this.$refs.productUnitPrice.marginProfit, 'marginProfit': this.$refs.productUnitPrice.marginProfit,
'marginProfitPercent': this.$refs.productUnitPrice.marginProfitPercent, 'marginProfitPercent': this.$refs.productUnitPrice.marginProfitPercent,
'productsQuantityAsTitle': this.productsQuantityAsTitle,
/*'taxRate': this.$refs.productUnitPrice.taxRate, /*'taxRate': this.$refs.productUnitPrice.taxRate,
'supplierTaxRate': this.$refs.productUnitPrice.supplierTaxRate, 'supplierTaxRate': this.$refs.productUnitPrice.supplierTaxRate,
*/ */
'supplierTaxRate': null, 'supplierTaxRate': null,
'multiplyingFactor': null, 'multiplyingFactor': null,
'taxRateValue': null, 'taxRateValue': null,
'productsQuantityAsTitle': null,
'propertyExpirationDate': this.propertyExpirationDate, 'propertyExpirationDate': this.propertyExpirationDate,
'behaviorExpirationDate': this.behaviorExpirationDate 'behaviorExpirationDate': this.behaviorExpirationDate
}; };
propertyNoveltyExpirationDateActive: false, propertyNoveltyExpirationDateActive: false,
propertyNoveltyExpirationDate:null, propertyNoveltyExpirationDate:null,
activeProducts: false, activeProducts: false,
productsQuantityAsTitle: false,
formProducts: {}, formProducts: {},
currentSection: 'general', currentSection: 'general',
sectionsArray: [ sectionsArray: [
} }
} }
}, },
emptyProductsField: function (fieldName){
if (confirm('Êtes-vous sur de cette action ?')) {
for (i = 0; i < this.$refs.productForm.length; i++) {
this.$refs.productForm[i][fieldName] = null;
}
}
},
getUnitReference: function () { getUnitReference: function () {
if (typeof this.$refs.productUnitPrice !== 'undefined') { if (typeof this.$refs.productUnitPrice !== 'undefined') {
return this.$refs.productUnitPrice.unitReference; return this.$refs.productUnitPrice.unitReference;

+ 1
- 1
ShopBundle/Resources/public/sass/backend/custom.scss View File

.card-body.p-0 .products-collection-table tbody > tr > td:first-of-type, .card-body.p-0 .products-collection-table tbody > tr > th:first-of-type, .card-body.p-0 .products-collection-table thead > tr > td:first-of-type, .card-body.p-0 .products-collection-table thead > tr > th:first-of-type{padding-left: 0.35rem;} .card-body.p-0 .products-collection-table tbody > tr > td:first-of-type, .card-body.p-0 .products-collection-table tbody > tr > th:first-of-type, .card-body.p-0 .products-collection-table thead > tr > td:first-of-type, .card-body.p-0 .products-collection-table thead > tr > th:first-of-type{padding-left: 0.35rem;}
.products-collection-table .btn-empty-field{position: absolute; right: 3px; font-size: 0.7rem; top: 5px; padding: 0px;} .products-collection-table .btn-empty-field{position: absolute; right: 3px; font-size: 0.7rem; top: 5px; padding: 0px;}
#lc-product-family-edit .products-collection-table {table-layout:fixed;/* background-clip: padding-box;*/ border-collapse: collapse;} #lc-product-family-edit .products-collection-table {table-layout:fixed;/* background-clip: padding-box;*/ border-collapse: collapse;}
#lc-product-family-edit .products-collection-table th{font-size:13px; border-left: 1px solid #dee2e6; border-top: 1px solid #dee2e6; text-align: center; border-bottom: 2px solid #dee2e6;}
#lc-product-family-edit .products-collection-table th{font-size:13px; border-left: 1px solid #dee2e6; border-top: 1px solid #dee2e6; text-align: center; border-bottom: 2px solid #dee2e6; position: relative;}
#lc-product-family-edit .products-collection-table tfoot th{border-top: 2px solid #dee2e6;} #lc-product-family-edit .products-collection-table tfoot th{border-top: 2px solid #dee2e6;}
#lc-product-family-edit .products-collection-table th span {white-space: initial;} #lc-product-family-edit .products-collection-table th span {white-space: initial;}
#lc-product-family-edit .products-collection-table th:last-child{border-right: 1px solid #dee2e6;} #lc-product-family-edit .products-collection-table th:last-child{border-right: 1px solid #dee2e6;}

+ 1
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml View File

propertyAlcoholLevel: Degré d'alcool propertyAlcoholLevel: Degré d'alcool
displayPriceUnitRef: Afficher le prix par unité de référence displayPriceUnitRef: Afficher le prix par unité de référence
behaviorPrice: Travailler avec des tarifs behaviorPrice: Travailler avec des tarifs
productsQuantityAsTitle: Titre équivalent à quantité
behaviorPriceOptions: behaviorPriceOptions:
by-piece: À la pièce by-piece: À la pièce
by-reference-unit: Par unité de référence by-reference-unit: Par unité de référence

+ 1
- 0
ShopBundle/Resources/views/backend/productfamily/form.html.twig View File

{% if formValues.behaviorExpirationDate %}behaviorExpirationDate: "{{ formValues.behaviorExpirationDate }}",{% endif %} {% if formValues.behaviorExpirationDate %}behaviorExpirationDate: "{{ formValues.behaviorExpirationDate }}",{% endif %}
{% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate }}",{% endif %} {% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate }}",{% endif %}
{% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %} {% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %}
{% if formValues.productsQuantityAsTitle %}productsQuantityAsTitle: {{ formValues.productsQuantityAsTitle }},{% endif %}


}; };
multiplyingFactor = "{{ form.multiplyingFactor.vars.value }}" multiplyingFactor = "{{ form.multiplyingFactor.vars.value }}"

+ 1
- 1
ShopBundle/Resources/views/backend/productfamily/macros.html.twig View File

#new #new
{% endif %} <br/> {% endif %} <br/>
{% verbatim %}{{keyForm}}{% endverbatim %}<i class="fa fa-fw fa-sort"></i></td> {% verbatim %}{{keyForm}}{% endverbatim %}<i class="fa fa-fw fa-sort"></i></td>
{{ _self.product_field(4, product.title, 'title') }}
{{ _self.product_field(4, product.title, 'title', false, "",'v-show="productFamily.productsQuantityAsTitle == false"' ) }}
{{ _self.product_field(2, product.quantity, 'quantity') }} {{ _self.product_field(2, product.quantity, 'quantity') }}
{{ _self.product_field(2, product.unit, 'unit', 'unitWording') }} {{ _self.product_field(2, product.unit, 'unit', 'unitWording') }}
{{ _self.product_field(3, product.buyingPriceByRefUnit, 'buyingPriceByRefUnit',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }} {{ _self.product_field(3, product.buyingPriceByRefUnit, 'buyingPriceByRefUnit',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}

+ 59
- 23
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig View File

{% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %} {% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %}
{% trans_default_domain 'lcshop' %} {% trans_default_domain 'lcshop' %}


{#{% import _self as formMacros %}#}
{# {% import _self as formMacros %} #}
<div class="row"> <div class="row">
{{ macros.startCard(12, 'ProductFamily.products', 'light', true) }} {{ macros.startCard(12, 'ProductFamily.products', 'light', true) }}


<tr> <tr>
<th> <th>
</th> </th>
<th colspan="4" class="string">
<th colspan="4" class="string" v-show="productsQuantityAsTitle == false">
Titre Titre
<button v-on:click="emptyProductsField('title');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th colspan="2" class="string "> <th colspan="2" class="string ">
Quantité Quantité
<button v-on:click="emptyProductsField('quantity');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th colspan="2" class="quantity"> <th colspan="2" class="quantity">
Unité Unité
<button v-on:click="emptyProductsField('unit');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="buyingPriceByRefUnit "> colspan="3" class="buyingPriceByRefUnit ">
PA HT / ${ getUnitReference() } PA HT / ${ getUnitReference() }
<button v-on:click="emptyProductsField('buyingPriceByRefUnit');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="priceByRefUnit"> colspan="3" class="priceByRefUnit">
PA TTC / ${ getUnitReference() } PA TTC / ${ getUnitReference() }
<button v-on:click="emptyProductsField('buyingPriceByRefUnitWithTax');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>


<th colspan="3" class="price main-info"> <th colspan="3" class="price main-info">
PA HT PA HT
<button v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'" v-on:click="emptyProductsField('buyingPrice');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th colspan="3" class="price" <th colspan="3" class="price"
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
PA TTC PA TTC
<button v-on:click="emptyProductsField('buyingPriceWithTax');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th colspan="3" class="main-info"> <th colspan="3" class="main-info">
Coef Coef
<button v-on:click="emptyProductsField('multiplyingFactor');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>




<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class=""> colspan="3" class="">
PV HT / ${ getUnitReference() } PV HT / ${ getUnitReference() }
<button v-on:click="emptyProductsField('priceByRefUnit');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="price"> colspan="3" class="price">
PV TTC / ${ getUnitReference() } PV TTC / ${ getUnitReference() }
<button v-on:click="emptyProductsField('priceByRefUnitWithTax');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>


<th colspan="3" class="price"> <th colspan="3" class="price">
{# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">#}
{# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> #}
PV HT PV HT
<button v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'" v-on:click="emptyProductsField('price');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th colspan="3" class="price main-info"> <th colspan="3" class="price main-info">
PV TTC PV TTC
<button v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'" v-on:click="emptyProductsField('priceWithTax');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th colspan="2"> <th colspan="2">
Marge HT Marge HT
<th colspan="2" class="" <th colspan="2" class=""
v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'"> v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
<span style="text-transform: uppercase"> ${typeExpirationDate}</span> <span style="text-transform: uppercase"> ${typeExpirationDate}</span>
<button v-on:click="emptyProductsField('propertyExpirationDate');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th colspan="2" <th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'"> v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
Stock Stock
<button v-on:click="emptyProductsField('availableQuantity');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th colspan="2" <th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'"> v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
Stock par défaut Stock par défaut
<button v-on:click="emptyProductsField('availableQuantityDefault');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th> </th>
<th colspan="2" <th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'"> v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'">
<th> <th>
Rappel Rappel
</th> </th>
<th colspan="4" class="string">
<th colspan="4" class="string" v-show="productsQuantityAsTitle == false">
${title} ${title}

</th> </th>
<th colspan="2" class="string "> <th colspan="2" class="string ">
${productFamily.quantity} ${productFamily.quantity}
</th> </th>


<th colspan="3" class="price"> <th colspan="3" class="price">
{# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">#}
{# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> #}
${productFamily.price} ${productFamily.price}
</th> </th>
<th colspan="3" class="price main-info"> <th colspan="3" class="price main-info">
</tfoot> </tfoot>
</table> </table>


<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span
class="fa fa-plus"></span> Ajouter une déclinaison
</button>
<p>
<strong>Aide à l'utilisation - Raccourci clavier</strong>
<ul>
<li><strong>TAB</strong> : Champ suivant</li>
<li><strong>SHIFT + TAB</strong> : Champ précédent</li>
<li><strong>FLÈCHE BAS</strong> : Déclinaison suivante</li>
<li><strong>FLÈCHE HAUT</strong> : Déclinaison précédente</li>
<li><strong>SHIFT + [+]</strong> : Ajout d'une nouvelle déclinaison</li>
</ul>
</p>

<div class="clearfix"></div>

<div class="col-12">
<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span
class="fa fa-plus"></span> Ajouter une déclinaison
</button>

{{ form_row(form.productsQuantityAsTitle, {"attr":{'v-model' : 'productsQuantityAsTitle'}}) }}
<p>
<strong>Aide à l'utilisation - Raccourci clavier</strong>
<ul>
<li><strong>TAB</strong> : Champ suivant</li>
<li><strong>SHIFT + TAB</strong> : Champ précédent</li>
<li><strong>FLÈCHE BAS</strong> : Déclinaison suivante</li>
<li><strong>FLÈCHE HAUT</strong> : Déclinaison précédente</li>
<li><strong>SHIFT + [+]</strong> : Ajout d'une nouvelle déclinaison</li>
</ul>
</p>
</div>

<div class="clearfix"></div>


{{ macros.endCard() }} {{ macros.endCard() }}
</div> </div>
{% for keyForm,i in sortableProductsField %} {% for keyForm,i in sortableProductsField %}
{% set product = form.products[i] %} {% set product = form.products[i] %}


{#{% if product.vars.value.status >= 0 and (product.vars.value.originProduct is null or product.vars.value.originProduct == false) %}#}
{# {% if product.vars.value.status >= 0 and (product.vars.value.originProduct is null or product.vars.value.originProduct == false) %} #}
window.productForm[{{ keyForm }}] = { window.productForm[{{ keyForm }}] = {
{% if product.vars.value.originProduct is defined %}originProduct: parseInt({{ product.vars.value.originProduct }}),{% endif %} {% if product.vars.value.originProduct is defined %}originProduct: parseInt({{ product.vars.value.originProduct }}),{% endif %}
{% if product.vars.value.status is defined %}status: parseInt({{ product.vars.value.status }}),{% endif %} {% if product.vars.value.status is defined %}status: parseInt({{ product.vars.value.status }}),{% endif %}
{% if product.vars.value.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %} {% if product.vars.value.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %}
{% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %} {% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %}
{% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %} {% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %}
{#{% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %}#}
{# {% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %} #}
}; };
window.formProductTemplate[{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}'; window.formProductTemplate[{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
{#{% endif %}#}
{# {% endif %} #}
{% endfor %} {% endfor %}


</script> </script>

+ 4
- 0
ShopBundle/Services/ProductFamilyUtils.php View File

$entity->addProduct($originProduct); $entity->addProduct($originProduct);


foreach ($entity->getProducts() as $product) { foreach ($entity->getProducts() as $product) {
if($entity->getProductsQuantityAsTitle() && $product->getStatus()>=1){
$product->setTitle($product->getQuantityInherited().$product->getUnitInherited()->getWording());
}

$product->setProductFamily($entity); $product->setProductFamily($entity);
$this->em->persist($product); $this->em->persist($product);
$entity->addProduct($product); $entity->addProduct($product);

Loading…
Cancel
Save