<%@ 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(obj){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            if(validateForm.form()){
                if(obj == 1){
                    $('#flag').val('yes');
                }else{
                    $('#flag').val('no');
                }
                $("#inputForm").submit();
                return true;
            }

            return false;
        }

        $('#btnPresent').click(function () {

            $.ajax({
                url:"${ctx}/workreimbur/workReimbur/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);
					}
				}
			});
		});
	</script>
</head>

<body class="gray-bg">

  <div class="wrapper wrapper-content">
	<div class="ibox">
	<div class="ibox-title">
		<h5>报销申请详情 </h5>
	</div>
		<div class="ibox-content">
		<form:form id="inputForm" modelAttribute="workReimbur" action="${ctx}/workreimbur/workReimbur/saveAudit" method="post" class="form-horizontal">
		<form:hidden path="id"/>
			<form:hidden path="home"/>
		<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="${workReimbur.act.status}" />
			<div class="control-group">
				<label class="control-label">报销明细：</label>
				<div class="controls">
					<c:forEach items="${workReimbur.detailsList}" var="reimburDetail">
						<table style="text-align: center;width: 100%;margin-top:10px;" class="table table-striped table-bordered table-condensed" >
							<tr>
								<td>报销金额(元)：</td><td>${reimburDetail.reimburAmount}</td>
								<td>报销类别：</td><td>${reimburDetail.reimburCategory}</td>
							</tr>
							<tr>
								<td>费用明细：</td><td colspan="3">${reimburDetail.reimburDetail}</td>
							</tr>
						</table>
					</c:forEach>
				</div>
				<label class="control-label">报销总额(元)：</label>
				<div class="controls" style="margin-top: 8px;">
					${workReimbur.totalAmount}
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">图片：</label>
				<div class="controls">
					<table 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:if test="${not empty workReimbur.workattachmentList}">
							<c:forEach items="${workReimbur.workattachmentList}" var="attachment" varStatus="varStatus">
								<tr>
									<%--<td>${varStatus.index+1}</td>--%>
									<c:if test="${fn:containsIgnoreCase(attachment.attachmentName,'jpg')
												   or fn:containsIgnoreCase(attachment.attachmentName,'png')
												   or fn:containsIgnoreCase(attachment.attachmentName,'gif')
												   or fn:containsIgnoreCase(attachment.attachmentName,'jpeg')}">
										<td><img src="${attachment.url}" onclick="openDialogView(' ','${ctx}/sys/picturepreview/picturePreview?url=${attachment.url}','860px','600px')" width="50" height="50" alt="${attachment.attachmentName}"/></td>
									</c:if>
									<td>${fns:getUserById(attachment.attachmentUser).name}</td>
									<td><fmt:formatDate value="${attachment.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
										<td>
											<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${attachment.url}');" class="btn btn-success btn-xs">下载</a>

											<%--<a href="${ctx}/workfullmanage/workFullManage/downLoadAttach?file=${attachment.url}" class="btn btn-success btn-xs">下载</a>--%>
										</td>
								</tr>
							</c:forEach>
						</c:if>
					</table>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">备注：</label>
				<div class="controls" style="margin-top: 8px;">
						${workReimbur.remarks}
				</div>
			</div>
			<c:if test="${not empty status}">
				<div class="control-group">
					<label class="control-label">审批意见：</label>
					<div class="controls">
						<form:textarea path="act.comment" class="form-control" rows="3" maxlength="127"/>
					</div>
				</div>
				<%--<div class="form-actions">
				<c:if test="${workReimbur.act.taskDefKey ne 'apply_end'}">
						<input id="btnSubmit" class="btn btn-primary" type="submit" value="同 意" onclick="$('#flag').val('yes')"/>&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>
			<act:flowChart procInsId="${workReimbur.act.procInsId}"/>
			<act:histoicFlow procInsId="${workReimbur.act.procInsId}"/>
	</form:form>
	</div>
	</div>
	</div>
</body>
</html>