<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>项目流程管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		
		$('#btnPresent').click(function () { 

			$.ajax({
	             url:"${ctx}/projectManagement/projectManagement/present",
	             data:$('#loginForm').serialize(),
	             type:"post",
	             success:function(data){
	        
	             }					
		});
		});	
			
		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            //只做查看时，禁用掉以下标签
            $('input,textarea,select').attr('disabled',<%=request.getAttribute("disabled")%>);
            if (${requestScope.disabled eq 'false'}) {
                $("#startTime").attr('disabled',true);
                $("#endTime").attr('disabled',true);
                $("#reason").attr('disabled',true);
            }
		});
	</script>
</head>

<body class="gray-bg">

  <div class="wrapper wrapper-content">
	<div class="ibox">
	<div class="ibox-title">
		<h5>当前步骤--[${workEngineeringProject.act.taskName}] </h5>
		<div class="ibox-tools">
			<a class="collapse-link">
				<i class="fa fa-chevron-up"></i>
			</a>
			<a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)">
				<i class="fa fa-wrench"></i>
			</a>
			<ul class="dropdown-menu dropdown-user">
				<li><a href="javascript:void(0)">选项1</a>
				</li>
				<li><a href="javascript:void(0)">选项2</a>
				</li>
			</ul>
			<a class="close-link">
				<i class="fa fa-times"></i>
			</a>
		</div>
	</div>
		<div class="ibox-content">
		<form:form id="inputForm" modelAttribute="workEngineeringProject" action="${ctx}/projectManagement/projectManagement/saveAudit" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="act.taskId"/>
		<form:hidden path="act.taskName"/>
		<form:hidden path="act.taskDefKey"/>
		<form:hidden path="act.procInsId"/>
		<form:hidden path="act.procDefId"/>
		<form:hidden id="flag" path="act.flag"/>
		<%--	<taskId=${task.id}&taskName=${fns:urlEncode(task.name)}&taskDefKey=${task.taskDefinitionKey}&procInsId=${task.processInstanceId}&procDefId=${task.processDefinitionId}&status=${status}></taskId>
		--%><sys:message content="${message}"/>
		<c:set var="status" value="${workEngineeringProject.status}" />
			<div class="control-group">
				<label class="control-label">合同名称：</label>
				<div class="controls">
						${workEngineeringProject.contractId.name}
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">合同编号：</label>
				<div class="controls">
						${workEngineeringProject.contractId.contractNum}
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">项目名称：</label>
				<div class="controls">
						${workEngineeringProject.projectId.name}
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">项目编号：</label>
				<div class="controls">
						${workEngineeringProject.projectId.number}
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">备注信息：</label>
				<div class="controls">
						${workEngineeringProject.remarks}
				</div>
			</div>
			<c:if test="${workEngineeringProject.plan eq 2 }">
				<div class="control-group">
					<label class="control-label">选择退回步骤：</label>
					<div class="controls">
						<input type="radio" value="2" name="reject" checked="checked">文件自校
						<c:if test="${not empty workEngineeringProject.proofreadTotal}">
							<input type="radio" value="3" name="reject" >项目负责人审核
						</c:if>
					</div>
				</div>
			</c:if>
			<c:if test="${not empty workEngineeringProject.proofreadTotal && workEngineeringProject.plan eq 2 }">
				<div class="control-group">
					<label class="control-label">校审问题：<font color="red">*</font></label>
					<div class="controls">
						<input type="radio" value="一般问题" name="problem" checked="checked">一般问题
						<input type="radio" value="中等问题" name="problem" >中等问题
						<input type="radio" value="重大问题" name="problem" >重大问题
					</div>
				</div>
			</c:if>

			<div class="control-group">
				<label class="control-label">审批意见：</label>
				<div class="controls">
					<form:textarea path="act.comment" class="form-control " rows="3" maxlength="20"/>
				</div>
			</div>
			<div class="form-actions">
				<c:if test="${not empty workEngineeringProject.act.taskDefKey}">
					<c:choose>
						<c:when test="${workEngineeringProject.plan eq '1'}">
							<input id="btnSubmit" class="btn btn-primary" type="submit" value="确认选择" onclick="$('#flag').val('1')"/>&nbsp;
						</c:when>
						<c:when test="${workEngineeringProject.plan eq '2'}">
							<input id="btnSubmit" class="btn btn-inverse" type="submit" value="确认驳回" onclick="$('#flag').val('2')"/>&nbsp;
						</c:when>
						<c:when test="${workEngineeringProject.plan eq '3'}">
							<input id="btnSubmit" class="btn btn-inverse" type="submit" value="重新申请" onclick="$('#flag').val('1')"/>&nbsp;
						</c:when>
						<c:otherwise>
							<input id="btnSubmit" class="btn btn-inverse" type="submit" value="撤回申请" onclick="$('#flag').val('2')"/>&nbsp;
						</c:otherwise>
					</c:choose>
				</c:if>
				<c:if test="${empty workEngineeringProject.act.taskDefKey}">
					<input id="btnSubmit" class="btn btn-primary" type="submit" value="文件自校" onclick="$('#flag').val('1')"/>&nbsp;
					<%--<input id="btnSubmit" class="btn btn-inverse" type="submit" value="驳 回" onclick="$('#flag').val('no')"/>&nbsp;--%>
				</c:if>
				<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
			</div>
			<c:if test="${not empty workEngineeringProject.act.taskDefKey}">
				<act:flowChart procInsId="${workEngineeringProject.processInstanceProofreadId}"/>
				<act:histoicFlow procInsId="${workEngineeringProject.processInstanceProofreadId}"/>
			</c:if>
	</form:form>
	</div>
	</div>
	</div>
</body>
</html>