<div class="contact_title">
    {{'account.add_post'|_({ step_number: 2 })}}
</div>

<form action="#" class="post_form" enctype="multipart/form-data"
    data-request="onOfferFill"
    data-request-validate
    data-request-flash
    data-request-files
>
    <input type="hidden" name="product_id" value="{{product.id}}">

    <div class="post_input p-b">
        <label>{{'page.measure'|_}} <span>*</span> </label>
        <div class="my-select">
            <select name="measure_id">
                <option value="">{{'page.measure'|_}}</option>
                {% for m in measures %}
                <option value="{{m.id}}"
                    {% if product.measure.id == m.id %}
                        selected
                    {% endif %}
                >{{m.name}}</option>
                {% endfor %}
            </select>
            <span class="error_txt" data-validate-for="measure_id"></span>
        </div>
    </div>

    <div class="post_input">
        <label for="good-count">{{'page.prod_amount_2'|_}} <span>*</span> </label>
        <input type="number" step="0.01" name="quantity" placeholder="{{'page.example'|_}}: {{'account.quantity_example'|_}}" id="good-count"
        value="{{ product.quantity }}">
        <span class="error_txt" data-validate-for="quantity"></span>
    </div>

    <div class="post_input p-b">
        <label>{{'account.currency'|_}}  <span>*</span> </label>
        <div class="my-select">
            <select name="currency_id">
                <option value="">{{'account.currency'|_}}</option>
                {% for currency in currencies %}
                <option value="{{currency.id}}"
                    {% if product.currency.id == currency.id %}
                        selected
                    {% endif %}
                >{{currency.name}}</option>
                {% endfor %}
            </select>
            <span class="error_txt" data-validate-for="currency_id"></span>
        </div>
    </div>

    <div class="post_input">
        <label for="good-cost">{{'page.prod_price'|_}} <span>*</span> </label>
        <input type="text" name="price" placeholder="{{'page.example'|_}}: 120" id="good-cost"
        value="{{ product.price }}">
        <span class="error_txt" data-validate-for="price"></span>
    </div>

    <div class="post_input p-b">
        <label>{{'page.delivery_cond'|_}} <span>*</span> </label>
        <div class="my-select">
            <select name="delivery_term_id">
                <option value="">{{'page.delivery_cond'|_}}</option>
                {% for dt in deliveryTerms %}
                <option value="{{dt.id}}"
                    {% if product.delivery_term.id == dt.id %}
                        selected
                    {% endif %}
                >{{dt.name}}</option>
                {% endfor %}
            </select>
            <span class="error_txt" data-validate-for="delivery_term_id"></span>
        </div>
    </div>

    <div class="post_input">
        <label for="good-cost">{{'page.delivery_point'|_}} <span>*</span> </label>
        <input type="text" name="place" placeholder="{{'page.example'|_}}: {{'account.delivery_point_example'|_}}" id="good-cost"
        value="{{ product.place }}">
        <span class="error_txt" data-validate-for="place"></span>
    </div>

    <div class="post_input p-b">
        <label>{{'page.packaging'|_}} <span>*</span></label>
        <div class="my-select">
            <select name="packaging">
                <option value="">{{'page.packaging'|_}}</option>
                <option value="yes"
                    {% if product.packaging == "yes" %}
                        selected
                    {% endif %}
                >{{'page.packaging_yes'|_}}</option>
                <option value="no"
                    {% if product.packaging == "no" %}
                        selected
                    {% endif %}
                >{{'page.packaging_no'|_}}</option>
            </select>
            <span class="error_txt" data-validate-for="packaging"></span>
        </div>
    </div>

    <div class="post_input p-b">
        <label>{{'page.payment_cond'|_}}  <span>*</span></label>
        <div class="my-select">
            <select name="payment_term_id">
                <option value="">{{'page.payment_cond'|_}}</option>
                {% for pt in paymentTerms %}
                <option value="{{pt.id}}"
                    {% if product.payment_term.id == pt.id %}
                        selected
                    {% endif %}
                >{{pt.name}}</option>
                {% endfor %}
            </select>
            <span class="error_txt" data-validate-for="payment_term_id"></span>
        </div>
    </div>

    <div class="post_comment">
        <label for="description_ru">{{'page.prod_desc'|_}} (RU) <span>*</span></label>
        <textarea id="description_ru" name="description_ru">{{product.lang('ru').description}}</textarea>
        <span class="error_txt" data-validate-for="description_ru"></span>
    </div>
    <div class="post_comment">
        <label for="description_en">{{'page.prod_desc'|_}} (EN) <span>*</span></label>
        <textarea id="description_en" name="description_en">{{product.lang('en').description}}</textarea>
        <span class="error_txt" data-validate-for="description_en"></span>
    </div>
    <div class="post_comment">
        <label for="description_tm">{{'page.prod_desc'|_}} (TM) <span>*</span></label>
        <textarea id="description_tm" name="description_tm">{{product.lang('tm').description}}</textarea>
        <span class="error_txt" data-validate-for="description_tm"></span>
    </div>

    <div class="post_upload_box">

        {% for i in 0..2 %}
        <div class="post_upload_item">
            {% if product.images[i] %}
            <div class="post_upload_img">
                <img src="{{ product.images[i].thumb(347,150,{'mode':'crop'}) }}" alt="photo">
                <input type="hidden" name="old_img[{{i}}]">
            </div>
            {% endif %}

            <div class="post_input">
                {% if not product.images[i] %}
                <label>{{'account.upload_photo'|_}} #{{i+1}} <span>*</span></label>
                <div class="upload_group">
                    <label for="file-{{i}}">{{'account.upload_photo'|_}}</label>
                    <div class="form_group">
                        <label class="additional">
                            <span>{{'account.nothing_chosen'|_}}</span>
                        </label>
                        <input type="file"
                            name="new_img[{{i}}]"
                            id="file-{{i}}" class="inputfile inputfile-1"
                            data-multiple-caption="{count} files selected"
                        />
                    </div>
                </div>
                {% else %}
                <a href="#"
                    data-request="onImageDelete"
                    data-request-data="being_edited_product_id: {{product.id}}, product_image_id: {{product.images[i].id}}"
                    class="select_delete delete-btn">
                    <img src="{{'assets/images/svg/red-close.svg'|theme}}" alt="">
                </a>
                {% endif %}
            </div>
        </div>
        {% endfor %}
    </div>

    <span class="error_txt t-c" data-validate-for="no_images"></span>
    <span class="error_txt t-c" data-validate-for="new_img_size_error"></span>
    <span class="error_txt t-c" data-validate-for="new_img_type_error"></span>

    <div class="btn_bg">
        <button class="post_btn" type="submit">
            {{'account.step'|_({ step_number: 3 })}}
        </button>
    </div>

    <div class="add_post_text">
        {{'account.required_fields'|_}}
    </div>

</form>



<script src="{{ 'assets/js/custom-file-input.js'|theme }}"></script>
<script src="{{ 'assets/js/scrollTopOnSteps.js'|theme }}"></script>

