{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <div class="row max-width-initial">
        <div class="small-12 columns">
            <div class="content-container has-loading">
                <div class="content-container-content hide">
                    <div class="row max-width-initial">
                        <div class="large-3 medium-3 columns">
                            <div class="input-group">
                                <label class="input-group-label">Branch</label>
                                <select class="input-group-field" id="inventoryFilter-branch">
                                    <option value="all">All</option>
                                    {% for branch in branches %}
                                        <option value="{{ branch.idencoded }}">{{ branch.description }}</option>
                                    {% endfor %}
                                </select>
                            </div>
                        </div>
                        <div class="large-3 medium-3 columns">
                            <div class="input-group">
                                <label class="input-group-label">Location</label>
                                <select class="input-group-field" id="inventoryFilter-location">
                                    <option class="{% for branch in branches %} {{ branch.idencoded ~ ' ' }} {% endfor %} all" value="all">All</option>
                                    {% for branch in branches %}
                                        {% for location in branch.locations %}
                                            <option class="{{ branch.idencoded }}" value="{{ location.idencoded }}">{{ location.description }}</option>
                                        {% endfor %}
                                    {% endfor %}
                                </select>
                            </div>
                        </div>
                        <div class="large-3 medium-3 columns">
                            <div class="input-group">
                                <label class="input-group-label">Status</label>
                                <select class="input-group-field" id="inventoryFilter-status">
                                    <option value="all">All</option>
                                    {% for inventoryStatus in inventoryStatuses %}
                                        <option value="{{ inventoryStatus }}" {{ inventoryStatus == 'Stock On Hand' ? 'selected' : '' }}>{{ inventoryStatus }}</option>
                                    {% endfor %}
                                </select>
                            </div>
                        </div>
                        <div class="large-3 medium-3 columns text-right">
                            {% if userData.type == 'Super Admin' or 'Admin Inventory New' in userData.accesses %}
                                <label class="middle"><a class="href-new-action" href="{{ path('inventory_form') }}">New Inventory</a></label>
                            {% endif %}
                            {# {% if userData.type == 'Super Admin' or 'Admin Inventory Export To Excel' in userData.accesses %}
                                <a href="javascript:void(0)" class="execute-report" data-url="admin/report/inventory/export_to_excel" data-paramsids="inventoryFilter-branch|inventoryFilter-location|inventoryFilter-status">Export CSV</a>
                            {% endif %} #}
                        </div>
                    </div>
                    <table class="display responsive" id="inventory-datalist" width="100%">
                        <thead>
                        <tr>
                            <th>Branch</th>
                            <th>Location</th>
                            <th>Item</th>
                            <th>Status</th>
                            <th>Quantity</th>
                            <th>Action</th>
                        </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script language="javascript">
        //<![CDATA[
        jQ(document).ready(function(){
            report.init('{{ app.environment }}');
            inventory.settings.ajaxUrl = '{{ path('inventory_ajax_list') }}';
            inventory.init();
        });
        //]]>
    </script>
{% endblock %}