{% set purchaseOrder = purchaseOrderBreakdown.purchaseOrder %}
{% set materialRequisition = purchaseOrder.materialRequisition %}
{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <div class="row max-width-initial">
        <div class="small-12 columns">
            <nav aria-label="You are here:" role="navigation">
                <ul class="breadcrumbs">
                    <li><a href="{{ path('material_requisition_purchase_order_breakdown_item_delivery') }}">Receive Order</a></li>
                    <li>
                        <span class="show-for-sr">Current: </span> Receive Order Info
                    </li>
                </ul>
            </nav>
            <div class="content-detail-container">
                <div class="row max-width-initial">
                    <div class="large-4 columns">
                        <div class="page-detail-header">P.O. Details</div>
                        {#<div class="page-detail">Batch No.: <span>{{ purchaseOrder.batchNo }}</span></div>#}
                        <div class="page-detail">P.O. Date: <span>{{ purchaseOrderBreakdown.poDateAsString }}</span></div>
                        <div class="page-detail">P.O. No.: <span>{{ purchaseOrderBreakdown.pono }}</span></div>
                        <div class="page-detail">Supplier: <span>{{ purchaseOrder.supplier.description|default('') }}</span></div>
                        {#<div class="page-detail">Status: <span>{{ purchaseOrderBreakdown.status }}</span></div>#}
                        <div class="page-detail">No. of Items: <span>{{ purchaseOrderBreakdown.purchaseOrderBreakdownItems.count }}</span></div>
                    </div>
                    <div class="large-4 columns">
                        <div class="page-detail-header">Purchase Request Details</div>
                        <div class="page-detail">Control No.: <span><a href="{{ path('material_requisition_view', {materialRequisition_id: materialRequisition.idEncoded}) }}">{{ materialRequisition.materialrequisitionno|default('N/A') }}</a></span></div>
                        <div class="page-detail">Request Date: <span>{{ materialRequisition.requestdateasstring|default('N/A') }}</span></div>
                        <div class="page-detail">Branch: <span>{{ materialRequisition.healthFacility.description|default('N/A') }}</span></div>
                        {#<div class="page-detail">Department: <span>{{ materialRequisition.department.description }}</span></div>#}
                        <div class="page-detail">Requested By: <span>{{ materialRequisition.accountUser.fullname|default('N/A') }}</span></div>
                    </div>
                    <div class="large-4 columns">
                        <div class="page-detail-header">&nbsp;</div>
                        <div class="page-detail">Purpose: <span>{{ materialRequisition.purpose.description|default('N/A') }}</span></div>
                        {#<div class="page-detail">Specific Purpose: <span>{{ materialRequisition.specificpurpose }}</span></div>#}
                        <div class="page-detail">Notes: <span>{{ materialRequisition.note|default('N/A') }}</span></div>
                    </div>
                </div>
            </div>
            <div class="content-container has-loading">
                <div class="content-container-content hide">
                    <div class="text-right button-container">
                        {% if purchaseOrderBreakdown.status == 'Sent' and (userData.type == 'Super Admin' or 'Admin Purchase Order Receive New' in userData.accesses) %}
                            <a href="javascript:void(0)" class="button small" id="href-purchaseOrderBreakdownItemDelivery-formAll" data-id="{{ purchaseOrderBreakdown.idencoded }}" style="margin: 0 0 10px 10px;">Receive Items</a>
                        {% endif %}
                        {#{% if userData.type == 'Super Admin' or 'Admin Purchase Order Receive Add Quantity' in userData.accesses %}
                            <a href="javascript:void(0)" class="button small success" id="href-purchaseOrderBreakdown-addQuantity" style="margin: 0 0 10px 10px;">Add Quantity</a>
                        {% endif %}#}
                        {#{% if purchaseOrderBreakdown.isvoidable and (userData.type == 'Super Admin' or 'Admin Purchase Order Receive Void' in userData.accesses) %}#}
                        {% if userData.type == 'Super Admin' or 'Admin Purchase Order Receive Void' in userData.accesses %}
                            <a href="javascript:void(0)" class="button small alert" id="href-purchaseOrderBreakdown-void"  style="margin: 0 0 10px 10px;">Void</a>
                        {% endif %}
                        {#{% if userData.type == 'Super Admin' or 'Admin Purchase Order Receive Purchase Order Print' in userData.accesses %}
                            <a href="{{ path('material_requisition_purchase_order_breakdown_print' , { purchaseOrderBreakdown_id : purchaseOrderBreakdown.id|base64Encode }) }}" class="button small primary" target="_blank" style="margin: 0 0 10px 10px;">Print PO</a>
                        {% endif %}
                        {% if userData.type == 'Super Admin' or 'Admin Purchase Order Receive Purchase Invoice Print' in userData.accesses %}
                            <a href="{{ path('material_requisition_purchase_invoice_print' , { purchase_invoice_id : purchaseOrderBreakdown.purchaseInvoice.id|base64Encode }) }}" class="button small primary" target="_blank" style="margin: 0 0 10px 10px;">Print RR</a>
                        {% endif %}#}
                        {#{% if purchaseOrderBreakdown.status == 'Sent' and (userData.type == 'Super Admin' or 'Admin Purchase Order Receive Cancel' in userData.accesses) %}
                            <a href="javascript:void(0)" class="button small alert" id="href-purchaseOrderBreakdownItemDelivery-cancel" data-id="{{ purchaseOrderBreakdown.idencoded }}" style="margin: 0 0 10px 10px;">Cancel PO</a>
                        {% endif %}#}
                    </div>
                    <table class="display responsive" id="purchaseOrderBreakdownItemDelivery-datalist" width="100%">
                        <thead>
                        <tr>
                            {#<th>Item</th>#}
                            {#<th>Doc No.</th>#}
                            {#<th>Qty Ordered</th>#}
                            {#<th>Qty Voided</th>#}
                            {#<th>Qty Already Received</th>#}
                            <th>Received Date</th>
                            <th>DR Date</th>
                            <th>DR No.</th>
                            <th>Invoice Date</th>
                            <th>Invoice No.</th>
                            <th>Item/s</th>
                            <th>Action</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="reveal large" id="modal" data-reveal data-close-on-esc="false" data-close-on-click="false">
        <div id="modal-content"></div>
        <button class="close-button" data-close aria-label="Close modal" type="button">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script language="javascript">
        //<![CDATA[
        purchaseOrderBreakdownItemDelivery_view.settings.purchaseOrderBreakdown_id = '{{ purchaseOrderBreakdown_id }}';
        purchaseOrderBreakdownItemDelivery_view.settings.ajaxUrl = '{{ path('material_requisition_purchase_order_breakdown_item_delivery_ajax_list') }}';
        purchaseOrderBreakdownItemDelivery_view.settings.voidUrl = '{{ path('material_requisition_purchase_order_breakdown_item_delivery_void') }}';
        purchaseOrderBreakdownItemDelivery_view.settings.voidActionUrl = '{{ path('material_requisition_purchase_order_breakdown_item_delivery_void_action') }}';
        purchaseOrderBreakdownItemDelivery_view.settings.addQuantityUrl = '{{ path('material_requisition_purchase_order_breakdown_item_delivery_add_quantity') }}';
        purchaseOrderBreakdownItemDelivery_view.settings.addQuantityActionUrl = '{{ path('material_requisition_purchase_order_breakdown_item_delivery_add_quantity_action') }}';
        purchaseOrderBreakdownItemDelivery_view.settings.purchaseOrderBreakdownItemDeliveryFormAll_url = '{{ path('material_requisition_purchase_order_breakdown_item_delivery_form_all') }}';
        purchaseOrderBreakdownItemDelivery_view.settings.purchaseOrderBreakdownItemDeliveryFormAllAction_url = '{{ path('material_requisition_purchase_order_breakdown_item_delivery_form_all_action') }}';
        purchaseOrderBreakdownItemDelivery_view.settings.purchaseOrderBreakdownItemDeliveryForm_url = '{{ path('material_requisition_purchase_order_breakdown_item_delivery_form') }}';
        purchaseOrderBreakdownItemDelivery_view.settings.purchaseOrderBreakdownItemDeliveryFormAction_url = '{{ path('material_requisition_purchase_order_breakdown_item_delivery_form_action') }}';
        // purchaseOrderBreakdownItemDelivery_view.settings.bank_autocomplete_url = '{{ path('bank_autocomplete') }}';
        jQ(document).ready(purchaseOrderBreakdownItemDelivery_view.init);
        //]]>
    </script>
{% endblock %}