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

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

{% if tools %}
{{ tools|raw }}
{% endif %}
{% endmacro card_start %} {% macro card_end(overlay = false) %}
{% if overlay %}
{% endif %}
{% 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, button=false) %} {% embed '@LcShop/backend/default/block/embed_box.twig' %} {% trans_default_domain 'lcshop' %} {% block class %}{{ class }}{% endblock %} {% block icon %}{{ icon }}{% endblock %} {% block label %}{{ label|raw }}{% endblock %} {% block value %}{{ value|raw }}{% endblock %} {% if button %} {% block button %}{{ button|raw }}{% endblock %} {% endif %} {% endembed %} {% endmacro box_info %} {% macro form_row_append(field, append) %}
{{ form_label(field) }} {{ _self.form_widget_append(field, append) }}
{% endmacro form_row_append %} {% macro form_widget_append(field, append) %}
{{ form_widget(field) }}
{{ append }}
{{ form_help(field) }}
{% endmacro form_widget_append %} {% macro available_quantity_product(product) %} {% if product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY") %} {{ product.productFamily.availableQuantity }} {% elseif product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE") %} {{ product.productFamily.availableQuantity }} / {{ product.productFamily.unit.unitReference }} {% elseif product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT") %} {{ product.availableQuantity }} {% endif %} {% endmacro available_quantity_product %} {% macro button(entity, action, id=null, class="success", title=null, icon=null) %} {% if title %} {% set trad = title %} {% else %} {% set trad = 'action.'~action %} {% endif %} {% if icon is null %} {% if action=="edit" %}{% set icon = 'pen' %} {% elseif action=="show" %}{% set icon = 'eye' %} {% endif %} {% endif %} {% set param = {action : action, entity: entity, referer: app.request.requestUri} %} {% if id %}{% set param = param|merge({id: id}) %}{% endif %} {% endmacro button %} {% macro list_tickets(tickets) %} {% for ticket in tickets %} {% endfor %}
Sujet Statut Dernier message
{{ ticket.subject }} {% set value = ticket.status %} {% include '@LcShop/backend/default/field/ticket_status.html.twig' %} {% set item = ticket %} {% include '@LcShop/backend/default/field/ticket_last_message.html.twig' %} {{ _self.button('Ticket', 'show', ticket.id) }}
{% endmacro list_tickets %} {% macro list_reduction_credits(reductionCredits, user) %} {% set merchant_current = merchantUtils.getMerchantCurrent() %} {% for reductionCredit in reductionCredits %} {% if reductionCredit.getMerchant() == merchant_current %} {% set isUsed = orderUtils.isReductionCreditUsed(reductionCredit, user) %} {% endif %} {% endfor %}
Titre Montant En ligne Utilisé
{{ reductionCredit.title }} {{ reductionCredit.value|format_price(false) }} {% include '@LcShop/backend/default/field/status.html.twig' with {value: reductionCredit.status} %} {% include '@EasyAdmin/default/field_boolean.html.twig' with {value: isUsed} %} {% if isUsed == false and reductionCredit.status >=0 %} {{ _self.button('ReductionCredit', 'edit', reductionCredit.id, 'primary') }} {% endif %}
{% endmacro list_reduction_credits %} {% macro list_reduction_carts(reductionCarts, user = false) %} {% for reductionCart in reductionCarts %} {% endfor %}
Titre Montant Quantité utilisé Quantité restante En ligne Actions
{{ reductionCart.title }} {% if reductionCart.value > 0 %} {{ reductionCart.value }} {% if reductionCart.unit == 'percent' %}%{% else %}€{% endif %} {% if reductionCart.appliedTo is defined and reductionCart.appliedTo|length > 0 %} sur {% if reductionCart.appliedTo == 'order-products' %} les produits {% endif %} {% endif %} ({% if reductionCart.behaviorTaxRate == 'tax-included' %}TTC{% else %}HT{% endif %}) {% endif %} {% if reductionCart.freeShipping %} {% if reductionCart.value > 0 %}
{% endif %} Livraison offerte {% endif %}
{% if user is not null %} {% set totalUsed = orderUtils.getReductionCartUsedQuantityPerUser(reductionCart, user) %} {{ totalUsed }} {% endif %} {% if user is not null %} {{ reductionCart.availableQuantityPerUser - totalUsed }} {% endif %} {% include '@EasyAdmin/default/field_boolean.html.twig' with {value: reductionCart.status} %} {{ _self.button('ReductionCart', 'edit', reductionCart.id, 'primary') }}
{% endmacro list_reduction_carts %} {% macro box_user_info(user) %} {% embed '@LcShop/backend/default/block/embed_box.twig' %} {% trans_default_domain 'lcshop' %} {% block class %}bg-info{% endblock %} {% block icon %}user{% endblock %} {% block label %}{{ "group.User.item"|trans({}, 'lcshop') }}{% endblock %} {% block value %} #{{ user.id }}  {{ user.gender == 1 ? 'Mme.' : 'M.' }} {{ user.name }} {{ user.age < 200 ? '('~user.age~' ans)' : ''}}
{{ user.email }}
{{ orderUtils.countValidOrderShopByUser(user) }} {{ orderUtils.getTotalSpentByUser(user) }} {{ orderUtils.countRedeliveryByUser(user) }} {{ user.reductionCredits|length }} {% endblock %} {% block button %} Voir la fiche {% endblock %} {% endembed %} {% endmacro box_user_info %}