<%@ 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;
		}
		$(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);
					}
				}
			});
			
		});
	</script>
</head>
<body class="hideScroll">
		<form:form id="inputForm" modelAttribute="workVisa" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="fullManage.id" value="${workFullManage.id}"/>
		<sys:message content="${message}"/>
		<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
		   <tbody>
			   <tr>
				   <td class="width-20 active" rowspan="7"><label class="pull-right">台账信息</label></td>
			   </tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">发起单位：</label></td>
					<td class="width-25">
						${workVisa.initiateClient}
					</td>
					<td class="width-15 active"><label class="pull-right">单位工程名称：</label></td>
					<td class="width-25">
							${workVisa.cprojectName}
					</td>
				</tr>
			   <tr>
					<td class="width-15 active"><label class="pull-right">施工标段：</label></td>
					<td class="width-25">
							${workVisa.constructionExample}
					</td>
				   <td class="width-15 active"><label class="pull-right">签证单编号：</label></td>
				   <td class="width-25">
						   ${workVisa.visaNumber}
				   </td>
			   </tr>
			   <tr>
					<td class="width-15 active"><label class="pull-right">签证范围：</label></td>
					<td class="width-25">
							${workVisa.visaArea}
					</td>
				   <td class="width-15 active"><label class="pull-right">主题内容：</label></td>
				   <td class="width-25">
						   ${workVisa.theme}
				   </td>
			   </tr>
			   <tr>
					<td class="width-15 active"><label class="pull-right">签证单主要内容：</label></td>
					<td class="width-25" colspan="3">
							${workVisa.visaContent}
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">审价批复意见：</label></td>
					<td class="width-25" colspan="3">
							${workVisa.replySuggest}
					</td>
					<%--<td class="width-15 active"><label class="pull-right">全过程管理项目：</label></td>--%>
					<%--<td class="width-35">--%>
						<%--<sys:gridselect url="${ctx}/workvisa/workVisa/selectfullManage" id="fullManage" name="fullManage.id"  value="${workVisa.fullManage.id}"  title="选择全过程管理项目" labelName="fullManage.id" --%>
						 <%--labelValue="${workVisa.fullManage.id}" cssClass="form-control required" fieldLabels="全过程项目表" fieldKeys="WorkFullManage" searchLabel="id" searchKey="id" ></sys:gridselect>--%>
					<%--</td>--%>
				</tr>
			 <%--  <tr>
				   <td class="width-15 active"><label class="pull-right">备注信息：</label></td>
				   <td class="width-25" colspan="3">
						   ${workVisa.remarks}
				   </td>
			   </tr>--%>
				<tr>
					<td class="width-25" colspan="4">
						<div style="width: 580px; ">
							<div style="float:left;width: 80px; height: 100%; ">
								附件
							</div>
							<div style="float:left; height: 100%; width: 500px; ">
								<%--<div style="display: inline-block">--%>
									<%--<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>--%>
									<%--<a id="attachment_btn" class="btn btn-info btn-xs" ><i class="fa fa-plus"></i> 添加附件</a>--%>
									<%--<span id="attachment_title"></span>--%>
								<%--</div>--%>
								<%--<table id="listAttachment"  style="text-align: center;width: 100%;margin-top:10px;"  class="table table-striped table-bordered table-condensed" >
									<tr>
										<td>序号</td><td>文件名</td><td>上传人</td><td>上传时间</td><td>操作</td>
									</tr>
									<c:forEach items="${workAttachments}" var="attachment" varStatus="index">
										<tr>
											<td>${index.index + 1}</td>
											<td>${attachment.attachmentName}</td>
											<td>${attachment.attachmentUser}</td>
											<td><fmt:formatDate value="${attachment.createDate}" pattern="yyyy-MM-dd"/></td>
											<td>
												<a href="${attachment.url}">下载</a>
												&lt;%&ndash;<a href="${ctx}/workvisa/workVisa/deleteFileFromAliyun?attachmentId=${attachment.id}&id=${workVisa.id}">删除</a>&ndash;%&gt;
											</td>
										</tr>
									</c:forEach>
								</table>--%>

									<table id="contentTable" class="table table-striped table-bordered table-condensed">
										</tbody>
										<tr>
											<th class="hide"></th>
											<th width="30%">文件名称</th>
											<th width="30%">上传人</th>
											<th width="30%">创建时间</th>
											<th>操作</th>
										</tr>
										<c:choose>
											<c:when test="${not empty workVisa.workAttachments}">
												<c:forEach items="${workVisa.workAttachments}" var="workClientAttachment">
													<tr>
														<td class="hide"></td>
														<c:choose>
															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
												   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
												   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
												   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
												   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
																<td><img src="${workClientAttachment.url}" width="50" height="50" alt="${workClientAttachment.attachmentName}"/></td>
															</c:when>
															<c:otherwise>
																<c:choose>
																	<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
																		<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','80%','80%','1')">${workClientAttachment.attachmentName}</a></td>
																	</c:when>
																	<c:otherwise>
																		<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','80%','80%')">${workClientAttachment.attachmentName}</a></td>
																	</c:otherwise>
																</c:choose>
															</c:otherwise>
														</c:choose>
														<td>${workClientAttachment.createBy.name}</td>
														<td><fmt:formatDate value="${workVisa.createDate}" pattern="yyyy年MM月dd日" type="date" dateStyle="full"/></td>
														<td>
															<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent(encodeURIComponent('${workClientAttachment.url}'));" class="btn btn-success btn-xs">下载</a>

															<%--<a href="${workClientAttachment.url}">下载</a>--%>
														</td>
													</tr>
												</c:forEach>
											</c:when>
											<c:otherwise>
												<tr>
													<td colspan="5" align="center">暂无数据</td>
												</tr>
											</c:otherwise>
										</c:choose>

										</tbody>
										<tbody id="workContractAnnexList">
										</tbody>
									</table>
							</div>
						</div>
					</td>
				</tr>
			   <tr>
				   <td class="width-20 active" rowspan="5"><label class="pull-right">项目信息</label></td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">项目编号：</label></td>
				   <td class="width-25">
						   ${workFullManage.fullProjectNumber}
				   </td>
				   <td class="width-15 active"><label class="pull-right">项目来源：</label></td>
				   <td class="width-25">
						   ${fns:getDictLabel(workFullManage.fullProjectSource, 'full_project_source', '')}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">项目名称：</label></td>
				   <td class="width-25">
						   ${workFullManage.fullProjectName}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">行业分类：</label></td>
				   <td class="width-25">
						   ${fns:getDictLabel(workFullManage.fullIndustryType, 'full_industry_type', '')}
				   </td>
				   <td class="width-15 active"><label class="pull-right">结构类型：</label></td>
				   <td class="width-25">
						   ${fns:getDictLabel(workFullManage.fullStructureType, 'full_structure_type', '')}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">投资额（元）：</label></td>
				   <td class="width-25">
						   ${workFullManage.fullInvestMoney}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-20 active" rowspan="5"><label class="pull-right">客户信息</label></td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">业主单位：</label></td>
				   <td class="width-25" colspan="3">
					   <input type="hidden" id="clientId" name="clientId" value="${workFullManage.workClientInfo.id}"/>
						   ${workFullManage.workClientInfo.name}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">客户信用等级：</label></td>
				   <td class="width-25">
						   ${workFullManage.workClientInfo.creditRank}
				   </td>
				   <td class="width-15 active"><label class="pull-right">业主联系人：</label></td>
				   <td class="width-25">
						   ${workFullManage.workClientInfo.workClientLinkmanList[0].name}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">职务：</label></td>
				   <td class="width-25">
						   ${workFullManage.workClientInfo.workClientLinkmanList[0].position}
				   </td>
				   <td class="width-15 active"><label class="pull-right">联系方式：</label></td>
				   <td class="width-25">
						   ${workFullManage.workClientInfo.workClientLinkmanList[0].linkPhone}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">QQ：</label></td>
				   <td class="width-25">
						   ${workFullManage.workClientInfo.workClientLinkmanList[0].qq}
				   </td>
				   <td class="width-15 active"><label class="pull-right">Email：</label></td>
				   <td class="width-25">
						   ${workFullManage.workClientInfo.workClientLinkmanList[0].email}
				   </td>
			   </tr>

			   <%--<tr>--%>
					<%--<td class="width-15 active"><label class="pull-right">项目状态：</label></td>--%>
					<%--<td class="width-35">--%>
						<%--<form:textarea path="status" htmlEscape="false" rows="4"    class="form-control "/>--%>
					<%--</td>--%>
					<%--<td class="width-15 active"></td>--%>
		   			<%--<td class="width-35" ></td>--%>
		  		<%--</tr>--%>
		 	</tbody>
		</table>
	</form:form>
</body>
</html>