<%@ 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() {
			$("#name").focus();
			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'}) {
                $("#leaveType").attr('disabled',true);
                $("#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>采购申请详情</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="oaBuy" action="${ctx}/oabuy/oaBuy/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"/>
		<sys:message content="${message}"/>
		<c:set var="status" value="${oaBuy.act.status}" />
		<div class="control-group">
			<label class="control-label"><font color="red">*</font>申请内容：</label>
			<div class="controls" style="margin-top: 7px;">
				${oaBuy.applyContent}
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><font color="red">*</font>采购类型：</label>
			<div class="controls" style="margin-top: 7px;">
					${fns:getDictLabel(oaBuy.buySort, 'buy_sort', '')}
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><font color="red">*</font>交付日期：</label>
			<div class="controls" style="margin-top: 7px;">
				<fmt:formatDate value="${oaBuy.deliverDate}" pattern="yyyy-MM-dd"/>
				<span class="help-inline"></span>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">采购明细：</label>
			<div class="controls">
				<tr>
				<td class="width-15 active"></td>
				<td class="width-75"  colspan="3">
					<div></div>
					<table style="margin-top:10px;" id="contentTable" class="table table-striped table-bordered table-condensed">
						<thead>
						<tr>
							<th>序号</th>
							<th>名称</th>
							<th>规格</th>
							<th>数量</th>
							<th>单位</th>
							<th>价格</th>
						</tr>
						</thead>
						<tbody id="buyDetailsList">
						<c:forEach items="${oaBuy.buyDetailsList}" var="buyDetails" varStatus="status">
							<tr>
								<td>${status.index + 1}</td>
								<td>${buyDetails.name}</td>
								<td>${buyDetails.format}</td>
								<td>${buyDetails.amount}</td>
								<td>${buyDetails.unit}</td>
								<td>${buyDetails.price}</td>
							</tr>
						</c:forEach>
						<c:if test="${linkManSize == 0}">
							<tr>
								<td colspan="8">暂无数据</td>
							</tr>
						</c:if>
						</tbody>
					</table>
				</td>
				</tr></div>
		</div>
		<div class="control-group">
			<label class="control-label">支付方式：</label>
			<div class="controls" style="margin-top: 7px;">
						${fns:getDictLabel(oaBuy.payStyle, 'pay_style', '')}
							<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">备注信息：</label>
			<div class="controls" style="margin-top: 7px;">
					${oaBuy.remarks}
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><font color="red">*</font>附件：</label>
			<div class="controls">
				<table id="upTable" class="table table-striped table-bordered table-condensed">
					<thead>
					<tr>
						<th class="hide"></th>
						<%--<th>序号</th>--%>
						<th>文件名</th>
						<th>上传人</th>
						<th>上传时间</th>
						<th width="100">操作</th>
					</tr>
					</thead>
					<tbody id="file_attachment">
						<c:choose>
							<c:when test="${not empty oaBuy.workAttachments}">
								<c:forEach items="${oaBuy.workAttachments}" var="workClientAttachment" varStatus="status">
									<tr>
										<td>${status.index + 1}</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="${workClientAttachment.createDate}" type="both"/> </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="${ctx}/workfullmanage/workFullManage/downLoadAttach?file=${workClientAttachment.url}" class="btn btn-success btn-xs">下载</a>--%>
										</td>
									</tr>
								</c:forEach>
							</c:when>
							<c:otherwise>
								<tr>
									<td colspan="5" align="center">暂无数据</td>
								</tr>
							</c:otherwise>
						</c:choose>
					</tbody>
				</table>
			</div>
		</div>
	</form:form>
</div>
	</div>
	</div>
</body>
</html>

