{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <form method="POST" action="{{ path('material_requisition_purchase_invoice_credit_payment_form', {purchaseInvoice_id: purchaseInvoice_id, action: action, id: id }) }}">
        <div class="row max-width-initial">
            <div class="large-6 columns">
                <p class="form-hint-text">Enter basic information below</p>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.payment_date) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.payment_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.payment_method) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.payment_method) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.amount) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.amount) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.remark) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.remark) }}
                    </div>
                </div>
            </div>
            <div class="large-6 columns">
                <p class="form-hint-text">Enter other information below</p>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.check_no) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.check_no) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.check_date) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.check_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.cleared_date) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.cleared_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.bank_description) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.bank_description) }}
                        {{ form_widget(form.bank_id) }}
                    </div>
                </div>
            </div>
            <div class="small-12 columns">
                Amount to be paid : {{ purchaseInvoice.totalcreditpaymentbalance|number_format(2,'.',',') }}
                <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 Purchase Invoice Credit Payment 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_purchase_invoice_view', {id: purchaseInvoice_id}) }}" class="button secondary">Back</a>
                </div>
            </div>
        </div>

        {{ form_widget(form.purchaseInvoice_id) }}
        {{ form_widget(form.action) }}
        {{ form_widget(form.id) }}
        {{ form_widget(form._token) }}
    </form>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        jQ(document).ready(function(){
            purchaseInvoiceCreditPayment_form.settings.bank_autocomplete_url = '{{ path('bank_autocomplete') }}';
            purchaseInvoiceCreditPayment_form.init();
        });
        //]]>
    </script>
{% endblock %}