Guillaume 4 years ago
parent
commit
00b9689df0
24 changed files with 528 additions and 355 deletions
  1. +7
    -0
      ShopBundle/Resources/public/css/backend/adminlte/plugins/jquery-ui/jquery-ui.min.css
  2. +4
    -1
      ShopBundle/Resources/public/css/backend/custom.css
  3. +0
    -1
      ShopBundle/Resources/public/js/backend/plugin/bootstrap.bundle.min.js.map
  4. +0
    -0
      ShopBundle/Resources/public/js/backend/plugin/bootstrap/bootstrap.bundle.min.js
  5. +1
    -0
      ShopBundle/Resources/public/js/backend/plugin/bootstrap/bootstrap.bundle.min.js.map
  6. +13
    -0
      ShopBundle/Resources/public/js/backend/plugin/jquery-ui/jquery-ui.min.js
  7. +0
    -0
      ShopBundle/Resources/public/js/backend/plugin/jquery/jquery.min.js
  8. +5
    -5
      ShopBundle/Resources/public/js/backend/script/custom.js
  9. +58
    -34
      ShopBundle/Resources/translations/lcshop.fr.yaml
  10. +17
    -0
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  11. +10
    -4
      ShopBundle/Resources/views/backend/default/edit.html.twig
  12. +5
    -2
      ShopBundle/Resources/views/backend/default/layout.html.twig
  13. +2
    -6
      ShopBundle/Resources/views/backend/default/list.html.twig
  14. +10
    -2
      ShopBundle/Resources/views/backend/default/new.html.twig
  15. +1
    -1
      ShopBundle/Resources/views/backend/form/ckfinder_widget.html.twig
  16. +26
    -39
      ShopBundle/Resources/views/backend/form/custom_bootstrap_4.html.twig
  17. +4
    -2
      ShopBundle/Resources/views/backend/order/panel_addresses.html.twig
  18. +35
    -19
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  19. +24
    -14
      ShopBundle/Resources/views/backend/productfamily/panel_general.html.twig
  20. +108
    -89
      ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig
  21. +94
    -86
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig
  22. +15
    -13
      ShopBundle/Resources/views/backend/productfamily/panel_property.html.twig
  23. +42
    -37
      ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig
  24. +47
    -0
      ShopBundle/Twig/BackendTwigExtension.php

+ 7
- 0
ShopBundle/Resources/public/css/backend/adminlte/plugins/jquery-ui/jquery-ui.min.css
File diff suppressed because it is too large
View File


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

@@ -14,7 +14,10 @@ table th.sorting_asc, table th.sorting_desc{border-top:3px solid var(--success);
table th.filtered{border-top:3px solid var(--primary);}

td.actions{white-space: nowrap;}
/* Général */


/* Général */
.btn.btn-primary.action-save{float: right;}

.input-group-text {
padding: 0.250rem .75rem ;

+ 0
- 1
ShopBundle/Resources/public/js/backend/plugin/bootstrap.bundle.min.js.map
File diff suppressed because it is too large
View File


ShopBundle/Resources/public/js/backend/plugin/bootstrap.bundle.min.js → ShopBundle/Resources/public/js/backend/plugin/bootstrap/bootstrap.bundle.min.js View File


+ 1
- 0
ShopBundle/Resources/public/js/backend/plugin/bootstrap/bootstrap.bundle.min.js.map
File diff suppressed because it is too large
View File


+ 13
- 0
ShopBundle/Resources/public/js/backend/plugin/jquery-ui/jquery-ui.min.js
File diff suppressed because it is too large
View File


ShopBundle/Resources/public/js/backend/plugin/jquery.min.js → ShopBundle/Resources/public/js/backend/plugin/jquery/jquery.min.js View File


+ 5
- 5
ShopBundle/Resources/public/js/backend/script/custom.js View File

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

initAdminLtePlugin();

// generateNotice('success', '<i class="fa fa-store"></i> NICHE');
//generateNotice('error', 'Ceci est une notice');

});

@@ -21,9 +21,9 @@ function initLcNoty() {
function initAdminLtePlugin(){
$('[data-toggle="tooltip"]').tooltip()

if($('.select2').length) {
$('.select2').select2({
/*theme: 'bootstrap4'*/
/*if($('.select2, select.form-control').length) {
$('.select2,select.form-control').select2({
//theme: 'bootstrap'
})
}
if($('.select2-no-search').length) {
@@ -31,7 +31,7 @@ function initAdminLtePlugin(){
minimumResultsForSearch: Infinity
});
}
*/




+ 58
- 34
ShopBundle/Resources/translations/lcshop.fr.yaml View File

@@ -8,42 +8,66 @@ list:
product:
title: Titre
titleHelp: Un message d'aide
form:
group:

group:
main: Général
address: Adresse
default: Édition
ProductFamily:
addresses: Livraisons & facturation
main: Général
products: Déclinaisons
price: Prix
categories: Catégories
unit: Unité & quantité
tax: TVA
property: Caractéristiques
field:
default:
id: Id
status: En ligne
supplier: Producteur
title: Titre
titleHelp: Ceci est une texte d'aide, utilises <i>le nom du champ</i>Help pour en ajouter un
subtitle: Sous-titre
kmsHub: Nombre de kilomètres depuis le dépôt
image: Image
description: Description
type: Type
civility: Civilité
lastname: Nom
firstname: Prénom
country: Pays
address: Adresse
field:
default:
supplier: Producteur
title: Titre
subtitle: Sous-titre
kmsHub: Nombre de kilomètres depuis le dépôt
image: Image
description: Description
type: Type
civility: Civilité
lastname: Nom
firstname: Prénom
country: Pays
address: Adresse
zip: Code postal
city: Ville
phone: Téléphone
company: Société
siret: N° SIRET
tva: N° TVA
price: Prix de vente
ProductFamily:
productsType: Type de déclinaisons
buyingPrice: Prix d'achat
multiplyingFactor: Coefficiant multiplicateur
priceByRefUnit: Prix de vente / unité de référence
availableQuantity: Quantité disponible
availableQuantityDefault: Quantité disponible par défaut
quantity: Quantité disponible cette semaine
behaviorCountStock: Gestion du stock
taxRate: TVA
unit: Unité
zip: Code postal
city: Ville
phone: Téléphone
company: Société
siret: N° SIRET
tva: N° TVA
price: Prix de vente
username: Nom d'utilisateur
email: E-mail
plainPassword: Mot de passe
roles: Rôle attribué
addresses: Adresses
enabled: Activé
isSubscribedNewsletter: Inscris à la newsletter
zips: Codes postaux
cities: Villes
orderPriceMin: Montant minimum de commande
deliveryPrice: Montant de la livraison
ProductFamily:
productsType: Type de déclinaisons
buyingPrice: Prix d'achat
multiplyingFactor: Coefficiant multiplicateur
priceByRefUnit: Prix de vente / unité de référence
availableQuantity: Quantité disponible
availableQuantityDefault: Quantité disponible par défaut
quantity: Quantité disponible cette semaine
behaviorCountStock: Gestion du stock
taxRate: TVA
unit: Unité
action:
new: Créer %entity_label%
switchMerchant: Votre hub

+ 17
- 0
ShopBundle/Resources/views/backend/default/block/macros.html.twig View File

@@ -0,0 +1,17 @@
{% macro startCard(col, zone = "default") %}
<div class="col-{{ col }}">
<div class="card card-primary">
<div class="card-header">
<h3 class="card-title">
{% set label = "group."~zone %}
{{ label|trans({}, 'lcshop')|raw }}
</h3>
</div>
<div class="card-body">
{% endmacro %}

{% macro endCard() %}
</div>
</div>
</div>
{% endmacro %}

+ 10
- 4
ShopBundle/Resources/views/backend/default/edit.html.twig View File

@@ -37,10 +37,18 @@
{% endblock delete_form %}
{% endblock %}

{% block head_stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/jquery-ui/jquery-ui.min.css') }}">
{% endblock %}

{% block body_javascript %}
{{ parent() }}

<script type="text/javascript">
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery-ui/jquery-ui.min.js') }}"></script>


{#<script type="text/javascript">
$(function() {
$('.edit-form').areYouSure({ 'message': '{{ 'form.are_you_sure'|trans({}, 'EasyAdminBundle')|e('js') }}' });

@@ -123,7 +131,5 @@
});
});
});
</script>

{{ include('@EasyAdmin/default/includes/_select2_widget.html.twig') }}
</script>#}
{% endblock %}

+ 5
- 2
ShopBundle/Resources/views/backend/default/layout.html.twig View File

@@ -204,10 +204,11 @@

{% block body_javascript %}
<!-- jQuery -->
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery/jquery.min.js') }}"></script>
<!-- Bootstrap 4 -->
<script src="{{ asset('bundles/lcshop/js/backend/plugin/bootstrap.bundle.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/bootstrap/bootstrap.bundle.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/toastr/toastr.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/select2/select2.min.js') }}"></script>
<!-- AdminLTE App -->
<script src="{{ asset('bundles/lcshop/js/backend/plugin/adminlte.min.js') }}"></script>

@@ -219,6 +220,8 @@
{% endfor %}
{% endblock body_custom_javascript %}



</body>
{% endblock body %}
</html>

+ 2
- 6
ShopBundle/Resources/views/backend/default/list.html.twig View File

@@ -113,7 +113,6 @@
{% for field, metadata in _fields_visible_by_user %}
{% set isSortingField = (metadata.property == app.request.get('sortField')) or ('association' == metadata.type and app.request.get('sortField') starts with metadata.property ~ '.') %}
{% set nextSortDirection = isSortingField ? (app.request.get('sortDirection') == 'DESC' ? 'ASC' : 'DESC') : 'DESC' %}
{% set _column_label = metadata.label|trans(_trans_parameters) %}
{% set _column_icon = isSortingField ? (nextSortDirection == 'DESC' ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %}

{% set searchable = ''%}
@@ -130,11 +129,9 @@
{#<th class="{{ isSortingField ? 'sorted' }} {{ metadata.virtual ? 'virtual' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" >#}
<th data-searchable="{{ searchable }}" >
{% if metadata.sortable %}
{#<a href="{{ path('easyadmin', _request_parameters|merge({ page: 1, sortField: metadata.property, sortDirection: nextSortDirection })) }}">#}
{{ _column_label|raw }} {#<i class="fa fa-fw {{ _column_icon }}"></i>#}
{#</a>#}
{{ metadata.fieldName|lc_trad(_entity_config['name']) }}
{% else %}
<span>{{ _column_label|raw }}</span>
<span>{{ metadata.fieldName|lc_trad(_entity_config['name']) }}</span>
{% endif %}
</th>
{% endfor %}
@@ -254,6 +251,5 @@
<script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/responsive.bootstrap4.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/dataTables.fixedHeader.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/bootstrap/bootstrap-switch.min.js') }}"></script>
<script src="{{ asset('bundles/lcshop/js/backend/plugin/select2/select2.min.js') }}"></script>

{% endblock %}

+ 10
- 2
ShopBundle/Resources/views/backend/default/new.html.twig View File

@@ -24,9 +24,17 @@
{% endblock entity_form %}
{% endblock %}

{% block head_stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/jquery-ui/jquery-ui.min.css') }}">
{% endblock %}

{% block body_javascript %}
{{ parent() }}

<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery-ui/jquery-ui.min.js') }}"></script>

{#
<script type="text/javascript">
$(function() {
$('.new-form').areYouSure({ 'message': '{{ 'form.are_you_sure'|trans({}, 'EasyAdminBundle')|e('js') }}' });
@@ -112,6 +120,6 @@
}, false);
});
</script>
{{ include('@EasyAdmin/default/includes/_select2_widget.html.twig') }}
#}
{#{{ include('@EasyAdmin/default/includes/_select2_widget.html.twig') }}#}
{% endblock %}

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

@@ -8,6 +8,6 @@
<i class="fa fa-fw fa-image"></i>
</div>
<input class="lc-ckfinder-field" type="hidden" name="{{ full_name }}" value="{{ value }}" />
<button type="button" id="{{ button_id }}" class="btn btn-primary lc-ckfinder-button" {% for attrname, attrvalue in button_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ 'action.choiceFile'|trans({}, 'lcshop') }}</button>
<button type="button" id="{{ button_id }}" class="btn btn-secondary lc-ckfinder-button" {% for attrname, attrvalue in button_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ 'action.choiceFile'|trans({}, 'lcshop') }}</button>
</div>
{% endblock %}

+ 26
- 39
ShopBundle/Resources/views/backend/form/custom_bootstrap_4.html.twig View File

@@ -48,8 +48,11 @@
</div>
{% endif %}#}

{% if easyadmin.field.help|default(form.vars.help) != '' %}
<small class="form-help">{{ easyadmin.field.help|default(form.vars.help)|trans(domain = form.vars.translation_domain)|raw }}</small>
{% set labelHelp = 'form.field.'~easyadmin['entity']['name']~'.'~name~'Help' %}
{% if labelHelp|trans({}, 'lcshop') == labelHelp %}{% set labelHelp = 'form.field.default.'~name~'Help' %}{% endif %}

{% if labelHelp|trans({}, 'lcshop') != labelHelp %}
<small class="form-text text-muted">{{ labelHelp|trans({}, 'lcshop')|raw }}</small>
{% endif %}

{{- form_errors(form) -}}
@@ -60,42 +63,26 @@


{% block easyadmin_widget_groups %}
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
{% for group_name, group_config in easyadmin_form_groups|filter(group_config => not group_config.form_tab or group_config.form_tab == tab_name) %}
<div class="field-group col-{{ group_config.columns|default('12') }} {{ group_config.css_class|default('') }}">
<div class="card card-primary">
{% if group_config.label|default(false) or group_config.icon|default(false) or group_config.collapsible|default(false) %}
<div class="card-header {{ group_config.icon|default(false) ? 'with-icon' }}">
<h3 class="card-title">
{% if group_config.icon|default(false) %}
<i class="fa fa-fw fa-{{ group_config.icon }}"></i>
{% endif %}
{% set label = 'form.group.'~group_config.label %}
{{ label|trans(domain = _translation_domain)|raw }}
</h3>
{{ macros.startCard(group_config.columns|default('12'), group_config.label, 'primary') }}
{% for field in form|filter(field => 'hidden' not in field.vars.block_prefixes and field.vars.easyadmin.form_group == group_name) %}
{% if not field.vars.easyadmin.form_tab or field.vars.easyadmin.form_tab == tab_name %}
<div class="col-{{ field.vars.easyadmin.field.columns|default('12') }} {{ field.vars.easyadmin.field.css_class|default('') }}">
{{ form_row(field) }}
</div>

{% if group_config.help|default(false) %}
<div class="legend-help">{{ group_config.help|trans(domain = _translation_domain)|raw }}</div>
{% endif %}
{% endif %}
{% endfor %}
{{ macros.endCard() }}
{% else %}

<div class="card-body">
{% for field in form|filter(field => 'hidden' not in field.vars.block_prefixes and field.vars.easyadmin.form_group == group_name) %}
{% if not field.vars.easyadmin.form_tab or field.vars.easyadmin.form_tab == tab_name %}
<div class="col-{{ field.vars.easyadmin.field.columns|default('12') }} {{ field.vars.easyadmin.field.css_class|default('') }}">
{{ form_row(field) }}
</div>
{% endif %}
{% endfor %}
{{ macros.startCard(8) }}
{% for field in form|filter(field => 'hidden' not in field.vars.block_prefixes and (not field.vars.easyadmin.form_tab or field.vars.easyadmin.form_tab == tab_name)) %}
<div class="col-{{ field.vars.easyadmin.field.columns|default('12') }} {{ field.vars.easyadmin.field.css_class|default('') }}">
{{ form_row(field) }}
</div>
</div>
</div>
{% else %}
{% for field in form|filter(field => 'hidden' not in field.vars.block_prefixes and (not field.vars.easyadmin.form_tab or field.vars.easyadmin.form_tab == tab_name)) %}
<div class="col-{{ field.vars.easyadmin.field.columns|default('12') }} {{ field.vars.easyadmin.field.css_class|default('') }}">
{{ form_row(field) }}
</div>
{% endfor %}
{% endfor %}
{{ macros.endCard() }}
{% endfor %}
{% endblock easyadmin_widget_groups %}

@@ -111,18 +98,18 @@
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %}
{%- endif -%}

{%- if label_format is not empty -%}
{# {%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- else -%}
{{ name|lc_trad(easyadmin['entity']['name'], 'form') }}
{% set label = 'form.field.'~easyadmin['entity']['name']~'.'~name %}
{% if label|trans({}, 'lcshop') == label %}
{% set label = 'form.field.default.'~name %}
{% endif %}
{%- endif -%}
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ label|trans({}, 'lcshop') }}</{{ element|default('label') }}>
{% if label|trans({}, 'lcshop') == label %}{% set label = 'form.field.default.'~name %}{% endif %}
{%- endif -%}#}

<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ name|lc_trad(easyadmin['entity']['name'], 'field') }}</{{ element|default('label') }}>

{%- endif -%}
{%- endblock form_label %}

+ 4
- 2
ShopBundle/Resources/views/backend/order/panel_addresses.html.twig View File

@@ -1,7 +1,9 @@
<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Livraisons & facturation</legend>
<div class="card card-primary">
<div class="card-header">
<h3>{{ "form.group.ProductFamily.addresses"|trans }}</h3>
</div>
<div class="row" >

<div class="col">

+ 35
- 19
ShopBundle/Resources/views/backend/productfamily/form.html.twig View File

@@ -1,17 +1,23 @@
{{ form_start(form, {"attr": {'@change' : 'formUpdated'}}) }}

<div class="lc-vue-js-container" id="lc-product-family-edit">
<div id="nav-params">
<button type="button" v-for="section in sectionsArray"
v-if="(section.name == 'products' && activeProducts == true) || (section.name != 'products')"
:class="'btn '+((currentSection == section.name) ? 'btn-primary' : 'btn-default')"
@click="changeSection(section)">
${ section.nameDisplay }
<span v-if="section.name == 'products'">({{ form.products|length }})</span>
<span class="glyphicon glyphicon-triangle-bottom"></span>
</button>
<div id="lc-product-family-edit">
<div class="card card-light">
<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"
v-if="(section.name == 'products' && activeProducts == true) || (section.name != 'products')"
:class="'btn '+((currentSection == section.name) ? 'btn btn-primary' : 'btn ')"
@click="changeSection(section)">
${ section.nameDisplay }
<span v-if="section.name == 'products'">({{ form.products|length }})</span>
<span class="glyphicon glyphicon-triangle-bottom"></span>
</button>
</li>
</ul>
</div>
</div>
<div class="form">
<div class="form ">

<script>// rendered by server
window.mixinUnitValues = {
@@ -59,24 +65,34 @@
<div v-show="currentSection == 'note'" class="panel panel-default">
<div class="row" id="lc-app-unit">
<div class="field-group col-12">
<fieldset>
<legend>Note interne</legend>
{{ form_row(form.note) }}
</fieldset>
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.note"|trans }}</h3>
</div>
<div class="card-body">
{{ form_row(form.note) }}
</div>
</div>

</div>
</div>
</div>
<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Note interne</legend>
{{ entity.note|raw }}
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.note"|trans }}</h3>
</div>
<div class="card-body">
{{ entity.note|raw }}
</div>

</fieldset>
</div>
</div>
</div>

</div>

</div>
{{ form_end(form) }}


+ 24
- 14
ShopBundle/Resources/views/backend/productfamily/panel_general.html.twig View File

@@ -1,8 +1,11 @@
{% trans_default_domain 'lcshop' %}
<div class="row">
<div class="field-group col-8">
<fieldset>
<legend>Général</legend>
<div class="row">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.main"|trans }}</h3>
</div>
<div class="card-body row">
<div class="col-12">
{{ form_row(form.supplier) }}
</div>
@@ -19,21 +22,28 @@
{{ form_row(form.description) }}
</div>
</div>
</fieldset>
</div>
</div>
<div class="field-group col-4" id="product-categories">
<fieldset>
<legend>Déclinaisons</legend>
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.products"|trans }}</h3>
</div>
<div class="card-body">
{{ form_row(form.activeProducts, {"attr": {"v-model": 'activeProducts'}}) }}

{{ form_row(form.activeProducts, {"attr": {"v-model": 'activeProducts'}}) }}
<div v-show="activeProducts == true">
{{ form_row(form.productsType) }}
</div>
</div>
</div>

<div v-show="activeProducts == true">
{{ form_row(form.productsType) }}
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.categories"|trans }}</h3>
</div>
</fieldset>
<fieldset>
<legend>Catégories</legend>
<div class="row">

<div class="card-body">
{% for category in categories %}
{% set child = 'category_' ~ category.id %}
{{ form_row(attribute(form.productCategories, child)) }}
@@ -46,6 +56,6 @@
{% endfor %}
{% endfor %}
</div>
</fieldset>
</div>
</div>
</div>

+ 108
- 89
ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig View File

@@ -1,126 +1,145 @@
{% trans_default_domain 'lcshop' %}

<product-unit-price ref="productUnitPrice" inline-template key-form="productfamily">
<div class="row">
<div class="field-group col-8">
<fieldset>
<legend>Prix</legend>

<div class="form-group field-price">
<div class=" field-group col-4">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.unit"|trans }}</h3>
</div>
<div class="card-body row">
<div class="col-12">
{{ form_label(form.buyingPrice) }}
</div>
<div class="col-6">
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.buyingPrice, {'attr' : {'v-model': 'buyingPrice', '@change' : 'changeBuyingPriceWithTax'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ HT {#${ unitReference }#}</span>
</div>
</div>
</div>
{{ form_row(form.unit, {"attr":{'v-model': 'unit', '@change': "priceByRefUnitUpdate"}}) }}
</div>
<div class="col-6">
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.buyingPriceWithTax, {'attr' : {'v-model': 'buyingPriceWithTax', '@change' : 'changeBuyingPrice'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ TTC</span>

<div class="col-12">
<div class="form-group field-weight">
{{ form_label(form.quantity) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.quantity, {'attr' : {'v-model': 'quantity', '@change': "priceByRefUnitUpdate"}}) }}
<div class="input-group-append">
<span class="input-group-text">${ unit }</span>
</div>
</div>
{{ form_help(form.quantity) }}
</div>
</div>
</div>
</div>
<div class="col-10 align-content-center">
{{ form_row(form.multiplyingFactor, {'attr': {'v-model':'multiplyingFactor', '@change' : 'updateMultiplyingFactor'}}) }}
</div>

</div>
</div>

<div class="form-group field-price">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.tax"|trans }}</h3>
</div>
<div class="card-body row">
<div class="col-12">
{{ form_label(form.price) }}
{{ form_row(form.taxRate, {'attr': {'v-model':'taxRate'}}) }}
</div>
<div class="col-6">
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.price, {'attr' : {'v-model': 'price', '@change' : 'changePriceWithTax'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ HT</span>
<div class="col-12">
{{ form_row(form.differentSupplierTaxRate, {'attr': {'v-model':'differentSupplierTaxRate'}}) }}
</div>
<div class="col-12" v-show="differentSupplierTaxRate == true">
{{ form_row(form.supplierTaxRate, {'attr': {'v-model':'supplierTaxRate'}}) }}
</div>
</div>
</div>


</div>

<div class="field-group col-8">
<div class="card card-light ">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.price"|trans }}</h3>
</div>
<div class="card-body">

<div class="form-group field-price row">
<div class="col-12">
{{ form_label(form.buyingPrice) }}
</div>
<div class="col-6">
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.buyingPrice, {'attr' : {'v-model': 'buyingPrice', '@change' : 'changeBuyingPriceWithTax'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ HT {#${ unitReference }#}</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="input-group">
{{ form_widget(form.priceWithTax, {'attr' : {'v-model': 'priceWithTax', '@change' : 'changePrice'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ TTC</span>
<div class="col-6">
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.buyingPriceWithTax, {'attr' : {'v-model': 'buyingPriceWithTax', '@change' : 'changeBuyingPrice'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ TTC</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-10 align-content-center">
{{ form_row(form.multiplyingFactor, {'attr': {'v-model':'multiplyingFactor', '@change' : 'updateMultiplyingFactor'}}) }}
</div>
</div>


<div class="form-group field-price" v-show="unit != 'piece'">
<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', 'readonly':'readonly'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ HT / ${ unitReference }</span>
<div class="form-group field-price 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' : 'changePriceWithTax'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ HT</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="input-group">
{{ form_widget(form.priceByRefUnitWithTax, {'attr' : {'v-model': 'priceByRefUnitWithTax','readonly':'readonly'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ TTC / ${ unitReference }</span>
<div class="col-6">
<div class="input-group">
{{ form_widget(form.priceWithTax, {'attr' : {'v-model': 'priceWithTax', '@change' : 'changePrice'}}) }}
<div class="input-group-append">
<span class="input-group-text">€ TTC</span>
</div>
</div>
</div>
</div>
</div>

</fieldset>
</div>

<div class="field-group col-4">
<fieldset>
<legend>TVA</legend>
<div class="col-12">
{{ form_row(form.taxRate, {'attr': {'v-model':'taxRate'}}) }}
</div>
<div class="col-12">
{{ form_row(form.differentSupplierTaxRate, {'attr': {'v-model':'differentSupplierTaxRate'}}) }}
</div>
<div class="col-12" v-show="differentSupplierTaxRate == true">
{{ form_row(form.supplierTaxRate, {'attr': {'v-model':'supplierTaxRate'}}) }}
</div>
</fieldset>
<fieldset>
<legend>Unité et quantité</legend>
<div class="col-12">
{{ form_row(form.unit, {"attr":{'v-model': 'unit', '@change': "priceByRefUnitUpdate"}}) }}
</div>

<div class="col-12">
<div class="form-group field-weight">
{{ form_label(form.quantity) }}
<div class="form-widget">
<div class="form-group field-price row" v-show="unit != 'piece'">
<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', 'readonly':'readonly'}}) }}
<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.quantity, {'attr' : {'v-model': 'quantity', '@change': "priceByRefUnitUpdate"}}) }}
{{ form_widget(form.priceByRefUnitWithTax, {'attr' : {'v-model': 'priceByRefUnitWithTax','readonly':'readonly'}}) }}
<div class="input-group-append">
<span class="input-group-text">${ unit }</span>
<span class="input-group-text">€ TTC / ${ unitReference }</span>
</div>
</div>
{{ form_help(form.quantity) }}
</div>
</div>
</div>

</fieldset>
</div>
</div>
</div>
</div>
</product-unit-price>
</product-unit-price>

+ 94
- 86
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig View File

@@ -87,7 +87,7 @@

<td colspan="2" class="price" v-on:click="priceInherited = true">
<div v-show="priceInherited == false">
<div v-if="price" >
<div v-if="price">
{% verbatim %}{{ price }}€{% endverbatim %}
</div>
<div v-else class="inherited">
@@ -183,98 +183,106 @@
</tr>
{% endmacro %}
{% import _self as formMacros %}
<table class="table datagrid sortable lc-sortable-products products-collection-table"
:data-index="formProductArray.length"
data-prototype="{{ formMacros.printProductRow(form.products.vars.prototype)|e('html_attr') }}">
<thead>
<tr>
<th>
</th>
<th colspan="3" class="string">
Titre
</th>
<th colspan="1" class="string ">
Quantité
</th>
<th colspan="2" class="quantity">
Unité
</th>
<th colspan="2" class="price">
PA HT
</th>
<th colspan="2" class="price">
PA TTC
</th>
<th colspan="2" class="">
Coef
</th>
<th colspan="2" class="price">
PV HT
</th>
<th colspan="2" class="price">
PV TTC
</th>
<th colspan="2" class="priceByRefUnit">
PV HT / ${ getUnitReference() }
</th>
<th colspan="2" class="priceByRefUnit">
PV TTC / ${ getUnitReference() }
</th>
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.products"|trans }}</h3>
</div>
<div class="card-body">

<th class="stock">
Stock
</th>
<th class="stock">
Stock par défaut
</th>
<th colspan="2" class="">
DLC
</th>
<th class="">
Action
</th>
</tr>
</thead>
<tbody class="products-collection">
<table class="table datagrid sortable lc-sortable-products products-collection-table"
:data-index="formProductArray.length"
data-prototype="{{ formMacros.printProductRow(form.products.vars.prototype)|e('html_attr') }}">
<thead>
<tr>
<th>
</th>
<th colspan="3" class="string">
Titre
</th>
<th colspan="1" class="string ">
Quantité
</th>
<th colspan="2" class="quantity">
Unité
</th>
<th colspan="2" class="price">
PA HT
</th>
<th colspan="2" class="price">
PA TTC
</th>
<th colspan="2" class="">
Coef
</th>
<th colspan="2" class="price">
PV HT
</th>
<th colspan="2" class="price">
PV TTC
</th>
<th colspan="2" class="priceByRefUnit">
PV HT / ${ getUnitReference() }
</th>
<th colspan="2" class="priceByRefUnit">
PV TTC / ${ getUnitReference() }
</th>

<th class="stock">
Stock
</th>
<th class="stock">
Stock par défaut
</th>
<th colspan="2" class="">
DLC
</th>
<th class="">
Action
</th>
</tr>
</thead>
<tbody class="products-collection">

<template v-for="(formProduct, key) in formProductArray">
<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 ref="productForm" v-bind:product-family="productFamily" :template="formProduct"
:key-form="key"></product-form>
</template>

</tbody>
</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>
<div class="clearfix"></div>
<script>
window.productForm = new Array();
</script>
</tbody>
</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>
<div class="clearfix"></div>
<script>
window.productForm = new Array();
</script>

{% for keyForm,i in sortableProductsField %}
{% set product = form.products[i] %}
<script>
window.productForm[{{ keyForm }}] = {
{% 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 }}",{% endif %}
{% if product.vars.value.buyingPrice %}buyingPrice: "{{ product.vars.value.buyingPrice }}",{% endif %}
{% if product.vars.value.price %}price: parseFloat({{ product.vars.value.price }}).toFixed(3),{% 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.expirationDate %}expirationDate: {{ product.vars.value.expirationDate }}{% endif %}
};
jQuery(window).on('load', function () {
var formProduct = '{{ formMacros.printProductRow(product)|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
{% for keyForm,i in sortableProductsField %}
{% set product = form.products[i] %}
<script>
window.productForm[{{ keyForm }}] = {
{% 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 }}",{% endif %}
{% if product.vars.value.buyingPrice %}buyingPrice: "{{ product.vars.value.buyingPrice }}",{% endif %}
{% if product.vars.value.price %}price: parseFloat({{ product.vars.value.price }}).toFixed(3),{% 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.expirationDate %}expirationDate: {{ product.vars.value.expirationDate }}{% endif %}
};
jQuery(window).on('load', function () {
var formProduct = '{{ formMacros.printProductRow(product)|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';

appProductFamily.formProductArray.push(formProduct);
appProductFamily.indexFormProduct++;
});
</script>
appProductFamily.formProductArray.push(formProduct);
appProductFamily.indexFormProduct++;
});
</script>

{% endfor %}
{% endfor %}
</div>
</div>

{% do form.products.setRendered %}


+ 15
- 13
ShopBundle/Resources/views/backend/productfamily/panel_property.html.twig View File

@@ -1,39 +1,41 @@
{% trans_default_domain 'lcshop' %}
<div class="row">
<div class="field-group col-7">
<fieldset>
<legend>Caractéristiques</legend>
<div class="row">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.property"|trans }}</h3>
</div>
<div class="card-body">
<div class="col-5">
{{ form_row(form.isNovelty, {'attr': {'v-model':'isNovelty'}}) }}
</div>
<div class="col-7" v-show="isNovelty==true">
{{ form_row(form.noveltyExpirationDate) }}
</div>
</div>
<div class="row">

<div class="col-5">
{{ form_row(form.isOrganic, {'attr': {'v-model':'isOrganic'}}) }}
</div>
<div class="col-7" v-show="isOrganic==true">
{{ form_row(form.organicLabel) }}
</div>
</div>

<div class="row">
<div class="col">
{{ form_row(form.largeVolume) }}
</div>
</div>
</fieldset>
</div>
</div>
<div class="field-group col-5">
<fieldset>
<legend>Date d'expiration</legend>
<div class="row">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.property"|trans }}</h3>
</div>
<div class="card-body">
<div class="col">
{{ form_row(form.expirationDate, {'attr': {'v-model':'expirationDate'}}) }}
</div>
</div>
</fieldset>
</div>
</div>
</div>
</div>

+ 42
- 37
ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig View File

@@ -1,47 +1,52 @@
<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Stock</legend>
<div class="row">
<div class="col">
{{ form_label(form.behaviorCountStock) }}
{% for field in form.behaviorCountStock %}
{% if field.vars.value == "by-product" %}
<div v-if="activeProducts == true">
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorCountStock'}}) }}
</div>
{% else %}
{% trans_default_domain 'lcshop' %}


<div class="field-group col-12">

<div class="card card-light">
<div class="card-header">
<h3 class="card-title">{{ "form.group.ProductFamily.stock"|trans }}</h3>
</div>
<div class="card-body row">
<div class="col">
{{ form_label(form.behaviorCountStock) }}
{% for field in form.behaviorCountStock %}
{% if field.vars.value == "by-product" %}
<div v-if="activeProducts == true">
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorCountStock'}}) }}
{% endif %}
{% endfor %}
</div>
<div class="col">
<div v-show="behaviorCountStock == 'by-product-family' || behaviorCountStock == 'by-quantity'"
class="form-group">
{{ form_label(form.availableQuantity) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.availableQuantity) }}
<div v-show="behaviorCountStock == 'by-quantity'" class="input-group-append">
<span class="input-group-text">${ getUnitReference() }</span>
</div>
</div>
{% else %}
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorCountStock'}}) }}
{% endif %}
{% endfor %}
</div>
<div class="col">
<div v-show="behaviorCountStock == 'by-product-family' || behaviorCountStock == 'by-quantity'"
class="form-group">
{{ form_label(form.availableQuantity) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.availableQuantity) }}
<div v-show="behaviorCountStock == 'by-quantity'" class="input-group-append">
<span class="input-group-text">${ getUnitReference() }</span>
</div>
{{ form_help(form.availableQuantity) }}
</div>
{{ form_help(form.availableQuantity) }}
</div>

{{ form_label(form.availableQuantityDefault) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.availableQuantityDefault) }}
<div v-show="behaviorCountStock == 'by-quantity'" class="input-group-append">
<span class="input-group-text">${ getUnitReference() }</span>
</div>
{{ form_label(form.availableQuantityDefault) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.availableQuantityDefault) }}
<div v-show="behaviorCountStock == 'by-quantity'" class="input-group-append">
<span class="input-group-text">${ getUnitReference() }</span>
</div>
{{ form_help(form.availableQuantityDefault) }}
</div>
{{ form_help(form.availableQuantityDefault) }}
</div>
</div>
</div>
</fieldset>
</div>
</div>
</div>
</div>


+ 47
- 0
ShopBundle/Twig/BackendTwigExtension.php View File

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

namespace Lc\ShopBundle\Twig;

use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;

class BackendTwigExtension extends AbstractExtension
{
public $trans;

public function __construct(TranslatorInterface $translator)
{
$this->trans = $translator;

}


public function getFunctions()
{
return array(

);
}
public function getFilters()
{
return [
new TwigFilter('lc_trad', [$this, 'lcTrad'])
];
}

public function lcTrad($field, $entityName, $type="field")
{

$tradKey = $type.'.'.$entityName.'.'.$field;
$tradDefaultKey = $type.'.default.'.$field;
$trad = $this->trans->trans($tradKey, array(), 'lcshop');
if($trad == $tradKey){
$trad = $this->trans->trans($tradDefaultKey, array(), 'lcshop');
}
return $trad;
}


}

Loading…
Cancel
Save