<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
    <head th:replace="_fragments :: head('Receive Inventory')"></head>
    <body>
        <div class="container-fluid">
            <header class="row page-header" th:replace="_fragments :: page-header"></header>
            <main class="row page-main">
                <div class="col-sm">
                    <div th:replace="_notices :: page-notices"></div>
                    <h3 class="pb-2">Receive Inventory</h3>
                    <form th:action="@{/stitching/receive-inventory}"
                          method="POST"
                          id="stitchingReceiveInventory">
                        <div class="bg-light p-3 mb-3">
                            <div class="form-row">
                                <div class="col-sm-3 p-0">
                                    <master-bundle-search
                                            v-bind:id-field-name="'master-id'"
                                            v-on:master-bundle-select="OnSelect"
                                            v-bind:required="true">
                                    </master-bundle-search>
                                </div>
                                <div class="col-sm-3">
                                    <label>Stitching Account</label>
                                    <select class="form-control" name="account-id" required>
                                        <option value="">Please Select</option>
                                        <option th:each="account :${accounts}"
                                                th:value="${account.id}"
                                                th:text="${account.title}"
                                                th:title="${account.notes}"></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="bg-light p-3 mb-3">
                            <h6>Bundles</h6>
                            <div class="form-row col-sm-6">
                                <table class="table mt-2 table-bordered table-hover bg-white">
                                    <tr>
                                        <th>Bundle ID</th>
                                        <th>Item ID</th>
                                        <th>Sku</th>
                                        <th>Type</th>
                                        <th>Job Card ID</th>
                                        <th>Wrap Qty</th>
                                    </tr>
                                    <tbody>
                                        <tr v-for="(bundle,i) in bundles">
                                            <td>{{bundle.id}}</td>
                                            <td>{{bundle.itemId}}</td>
                                            <td>{{bundle.sku}}</td>
                                            <td>{{bundle.type}}</td>
                                            <td>{{bundle.jobCardId}}</td>
                                            <td>{{bundle.wrapQuantity}}</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div>
                            <button class="btn btn-primary" type="submit">Receive Master Bundle</button>
                            <a th:href="@{/job-cards}" class="btn btn-light">Cancel</a>
                        </div>
                    </form>
                    <script th:inline="javascript">
                    </script>
                    <script th:src="@{/js/vendor/compressor.min.js}"></script>
                    <script th:src="@{/js/stitching/receive-inventory.js}"></script>
                </div>
            </main>
        </div>
        <div th:replace="_fragments :: page-footer-scripts"></div>
    </body>
</html>