{% extends 'application/layout.html.twig' %}
{% block content %}
<main class="main">
<div class="breadcrumb">
<div class="container">
<ol class="breadcrumb__list">
<li class="breadcrumb__item"><a href="{{ path('home') }}" class="breadcrumb__link">Главная</a></li>
<li class="breadcrumb__item"><a href="{{ path('gallery') }}" class="breadcrumb__link">Галерея проектов</a></li>
<li class="breadcrumb__item active" aria-current="page">{{ item.name(app.request.locale) }}</li>
</ol>
</div>
</div>
<div class="page page--project">
<div class="container">
<div class="page__header">
<h1 class="page__title">{{ item.name(app.request.locale) }}</h1>
</div>
<div class="project__row">
<div class="project__main">
<div class="project-promo swiper a-carousel-single nav-inside">
<div class="swiper-wrapper">
{% for image in item.images %}
{% set imageNumber = loop.index %}
<div class="swiper-slide">
<div class="project-promo__photo">
{{ include('application/partial/picture.html.twig', {image: image, width: 929, height: 629}) }}
</div>
{% for projectProduct in item.products %}
{% if projectProduct.imageNumber == imageNumber %}
<div class="project-promo__tooltip item-tooltip" style="left: {{ projectProduct.x / 9.3 }}%; top: {{ projectProduct.y / 6.3 }}%;">
<div class="item-tooltip__toggle a-tooltip">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 8a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H2a1 1 0 0 1-1-1z"/><path d="M8 1a1 1 0 0 1 1 1v12a1 1 0 1 1-2 0V2a1 1 0 0 1 1-1z"/></svg>
</div>
<div class="item-tooltip__menu">
<button class="item-tooltip__close a-tooltip"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.146 3.146a.5.5 0 0 1 .708 0l9 9a.5.5 0 0 1-.708.708l-9-9a.5.5 0 0 1 0-.708z"></path><path d="M12.854 3.146a.5.5 0 0 0-.708 0l-9 9a.5.5 0 0 0 .708.708l9-9a.5.5 0 0 0 0-.708z"></path></svg></button>
<div class="item-tooltip__photo">
{{ include('application/partial/picture.html.twig', {image: projectProduct.product.image, width: 50, height: 50}) }}
</div>
<div class="item-tooltip__detail">
<div class="item-tooltip__title"><a href="{{ documentUrl(projectProduct.product) }}">{{ projectProduct.product.name(app.request.locale) }}</a></div>
<div class="item-tooltip__price"><span class="item-tooltip__value">{{ projectProduct.product.price|number_format(2, '.', ' ') }}</span> ₽ за шт.</div>
<div class="item-tooltip__descr">{{ projectProduct.shortText }}</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
<div class="btn-prev"><svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.854 12.867a.536.536 0 0 1-.708 0l-5-4.546a.426.426 0 0 1 0-.642l5-4.546a.536.536 0 0 1 .708 0 .426.426 0 0 1 0 .643L6.207 8l4.647 4.224a.426.426 0 0 1 0 .643z"/></svg></div>
<div class="btn-next"><svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.146 3.133a.536.536 0 0 1 .708 0l5 4.546a.426.426 0 0 1 0 .642l-5 4.546a.536.536 0 0 1-.708 0 .426.426 0 0 1 0-.643L9.793 8 5.146 3.776a.426.426 0 0 1 0-.643z"/></svg></div>
</div>
</div>
<div class="project__sidebar">
<div class="box project__detail">
<h3 class="project__title">Описание проекта</h3>
<div class="project__descr">{{ item.shortText(app.request.locale)|raw }}</div>
<div class="param-tbl">
{% for projectProduct in item.products %}
<div class="param-tbl__item">
<div class="param-tbl__param">{{ projectProduct.product.name(app.request.locale) }}</div>
<div class="param-tbl__value"><span class="price__value">{{ projectProduct.amount|number_format(2, '.', ' ') }}</span> <span class="price__unit">₽</span></div>
</div>
{% endfor %}
<div class="param-tbl__item project__price">
<div class="param-tbl__param">Итого</div>
<div class="param-tbl__value">
<span class="price__value">{{ item.amount|number_format(2, '.', ' ') }}</span>
<span class="price__unit">₽</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="section">
<div class="container">
<div class="section__item section__item--md">
<h2 class="product-add__title">Товары из проекта</h2>
<div class="product-carousel swiper a-carousel-product nav-right">
<div class="swiper-wrapper">
{% for projectProduct in item.products %}
{% if projectProduct.product.active %}
<div class="swiper-slide">
{{ include('application/catalog/product-block.html.twig', {product: projectProduct.product}) }}
</div>
{% endif %}
{% endfor %}
</div>
<div class="btn-prev"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.854 12.867a.536.536 0 0 1-.708 0l-5-4.546a.426.426 0 0 1 0-.642l5-4.546a.536.536 0 0 1 .708 0 .426.426 0 0 1 0 .643L6.207 8l4.647 4.224a.426.426 0 0 1 0 .643z"/></svg></div>
<div class="btn-next"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.146 3.133a.536.536 0 0 1 .708 0l5 4.546a.426.426 0 0 1 0 .642l-5 4.546a.536.536 0 0 1-.708 0 .426.426 0 0 1 0-.643L9.793 8 5.146 3.776a.426.426 0 0 1 0-.643z"/></svg></div>
</div>
</div>
{% if otherProject|length %}
<div class="section__item section__item--md">
<h2 class="product-add__title">Другие проекты</h2>
<div class="project__carousel swiper a-carousel-projects-inside nav-right">
<div class="swiper-wrapper">
{% for project in otherProject %}
<div class="swiper-slide {% if loop.index0 % 5 == 0 %}project__column--lg{% endif %}">
{{ include('application/projects/project-block.html.twig') }}
</div>
{% endfor %}
</div>
<div class="btn-prev"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.854 12.867a.536.536 0 0 1-.708 0l-5-4.546a.426.426 0 0 1 0-.642l5-4.546a.536.536 0 0 1 .708 0 .426.426 0 0 1 0 .643L6.207 8l4.647 4.224a.426.426 0 0 1 0 .643z"/></svg></div>
<div class="btn-next"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.146 3.133a.536.536 0 0 1 .708 0l5 4.546a.426.426 0 0 1 0 .642l-5 4.546a.536.536 0 0 1-.708 0 .426.426 0 0 1 0-.643L9.793 8 5.146 3.776a.426.426 0 0 1 0-.643z"/></svg></div>
</div>
</div>
{% endif %}
</div>
</div>
</main>
{% endblock %}
{% block scripts %}
<script>
$('.a-tooltip').on('click', function() {
$(this).closest('.item-tooltip').toggleClass('active');
return false;
});
</script>
{% endblock %}