<h3 class="product-details-tab subtitle">
{{ 'detail.tabsVariants'|trans|sw_sanitize }}
</h3>
<div class="product-details-variants">
{% set variants = page.product.extensions.variants %}
{% set tableAttributes = page.product.extensions.tableAttributes %}
<table class="table table-striped product-details-variants-table">
<thead>
<th>
{{ "detail.variantsTableOrderNumberLabel"|trans|sw_sanitize }}
</th>
<th>
{{ "detail.variantsTableNameLabel"|trans|sw_sanitize }}
</th>
{% for property in tableAttributes.properties %}
<th>
{{ property.name }}
</th>
{% endfor %}
{% if context.customer %}
<th>
{{ "detail.variantsTableStockLabel"|trans|sw_sanitize }}
</th>
<th>
{{ "detail.variantsTablePriceLabel"|trans|sw_sanitize }}
</th>
{% endif %}
<th></th>
</thead>
<tbody>
{% for variant in variants %}
{% set product = variant %}
{% set id = product.id %}
<tr data-id="{{ variant.id }}">
<td>
<a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
title=" {{ variant.productNumber }}">
{{ variant.productNumber }}
</a>
</td>
<td>{{ variant.translated.name }}</td>
{% for property in tableAttributes.properties %}
{% set propertyValue = tableAttributes.productPropertyValueCollection.getPropertyValueOfProduct(variant.id, property.identifier) %}
<td>{{ propertyValue ? propertyValue.value : '-' }}</td>
{% endfor %}
{% if context.customer %}
<td>
{% set stockInfo = decodeStockInfo(variant, context) %}
{% if stockInfo and stockInfo.stock is defined %}
<div class="variants-stock-info--item">
<span>{{ "detail.available"|trans|sw_sanitize }}</span>
<span>
{% if stockInfo.stock > 1000 %}
1000+
{% else %}
{{ stockInfo.stock }}
{% endif %}
</span>
</div>
{% if stockInfo.restock is defined and stockInfo.restock is iterable and stockInfo.restock|length > 0 %}
{% for cw, amount in stockInfo.restock %}
<div class="variants-stock-info--item">
<span>{{ "detail.cw"|trans|sw_sanitize }}{{ cw }}</span>
<span>{{ amount }}</span>
</div>
{% endfor %}
{% endif %}
{% else %}
{% if variant.availableStock > 1000 %}
<div class="variants-stock-info--item">
<span>{{ "detail.available"|trans|sw_sanitize }}</span>
<span>1000+</span>
</div>
{% else %}
<div class="variants-stock-info--item">
<span>{{ "detail.available"|trans|sw_sanitize }}</span>
<span>{{ variant.availableStock }}</span>
</div>
{% endif %}
{% if variant.availableStock <= 0 and variant.restockTime %}
{{ "detail.variantsTableStockRestockInformation"|trans({'%restockTime%': product.restockTime})|sw_sanitize }}
{% endif %}
{% endif %}
</td>
<td>
<strong>{{ variant.calculatedPrice.totalPrice|currency }}</strong>
{#
<div class="product-detail-price-unit">
<span class="price-unit-label">
{{ "detail.priceUnitName"|trans|sw_sanitize }}<br>
</span>
<span class="price-unit-content">
{{ variant.purchaseUnit }} {{ "detail.perPackUnit"|trans|sw_sanitize }} {{ variant.translated.packUnit }}
</span>
{% if variant.calculatedPrice.referencePrice is not null %}
<span class="price-unit-reference-content">
({{ variant.calculatedPrice.referencePrice|currency }} / {% if variant.calculatedPrice.referencePrice.referenceUnit > 1 %}{{ variant.calculatedPrice.referencePrice.referenceUnit }} {% endif %}{{ variant.calculatedPrice.referencePrice.unitName }})
</span>
{% endif %}
</div>
#}
</td>
{% endif %}
<td class="product-details-variants-table-action-column">
{% sw_include '@Storefront/storefront/component/product/card/variant-action.html.twig' %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>