{% macro card_start(zone = "default", card ='primary', fullWidth = false, tools = false ) %}
{% 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 %}
{% endmacro startCard %}
{% macro cardOverlay(attr) %}
{% endmacro cardOverlay %}
{% macro endCard(noCol = false) %}
{% if noCol == false %}{% endif %}
{% endmacro endCard %}
{% macro priceField(field, fieldTax, fieldName, behaviorPriceValue) %}
{% endmacro %}
{% macro autoresizeField(field) %}
{{ form_label(field) }} |
{{ form_widget(field, {'attr' : {rows : '1'}}) }}
|
{% endmacro autoresizeField %}
{% macro fieldReductionList(form, field, filterOn = false, filterType='string') %}
{% endmacro fieldReductionList %}
{% macro fieldReductionDateRange(form) %}
{% endmacro fieldReductionDateRange %}
{% macro fieldReductionValue(form) %}
{% 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) %}
{% 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) %}
Sujet |
Statut |
Dernier message |
|
{% for ticket in tickets %}
{{ 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) }}
|
{% endfor %}
{% endmacro list_tickets %}
{% macro list_reduction_credits(reductionCredits, user) %}
{% set merchant_current = merchantUtils.getMerchantCurrent() %}
Titre |
Montant |
En ligne |
Utilisé |
|
{% for reductionCredit in reductionCredits %}
{% if reductionCredit.getMerchant() == merchant_current %}
{% set isUsed = orderUtils.isReductionCreditUsed(reductionCredit, user) %}
{{ 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 %}
|
{% endif %}
{% endfor %}
{% endmacro list_reduction_credits %}
{% macro list_reduction_carts(reductionCarts, user = false) %}
Titre |
Montant |
Quantité utilisé |
Quantité restante |
En ligne |
Actions |
{% for reductionCart in reductionCarts %}
{{ 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') }}
|
{% endfor %}
{% 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 %}