{% extends "base.html" %}

{% block content %}
<body id="page-top">

    <!-- Page Wrapper -->
    <div id="wrapper">

        {% include "nav.html" %}

        <!-- Content Wrapper -->
        <div id="content-wrapper" class="d-flex flex-column">


            <!-- Main Content -->
            <div id="content">


                <!-- Begin Page Content -->
                <div class="container-fluid">

                    <!-- Page Heading -->
                    <h1 class="h3 mb-2 text-gray-800">{{ warehouse_name }}</h1>
                        <p class="mb-4">Order Listing</p>
                        <!-- Filter -->
                        <div class="card shadow mb-4">
                            <!-- Card Header - Accordion -->
                            <a class="d-block card-header py-3">
                                <h6 class="m-0 font-weight-bold text-primary">Filter</h6>
                            </a>
                            <!-- Card Content - Collapse -->
                            <form method="get" class="px-2">
                                <div class="row g-3 align-items-center mx-2 my-4">
                                        {{ filter.form.as_p }}
                                    <div class="col-auto">
                                        <button type="submit" class="btn btn-primary">Filter</button>
                                    </div>
                                    <div class="col-auto">
                                        <a href={{ request.path }} class="btn btn-danger">
                                            <i class="fas fa-trash"></i> Clear Filter
                                        </a>
                                    </div>
                                </div>
                            </form>
                        </div>
                        
                        

                        <!-- End Filter -->

                    <!-- DataTales Example -->
                    <div class="card shadow mb-4">
                        <div class="card-header py-3">
                            <h6 class="m-0 font-weight-bold text-primary">Order</h6>
                        </div>
                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                                    <thead>
                                        <tr>
                                            <th>Transfer From</th>
                                            <th>Transfer To</th>
                                            <th>Item Name</th>
                                            <th>Quantity</th>
                                            <th>Updated Time</th>
                                        </tr>
                                    </thead>
                                    <tfoot>
                                        <tr>
                                            <th>Transfer From</th>
                                            <th>Transfer To</th>
                                            <th>Item Name</th>
                                            <th>Quantity</th>
                                            <th>Updated Time</th>
                                        </tr>
                                    </tfoot>
                                    <tbody>
                                        {% if filter.is_bound %}
                                            {% for transfer in filter.qs %}
                                            <tr>
                                                {% comment %} <td><a href={% url "inventory"  wid=warehouse_id iid=inventory.id %}>{{ inventory.stock_identifier }}<a/></td> {% endcomment %}
                                                <td>{{ transfer.from_warehouse }}</td>
                                                <td>{{ transfer.to_warehouse }}</td>
                                                <td>{{ transfer.item }}</td>
                                                <td>{{ transfer.quantity }}</td>
                                                <td>{{ transfer.update_time }}</td>
                                            </tr>
                                            {% endfor %}
                                        {% else %}
                                            {% for transfer in transfer_list %}
                                            <tr>
                                                {% comment %} <td><a href={% url "inventory" wid=warehouse_id iid=inventory.id %}>{{ inventory.stock_identifier }}<a/></td> {% endcomment %}
                                                <td>{{ transfer.from_warehouse }}</td>
                                                <td>{{ transfer.to_warehouse }}</td>
                                                <td>{{ transfer.item }}</td>
                                                <td>{{ transfer.quantity }}</td>
                                                <td>{{ transfer.update_time }}</td>
                                            </tr>
                                            {% endfor %}
                                        {% endif %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>

                </div>
                <!-- /.container-fluid -->

            </div>
            <!-- End of Main Content -->


        </div>
        <!-- End of Content Wrapper -->

    </div>
    <!-- End of Page Wrapper -->

    <!-- Scroll to Top Button-->
    <a class="scroll-to-top rounded" href="#page-top">
        <i class="fas fa-angle-up"></i>
    </a>

    {% include "footer.html" %}

</body>
{% endblock content %}