{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <form method="POST" action="{{ path('material_requisition_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-4 large-text-right columns">
                        {{ form_label(form.request_date) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.request_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.required_date) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.required_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.healthFacility_description) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.healthFacility_description) }}
                        {{ form_widget(form.healthFacility) }}
                    </div>
                </div>
                {#<div class="row">#}
                    {#<div class="large-4 large-text-right columns">#}
                        {#{{ form_label(form.department) }}#}
                    {#</div>#}
                    {#<div class="large-8 columns">#}
                        {#{{ form_widget(form.department) }}#}
                    {#</div>#}
                {#</div>#}
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.reference_no) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.reference_no) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.title) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.title) }}
                    </div>
                </div>
                {#<div class="row hide">#}
                    {#<div class="large-4 large-text-right columns">#}
                        {#{{ form_label(form.canvass_type) }}#}
                    {#</div>#}
                    {#<div class="large-8 columns">#}
                        {#{{ form_widget(form.canvass_type) }}#}
                    {#</div>#}
                {#</div>#}
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.purpose_description) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.purpose_description) }}
                        {{ form_widget(form.purpose) }}
                    </div>
                </div>
                {#<div class="row">#}
                    {#<div class="large-4 large-text-right columns">#}
                        {#{{ form_label(form.specific_purpose) }}#}
                    {#</div>#}
                    {#<div class="large-8 columns">#}
                        {#{{ form_widget(form.specific_purpose) }}#}
                    {#</div>#}
                {#</div>#}
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.note) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.note) }}
                    </div>
                </div>
                <div class="row {{ userData.type == 'Super Admin' ? '' : 'hide' }}">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.account_user_description) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.account_user, {attr: {value: userData.type == 'Super Admin' ? '' : userData.id}}) }}
                        {{ form_widget(form.account_user_description, {attr: {value: userData.type == 'Super Admin' ? '' : userData.fullName}}) }}
                    </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 Material Requisition 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('material_requisition') }}" 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>
        materialRequisition_form.settings.branch_autocomplete_url = '{{ path('health_facility_autocomplete') }}';
        materialRequisition_form.settings.purpose_autocomplete_url = '{{ path('purpose_autocomplete') }}';
        materialRequisition_form.settings.account_user_autocomplete_url = '{{ path('account_user_autocomplete') }}';
        jQ(document).ready(function(){
            materialRequisition_form.init();
        });
    </script>
{% endblock %}