<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增线索管理')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-clue-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">姓名：</label>
                <div class="col-sm-8">
                    <input name="name" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">公司：</label>
                <div class="col-sm-8">
                    <input name="company" class="form-control" type="text">
                </div>
            </div>
            <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 class="form-group">    
                <label class="col-sm-3 control-label">职务：</label>
                <div class="col-sm-8">
                    <input name="duty" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">手机：</label>
                <div class="col-sm-8">
                    <input id="mobile" name="mobile" class="form-control" type="number" required >
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">用户邮箱：</label>
                <div class="col-sm-8">
                    <input name="email" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">qq：</label>
                <div class="col-sm-8">
                    <input name="qq" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">微信：</label>
                <div class="col-sm-8">
                    <input name="wechat" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">旺旺：</label>
                <div class="col-sm-8">
                    <input name="wangwang" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">MSN：</label>
                <div class="col-sm-8">
                    <input name="msn" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">性别：</label>
                <div class="col-sm-8">
                    <select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">线索来源：</label>
                <div class="col-sm-8">
                    <select name="clueSource" class="form-control m-b" th:with="type=${@dict.getType('crm_customer_source')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">决策等级：</label>
                <div class="col-sm-8">
                    <select name="decisionLevel" class="form-control m-b" th:with="type=${@dict.getType('person_decision_level')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">市场活动：</label>
                <div class="col-sm-8">
                    <input name="marketActivity" class="form-control" type="text">
                </div>
            </div>
           <div class="form-group">
						<label class="col-xs-3 control-label">备注：</label>
						<div class="col-xs-8">
							<textarea name="remark" maxlength="500" class="form-control"
								rows="3"></textarea>
						</div>
					</div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "crm/clue"
        $("#form-clue-add").validate({
        	onkeyup: false,
        	rules:{
        		 mobile:{
                    remote: {
                    	url: prefix + "/checkMobileUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                            "mobile": function () {
                                return $.common.trim($("#mobile").val());
                            }
                        },
                        dataFilter: function (data, type) {
                        	return $.validate.unique(data);
                        }
                    }
        		},
        	},
        	messages: {
        		"mobile":{
                	remote: "手机号已经存在"
        		}
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-clue-add').serialize());
            }
        }

        $("input[name='trasferDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>