<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('更改库存状态')" />
</head>
<body class="white-bg">
<div class="main-content">
    <form class="form-horizontal m" id="form-goods-edit" th:object="${tMiStock}">
        <div class="form-group">
            <label class="col-sm-3 control-label">选择状态：</label>
            <div class="col-sm-12" th:if="${#strings.contains(tMiStock.sts, '0')}">
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="0"/> 合格 </label>
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="2"/> 延期 </label>
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="3"/> 报废 </label>
            </div>
            <div class="col-sm-12" th:if="${#strings.contains(tMiStock.sts, '1')}">
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="1"/> 不合格 </label>
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="2"/> 延期 </label>
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="3"/> 报废 </label>
            </div>
            <div class="col-sm-12" th:if="${#strings.contains(tMiStock.sts, '2')}">
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="2"/> 延期 </label>
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="1"/> 不合格 </label>
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="3"/> 报废 </label>
            </div>
            <div class="col-sm-12" th:if="${#strings.contains(tMiStock.sts, '5')}">
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="5"/> 待检 </label>
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="0"/> 合格 </label>
                <label class="radio-box"><input type="radio" th:field="*{sts}" name="sts" value="1"/> 不合格 </label>
            </div>
            <div class="tab-content">
                <div class="tab-pane" id="buhege">
                    <label id="buhegeLabel" class="col-sm-12 control-label is-required">原因说明：</label>
                    <label id="baofeiLabel" class="col-sm-12 control-label is-required">报废流程编号：</label>
                    <div class="col-sm-12">
                        <textarea name="mark" id="mark" maxlength="500" class="form-control" rows="6"></textarea>
                    </div>
                </div>
                <div class="tab-pane" id="yanqi">
                    <label class="col-sm-12 control-label is-required">延期日期：</label>
                    <div class="col-sm-12">
                        <input type="text" id="expirationDate" name="expirationDate" class="time-input"
                               placeholder="延期日期">
                    </div>
                </div>
            </div>
        </div>
        <input name="goodsId" id="goodsId" th:field="*{goodsId}" class="form-control" type="hidden" required>
        <input name="produclotid" id="produclotid" th:field="*{produclotid}" class="form-control" type="hidden" required>
        <input name="ctl" id="ctl" th:field="*{ctl}" class="form-control" type="hidden" required>
    </form>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    $("input:radio[name='sts']").change(function (){
        var sts = $("input[name='sts']:checked").val();
        console.log(sts)
        if (sts == "1") {// 不合格
            $(".tab-content").show();
            $("#buhege").show();
            $("#buhegeLabel").show();
            $("#baofeiLabel").hide();
            $("#yanqi").hide();
        } else if (sts == "2") {// 延期
            $(".tab-content").show();
            $("#yanqi").show();
            $("#buhege").hide();
        } else if (sts == "3") {// 报废
            $(".tab-content").show();
            $("#buhege").show();
            $("#buhegeLabel").hide();
            $("#baofeiLabel").show();
            $("#yanqi").hide();
        } else {// 合格与待检
            $(".tab-content").hide();
        }
    });
</script>
</body>
</html>