|
|
|
|
|
|
|
|
{% 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 %} |
|
|
{% if value > 0 %} |
|
|
{% set badge_class = 'badge-success' %} |
|
|
{% set badge_class = 'badge-success' %} |
|
|
{% else %} |
|
|
{% else %} |
|
|
{% set badge_class = 'badge-danger' %} |
|
|
{% set badge_class = 'badge-danger' %} |
|
|
{% endif %} |
|
|
{% 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> |
|
|
</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 %} |