<%
layout("/include/_container.html", {title:"表单", parent:"报销申请"}){
%>
	<script type="text/javascript">

		$(document).ready(function() {
			jp.ajaxForm("#inputForm",function(data){
				if(data.success){
				    jp.toastr_success(data.msg);
				    jp.unblock("#inputForm", 0);//立即清除loading层
					jp.go("${ctx}/test/activiti/testActivitiExpense");
				}else{
				    jp.toastr_error(data.msg);
				    $("#inputForm").find("button:submit").button("reset");
				}
			});


            $("#agree").click(function () {
                jp.prompt("同意, 审批意见", function (message) {
                    jp.post("${ctx}/act/task/audit",
                        {
                            "taskId":"${testActivitiExpense.act.taskId}",
                            "taskName":"${testActivitiExpense.act.taskName}",
                            "taskDefKey":"${testActivitiExpense.act.taskDefKey}",
                            "procInsId":"${testActivitiExpense.act.procInsId}",
                            "procDefId":"${testActivitiExpense.act.procDefId}",
                            "flag":"yes",
                            "comment":message

                        },
                        function (data) {
								if(data.success){
									jp.success(data.msg);
									jp.go("${ctx}/act/task/todo")
								}
                        })
                })
            })


            $("#reject").click(function () {
                jp.prompt("驳回, 审批意见", function (message) {
                    jp.post("${ctx}/act/task/audit",
                        {
                            "taskId":"${testActivitiExpense.act.taskId}",
                            "taskName":"${testActivitiExpense.act.taskName}",
                            "taskDefKey":"${testActivitiExpense.act.taskDefKey}",
                            "procInsId":"${testActivitiExpense.act.procInsId}",
                            "procDefId":"${testActivitiExpense.act.procDefId}",
                            "flag":"no",
                            "comment":message

                        },
                        function (data) {

                            if(data.success){
								jp.success(data.msg);
								jp.go("${ctx}/act/task/todo")
                            }


                        })
                })
            })


		});
	</script>
<div class="white-box">
	
		<div class="form-group text-center">
			<h3>${testActivitiExpense.act.taskName}</h3>
		</div>
		<form id="inputForm" action="${ctx}/test/activiti/testActivitiExpense/save" method="post" class="form-horizontal">
		<input type="hidden" name="id" value="${testActivitiExpense.id!}"/>
				<div class="form-group">
					<label class="col-sm-2 control-label"><font color="red">*</font>员工姓名：</label>
					<div class="col-sm-10">
					${testActivitiExpense.user.name!}
					</div>
				</div>
			<hr>
				<div class="form-group">
					<label class="col-sm-2 control-label"><font color="red">*</font>报销费用：</label>
					<div class="col-sm-10">
					${testActivitiExpense.cost!}
					</div>
				</div>
			<hr>
				<div class="form-group">
					<label class="col-sm-2 control-label"><font color="red">*</font>归属部门：</label>
					<div class="col-sm-10">
					${testActivitiExpense.office.name!}
					</div>
				</div>
			<hr>
				<div class="form-group">
					<label class="col-sm-2 control-label"><font color="red">*</font>报销事由：</label>
					<div class="col-sm-10">
					${testActivitiExpense.reason!}
					</div>
				</div>
			<hr>
		</form>

		
			<% if(testActivitiExpense.act.taskDefKey! != '' && !testActivitiExpense.act.finishTask! && testActivitiExpense.act.isNextGatewaty!){ %>
			<div class="row">
				<div class="col-sm-3"></div>
				<div class="col-sm-6">
					<div class="form-group text-center">
						<input id="agree" class="btn  btn-primary btn-lg btn-parsley" type="submit" value="同 意" />&nbsp;
						<input id="reject" class="btn  btn-danger btn-lg btn-parsley" type="submit" value="驳 回" />&nbsp;
					</div>
				</div>
			</div>
			<% } %>
			<% if(testActivitiExpense.act.taskDefKey! != '' && !testActivitiExpense.act.finishTask! && !testActivitiExpense.act.isNextGatewaty!){ %>
			<div class="row">
				<div class="col-sm-3"></div>
				<div class="col-sm-6">
					<div class="form-group text-center">
						<input id="agree" class="btn  btn-primary btn-lg btn-parsley" type="submit" value="办 理" />&nbsp;
					</div>
				</div>
			</div>
			<% } %>

			<%if(isNotEmpty(testActivitiExpense.id!)){ %>
				<#flowChart procInsId="${testActivitiExpense.act.procInsId!}"/>
				<#histoicFlow procInsId="${testActivitiExpense.act.procInsId!}" />
			<% } %>

		</div>				
	</div>
	</div>
</div>
<% } %>