瀏覽代碼

[Backend] Produits : affichage du stock dans la liste

feature/export_comptable
Guillaume 4 年之前
父節點
當前提交
a492d26504
共有 1 個文件被更改,包括 40 次插入16 次删除
  1. +40
    -16
      ShopBundle/Resources/views/backend/default/list-fields/field_product_family_available_quantity.html.twig

+ 40
- 16
ShopBundle/Resources/views/backend/default/list-fields/field_product_family_available_quantity.html.twig 查看文件

@@ -1,22 +1,46 @@
{% if value is defined and value is not null %}
{% set value_is_set = value is defined and value is not null %}
{% if item.getBehaviorCountStock() == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE") %}
{% if value_is_set %}
{{ _self.badge_stock_start(value) }}
{{ value }} {{ item.getUnit().getUnit() }}
{{ _self.badge_stock_end() }}
{% else %}
{{ _self.no_stock() }}
{% endif %}
{% elseif item.getBehaviorCountStock() == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY") %}
{% if value_is_set %}
{{ _self.badge_stock_start(value) }}
{{ value }} pièce{% if value > 1 %}s{% endif %}
{{ _self.badge_stock_end() }}
{% else %}
{{ _self.no_stock() }}
{% endif %}
{% elseif item.getBehaviorCountStock() == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT") %}
{% set available_quantity_products = item.getAvailableQuantityInherited() %}
{% if available_quantity_products > 0 %}
{{ _self.badge_stock_start(available_quantity_products) }}
{{ available_quantity_products }} pièce{% if available_quantity_products > 1 %}s{% endif %} (déclinaisons)
{{ _self.badge_stock_end() }}
{% else %}
{{ _self.no_stock() }}
{% endif %}
{% elseif item.getBehaviorCountStock() == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED") %}
<span class="badge badge-success">Illimité</span>
{% endif %}

{% macro no_stock() %}
<span class="badge badge-danger">Pas de stock</span>
{% endmacro %}

{% macro badge_stock_start(value) %}
{% if value > 0 %}
{% set badge_class = 'badge-success' %}
{% else %}
{% set badge_class = 'badge-danger' %}
{% endif %}
<span class="badge {{ badge_class }}">
{% if item.getBehaviorCountStock() == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE") %}
{{ value }} {{ item.getUnit().getUnit() }}
{% elseif item.getBehaviorCountStock() == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY") %}
{{ value }} pièce{% if value > 1 %}s{% endif %}
{% elseif item.getBehaviorCountStock() == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT") %}
{{ item.getAvailableQuantityInherited() }} pièce{% if value > 1 %}s{% endif %} (déclinaisons)
{% endif %}
<span class="badge {{ badge_class }}">
{% endmacro %}

{% macro badge_stock_end() %}
</span>
{% else %}
{% if item.getBehaviorCountStock() == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED") %}
<span class="badge badge-success">Illimité</span>
{% else %}
<span class="badge badge-danger">Pas de stock</span>
{% endif %}
{% endif %}
{% endmacro %}

Loading…
取消
儲存