<%@ page contentType="text/html;charset=UTF-8"%>
<%@ 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">
<%@ include file="/commons/meta.jsp"%>
<base href="<%=basePath%>">
<link href="${ctx}/resource/js/plugins/loadmask/jquery.loadmask.css" rel="stylesheet" type="text/css" />
<script type='text/javascript' src='${ctx}/resource/js/plugins/loadmask/jquery.loadmask.js'></script>

<title>配置输出线</title>
<script type="text/javascript">
	$(document).ready(function() {
		$("#deleteBtn").click(function() {
			if (!hasOneChecked("expandPropertyIds")) {
				alert('请选择要操作的对象!');
				return;
			}
			if (!window.confirm('确定执行[删除]操作?')) {
				return;
			}
			//用jquery中的ajax方法，向服务器提交请求 
			jQuery.ajax({
				type : "POST",
				url : "${ctx}/actInfo/sequenceFlow/deleteProperty.do",
				data : $('#myform').serialize(),
				success : function(resp) {
					alert(resp);
					window.location.reload();
				}
			});
		});
		$("#submitButton").click(function() {
			//判断排序号是否为空并且是否为数字
			var TRANSITION_DISPLAY_ORDER = $("#TRANSITION_DISPLAY_ORDER").val();
			if(""==TRANSITION_DISPLAY_ORDER){
				//alert("排序号不能为空！");
				//return;
			}else{
				if(isNaN(TRANSITION_DISPLAY_ORDER)){
					alert("排序号必须为数字！");
					return;
				}
			}
			
			//用jquery中的ajax方法，向服务器提交请求 
			setMask("main-container");
			jQuery.ajax({
				type : "POST",
				url : "${ctx}/actInfo/sequenceFlow/update.do",
				data : $('#myform').serialize(),
				success : function(resp) {
					alert(resp);
					window.location.reload();
				}
			});
		});
	});
</script>
</head>
<body class="white-page">
	<form action="${ctx}/actInfo/sequenceFlow/update.do" method="post"
		id="myform">
		<div class="main-container" id="main-container">
			<div class="panel panel-primary">
				<div class="panel-body">
					<div class="well well-sm">
								<button type="button" class="btn btn-sm btn-primary"
									id="submitButton" >
									保存
									<i class="ace-icon fa fa-save bigger-110"></i>
								</button>
								<button onclick="art.dialog.close();" type="button" class="btn btn-sm btn-primary">
									关闭
									<i class="ace-icon fa fa-times bigger-110"></i>
								</button>
					</div>
					
					<table class='table table-bordered form-table' border="0" cellspacing="0"
						cellpadding="0" id="myTable">
						<!-- 存放隐藏域的区域 -->
						<input type="hidden" name="id" value="${sequenceFlow.id}" />
						<input type="hidden" name="procDefId" value="${procDefId}" />
						<!-- 存放表单的区域 -->
						<tr>
							<td><font color="red">*</font>输出线ID：</td>
							<td>${sequenceFlow.id}</td>
						</tr>
						
						<tr>
							<td>输出线名称
							（展现在流程图中）：</td>
							<td><input name="name" id="name" value="${sequenceFlow.name}" style="width: 500px" type="text" /></td>
						</tr>
						<tr>
							<td>下一环节别名：</td>
							<td><input name="nextActAlias" id="nextActAlias"
								value="${nextActAlias}" type="text" style="width: 500px"/></td>
							
						</tr>
						
						<tr>
							<td>同组织级别过滤：</td>
							<td>
								<select name="ACTIVITY_USER_SAME_ORG_LEVEL" id="ACTIVITY_USER_SAME_ORG_LEVEL" style="width: 200px">
										<option value="" ${sequenceFlow.ACTIVITY_USER_SAME_ORG_LEVEL==''?'selected':''}>--请选择--</option>
										<option value="1" ${sequenceFlow.ACTIVITY_USER_SAME_ORG_LEVEL=='1'?'selected':''}>同公司</option>
										<option value="2" ${sequenceFlow.ACTIVITY_USER_SAME_ORG_LEVEL=='2'?'selected':''}>同部门</option>
										<option value="3" ${sequenceFlow.ACTIVITY_USER_SAME_ORG_LEVEL=='3'?'selected':''}>同级别组织</option>
								</select>
							</td>
						</tr>
						<tr>
							<td>返回经办人：</td>
							<td><select name="TRANSITION_RETURN_FORMER"
								id="TRANSITION_RETURN_FORMER" style="width: 200px"> 
									<option value="">--请选择--</option>
									<c:forEach items="${activitys}" var="activity">
										<option value="${activity.actDefId}"
											${activity.actDefId==sequenceFlow.TRANSITION_RETURN_FORMER?"selected":""}>${activity.actDefName}</option>
									</c:forEach>
							</select></td>
						</tr>
						
						<tr>
							<td>排序号：</td>
							<td><input name="TRANSITION_DISPLAY_ORDER"
								id="TRANSITION_DISPLAY_ORDER"
								value="${sequenceFlow.TRANSITION_DISPLAY_ORDER}" type="text" /></td>
						</tr>
						
						
					</table>
					<!-- 
					<div class="panel panel-primary">
						<div class="panel-heading">扩展属性</div>
						<div class="panel-body">
							<div class="form-group well well-sm">

								<table border="0" cellspacing="0" cellpadding="0"
									class="table-search">
									<tr>
										<td colspan="7">
											<button type="button" class="btn btn-xs btn-success"
												onclick="showDiaLog('${ctx}/actInfo/sequenceFlow/createProperty.do?procDefId=${procDefId}&sequenceFlowId=${sequenceFlow.id}','新增扩展属性','500px','300px')" />
											新  增
											</button>
											<button type="button" id="deleteBtn" class="btn btn-xs btn-danger">删  除
											</button>

										</td>
									</tr>
								</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('expandPropertyIds',this.checked)"></th>
													<th style="width: 300px">属性ID</th>
													<th>属性名称</th>
													<th>操作</th>
												</tr>
											</thead>
											<tbody>
												<c:forEach items="${sequenceFlow.expandProperties}"
													var="item" varStatus="status">
													<tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
														<td><input type="checkbox" name="expandPropertyIds"
															value="${item.id }"></td>
														<td>${item.id}&nbsp;</td>
														<td>${item.value}&nbsp;</td>
														<td><a href="javascript:void(0);"
															onclick="showDiaLog('${ctx}/actInfo/sequenceFlow/editProperty.do?procDefId=${procDefId}&sequenceFlowId=${sequenceFlow.id}&expandPropertyId=${item.id }','修改扩展属性','500px','300px')">修改</a></td>
													</tr>
												</c:forEach>
											</tbody>
										</table>
									</div>
								</div>
							</div>
							<!-- 
		<div class="box2" panelTitle="执行监听器列表" roller="false">
			<table>
				<tr>
					<td colspan="7">
						<button type="button" onclick="importProcessBpmnXml();" /> <span
						class="icon_add">新增</span>
						</button>
						<button type="submit" /> <span class="icon_find">删除</span>
						</button>
					</td>
				</tr>
			</table>
			<table class="tableStyle">

				<tr>
					<th>事件ID</th>
					<th>事件类型</th>
					<th>实现类型</th>
					<th>实现类</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${userTask.outgoingFlows}" var="item"
					varStatus="status">
					<tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
						<td>${item.id}&nbsp;</td>
						<td>${item.event}&nbsp;</td>
						<td>${item.implementationType}&nbsp;</td>
						<td>${item.implementation}&nbsp;</td>
						<td>${item.documentation}&nbsp;</td>
						<td><a href="javascript:void(0);" onclick="">修改</a></td>
					</tr>
				</c:forEach>
			</table>


		</div>
						</div>
					</div>
					-->
				</div></div></div>
	</form>

</body>
</html>
