{% block zeobv_bundle_products_components_bundle_product_info %}
{% if products %}
{{ "zeobv-bundle-products.detail.tableHeaderText"|trans|sw_sanitize }}
{% set showAvailabilityColumn = config('ZeobvBundleProducts.config.showBundleProductItemAvailabilityColumn') %}
{% set showThumbnail = config('ZeobvBundleProducts.config.showBundleProductItemThumbnailColumn') %}
{% set showManufacturer = config('ZeobvBundleProducts.config.showBundleProductItemManufacturer') %}
{% set showBundleProductNumber = config('ZeobvBundleProducts.config.showBundleProductNumber') %}
<table class="table product-bundle-products-table">
{% block page_product_detail_price_block_table_head %}
<thead class="product-bundle-products-head">
{% block page_product_detail_price_block_table_head_inner %}
<tr class="product-bundle-products-header-row">
{% block zeobv_bundle_products_components_bundle_product_info_table_header_cell_name %}
<th scope="col"
class="product-bundle-products-product-cell product-bundle-products-product-name-cell"
colspan="{{ showThumbnail ? "2" : 1 }}">
{{ "zeobv-bundle-products.detail.dataColumnName"|trans|sw_sanitize }}
</th>
{% endblock %}
{% block zeobv_bundle_products_components_bundle_product_info_table_header_cell_quantity %}
<th scope="col"
class="product-bundle-products-product-cell product-bundle-products-product-quantity-cell">
{{ "zeobv-bundle-products.detail.dataColumnQuantity"|trans|sw_sanitize }}
</th>
{% endblock %}
{% block zeobv_bundle_products_components_bundle_product_info_table_header_cell_available %}
{% if showAvailabilityColumn %}
<th scope="col"
class="product-bundle-products-product-cell product-bundle-products-product-available-cell">
{{ "zeobv-bundle-products.detail.dataColumnAvailable"|trans|sw_sanitize }}
</th>
{% endif %}
{% endblock %}
{% block zeobv_bundle_products_components_bundle_product_info_table_header_cell_price %}
{% if showPrices %}
<th scope="col"
class="product-bundle-products-product-cell product-bundle-products-product-price-cell">
{{ "zeobv-bundle-products.detail.dataColumnPrice"|trans|sw_sanitize }}
</th>
{% endif %}
{% endblock %}
</tr>
{% endblock %}
</thead>
{% endblock %}
{% block zeobv_bundle_products_components_bundle_product_info_table_body %}
<tbody class="product-bundle-products-body">
{% block zeobv_bundle_products_components_bundle_product_info_table_body_inner %}
{% set total = 0 %}
{% set mediaIds = products|map(product => product.cover ? product.cover.mediaId : null) %}
{% set mediaCollection = searchMedia(mediaIds, context.context) %}
{% for product in products|sort((a, b) => a.extensions.zeobvProductBundleConnection.position - b.extensions.zeobvProductBundleConnection.position) %}
{% set quantity = product.extensions.zeobvProductBundleConnection.quantity %}
{% set comment = product.extensions.zeobvProductBundleConnection.comment %}
{% set price = product.calculatedPrice %}
{% if product.calculatedPrices|length > 0 %}
{% set price = product.calculatedPrices|filter((calculatedPrice) => calculatedPrice.quantity <= quantity)|last %}
{% if not price %}
{% for advancePrice in product.prices %}
{% if advancePrice.quantityStart <= quantity and advancePrice.quantityEnd >= quantity %}
{% set price = product.calculatedPrices|filter(
(calculatedPrice) => calculatedPrice.quantity <= advancePrice.quantityEnd
)|last %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% if quantity > 1 %}
{% set price = quantity * price.unitPrice %}
{% else %}
{% set price = price.unitPrice %}
{% endif %}
{% set total = total + price %}
<tr class="product-bundle-products-product-row">
{% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_thumb %}
{% if showThumbnail %}
<td scope="row"
class="product-bundle-products-product-cell product-bundle-products-cell-thin product-bundle-products-product-cell-thumbnail">
{% set productCover = mediaCollection.get(product.cover.mediaId) %}
{% sw_thumbnails 'minimal-image-thumbnails' with {
media: productCover,
sizes: {
'default': '20px'
},
attributes: {
'class': 'img-fluid quickview-minimal-img',
'alt': ( product.cover.translated.alt ?: ''),
'title': (product.cover.translated.title ?: '')
}
} %}
</td>
{% endif %}
{% endblock %}
{% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_name %}
<td scope="row"
class="product-bundle-products-product-cell product-bundle-products-cell-thin">
{% set visibilityResult = product.visibilities.elements |first %}
{% if product.available and product.active and visibilityResult.visibility != "10" %}
<a href="{{ seoUrl('frontend.detail.page', {productId: product.id}) }}">
{{ product.translated.name }} {% if comment %} | {{ comment }} {% endif %}
</a>
{% else %}
{{ product.translated.name }} {% if comment %} | {{ comment }} {% endif %}
{% endif %}
<div class="sub-text">
{% if showManufacturer and product.manufacturer.name %}
<span class="manufacturer-name">{{ product.manufacturer.name }}</span>
{% endif %}
{% if showBundleProductNumber and product.productNumber %}
<span class="product-number">{{ product.productNumber }}</span>
{% endif %}
</div>
</td>
{% endblock %}
{% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_quantity %}
<td class="product-bundle-products-product-cell product-bundle-products-cell-thin product-bundle-products-product-cell-qty">
{{ quantity }}
</td>
{% endblock %}
{% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_available %}
{% if showAvailabilityColumn %}
<td class="product-bundle-products-product-cell product-bundle-products-product-cell-available">
{% if product.available %}
{% sw_icon 'checkmark' style { 'size': 'sm' } %}
{% else %}
{% sw_icon 'x' style { 'size': 'sm' } %}
{% endif %}
</td>
{% endif %}
{% endblock %}
{% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_price %}
{% if showPrices %}
<td class="product-bundle-products-product-cell product-bundle-products-product-cell-price">
{{ price|currency }}
</td>
{% endif %}
{% endblock %}
</tr>
{% endfor %}
{% block zeobv_bundle_products_components_bundle_product_info_table_footer %}
{% if showPrices and showTotalPrice %}
<tr class="product-bundle-products-total-row">
{% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_total_label %}
<th scope="row"
colspan="{{ showThumbnail and showAvailabilityColumn ? 4 : (showThumbnail or showAvailabilityColumn ? 3 : 2) }}"
class="product-bundle-products-product-cell product-bundle-total-cell">
<span class="product-bundle-total-label">
{{ "zeobv-bundle-products.detail.dataColumnTotal"|trans|sw_sanitize }}
</span>
</th>
{% endblock %}
{% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_total_price %}
<td class="product-bundle-products-product-cell product-bundle-products-product-cell-total">
<span>{{ total|currency }}</span>
</td>
{% endblock %}
</tr>
{% endif %}
{% endblock %}
{% endblock %}
</tbody>
{% endblock %}
</table>
{% endif %}
{% endblock %}