{% extends 'base.html.twig' %}
{% trans_default_domain 'ECommerceBundle' %}
{% block title %}{{ product.originalTitle }} {{ product.origin }}{% endblock %}
{%- import 'ECommerce/App/Product/macros.html.twig' as macros -%}
{% block content %}
<div class="container-fluid">
<div class="container">
<div class="content">
<div class="row grid-1-3">
<div class="product-photo w-100 h-100">
{%- set photo = product.photos|first -%}
{%- if photo is not empty and photo.url is not empty -%}
<img src="{{ asset(photo.url)|imagine_filter('product_thumbnail') }}"
class="img-fluid mx-auto d-block w-100 h-100"
alt="{{ product.title }}" data-lity
data-lity-target="{{ asset(photo.url)|imagine_filter('product_small') }}">
{%- else -%}
<img src="{{ preload(asset('/assets/static/no-photo.jpg')) }}" class="img-fluid mx-auto d-block"
alt="{{ product.title }}">
{%- endif -%}
</div>
{%- set firstDepot = product.quantities|first -%}
{%- set restDepots = product.quantities[1:] -%}
{% set hasActiveDepot = false %}
{% for depot in product.quantities %}
{% if depot.quantity > 0 %}
{% set hasActiveDepot = true %}
{% endif %}
{% endfor %}
<div class="product-info d-flex flex-column">
<h1 class="text-left line-height-95 font-weight-bold font-45">{{ product.title }}</h1>
<p class="line-height-95 font-weight-medium font-28 mb-40">{{ product.manufacturer }}</p>
<div class="dimensions d-inline-flex align-items-center">
<img src="{{ preload(asset('assets/static/outer-diameter.svg')) }}" alt="Outer Diameter">
<p class="m-0 font-26 ml-3">{{ product.outerDiameter|number_format(2) }} mm</p>
</div>
<div class="dimensions d-inline-flex align-items-center">
<img src="{{ preload(asset('assets/static/inner-diameter.svg')) }}" alt="Inner Diameter">
<p class="m-0 font-26 ml-3">{{ product.innerDiameter|number_format(2) }} mm</p>
</div>
<div class="dimensions d-inline-flex align-items-center last mb-4">
<img src="{{ preload(asset('assets/static/width.svg')) }}" alt="Width">
<p class="m-0 font-26 ml-3">{{ product.width|number_format(2) }} mm</p>
</div>
<div class="price d-inline-flex align-items-center">
<p class="line-height-95 m-0 font-weight-medium font-28 text-uppercase">{{ 'product.price'|trans }}</p>
<p class="line-height-95 mb-0 ml-auto font-weight-medium font-28">{{ firstDepot|depot_product_price(app.user)|number_format(2) }} {{ currency_code(app.user) }}</p>
</div>
<div class="price d-inline-flex align-items-end">
<p class="line-height-95 m-0 mt-3 font-weight-medium font-28 color-blue text-uppercase mw-10">{{ 'product.label_discount_price'|trans }}</p>
{% if is_granted('ROLE_CLIENT') %}
<p class="line-height-95 mb-0 ml-auto font-weight-medium font-28 color-blue">{{ firstDepot|depot_product_price(app.user, true)|number_format(2) }} {{ currency_code(app.user) }}</p>
{% else %}
<p class="line-height-95 mb-0 ml-auto font-weight-medium font-28 color-blue">{{ 'product.log-in'|trans }}</p>
{% endif %}
</div>
</div>
<div class="border-rounded w-100 h-100 d-flex">
<div class="col-depot-info{{ hasActiveDepot ? ' has-active-depot' : '' }} w-100">
{% if firstDepot %}
{% if not hasActiveDepot or firstDepot.quantity > 0 %}
{% set depotProduct = firstDepot %}
{% include 'ECommerce/App/Product/partials/product_amount.html.twig' %}
{% endif %}
{% endif %}
{% for depot in restDepots %}
{% if not hasActiveDepot or depot.quantity > 0 %}
{% set depotProduct = depot %}
{% include 'ECommerce/App/Product/partials/product_amount.html.twig' %}
{% endif %}
{% endfor %}
</div>
</div>
</div>
<div class="row single-product-description">
<a class="mt-3" href="{{ product.link }}" target="_blank" rel="nofollow">
<h3 class="text-uppercase line-height-95 font-weight-normal font-28">{{ 'product.more_info'|trans }}</h3>
</a>
</div>
<div class="row justify-content-center">
<div class="synonym-products">
<div id="interchange-wrapper" class="mt-3 mb-5">
<div class="row justify-content-center">
<div class="col-12 mb-5 text-center">
<h1>{{ 'general.interchange_button_title'|trans }}</h1>
<a class="btn btn-primary mt-4"
href="{{ path('mdl_app_synonym_product_find', { 'title': (product.title|trim('*', 'left')) }) }}"
data-intro="{{ ('intro.interchange'|trans) }}"
data-toggle="replace"
data-trigger="#interchange-wrapper">
<span class="text-capitalize font-21 font-weight-normal">{{ 'general.interchange_button_search'|trans }}</span>
<img src="{{ asset('assets/static/arrows-both-way.svg') }}" class="img-fluid ml-5"
alt="found in interchange catalogue">
</a>
</div>
</div>
</div>
</div>
</div>
<div class="row catalog">
<a class="w-100" href="{{ path('mdl_public_page_show', {'slug': 'media', 'category': product.manufacturer.name}) }}">
<img class="w-100" src="{{ asset('assets/static/catalog-background.png') }}" aria-label="Catalog background" alt="Catalog background"/>
<h1 class="font-72 text-capitalize text-decoration-none text-white">Pogledaj katalog</h1>
<p class="font-26 text-white pb-3">Otkrij vise<img src="{{ asset('assets/static/arrow-button.svg') }}" alt="Arrow button"/></p>
</a>
</div>
</div>
</div>
</div>
{% endblock %}