<!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="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-vendor-add">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">供应商名称：</label>
                    <div class="col-sm-8">
                        <input name="vendorName" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">联系人：</label>
                    <div class="col-sm-8">
                        <input name="contact" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">手机：</label>
                    <div class="col-sm-8">
                        <input name="mobile" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">邮箱：</label>
                    <div class="col-sm-8">
                        <input name="mail" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">通信地址：</label>
                    <div class="col-sm-8">
                        <input name="address" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">退货收件人：</label>
                    <div class="col-sm-8">
                        <input name="refundContact" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">退货手机号：</label>
                    <div class="col-sm-8">
                        <input name="refundMobile" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">退货地址：</label>
                    <div class="col-sm-8">
                        <input name="refundAddress" class="form-control" type="text">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "master/vendor"
        $("#form-vendor-add").validate({
            rules: {
                vendorName: {
                    required: true,
                },
                contact: {
                    required: true,
                },
                mobile: {
                    required: true,
                    isPhone: true,
                },
                mail: {
                    required: true,
                    email:true,
                },
                address: {
                    required: true,
                },
                refundContact: {
                    required: true,
                },
                refundMobile: {
                    required: true,
                    isPhone: true,
                },
                refundAddress: {
                    required: true,
                },
            },
            messages: {
                vendorName: icon + "请输入供应商名称",
                contact: icon + "请输入联系人",
                mobile: {
                    required: icon + "请输入手机号",
                    isPhone: icon + "请填写正确的11位手机号",
                },
                mail: {
                    required: icon + "请输入邮箱",
                    email: icon + "请填写正确的邮箱格式",
                },
                address: icon + "请输入通信地址",
                refundContact: icon + "请输入退货收件人",
                refundMobile: {
                    required: icon + "请输入退货手机号",
                    isPhone: icon + "请填写正确的11位手机号",
                },
                refundAddress: icon + "请输入退货地址",
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-vendor-add').serialize());
            }
        }
    </script>
</body>
</html>