{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <form method="POST" action="{{ path('item_form', {action: action, id: id}) }}">
        <div class="row max-width-initial">
            <div class="large-6 columns">
                <h5>Basic information</h5>
                <p class="form-hint-text">Enter basic information below</p>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.supplier_desc) }}
                    </div>
                    <div class="large-9 columns">
                        <small class="float-right"><a href="{{ path('supplier_form') }}" target="_blank">Add Supplier</a></small>
                        {{ form_widget(form.supplier_desc) }}
                        {{ form_widget(form.supplier) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.itemSubCategory) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.itemSubCategory) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_widget(form.item_company) }}
                        {{ form_label(form.item_company_desc) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.item_company_desc) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.code) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.code) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.code2) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.code2) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.brand) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.brand) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.type) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.type) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.description) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.description) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.start_date) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.start_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.end_date) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.end_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.item_size) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.item_size) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.item_unit) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.item_unit) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.is_package) }}
                        {{ form_label(form.is_package) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.is_itemised) }}
                        {{ form_label(form.is_itemised) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.is_non_inventory) }}
                        {{ form_label(form.is_non_inventory) }}
                    </div>
                </div>
            </div>
            <div class="large-6 columns">
            </div>
            <div class="small-12 columns">
                <hr class="max-width-initial">
                <div class="button-container">
                    <button type="submit" class="button just-continue" name="action" value="{{ action }}"
                            data-message="Are you sure you want to save this information?"
                    >Save</button>
                    {% if action == 'u' and (userData.type == 'Super Admin' or 'Admin Items Delete' in userData.accesses) %}
                        <button type="submit" class="ask-continue button alert" name="action" value="d"
                                data-message="Are you sure you want to delete this record?"
                        >Delete</button>
                    {% endif %}
                    <a href="{{ path('item') }}" class="button secondary">Back</a>
                </div>
            </div>
        </div>
        {{ form_widget(form.action) }}
        {{ form_widget(form.id) }}
        {{ form_widget(form._token) }}
    </form>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        item_form.settings.company_autocomplete_url = '{{ path('company_autocomplete') }}';
        item_form.settings.supplier_autocomplete_url = '{{ path('supplier_autocomplete') }}';
        jQ(document).ready(function(){
            item_form.init();
        });
        //]]>
    </script>
{% endblock %}