<!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 Against Job Card</h3>
                    <form th:action="@{/cutting/receive-inventory}"
                          method="POST"
                          id="receiveInvApp"
                         th:object="${wrapper}">
                        <div class="bg-light p-3 mb-3">
                            <div class="form-row">
                                <div class="col-sm-3 p-0">
                                    <job-card-search v-bind:label-text="'Job Card'"
                                                     v-bind:id-field-name="'job-card-id'"
                                                     v-on:job-card-select="onCardSelect"
                                                     v-bind:required="true"
                                    ></job-card-search>

                                </div>
<!--                                <div class="col-sm-3">-->
<!--                                    <label>Cutting 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" v-if="jobCard.id !== undefined">
                            <h6>Job Card Details</h6>
                            <table class="table table-bordered bg-white col-sm-12">
                                <thead>
                                    <tr>
                                        <th>Code</th>
                                        <th>Job Order ID</th>
                                        <th>Status</th>
                                        <th>Inventory Status</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td> {{jobCard.code}}</td>
                                        <td>{{jobCard.jobOrderId}}</td>
                                        <td>
                                            <span class="badge" v-bind:class="getStatus"  v-if="jobCard.status" >{{jobCard.status}}</span>
                                        </td>
                                        <td>
                                            <span class="badge" v-bind:class="getInvStatus"  v-if="jobCard.inventoryStatus" >{{jobCard.inventoryStatus}}</span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <job-card-details
                                v-bind:job-card="jobCard">
                            </job-card-details>
                        </div>
                        <div>
                            <button class="btn btn-primary" type="submit">Receive Inventory</button>
                            <a th:href="@{/cutting/receive-inventory}" class="btn btn-light">Cancel</a>
                        </div>
                    </form>
                    <script th:inline="javascript">
                        window.ctp.types = [[${cutPieceTypes}]]
                        window.ctp.accounts = [[${accounts}]]
                    </script>
                    <script th:src="@{/js/vendor/compressor.min.js}"></script>
                    <script th:src="@{/js/receive-inventory.js}"></script>
                </div>
            </main>
        </div>
        <div th:replace="_fragments :: page-footer-scripts"></div>
    </body>
</html>