<!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-complaint-add" th:object="${crmCustomer}">
			<input name="customerId" type="hidden" id="customerId" th:field="*{customerId}" />
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">所属客户</label>
				<div class="col-sm-8">
					<div class="col-sm-8">
						<div class="form-control-static" th:text="${crmCustomer.customerName}"></div>
					</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="complaintDate" id="complaintDate"
							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="complaintName" 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="complaintPhone" class="form-control" required></input>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label  is-required">投诉内容：</label>
				<div class="col-sm-8">
					<textarea name="complaintContent" class="form-control" required></textarea>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">投诉类型：</label>
				<div class="col-sm-8">
					<select name="complaintType" class="form-control m-b"
						th:with="type=${@dict.getType('complaint_type')}" required>
						<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 is-required">投诉状态：</label>
				<div class="col-sm-8">
					<div class="radio-box"
						th:each="dict : ${@dict.getType('complaint_status')}">
						<input type="radio" th:id="${'complaintStatus_' + dict.dictCode}"
							name="complaintStatus" th:value="${dict.dictValue}"
							th:checked="${dict.default}" required> <label
							th:for="${'complaintStatus_' + 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/complaint"
		$("#form-complaint-add").validate({
			onkeyup : false,
			rules : {
				complaintName : {
					isName : true
				},
				complaintPhone : {
					isPhone : true
				}
			},
			focusCleanup : true
		});

		function submitHandler() {
			if ($.validate.form()) {
				debugger;
				var data=$('#form-complaint-add').serialize();
				$.operate.save(prefix + "/add", data+"&tableId=bootstrap-tableComplaint");
			}
		}
		

		$("input[name='complaintDate']").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>