<!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" xmlns:ctp="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head('Home Page')"></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" th:fragment="cardFragment">
            <div th:replace="_notices :: page-notices"></div>
            <form th:action="${purchaseOrder.id} != null ? @{/purchase-order/edit/(id=${purchaseOrder.id})} : @{/purchase-order/edit}"
                  method="POST"
                  id="jobCardApp">
                <div class="bg-light p-3 mb-3">
                    <h6 class="mb-3">Info</h6>
                    <input hidden="hidden" th:field="${purchaseOrder.id}">
                    <input hidden="hidden" th:field="${purchaseOrder.createdAt}">
                    <input hidden="hidden" th:field="${purchaseOrder.createdBy}">
                    <div class="form-row">
                        <div class="col-sm-3 form-group">
                            <label>Purchase Order Code</label>
                            <input class="form-control" th:field="${purchaseOrder.purchaseOrderCode}" required>
                        </div>
                        <div class="col-sm-3 form-group">
                            <label>Purchase Order Quantity</label>
                            <input class="form-control" th:field="${purchaseOrder.purchaseOrderQuantity}" required>
                        </div>
                        <div class="col-sm-3 form-group">
                            <label>Required Quantity</label>
                            <input class="form-control" th:field="${purchaseOrder.purchaseOrderQuantityRequired}" required>
                        </div>
                        <div class="col-sm-3 form-group">
                            <label>Article Name</label>
                            <input type="text" class="form-control" th:field="${purchaseOrder.articleName}" required>
                        </div>
                        <div class="col-sm-1 form-group">
                            <label for="active">Status OPEN/CLOSE</label>
                            <div class="form-check">
                                <input class="custom-control-label:" type="checkbox" id="active" th:field="*{purchaseOrder.poStatus}"/>
                            </div>
                        </div>
                    </div>
                </div>

                <div>
                    <button class="btn btn-secondary" type="submit" name="user" value="draft"
                            v-bind:disabled="hasEmptyItems()">
                        Save Draft
                    </button>
                    <button class="btn btn-primary" type="submit" name="user" value="post"
                            v-bind:disabled="hasEmptyItems()">
                        Post
                    </button>
                    <a th:href="@{/purchase-order}" class="btn btn-light">Cancel</a>
                </div>
            </form>

        </div>
    </main>
</div>
<div th:replace="_fragments :: page-footer-scripts"></div>
</body>
</html>