{% set userData = app.session.get('userData') %}
<form id="form-transferInventoryItemDelivery" method="POST">
    <h4>{{ page_title }}</h4>
    <div id="flash-messages-content-modal"></div>
    <p class="form-hint-text">Enter basic information below</p>
    <div class="row max-width-initial medium-up-3">
        <div class="column">
            <h5 class="subheader">Item: <strong>{{ transferInventoryItem.item.description }}</strong></h5>
        </div>
        <div class="column">
            <h5 class="subheader">Required Quantity: <strong>{{ transferInventoryItem.quantity|number_format(0, '.', ',') }}</strong></h5>
        </div>
        <div class="column">
            <h5 class="subheader">Quantity Received: <strong>{{ transferInventoryItem.quantityreceived|number_format(0, '.', ',') }}</strong></h5>
        </div>
    </div>
    <hr class="max-width-initial">
    <div class="row large-up-2">
        {#<div class="column">
            <div class="row">
                <div class="large-4 large-text-right columns">
                    {{ form_label(form.location) }}
                </div>
                <div class="large-8 columns">
                    {{ form_widget(form.location) }}
                </div>
            </div>
        </div>#}
        <div class="columns large-6">
            <div class="row">
                <div class="large-4 large-text-right columns">
                    {{ form_label(form.receive_date) }}
                </div>
                <div class="large-8 columns">
                    {{ form_widget(form.receive_date) }}
                </div>
            </div>
            <div class="row">
                <div class="large-4 large-text-right columns">
                    {{ form_label(form.quantity) }}
                </div>
                <div class="large-8 columns">
                    {{ form_widget(form.quantity) }}
                </div>
            </div>
        </div>
        {% if transferInventoryItemDelivery.transferInventoryItem.item.isItemised %}
        <div class="columns large-6">
            <div class="row">
                <div class="large-4 large-text-right columns">
                    <label for="">Serial No/s</label>
                </div>
                <div class="large-8 columns">
                    {% for transferInventoryItemDeliveryInventorySerialNo in transferInventoryItemDelivery.getTransferInventoryItemDeliveryInventorySerialNos %}
                        <select name="transferInventoryDeliveryItemTransferInventoryItemInvSerialNo[]" class="select2" id="">
                            <option value="{{ transferInventoryItemDeliveryInventorySerialNo.transferInventoryDeliveryItemTransferInventoryItemInvSerialNo.id }}" selected>{{ transferInventoryItemDeliveryInventorySerialNo.getInventorySerialNo.getSerialNo }}</option>
                            {% for tisn in transferInventoryItemDelivery.transferInventoryItem.getDeliveredInventorySerialNosForSelectInputAsArray %}
                                {% set d = tisn|split('~') %}
                                <option value="{{ d[0] }}">{{ d[1] }}</option>
                            {% endfor %}
                        </select>
                    {% endfor %}
                </div>
            </div>
        </div>
        {% endif %}
    </div>
    <hr class="max-width-initial">
    <div class="row max-width-initial">
        <div class="small-12 columns no-padding-right">
            <div class="button-container clearfix">
                <button type="button" class="button just-continue href-transferInventoryItemDelivery-action float-right" 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 Order Receive Delete' in userData.accesses) %}
                    <button type="button" class="ask-continue button alert href-transferInventoryItemDelivery-action float-right" name="action" value="d"
                            data-message="Are you sure you want to delete this record?"
                    >Delete</button>
                {% endif %}
            </div>
        </div>
    </div>
    {{ form_widget(form.transferInventoryItem) }}
    {{ form_widget(form.action) }}
    {{ form_widget(form.id) }}
    {{ form_widget(form._token) }}
</form>

<script>
    jQ('.select2').select2({

    })
</script>