{% extends "int/base.html" %}
{% load extras %}


{% block css %}
    {% include "ext/enquiry_published/body.css" %}
    {% include "int/quote_products/body.css" %}
{% endblock %}

{% block content %}

    <tr>
        <td class="letter__title letter__line center"><p><a href="{% base_url "internal" %}/{{ enquiry.key }}/proposals?proposal={{ quote.id }}">Новое предложение</a> от «{{ supplier.title }}»</p></td>
    </tr>


    <tr>
        <td class="letter__line letter__subject">
            <a class="subject text" href="{% base_url "internal" %}/{{ enquiry.key }}">{{ enquiry.key }}: {{ enquiry.subject }}</a>
        </td>
    </tr>

    <tr>
        <td class="letter__line letter__products">
            <table class="products table" border="0" cellspacing="0" cellpadding="0" width="100%">
                <tbody>
                    <tr>
                        <th class="products__header left">Наименование</th>
                        <th class="products__header right">Кол-во</th>
                        <th class="products__header right">Цена</th>
                    </tr>
                    {% for product in products %}
                        <tr class="{% if product.is_replacement %}replacement{% endif %}">
                            <td class="products__cell products__name left {% if product.is_replacement %}replacement_cell{% endif %}">
                                <p class="text">{{ product.name }}</p>
                                <p class="note text">{{ product.comment | urlize }}</p>
                            </td>
                            <td class="products__cell products__qty right">
                                {% if "qty" in product %}
                                    {{ product.qty }} из {{ product.qty_expected }}
                                {% endif %}
                            </td>
                            <td class="products__cell products__price right">
                                <p>{{ product.price }}</p>
                                <p class="note text">{{ product.delivery_time }}</p>
                            </td>
                        </tr>
                    {% endfor %}
                <tbody>
            </table>
        </td>
    </tr>

    <tr>
        <td class="letter__line letter__proposal">
            <table class="table" border="0" cellspacing="0" cellpadding="0" width="100%">
                <tbody>
                    <tr>
                        <td class="center comment">
                            <p>Приведены цены за единицу позиции с учётом налогов.</p>
                        </td>
                    </tr>
                <tbody>
            </table>
        </td>
    </tr>
    
    {%  if quote.terms.comment %}
    <tr>
        <td class="letter__line letter__attrs">
            <table class="attrs table" border="0" cellspacing="0" cellpadding="0" width="100%">
                <tbody>
                    <tr>
                        <td class="attrs__cell attrs__key">Условия оплаты</td>
                        <td class="attrs__cell attrs__value text">{{ quote.terms.comment }}</td>
                    </tr>
                <tbody>
            </table>
        </td>
    </tr>
    {% endif %}

{% endblock %}
