
{% set categories = __SELF__.categories %}
{% set subcategories = __SELF__.subcategories %}
{% set states = __SELF__.states %}
{% set cities = __SELF__.cities %}
{% set productIdOption = __SELF__.productIdOption %}

<!-- Add post ============================================================= -->
<section class="post">
    <div class="auto_container">
        {% if user.is_activated  %}
        <div class="post_wrap" id="form-steps">
            <div class="contact_title">
                {{'account.add_post'|_({ step_number: 1 })}} {{productForEditing.name}}
            </div>

            <form action="#"
                data-request="onSave"
                data-request-validate
                data-request-flash
                class="post_form post_form-2 first-step-form">

                {% if productForEditing %}
                    <input type="hidden" name="productForEditing" value="{{productForEditing.id}}">
                {% endif %}

                <!-- ru name -->
                <div class="post_input">
                    <label>{{'account.lot_title'|_}} (RU) <span>*</span></label>
                    <input type="text" name="name_ru" data-belongsto="product" placeholder="{{'page.example'|_}}: Гидравлическое масло"
                        {% if productForEditing %}
                         value="{{ productForEditing.lang('ru').name }}"
                        {% endif %}
                    >
                    <span class="error_txt" data-validate-for="name_ru"></span>
                </div>
                <!-- en name -->
                <div class="post_input">
                    <label>{{'account.lot_title'|_}} (EN) <span>*</span></label>
                    <input type="text" name="name_en" data-belongsto="product" placeholder="{{'page.example'|_}}: Hydraulic oil"
                        {% if productForEditing %}
                         value="{{ productForEditing.lang('en').name }}"
                        {% endif %}
                    >
                    <span class="error_txt" data-validate-for="name_en"></span>
                </div>
                <!-- tm name -->
                <div class="post_input">
                    <label>{{'account.lot_title'|_}} (TM) <span>*</span></label>
                    <input type="text" name="name_tm" data-belongsto="product" placeholder="{{'page.example'|_}}: Gidrawlika ýagy"
                        {% if productForEditing %}
                        value="{{ productForEditing.lang('tm').name }}"
                        {% endif %}
                    >
                    <span class="error_txt" data-validate-for="name_tm"></span>
                </div>

                <div class="post_input">
                    <label for="mark-goods">{{'page.prod_mark'|_}} <span>*</span></label>
                    <input type="text" name="mark" data-belongsto="product" placeholder="{{'page.example'|_}}: {{'account.mark_example'|_}}" id="mark-goods"
                        {% if productForEditing %}
                        value="{{ productForEditing.mark }}"
                        {% endif %}
                    >
                    <span class="error_txt" data-validate-for="mark"></span>
                </div>

                <div class="post_input">
                    <label for="owner">{{'page.prod_vendor'|_}} <span>*</span></label>
                    <input type="text" name="manufacturer" data-belongsto="product" placeholder="{{'page.example'|_}}: {{'account.mark_example'|_}}" id="owner"
                        {% if productForEditing %}
                        value="{{ productForEditing.manufacturer }}"
                        {% endif %}
                    >
                    <span class="error_txt" data-validate-for="manufacturer"></span>
                </div>

                <div class="post_input p-b">
                    <label>{{'account.category'|_}} <span>*</span>  </label>
                    <div class="my-select">
                        <select class="category-select" data-belongsto="product" name="category_id">
                            <option value="0">{{'account.category'|_}}</option>
                            {% for c in categories %}
                            <option value="{{ c.id }}"
                                {% if productForEditing and productForEditing.categories.first.id == c.id %}
                                    selected
                                {% endif %}
                            >{{ c.name }}</option>
                            {% endfor %}
                        </select>
                        <span class="error_txt" data-validate-for="category_id"></span>
                    </div>
                </div>

                <div class="post_input">
                    <label>{{'page.prod_vendor_country'|_}} <span>*</span></label>
                    <input type="text" name="country" data-belongsto="product" placeholder="{{'page.example'|_}}: Türkmenistan"
                        {% if productForEditing %}
                        value="{{ productForEditing.country }}"
                        {% endif %}
                    >
                    <span class="error_txt" data-validate-for="country"></span>
                </div>

                <div class="post_input p-b">
                    <label>{{'page.market_type'|_}} <span>*</span> </label>
                    <div class="my-select">
                        <select name="market_type" data-belongsto="product">
                            <option value="0">{{'page.market_type'|_}}</option>
                            <option value="in"
                                {% if productForEditing and productForEditing.market_type == 'in' %}
                                    selected
                                {% endif %}
                            >{{'page.market_type_option_in'|_}}</option>
                            <option value="out"
                                {% if productForEditing and productForEditing.market_type == 'out' %}
                                    selected
                                {% endif %}
                            >{{'page.market_type_option_out'|_}}</option>
                        </select>
                        <span class="error_txt" data-validate-for="market_type"></span>
                    </div>
                </div>

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

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

            </form>

        </div>
        {% else %}
        <div class="post_wrap">
            <div class="contact_title">
                {{'account.activation_required'|_}}
            </div>
        </div>
        {% endif %}
    </div>
</section>
<!-- Add post end ========================================================= -->


