<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/html5.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>试卷管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 试卷管理 <span class="c-gray en">&gt;</span> 试卷列表 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
	<form action="${pageContext.request.contextPath }/admin/questionPaper/list" method="post" id="searchForm">
	<div class="text-c"> 
		名称:  
		<input type="text" class="input-text" style="width:250px" placeholder="输入名称" value="${paperName }" id="" name="paperName">
	   	 状态类型: <span class="select-box inline">
		    <select class="select" id="" name="paperType">
		    	<option value="">请选择状态</option>
		      	<option value="1" <c:if test="${paperType == 1 }">selected="selected"</c:if>>有效</option>
				<option value="2" <c:if test="${paperType == 2 }">selected="selected"</c:if>>无效</option>
		    </select>
	    </span>
		
		<button type="button" class="btn btn-success radius" id="searchButton" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
	</div>
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> 
		<span class="l">
			<a href="javascript:;" onclick="member_add('添加试卷','${pageContext.request.contextPath}/admin/questionPaper/toAdd','','510')" class="btn btn-primary radius">
				<i class="Hui-iconfont">&#xe600;</i> 添加试卷
			</a>
		</span>
	</div>
	<div class="mt-20">
	<table class="table table-border table-bordered table-hover table-bg">
		<thead>
			<tr class="text-c">
				<th width="50">id</th>
				<th width="150">试卷名称</th>
				<th width="50">试卷图标</th>
				<th width="50">试卷回答次数</th>
				<th width="100">分享次数</th>
			
				<th width="100">创建时间</th>
				<th width="80">状态</th>
				<th width="200">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:if test="${!empty paperList }">
				<c:forEach items="${paperList }" var="paper">
				<tr class="text-c">
					<td>${paper.paperId }</td>
					<td>${paper.paperName }</td>
					<td class='text-l'>${paper.paperPic }</td>
					<td>${paper.paperNumber }</td>
					<td >${paper.paperShareNumber}</td>
					<td><fmt:formatDate value="${paper.paperCreateDate }" pattern="YYYY-MM-dd HH:MM:ss"/></td>
					<td>
						<c:if test="${paper.paperStatus == 1}">有效</c:if>
						<c:if test="${paper.paperStatus == 2}">无效</c:if>
					</td>
				
					<td class="td-manage">
						<input id="through" class="btn btn-primary radius upload-btn" 
						onclick="goods_edit('${pageContext.request.contextPath }/admin/questionPaper/listPaper/${paper.paperId }');"
						 type="button" value="详情" />&nbsp;
					<!-- 	<input id="through" class="btn btn-primary radius upload-btn" onclick="updateCType('修改优惠券类型','${pageContext.request.contextPath }/admin/couponType/toUpdateType/${paper.paperId }','','700');" type="button" value="修改" />&nbsp;
						<input id="through" class="btn btn-primary radius upload-btn" onclick="deleteCType(this,${paper.paperId });" type="button" value="删除" />
						 -->
					</td>
				</tr>
				</c:forEach>
			</c:if>
			<c:if test="${empty paperList }">
				<tr class="text-c">
					<td colspan="9">没有查询到数据</td>
				</tr>
			</c:if>
		</tbody>
	</table>
	</div>
</div>
<div align="right">
	<%@include file="/common/other/paper/pager.jsp"%>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/laypage/1.2/laypage.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script> 
<script type="text/javascript">
$(document).ready(function() {
	$("#searchButton").click(function() {
		var action = $("#searchForm").attr("action");
		$("#searchForm").attr("action", action).submit();
	});
})
/**
 * 打开修改商品界面
 */
function goods_edit(url){
	window.location.href = url;
}

/*试卷-添加*/
function member_add(title,url,id,w,h){
	window.location.href = url;
	//layer_show(title,url,w,h);
}
/*优惠券类型-详情*/
function detailCType(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*优惠券类型-删除*/
function deleteCType(obj,id){
	//alert("-----------");
	layer.confirm('确认要删除吗？',function(){
		$.ajax({
			url: '${pageContext.request.contextPath }/admin/couponType/deleteType/'+id,
			//data:{ "paperId":id },
			dataType:'json',//服务器返回json格式数据
			type:'post',	//HTTP请求类型
			error:function(data){
				//alert("-----error:function----->>" + data);
	      	  	layer.msg("删除失败!",{icon: 5,time:2000});
	        },
	        success:  function(data){
	        	//alert("----success------>>" + data);
	      	  	//layer.msg(data.status,{icon: 1,time:2000});
	      	  	if(data.status){
					$(obj).parents("tr").remove();
					layer.msg('已删除!',{icon:1,time:3000});
	      	  	}else{
	      	  		layer.msg(data.message,{icon:1,time:3000});
	      	  	}
	        }
		});
	});
}
</script> 
</body>
</html>