{% if vendor_can_product_file(product) %}
<div class="ui bottom attached tab segment product-tabs" data-tab="product_file">
<ul>
{% set isPreview = product.id is null
or 'open_marketplace_vendor_product_listings_preview' == app.request.attributes.get('_route')
%}
{% set ownerType = isPreview ? 'draft' : 'product' %}
{% for datasheet in product.datasheets %}
<li>
<a href="{{ path('app_datasheet', {
'ownerType': ownerType,
'ownerId': isPreview ? product_listing.latestDraft.id|default(product.id) : product.id,
'action': 'inline',
'filename': datasheet.originalFilename
}) }}" target="_blank"> <i class="icon file"></i> {{ datasheet.originalFilename }} </a>
<a href="{{ path('app_datasheet', {
'ownerType': ownerType,
'ownerId': isPreview ? product_listing.latestDraft.id|default(product.id) : product.id,
'action': 'download',
'filename': datasheet.originalFilename
}) }}"> {{ 'app.ui.download'|trans }} </a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}