{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
{% set variantsBreakpoints = product.variantsBreakpoints(sylius.channel, sylius.customer) %}
{% set brand = product.brand %}
{% if variantsBreakpoints|length %}
<div class="d-none d-md-block">
<h3>{{ 'app.product.detail.choose_variant'|trans }}</h3>
<div id="tier_prices_tables" class="table-prices rounded-top table-responsive"
data-min-qty="{{ product.calculateMinQty }}"
data-only-breakpoints="{{ product.onlyBreakpoints ? 1 : 0 }}"
{% if brand %}data-setup-charge="{{ brand.setupDefault }}" data-plate-charge="{{ brand.plateDefault }}" data-plate-per-color="{{ brand.platePerColor }}" {% endif %}>
<table class="table">
<tbody>
<tr>
<th>Type</th>
{% for qty in variantsBreakpoints["all"] %}
<th>{{ qty }}<span> pcs</span></th>
{% endfor %}
</tr>
{% set first = true %}
{% for product_variant in product.enabledVariants %}
{# Vypise do tabulky len varianty, kde je iba jeden options; Predpoklad je, ze option typu "type" to bude #}
{% if product_variant.optionValues|length == 1 %}
{% set tier_prices = product_variant.getTierPricesForChannel(sylius.channel, sylius.customer) %}
<tr id="variant-{{ product_variant.id }}" class="{% if loop.index is odd %}odd{% else %}even{% endif %}{% if product_variant.optionValues[0].option.code != 'type'%} no-type{% endif %}">
<td class="first">
<b>{{ product_variant.optionValues.first.value }}</b>
</td>
{% for qty in variantsBreakpoints["all"] %}
{% set tierPrice = product_variant.tierPriceByQty(qty, tier_prices) %}
{% include '@SyliusShop/Product/Show/_priceTier.html.twig' with { 'variant': product_variant, 'tierPrice': tierPrice, 'first': first, 'isType': product_variant.optionValues[0].option.code == 'type' } %}
{% set first = false %}
{% endfor %}
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<script type="text/javascript">
window.variantsBreakpoints = JSON.parse('{{ variantsBreakpoints | json_encode | e('js') }}');
window.variantsBreakpointsPrices = JSON.parse('{{ product.variantsBreakpointsPricesForJs(sylius.channel, sylius.customer) | json_encode | e('js') }}');
</script>
</div>
{% if product.minQuantity %}
<div class="product-min-quantity">{{ 'app.product_box.min_qty'|trans({ '%qty%': product.minQuantity }) }}</div>
{% endif %}
</div>
{% endif %}