<%@ 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">
        $(function(){
            var oneSize = $(".oneTab").size();
            for(var i = 0;i < oneSize;i++){
                var hei = $(".oneTab:eq("+i+")").parent().height();
                $(".oneTab:eq("+i+")").css("height",hei-5)
                    .css("vertical-align","middle")
                    .css("line-height",hei+"px")
            }
           /* $("img").not(".upload_ico").each(function () {
                var num = 1 ;
                $(this).click(function () {
                    var flag = num%2;
                    if(flag == 1){
                        $(this).css("width","90%");
                        $(this).css("height","90%");
                        num++;
                    }else if(flag ==0){
                        $(this).css("width","50px");
                        $(this).css("height","50px");
                        num++;
                    }
                })
            });*/
        })
		var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(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);
					}
				}
			});
			
					laydate.render({
			            elem: '#dateStart', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
			        });
					laydate.render({
			            elem: '#dateEnd', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
			        });
					laydate.render({
			            elem: '#invoiceDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
			        });

			//通过类型补全名称
            $("#type").change(function(){
                if($("#type").val() == 1){
                    $("#payName").val("${workAftermath.workClientInfo.name}");
                }
                if($("#type").val() == 2){
                    $("#payName").val("");
                } if($("#type").val() == 3){
                    $("#payName").val("");
                }
            });
		});
	</script>
</head>
<body class="hideScroll">
<div class="wrapper wrapper-content">
	<div class="ibox">
		<form:form id="inputForm" modelAttribute="workAftermath" action="${ctx}/workaftermath/workAftermath/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
			<form:hidden path="workBidingProject.id"/>
		<sys:message content="${message}"/>
			<div class="col-sm-12 m-t-xs">
				<div class="col-sm-2 gray-bg text-center oneTab">
					<label>中标信息</label>
				</div>
				<div class="col-sm-10 " >

							<table id="contentTablee" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
								<thead>
								<tr>
									<th  class="sort-column bidingOfficeName">企业名称</th>
									<th  class="sort-column contacts">联系人</th>
									<th  class="sort-column phone">联系电话</th>
									<th  class="sort-column Email">电子邮箱</th>
									<th  class="sort-column deposit">保证金（万元）</th>
									<th>操作</th>
								</tr>
								</thead>
								<tbody>
								<c:choose>
									<c:when test="${not empty workAftermath.list}">
										<c:forEach items="${workAftermath.list}" var="workProjectDeposit">
											<tr>
												<%--<td> <input type="checkbox" id="${workVisa.id}" class="i-checks"></td>--%>
												<td>
														${workProjectDeposit.bidingOfficeName}
												</td>
												<td>
														${workProjectDeposit.contacts}
												</td>
												<td>
														${workProjectDeposit.phone}
												</td>
												<td>
														${workProjectDeposit.email}
												</td>
												<td>
														${workProjectDeposit.deposit}
												</td>
												<td>
													<c:choose>
														<c:when test="${workProjectDeposit.bidingState eq 1}">

															<a href="" class="btn btn-info btn-xs disabled">已中标</a>
														</c:when>
														<c:when test="${workProjectDeposit.bidingState eq 2}">
															<a href="" class="btn btn-danger btn-xs disabled">未中标</a>
														</c:when>
														<c:otherwise>
															<a href="${ctx}/workaftermath/workAftermath/updateBiding?id=${workProjectDeposit.id}" onclick="return confirmx('确认此企业中标？', this.href)"   class="btn btn-info btn-xs"><%--btn btn-default btn-xs<i class="fa fa-trash"></i>--%>确认中标</a>
														</c:otherwise>
													</c:choose>
												</td>
											</tr>
										</c:forEach>
									</c:when>
									<c:otherwise>
										<tr>
											<td colspan="15" align="center">
												暂无数据
											</td>
										</tr>
									</c:otherwise>
								</c:choose>
								</tbody>
							</table>
					<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
						<tbody>
						<tr>
							<td class="width-15 active"><label class="pull-right">中标金额(万元)：</label></td>
							<td class="width-35">
								<form:input path="bidAmount" htmlEscape="false"    class="form-control  number"/>
							</td>
							<td class="width-15 active"><label class="pull-right">工期（起）：</label></td>
							<td class="width-35">
								<input id="dateStart" name="dateStart" type="text" maxlength="20" class="laydate-icondate form-control layer-date "
									   value="<fmt:formatDate value="${workAftermath.dateStart}" pattern="yyyy-MM-dd"/>"/>
							</td>
						</tr>
						<tr>
							<td class="width-15 active"><label class="pull-right">项目经理：</label></td>
							<td class="width-35">
								<%--<form:input path="projectMaster" htmlEscape="false"    class="form-control disabled"/>--%>
								${workAftermath.projectMaster}
							</td>
							<td class="width-15 active"><label class="pull-right">工期（止）：</label></td>
							<td class="width-35">
							<input id="dateEnd" name="dateEnd" type="text" maxlength="20" class="laydate-icondate form-control layer-date "
							value="<fmt:formatDate value="${workAftermath.dateEnd}" pattern="yyyy-MM-dd"/>"/>
							</td>
						</tr>
						</tbody>
					</table>
				</div>
			</div>

			<div class="col-sm-12 m-t-xs">
				<div class="col-sm-2 gray-bg text-center oneTab">
					<label>保证金退还</label>
				</div>
				<div class="col-sm-10 " >
					<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
						<tbody>
						<tr>
							<table id="contentTable" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
								<thead>
								<tr>
									<th  class="sort-column bidingOfficeName">企业名称</th>
									<th  class="sort-column contacts">联系人</th>
									<th  class="sort-column phone">联系电话</th>
									<th  class="sort-column Email">电子邮箱</th>
									<th  class="sort-column deposit">保证金（万元）</th>
									<th>操作</th>
									<th  class="sort-column depositStatus">保证金状态</th>
								</tr>
								</thead>
								<tbody>
								<c:choose>
									<c:when test="${not empty workAftermath.list}">
										<c:forEach items="${workAftermath.list}" var="workProjectDeposit">
											<tr>
													<%--<td> <input type="checkbox" id="${workVisa.id}" class="i-checks"></td>--%>
												<td>
														${workProjectDeposit.bidingOfficeName}
												</td>
												<td>
														${workProjectDeposit.contacts}
												</td>
												<td>
														${workProjectDeposit.phone}
												</td>
												<td>
														${workProjectDeposit.email}
												</td>
												<td>
														${workProjectDeposit.deposit}
												</td>
												<td>
													<c:choose>
														<c:when test="${workProjectDeposit.bidingState eq 1 or workProjectDeposit.bidingState eq 2}">
															<c:choose>
																<c:when test="${workProjectDeposit.depositStatus eq 4 or workProjectDeposit.depositStatus eq 2}">
																	<a href="${ctx}/workaftermath/workAftermath/updateStatus?id=${workProjectDeposit.id}" onclick="return confirmx('确认退还吗？', this.href)"   class="btn btn-danger btn-xs">开始退还保证金</a>
																</c:when>
																<c:otherwise>
																	<a href="javascript:void(0)" onclick="javascript:parent.layer.msg('该阶段无法退还保证金',{icon:2})" class="btn btn-default btn-xs">开始退还保证金</a>
																</c:otherwise>
															</c:choose>
														</c:when>
														<c:otherwise>
															<a href="javascript:parent.layer.msg('项目还未定标，暂无法退还',{icon:5})" class="btn btn-default btn-xs">开始退还保证金</a>
														</c:otherwise>
													</c:choose>

												</td>
												<td>
													<c:choose>
														<c:when test="${workProjectDeposit.depositStatus eq 3}">
															<a href="" class="btn btn-info btn-xs disabled">保证金已退还</a>
														</c:when>
														<c:otherwise>
															<a href="" class="btn btn-danger btn-xs disabled">保证金未退还</a>
														</c:otherwise>
													</c:choose>
												</td>
											</tr>
										</c:forEach>
									</c:when>
									<c:otherwise>
										<tr>
											<td colspan="15" align="center">
												暂无数据
											</td>
										</tr>
									</c:otherwise>
								</c:choose>
								</tbody>
							</table>
						</tr>
						</tbody>
					</table>
				</div>
			</div>

			<div class="col-sm-12 m-t-xs">
				<div class="col-sm-2 gray-bg text-center oneTab">
					<label>代理费缴纳</label>
				</div>
				<div class="col-sm-10 " >
					<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
						<tbody>
						<tr>
							<td class="width-15 active"><label class="pull-right">代理费缴纳方类型：</label></td>
							<td class="width-35">
								<form:select id="type" path="agencyType" class="form-control ">
									<form:option value="" label=""/>
									<form:options items="${fns:getDictList('agency_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</td>
							<td class="width-15 active"><label class="pull-right"><font color="red">*</font>缴纳方全称：</label></td>
							<td class="width-35">
								<form:input id ="payName" path="payName" htmlEscape="false"    class="form-control required"/>
							</td>
						</tr>
						<tr>
							<td class="width-15 active"><label class="pull-right">发票号：</label></td>
							<td class="width-35">
								<form:input path="invoiceNumber" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-15 active"><label class="pull-right">开票时间：</label></td>
							<td class="width-35">
								<input id="invoiceDate" name="invoiceDate" type="text" maxlength="20" class="laydate-icondate form-control layer-date "
									   value="<fmt:formatDate value="${workAftermath.invoiceDate}" pattern="yyyy-MM-dd"/>"/>
							</td>
						</tr>
						<tr>
							<td class="width-15 active"><label class="pull-right">备注信息：</label></td>
							<td class="width-35" colspan="3">
								<form:textarea path="remarks" htmlEscape="false" rows="4"    class="form-control "/>
							</td>
						</tr>
						</tbody>
					</table>
				</div>
			</div>
	</form:form>
	</div>
</div>
</body>
</html>