<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="include :: header('修改商品')"/>
    <th:block th:include="include :: select2-css"/>
</head>

<body>

<div class="main-content">
    <form class="form-horizontal" id="form-goods-edit" th:object="${goods}">
        <input id="goodsId" name="goodsId" type="hidden" th:field="*{goodsId}"/>
        <h4 class="form-header h4">基本信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">商品名称：</label>
                    <div class="col-sm-8">
                        <input name="goodsName" placeholder="请输入商品名称" class="form-control" type="text" maxlength="30"
                               th:field="*{goodsName}"
                               required>
                    </div>
                </div>
            </div>
<!--            <div class="col-sm-6">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label is-required">价格：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <input name="goodsPrice" placeholder="请输入商品价格" class="form-control" type="text" maxlength="12"-->
<!--                               th:field="*{goodsPrice}"-->
<!--                               required>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->
<!--        <div class="row">-->
<!--            <div class="col-sm-6">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label is-required">优惠价：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <input name="discountsPrice" placeholder="请输入优惠价" class="form-control" type="text"-->
<!--                               th:field="*{discountsPrice}"-->
<!--                               maxlength="12" required>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="col-sm-6">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label is-required">团购价：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <input name="groupPrice" placeholder="请输入团购价" class="form-control" type="text" maxlength="12"-->
<!--                               th:field="*{groupPrice}"-->
<!--                               required>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">商品类别：</label>
                    <div class="col-xs-8">
                        <select name="deptGoodsCategoryId" class="form-control m-b">
                            <option th:each="item : ${deptGoodsCategories}" th:text="${item.goodsCategoryName}"
                                    th:value="${item.deptGoodsCategoryId}" th:field="*{deptGoodsCategoryId}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">状态：</label>
                    <div class="col-sm-8">
                        <select name="status" class="form-control m-b" th:with="type=${@dict.getType('goods_status')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:field="*{status}"
                                    th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
<!--        <div class="row">-->
<!--            <div class="col-sm-6">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label is-required">商品库存：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <input name="goodsNumber" placeholder="请输入商品库存" class="form-control" type="text" maxlength="12"-->
<!--                               th:field="*{goodsNumber}"-->
<!--                               required>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->

        <h4 class="form-header h4">其他信息</h4>
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-xs-2 control-label">备注：</label>
                    <div class="col-xs-10">
                        <textarea name="remark" maxlength="500" class="form-control" rows="3"
                                  th:field="*{remark}"></textarea>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>

<script type="text/javascript">
    var prefix = ctx + "goods/goods";

    $("#form-goods-edit").validate({
        onkeyup: false,
        rules: {},
        messages: {},
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-goods-edit").serializeArray();
            $.operate.saveTab(prefix + "/edit", data);
            $.modal.close();
        }
    }

</script>
</body>
</html>