{% set userData = app.session.get('userData') %}
<h5>{{ page_title }}</h5>
{#<form method="POST" id="form-patientPayment-void">
    {% if form.action.vars.value|default('') == 'u' and patientPayment.paymentStatus|default('') != 'Void' and (userData.type == 'Super Admin' or 'Admin Patient Payment Void' in userData.accesses) %}
        <a href="javascript:void(0)" class="button href-patient-payment-void-action" data-axn="{{ form.action.vars.value }}" style="background-color: grey">Void</a>
        <input type="hidden" value="{{ form.id.vars.value|default('') }}" name="patientPayment[id]"/>
        <input type="hidden" value="{{ form.action.vars.value }}" name="patientPayment[action]"/>
    {% endif %}
</form>#}
<form method="POST" id="form-patientRefund">
    <div id="flash-messages-content-modal"></div>
    <div class="row max-width-initial">
        <div class="large-6 columns">
            <h5 class="subheader">Basic information</h5>
            <p class="form-hint-text">Enter basic information below</p>
            {% if  form.action.vars.value|default('') != 'u'  %}
                <div class="row">
                    <div class="large-5 columns text-right">
                        {{ form_label(form.patientBilling) }}
                    </div>
                    <div class="large-7 columns">
                        {{ form_widget(form.patientBilling) }}
                    </div>
                </div>
            {% else %}
                <div class="row">
                    <div class="large-5 columns text-right">
                        <label class="required middle required">Invoice No.</label>
                    </div>
                    <div class="large-7 columns">
                        {% if patientRefund.patientBilling %}
                            <input type="text" readonly value="{{ patientRefund.patientBilling ? patientRefund.patientBilling.invoiceNo|default(patientRefund.patientBilling.prevSysInvoiceNo) : patientRefund.patientBilling.prevSysInvoiceNo }} - {{ patientRefund.patientBilling.billingDateAsString }}  - {{ patientRefund.patientBilling.amountBalance }}">
                        {% else %}
                            <input type="text" readonly value="{{ patientRefund.prevSysInvoiceNo ~ ' - ' ~ patientRefund.prevSysInvoiceBranch }}">
                        {% endif %}
                        {{ form_widget(form.patientBilling, {attr: {class: 'hide'}}) }}
                    </div>
                </div>
                {#<input type="hidden" name="patientPayment[patientBilling]" value="{{ patientPayment.patientBilling.id }}">#}
            {% endif %}

            <div class="row">
                <div class="large-5 columns text-right">
                    {{ form_label(form.refund_date) }}
                </div>
                <div class="large-7 columns">
                    {{ form_widget(form.refund_date) }}
                </div>
            </div>
            <div class="row">
                <div class="large-5 columns text-right">
                    {{ form_label(form.amount) }}
                </div>
                <div class="large-7 columns">
                    {{ form_widget(form.amount) }}
                </div>
            </div>
        </div>
        <div class="large-6 columns">
            <h5 class="subheader">Other Information</h5>
            <p class="form-hint-text">Enter other information below</p>
            {{ form_label(form.note) }}
            {{ form_widget(form.note) }}
        </div>
    </div>
    <hr>
    <div class="row-max-width-initial">
        <div class="small-12 columns no-padding-right">
            <div class="button-container text-right">

                {#{% if action == 'n' and (userData.type == 'Super Admin' or 'Admin Patient Payment New' in userData.accesses) %}#}
                    <a href="javascript:void(0)" class="button just-continue href-patient-billing-refund-action" data-axn="{{ form.action.vars.value }}"
                       data-message="Are you sure you want to save this information?"
                       style="margin-left: 10px; margin-right: 0;"
                    >Save</a>
                {#{% endif %}#}
                {% if form.action.vars.value == 'u' and (userData.type == 'Super Admin' or 'Admin Patient Billing Refund Delete' in userData.accesses) %}
                    <a href="javascript:void(0)" class="ask-continue button alert href-patient-billing-refund-action" data-axn="d"
                       data-message="Are you sure you want to delete this record?"
                       style="margin-left: 10px; margin-right: 0;"
                    >Delete</a>
                {% endif %}
                <a href="javascript:void(0)" class="button secondary" data-close style="margin-left: 10px; margin-right: 0;">Close</a>
            </div>
        </div>
    </div>
    {{ form_widget(form.action) }}
    {{ form_widget(form.id) }}
    {{ form_widget(form.patient) }}
    {{ form_widget(form._token) }}
</form>