<!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-edit" th:object="${crmClue}">
            <input id="clueId" name="clueId" th:field="*{clueId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">姓名：</label>
                <div class="col-sm-8">
                    <input name="name" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{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 name="mobile" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{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}" th:field="*{sex}"></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}" th:field="*{clueSource}"></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}" th:field="*{decisionLevel}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">市场活动：</label>
                <div class="col-sm-8">
                    <input name="marketActivity" th:field="*{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">[[*{remark}]]</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-edit").validate({
        	onkeyup: false,
        	rules:{
        		 mobile:{
                    remote: {
                    	url: prefix + "/checkMobileUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                        	"clueId": function() {
                        		return $("#clueId").val();
                            },
                            "mobile": function () {
                                return $.common.trim($("#mobile").val());
                            }
                        },
                        dataFilter: function (data, type) {
                        	return $.validate.unique(data);
                        }
                    }
        		},
                focusCleanup: true
        	},
        	messages: {
        		"mobile":{
                	remote: "手机号已经存在"
        		}
            }
        });

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

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