<!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-convert-edit">
			<div class="row">
				<div class="col-sm-12">
					<div class="form-group">
						<label class="col-xs-3 control-label">说明原因：</label>
						<div class="col-xs-8">
							<textarea name="reason" id="reason" maxlength="500" class="form-control" rows="4"></textarea>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-sm-12">
					<div class="form-group">
						<label class="col-xs-3 control-label">转交记录：</label>
						<div class="col-xs-8">
							<a href="javascript:showHistory();">[查看转交历史记录]</a>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script  th:inline="javascript">
		var prefix = ctx + "crm/transfer";
		var ids=[[${ids}]];
		var businessType=[[${businessType}]];
		
		$("#form-convert-edit").validate({
			focusCleanup : true
		});

		function submitHandler() {
			if ($.validate.form()) {				
				var reason=$("#reason").val();
				var data = { "ids":ids,"belongTo": "","businessType":businessType,"reason":reason};
				$.modal.confirm("确定要转为公共吗?", function() {
					$.operate.save(prefix + "/transfer", data);
	    		});
			}
		}
		
		function showHistory(){
			var url = prefix + '/transferPublicHistory?businessType='+businessType;
		    $.modal.open("公客转交记录", url);
		}
		
	</script>
</body>
</html>