  <%@ page contentType="text/html;charset=UTF-8"%>
<%@page import="com.blueland.bpm.engine.config.model.*" %>
<%@ include file="/commons/taglibs.jsp"%>
<%
	String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/commons/meta.jsp"%>
<base href="<%=basePath%>"/>
<title>消息提醒配置新增</title>
<script type="text/javascript">

function saveMsgRemind(){
	$.ajax({
		type : "POST",
		url : "${ctx}/msgRemind/updateMsgRemind.do",
		data : $('#myform').serialize(),
		success : function(resp) {
			alert(resp);
			art.dialog.opener.location.reload();
		}
	});
}

$(function(){ 
	$("#isReceiveSms").click( 
		function(){ 
			$("#noRimind").removeAttr("checked");
			$("#isReceiveSmsValue").val('Y');
			$("#isReceiveTodo").val('Y');
		} 
	); 
	$("#isReceiveMail").click( 
		function(){ 
			$("#noRimind").removeAttr("checked");
			$("#isReceiveMailValue").val('Y');
			$("#isReceiveTodo").val('Y');
		} 
	); 
	$("#noRimind").click( 
		function(){ 
			$("#isReceiveSms").removeAttr("checked");
			$("#isReceiveMail").removeAttr("checked");
			
			$("#isReceiveMailValue").val('N');
			$("#isReceiveSmsValue").val('N');
			$("#isReceiveTodo").val('N');
		} 
	); 
}) 
</script>
</head>
<body style="font-size: 13px;">
	<form action="${ctx}/msgRemind/save.do" method="post" id="myform">
		<input type="hidden" id="remindId" name="remindId" value="${msgRemind.remindId}" />
		<input type="hidden" name="remindUserId" value="${msgRemind.remindUserId}" id="remindUserId"/>
		<!-- 是否接收短信提醒 -->
		<input type="hidden" name="isReceiveSms" id="isReceiveSmsValue" value="${msgRemind.isReceiveSms}"/>
		<!-- 是否接收邮件提醒-->
		<input type="hidden" name="isReceiveMail" id="isReceiveMailValue" value="${msgRemind.isReceiveMail}"/>
		<!-- 是否接收待阅 -->
		<input type="hidden" name="isReceiveReader" id="isReceiveReader" value="${msgRemind.isReceiveReader}"/>
		<!-- 是否接收待办 -->
		<input type="hidden" name="isReceiveTodo" id="isReceiveTodo" value="${msgRemind.isReceiveTodo}"/>
		<div class="main-container" id="main-container">
				<div class="panel panel-primary">
					<div class="panel-body">
						<table class='table table-bordered' border="0" cellspacing="0" cellpadding="0" id="myTable">
							<!-- 存放表单的区域 -->
								<tr>
									<th>
									提醒所属系统<font color="red">*</font>：
									</th>
									<td>
										<select name="remindAppId" id="remindAppId">
											<c:forEach var="app" items="${apps}">
												<option value="${app.appId}" <c:if test="${app.appId == msgRemind.remindAppId}">selected="selected"</c:if>>${app.appName}</option>
											</c:forEach>
										</select>
									</td>
								</tr>
								<tr>
									<th>
										是否接收提醒：
									</th>
									<td>
										<input type="checkbox" id="noRimind"
											<c:if test='${"N"==msgRemind.isReceiveSms && "N"==msgRemind.isReceiveMail}'>
												checked="checked"
											</c:if>
										/>不提醒&nbsp;&nbsp;
										<input type="checkbox" id="isReceiveSms" <c:if test='${"Y"==msgRemind.isReceiveSms}'>checked="checked"</c:if>/>短信提醒&nbsp;&nbsp;
										<input type="checkbox" id="isReceiveMail" <c:if test='${"Y"==msgRemind.isReceiveMail}'>checked="checked"</c:if>/>邮件提醒
									</td>
								</tr>
							</table>
						</div>
						<div class="col-md-offset-1 col-md-9" style="text-align: center;">
							<button type="button" class="btn btn-sm btn-primary"
							id="submitButton" onclick="saveMsgRemind();" >
							保存
							<i class="ace-icon fa fa-save bigger-110"></i>
							</button>
							<input type="button" class="btn btn-sm btn-primary"
							 onclick="art.dialog.close();"
							value="关 闭" />
						</div>
					</div>
			</div>				
	</form>
	<jsp:include page="../../pages/procDefMgr/procDefTree.jsp" flush="false" />
</body>
</html>