<form id="frm-supplier-approval">
    <h5 class="draggable-reveal-header">Supplier {{ supplier.description }} Approval</h5>
    <div class="content-detail-container">
        <div class="row max-width-initial">
            <div class="large-4 columns">
                <div class="page-detail-header">Supplier Details</div>
                <div class="page-detail">Requested By:   <span>{{ requesterFullName|default('') }}</span></div>
            </div>
            <div class="large-4 columns">
                <div class="page-detail-header">&nbsp;</div>
                <div class="page-detail">Created At: <span>{{ supplier.createdAt|date('m/d/Y') }}</span></div>
                <div class="page-detail">Notes: <span>{{ supplier.note }}</span></div>
            </div>
            <div class="large-4 columns">
                <div class="page-detail-header">&nbsp;</div>
                <div class="page-detail">Status: <span>{{ supplier.status }}</span></div>
            </div>
        </div>
    </div>
    {% if supplier.status != 'Approved' and supplier.status != 'Rejected' %}
        <div class="large-5 columns">
            <p class="form-hint-text">Approval Details</p>
            <textarea name="form[note]" rows="3" placeholder="Enter your notes here..."></textarea>
            <input name="form[id]" type="hidden" value="{{ id }}" />
            <input name="form[axn]" type="hidden" />
        </div>
    {% endif %}
    <hr>
    <div class="button-container text-right">
        <a href="javascript:void(0)"
           class="button btn-supplier-approval-axn {{ supplier.status == 'Approved' or supplier.status == 'Rejected' ? 'disabled' : '' }}"
           data-axn="a">Approve</a>
        <a href="javascript:void(0)"
           class="button alert btn-supplier-approval-axn {{ supplier.status == 'Approved' or supplier.status == 'Rejected' ? 'disabled' : '' }}"
           data-axn="r">Reject</a>
        <a href="javascript:void(0)" class="button secondary no-margin-right" data-close>Cancel</a>
    </div>
</form>
<br>
<h5>Approval History</h5>
<table class="display response" id="supplierApprovalForm_approvalHistory-datalist" width="100%">
    <thead>
    <tr>
        <th>Date / Time</th>
        <th>Status</th>
        <th>Approval</th>
        <th>User</th>
        <th>Notes</th>
    </tr>
    </thead>
    <tbody>
    {% for ss in supplier.supplierStatuses %}
        {% if ss.approvaldescription == 'Approved' or ss.approvaldescription == 'Rejected' %}
            <tr>
                <td>{{ ss.updatedAt|date('m/d/Y h:i:s A') }}</td>
                <td>{{ ss.status }}</td>
                <td>{{ ss.approvaldescription }}</td>
                <td>{{ ss.user.fullname }} - {{ ss.user.type }}</td>
                <td>{{ ss.note }}</td>
            </tr>
        {% endif %}
    {% endfor %}
    </tbody>
</table>
