<%@page import="com.blueland.bpm.engine.config.model.*" %>
<%@page import="com.blueland.bpm.common.page.*" %>
<%@page import="java.util.*" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
<%@ include file="/commons/taglibs.jsp"%>
<jsp:include page="/commons/userOrgTree.jsp" flush="false" />
<%
	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>
	<link href="${ctx}/resources/js/simpletable/simpletable.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="${ctx}/resources/js/simpletable/simpletable.js"></script>

	<script type="text/javascript" >
		$(document).ready(function() {
			// 分页需要依赖的初始化动作
			window.simpleTable = new SimpleTable('queryForm',${page.thisPageNumber},${page.pageSize},'${pageRequest.sortColumns}');
		});
		function createSmsConfig(url,title,width,height){
			if("" == $("#userId").val() || null == $("#userId").val()){
				alert("请输入用户的ID！");
				return;
			}else{
				var url = url+"?userId="+$("#userId").val();
				showDiaLog(url,title,width,height);
			}
		}
		function userNameOnDbClick(name, value) {
			$("#userName").val(name);
			$("#userId").val(value);
			$("#queryForm").submit();
		}
	</script>
</head>
<body>
<%@ include file="/commons/messages.jsp"%>
<form id="queryForm" name="queryForm"
	  action="${ctx}/smsConfig/list.do" method="post"
	  style="display: inline;">
	<div class="main-container" id="main-container">
		<div class="panel panel-primary">
			<div class="panel-heading">
				短信提醒设置
			</div>
			<div class="panel-body" id="panel-body" style="padding:3px;">
				<div class="well well-sm" style="margin-bottom: 2px;">

					<table border="0" cellspacing="0" cellpadding="0" class="table-search">
						<tbody>

						<tr colspan="7">
							<td>
								用户ID：<input type="text" id="userId" name="userId"  style="height:25px;margin-right: 2px;" value="${query.userId }"/>
								<button type="button" class="btn btn-xs btn-success"
										onclick="createSmsConfig('${ctx}/smsConfig/backCreate.do','新增短信提醒','543px','404px');">
									新增
									<i class="ace-icon fa fa-plus bigger-110"></i>
								</button>
							</td>
						</tr>

						<tr colspan="7">
							<td style="letter-spacing: 3.2px;">
								用户：<input type="text" id="userName" name="userName" value="${query.userName}" style="margin-right: 2px;height:25px;"
										  onclick="showUserOrg('userName','','','USER'); return false;" readonly/>

								系统简称：<input type="text" id="appEname" name="appEname"  value="" style="height:25px;" value="${query.appEname }"/>
								<button type="submit" class="btn btn-xs btn-primary"
										onclick="getReferenceForm(this).action='${ctx}/smsConfig/list.do'">
									查&nbsp;&nbsp;询
									<i class="ace-icon fa fa-search bigger-110"></i>
								</button>

								<button type="button" class="btn btn-xs btn-danger"
										onclick="batchDelete('${ctx}/smsConfig/delete.do','items',document.forms.queryForm)">
									删除
									<i class="ace-icon fa fa-trash-o bigger-110"></i>
								</button>
							</td>
						</tr>

						</tbody>
					</table>
				</div>

				<div class="row">
					<div class="col-xs-12">
						<div class="table-responsive">
							<table id="sample-table-1" class="table table-striped table-bordered table-hover">
								<thead>
								<tr>
									<th style="width:25px;"><input type="checkbox" onclick="setAllCheckboxState('items',this.checked)"></th>
									<!-- 排序时为th增加sortColumn即可,new SimpleTable('sortColumns')会为tableHeader自动增加排序功能; -->
									<th sortColumn="roleName" >用户ID</th>
									<th sortColumn="roleName" >用户名称</th>
									<th sortColumn="roleId" >星期几</th>
									<th sortColumn="roleId" >提醒时间段</th>
									<th sortColumn="roleAppId">系统简称</th>
									<th sortColumn="roleAppId">系统名称</th>
									<th sortColumn="roleAppId">流程名称</th>
								</tr>
								</thead>
								<tbody>

								<c:forEach items="${page.result}" var="item" varStatus="status">
									<tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
										<td><input type="checkbox" name="items" value="smsId=${item.smsid}&"></td>
										<td class="td" title="${item.userId}&nbsp;">${item.userId}&nbsp;</td>
										<td class="td" title="${item.userName}&nbsp;">${item.userName}&nbsp;</td>
										<td class="td" title="${item.weekday}&nbsp;">${item.weekday}&nbsp;</td>
										<td class="td" title="${item.timezone}&nbsp;">${item.timezone}&nbsp;</td>
										<td class="td" title="${item.appEname}&nbsp;">${item.appEname}&nbsp;</td>
										<td class="td" title="${item.appName}&nbsp;">${item.appName}&nbsp;</td>
										<td>
											<c:choose>
												<c:when test="${fn:length(item.processDefId)<1 }">
													全部流程
												</c:when>
												<c:otherwise>${item.processDefId}&nbsp;</c:otherwise>
											</c:choose>
										</td>
									</tr>
								</c:forEach>
								</tbody>
							</table>
							<simpletable:pageToolbar page="${page}">
							</simpletable:pageToolbar>
						</div>
						<!-- /.table-responsive -->
					</div>
					<!-- /span -->
				</div>
			</div>
		</div>
	</div>
</form>
</body>
</html>	
