{% macro card_start(zone = "default", card ='primary', fullWidth = false ) %}

{% set label = "group."~zone %} {{ label|trans({}, 'lcshop')|raw }}

{% endmacro card_start %} {% macro card_overlay(attr) %}
{% endmacro card_overlay %} {% macro card_end(noCol = false) %}
{% endmacro card_end %} {% macro startCard(col, zone = "default", card ='primary', fullWidth = false ) %} {% if col > 0 %}
{% endif %}

{% set label = "group."~zone %} {{ label|trans({}, 'lcshop')|raw }}

{% endmacro startCard %} {% macro cardOverlay(attr) %}
{% endmacro cardOverlay %} {% macro endCard(noCol = false) %}
{% if noCol == false %}{% endif %} {% endmacro endCard %} {% macro priceField(field, fieldTax, fieldName, behaviorPriceValue) %}
{{ form_label(field) }}
{{ form_widget(field, {'attr' : {'v-model': fieldName, '@change' : fieldName~'Updated'}}) }}
€ HT {% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %}
{{ form_widget(fieldTax, {'attr' : {'v-model': fieldName ~ 'WithTax', '@change' : fieldName~'WithTaxUpdated'}}) }}
€ TTC {% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %}
{% endmacro %} {% macro autoresizeField(field) %} {{ form_label(field) }}
{{ form_widget(field, {'attr' : {rows : '1'}}) }}
{% endmacro autoresizeField %} {% macro fieldReductionList(form, field, filterOn = false, filterType='string') %}
{{ form_widget(attribute(form, field~'Active'), {"attr" : {'v-model' : 'reduction'~field|uc_first~'Active' } }) }}
{% set attr = { 'ref' : 'reduction'~field|uc_first , 'v-model' : 'reduction'~field|uc_first } %} {{ form_widget(attribute(form, field), {"attr" : attr }) }}
{% endmacro fieldReductionList %} {% macro fieldReductionDateRange(form) %}
{{ form_widget(form.permanent, {"attr" : {'v-model' : 'reductionPermanent' } }) }}
{% endmacro fieldReductionDateRange %} {% macro fieldReductionValue(form) %}
{{ form_label(form.value) }}
{{ form_widget(form.value, {"attr" : {":required": "reductionActive", 'v-model' : 'reductionValue'}}) }}
%
{% endmacro fieldReductionValue %} {% macro fieldReductionBehaviorTaxRate(form) %}
{{ form_row(form.behaviorTaxRate, {"attr" : {":required": "reductionActive && reductionUnit=='amount'", 'v-model' : 'reductionBehaviorTaxRate'}}) }}
{% endmacro fieldReductionBehaviorTaxRate %} {% macro fieldReductionUnit(form) %}
{{ form_label(form.unit) }} {% for field in form.unit %} {{ form_widget(field, {"attr" : {":required": "reductionActive", "v-model" : 'reductionUnit'}}) }} {% endfor %}
{% endmacro fieldReductionUnit %} {% macro reductionCatalogForm(form) %} {{ _self.startCard(6, 'ReductionCatalog.info') }}
{{ form_row(form.title, {'attr' : {":required": "reductionActive"}}) }}
{{ _self.fieldReductionUnit(form) }} {{ _self.fieldReductionValue(form) }} {{ _self.fieldReductionBehaviorTaxRate(form) }} {{ _self.endCard() }} {{ _self.startCard(6, 'ReductionCatalog.conditions','success') }} {{ _self.fieldReductionDateRange(form) }} {{ _self.fieldReductionList(form, 'groupUsers') }} {{ _self.fieldReductionList(form, 'users') }} {% if form.suppliers is defined %} {{ _self.fieldReductionList(form, 'suppliers') }} {% endif %} {% if form.productCategories is defined %} {{ _self.fieldReductionList(form, 'productCategories') }} {% endif %} {% if form.productFamilies is defined %} {{ _self.fieldReductionList(form, 'productFamilies') }} {% endif %} {{ _self.endCard() }} {% endmacro reductionCatalogForm %} {% macro reductionCatalogFormValues(formValues, isProductFamilyForm= false) %} {% endmacro reductionCatalogFormValues %} {% macro box_info(class="bg-info", icon, label, value) %} {% embed '@LcShop/backend/default/block/embed_box.twig' %} {% trans_default_domain 'lcshop' %} {% block class %}{{ class }}{% endblock %} {% block icon %}{{ icon }}{% endblock %} {% block label %}{{ label }}{% endblock %} {% block value %} {{ value }} {% endblock %} {% endembed %} {% endmacro box_info %}