{% set offer = __SELF__.offer %}

{% if offer %}
<div class="detail_body">
    <div class="detail_gallery">
        <div class="detail_photo_box">
            {% if offer.images[0] %}
                {% for image in offer.images %}
                <div class="detail_photo">
                    <img src="{{ image.thumb(575,290,{'mode':'crop'}) }}" alt="">
                </div>
                {% endfor %}
            {% endif %}
        </div>
        <div class="detail_for_navs">
            {% if offer.images[0] %}
                {% for image in offer.images %}
                <div class="detail_photo_nav">
                    <img src="{{ image.thumb(98,60,{'mode':'crop'}) }}" alt="">
                </div>
                {% endfor %}
            {% endif %}
        </div>
    </div>
    <div class="detail_info">
        <div class="detail_title">
            {{offer.name}}
        </div>
        <div class="detail_info-inner">
            <div class="detail_about">
                <div class="detail_row">
                    <div class="detail_name">
                        {{'page.prod_no'|_}}:
                    </div>
                    <div class="detail_value">
                        № {{offer.id}}
                    </div>
                </div>
                <div class="detail_row">
                    <div class="detail_name">
                        {{'page.prod_amount_2'|_}} :
                    </div>
                    <div class="detail_value">
                        {{offer.quantity}} {{offer.measure.code}}.
                    </div>
                </div>
                <div class="detail_row">
                    <div class="detail_name">
                        {{'page.prod_price_2'|_}}:
                    </div>
                    <div class="detail_value">
                        {{offer.price}} {{offer.currency.code}} / 1 {{offer.measure.code}}.
                    </div>
                </div>
                <div class="detail_row">
                    <div class="detail_name">
                        {{'page.prod_startdate'|_}}:
                    </div>
                    <div class="detail_value green">
                        {{offer.created_at|date('d/m/Y')}}
                    </div>
                </div>
                <div class="detail_row">
                    <div class="detail_name">
                        {{'page.prod_finishdate'|_}}:
                    </div>
                    <div class="detail_value red">
                        {{offer.ends_at|date('d/m/Y')}}
                    </div>
                </div>
            </div>
            <div class="detail_other">
                <div class="detail_row">
                    <div class="detail_name">
                        {{'page.prod_mark'|_}}:
                    </div>
                    <div class="detail_value">
                        {{offer.mark}}
                    </div>
                </div>
                <div class="detail_row">
                    <div class="detail_name">
                        {{'page.prod_vendor'|_}}:
                    </div>
                    <div class="detail_value">
                        {{offer.manufacturer}}
                    </div>
                </div>
                <div class="detail_row">
                    <div class="detail_name">
                        {{'page.prod_vendor_country'|_}} :
                    </div>
                    <div class="detail_value">
                        {{offer.country}}
                    </div>
                </div>
                <div class="detail_row">
                    <div class="detail_name">
                        {{'page.market_type'|_}}
                    </div>
                    <div class="detail_value">
                        {% if offer.market_type == 'in' %}
                            {{'page.market_type_option_in'|_}}
                        {% endif %}
                        {% if offer.market_type == 'out' %}
                            {{'page.market_type_option_out'|_}}
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="detail_description">
    <div class="description_title">
        {{'page.prod_desc'|_}}:
    </div>
    <div class="detail_text">
        {{offer.description}}
    </div>
</div>
<div class="detail_table">
    <div class="table_group">
        <div class="title_item">
            {{'page.measure'|_}}
        </div>
        <div class="table_item">
            {{offer.measure.name}}
        </div>
    </div>
    <div class="table_group">
        <div class="title_item">
            {{'page.payment_cond'|_}}
        </div>
        <div class="table_item">
            {{offer.payment_term.name}}
        </div>
    </div>
    <div class="table_group">
        <div class="title_item">
            {{'page.delivery_cond'|_}}
        </div>
        <div class="table_item">
            {{offer.delivery_term.name}}
        </div>
    </div>
    <div class="table_group">
        <div class="title_item">
            {{'page.delivery_point'|_}}
        </div>
        <div class="table_item">
            {{offer.place}}
        </div>
    </div>
    <div class="table_group">
        <div class="title_item">
            {{'page.packaging'|_}}
        </div>
        <div class="table_item">
            {{offer.packaging ? (offer.packaging == 'yes' ? 'Есть' : 'Нет') : ''}}
        </div>
    </div>
</div>
<div class="detail_buttons">
    <a href="#" class="btn btn--green seller_btn">
        {{'page.seller_cont'|_}}
    </a>
    <div class="btn_group">
        {% if account.user and account.user.id != offer.vendor.id %}
            <a href="{{ 'kabinet/messages'|page }}?seller_id={{offer.vendor.id}}" class="btn btn--blue">
                {{'page.message_to_seller'|_}}
            </a>
        {% endif %}
    </div>
</div>

<div class="seller_info">
    <div class="seller_inner">
        <div class="seller_title">
            {{'page.seller_cont'|_}}
        </div>
        <div class="sller_box">
            <div class="seller_row">
                <div class="seller_icon">
                    <img src="{{'assets/images/svg/seller-profile.svg'|theme}}" alt="icon">
                </div>
                <div class="seller_group">
                    <div class="seller_label">
                        {{'page.fio'|_}}
                    </div>
                    <div class="seller_text">
                        {{offer.vendor.name}} {{offer.vendor.surname}}
                    </div>
                </div>
            </div>
            <div class="seller_row">
                <div class="seller_icon">
                    <img src="{{'assets/images/svg/seller-phone.svg'|theme}}" alt="icon">
                </div>
                <div class="seller_group">
                    <div class="seller_label">
                        {{'footer.tel'|_}}:
                    </div>
                    <div class="seller_text">
                        {{offer.vendor.username}}
                    </div>
                </div>
            </div>
            <div class="seller_row">
                <div class="seller_icon">
                    <img src="{{'assets/images/svg/seller-mail.svg'|theme}}" alt="icon">
                </div>
                <div class="seller_group">
                    <div class="seller_label">
                        E-mail:
                    </div>
                    <div class="seller_text">
                        {{offer.vendor.email}}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{% endif %}
