Procházet zdrojové kódy

correctifs tableau decli

feature/export_comptable
Fab před 4 roky
rodič
revize
3c9507ae0b
7 změnil soubory, kde provedl 546 přidání a 516 odebrání
  1. +1
    -1
      ShopBundle/Resources/public/js/backend/script/default/utils.js
  2. +0
    -23
      ShopBundle/Resources/public/js/backend/script/productfamily/init-edit.js
  3. +512
    -447
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  4. +18
    -30
      ShopBundle/Resources/views/backend/productfamily/advanced_edition.html.twig
  5. +2
    -2
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  6. +4
    -4
      ShopBundle/Resources/views/backend/productfamily/macros.html.twig
  7. +9
    -9
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig

+ 1
- 1
ShopBundle/Resources/public/js/backend/script/default/utils.js Zobrazit soubor

@@ -25,7 +25,7 @@ function getMargin(price, buyingPrice){
}

function getMarginPercent(price, buyingPrice){
return parseFloat(((price - buyingPrice) / buyingPrice) * 100).toFixed(2);
return parseFloat(((price - buyingPrice) / price) * 100).toFixed(2);
}

function applyReductionPercent(price, percentage)

+ 0
- 23
ShopBundle/Resources/public/js/backend/script/productfamily/init-edit.js Zobrazit soubor

@@ -1,23 +0,0 @@
jQuery(document).ready(function () {
initLcSortableProductsList();
});

function initLcSortableProductsList() {
if ($('.lc-sortable-products').length > 0) {
$('.lc-sortable-products tbody').sortable({
placeholder: "ui-state-highlight"
});
$('.lc-sortable-products tbody').on("sortupdate", function (event, ui) {
updateSortableProducts();
});
}
}


function updateSortableProducts() {
if ($('.lc-sortable-products').length > 0) {
$('.lc-sortable-products tr.lc-draggable').each(function (index, li) {
$(li).find('.field-position').val(index);
});
}
}

+ 512
- 447
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 18
- 30
ShopBundle/Resources/views/backend/productfamily/advanced_edition.html.twig Zobrazit soubor

@@ -12,6 +12,9 @@
};
window.appProductFamilyValues = {};
window.productUnitPriceValues = {};
window.productForm ={};
window.formProductTemplate = {};

</script>

<ul id="product-family-advanced-types-list">
@@ -81,18 +84,9 @@
</product-unit-price>



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

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

<table class="table datagrid sortable lc-sortable-products products-collection-table"
:data-index="formProductArray.length"
data-prototype="{{ product_family_macros.product_row(form.products.vars.prototype)|e('html_attr') }}">
:data-index="formProducts.length"
data-prototype="{{ product_family_macros.product_row(advancedType.products.vars.prototype)|e('html_attr') }}">
<thead>
<tr>
<th>
@@ -171,12 +165,11 @@
</thead>
<tbody class="products-collection">

<template v-for="(formProduct, key) in formProductArray">
<product-form ref="productForm" v-bind:product-family="productFamily" :template="formProduct"
:key-form="key"></product-form>
<template>
<product-form v-for="(formProduct, blop) in formProducts" v-bind:key="formProductKey[blop]"
:key-form="formProductKey[blop]" ref="productForm" v-bind:product-family="productFamily"
:template="formProduct"></product-form>
</template>

</tbody>
<tfoot>
<th>
@@ -229,7 +222,7 @@
${productFamily.priceWithTax}
</th>
<th colspan="2" class="price">
${productFamily.marginProfit}€<br />
${productFamily.marginProfit}€<br/>
${productFamily.marginProfitPercent}%
</td>

@@ -270,18 +263,17 @@

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

{{ macros.endCard() }}
</div>
{% do form.products.setRendered %}

{% do advancedType.products.setRendered %}
<script>
window.productForm = new Array();
window.formProductTemplate = new Array();
window.productForm[{{ i }}] ={};
window.formProductTemplate[{{ i }}] = {};

{% for keyForm,y in sortableProductsField[i] %}
{% set product = advancedType.products[y] %}

{% for keyForm,i in sortableProductsField %}
{% set product = form.products[i] %}

window.productForm[{{ i }}][{{ keyForm }}] = {
{% if product.vars.value.position %}position: "{{ product.vars.value.position }}",{% endif %}
{% if product.vars.value.title %}title: "{{ product.vars.value.title }}",{% endif %}
{% if product.vars.value.quantity %}quantity: "{{ product.vars.value.quantity }}",{% endif %}
{% if product.vars.value.unit %}unit: {{ product.vars.value.unit.id }},{% endif %}
@@ -294,15 +286,11 @@
{% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %}
{#{% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %}#}
};
window.formProductTemplate[{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
window.formProductTemplate[{{ i }}][{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[i][product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
{% endfor %}

</script>





{{ form_end(advancedType) }}
</div>
</li>

+ 2
- 2
ShopBundle/Resources/views/backend/productfamily/form.html.twig Zobrazit soubor

@@ -9,7 +9,7 @@
<div class="lc-vue-js-container card-header p-0 border-bottom-0">
<ul class="nav nav-tabs" id="nav-params">
<li class="nav-item" v-for="section in sectionsArray">
<button type="button"
<a :href="'#'+section.name" type="button"
v-if="(section.name == 'products' && activeProducts == true) || (section.name != 'products')"
:class="'btn '+((currentSection == section.name) ? 'btn btn-primary' : 'btn ')"
@click="changeSection(section)">
@@ -17,7 +17,7 @@
<span v-if="section.name == 'products'">({{ form.products|length }})</span>
<span class="glyphicon glyphicon-triangle-bottom"></span>
<i class="fa fa-exclamation-circle invalid-form"></i>
</button>
</a>

</li>
</ul>

+ 4
- 4
ShopBundle/Resources/views/backend/productfamily/macros.html.twig Zobrazit soubor

@@ -14,7 +14,7 @@
{% if field_display == false %}{% set field_display = field_name %}{% endif %}

<td {{ attr|raw }} colspan="{{ colspan }}" class="{{ field_name }}">
<div class="value" v-show="{{ field_name }}Inherited == false" v-on:click="setFocusOnField('{{ field_name }}Inherited', keyForm)">
<div class="value" v-show="{{ field_name }}Inherited == false" @click="setFocusOnField('{{ field_name }}Inherited', keyForm)">
<div v-if="{{ field_name }}">
{% verbatim %}{{ {% endverbatim %}{{ field_display }} {% verbatim %}}}{% endverbatim %}{{ display_suffix }}
{% if field_name == 'priceWithTax' %}
@@ -42,7 +42,7 @@
{% macro product_row(product, totalProductOrdered) %}

<tr class="lc-draggable">
<td><i class="fa fa-fw fa-sort"></i></td>
<td>{% verbatim %}{{keyForm}}{% endverbatim %}<i class="fa fa-fw fa-sort"></i></td>
{{ _self.product_field(4, product.title, 'title') }}
{{ _self.product_field(2, product.quantity, 'quantity') }}
{{ _self.product_field(2, product.unit, 'unit', 'unitWording') }}
@@ -52,7 +52,7 @@
{{ _self.product_field(3, product.buyingPriceWithTax, 'buyingPriceWithTax',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') ~ '\'"') }}

<td colspan="3" v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'">
{% verbatim %}{{ buyingPriceWithTax }}{% endverbatim %}€
{% verbatim %}{{ buyingPriceValue }}{% endverbatim %}€
</td>

{{ _self.product_field(3, product.multiplyingFactor, 'multiplyingFactor') }}
@@ -90,7 +90,7 @@

</td>
<td colspan="2">
<button type="button" class="btn-remove-product btn-sm btn-info" @click="modalProductForm()">
<button type="button" class="btn-sm btn-info" @click="modalProductForm()">
<i class="fa fa-edit"></i>
</button>
<button type="button" class="btn-remove-product btn-sm btn-danger" @click="deleteProductForm()">

+ 9
- 9
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig Zobrazit soubor

@@ -7,7 +7,7 @@
{{ macros.startCard(12, 'ProductFamily.products', 'light', true) }}

<table class="table datagrid sortable lc-sortable-products products-collection-table"
:data-index="formProductArray.length"
:data-index="formProducts.length"
data-prototype="{{ product_family_macros.product_row(form.products.vars.prototype)|e('html_attr') }}">
<thead>
<tr>
@@ -31,11 +31,11 @@
PA TTC / ${ getUnitReference() }
</th>

<th colspan="3" class="price"
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
<th colspan="3" class="price">
PA HT
</th>
<th colspan="3" class="price">
<th colspan="3" class="price"
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
PA TTC
</th>
<th colspan="3" class="">
@@ -88,8 +88,8 @@
<tbody class="products-collection">

<template>
<product-form v-for="(formProduct, blop) in formProductArray" v-bind:key="formProductKey[blop]"
:key-form="formProductKey[blop]" ref="productForm" v-bind:product-family="productFamily"
<product-form v-for="(formProduct, blop) in formProducts" v-bind:key="blop"
:key-form="blop" ref="productForm" v-bind:product-family="productFamily"
:template="formProduct"></product-form>
</template>
</tbody>
@@ -115,11 +115,11 @@
${productFamily.buyingPriceByRefUnitWithTax}
</th>

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

Načítá se…
Zrušit
Uložit