<!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-visit-edit" th:object="${crmVisit}">
        	<input name="customerId" type="hidden" id="customerId" />
            <input name="visitId" th:field="*{visitId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">所属客户：</label>
                <div class="col-sm-8">
                	<div class="input-group">
	                    <input name="customerName"  onclick="selectCustomer()" th:field="*{customer.customerName}" class="form-control" type="text" placeholder="请选择所属客户 " id="customerName" required readonly>
	                	<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">拜访时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="visitDate" th:value="${#dates.format(crmVisit.visitDate, 'yyyy-mm-dd HH:mm')}" class="form-control" placeholder="yyyy-mm-dd HH:mm" type="text" required>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">拜访人姓名：</label>
                <div class="col-sm-8">
                    <input name="visitName" th:field="*{visitName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">拜访人电话：</label>
                <div class="col-sm-8">
                    <input name="visitPhone" th:field="*{visitPhone}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">拜访内容：</label>
                <div class="col-sm-8">
                    <textarea name="visitContent" class="form-control" required>[[*{visitContent}]]</textarea>
                </div>
            </div>            
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">拜访状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('visit_Status')}">
                        <input type="radio" th:id="${'visitStatus_' + dict.dictCode}" name="visitStatus" th:value="${dict.dictValue}" th:field="*{visitStatus}" required>
                        <label th:for="${'visitStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </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/visit";
        $("#form-visit-edit").validate({
            focusCleanup: true
        });

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

        $("input[name='visitDate']").datetimepicker({
        });
        
        /* 拜访管理-新增-选择客户 */
        function selectCustomer() {
        	 var url = ctx + "crm/customer/selectCustomer";
        	 /* var options = {
				title: '选择客户',
				width: "780",
				url: url
			};
			$.modal.openOptions(options);
        	*/
        	 $.modal.open("选择客户", url);
		}
    </script>
</body>
</html>