<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<link rel="stylesheet"
	href="https://cdn.bootcss.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"
	integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb"
	crossorigin="anonymous">
<script
	src="https://cdn.bootcss.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"
	integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ"
	crossorigin="anonymous"></script>
<script src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript">
	$(function() {
		getTime();
		setInterval("getTime()", 10 * 1000);
	});

	function getTime() {
		var time = $('#time').empty();
		$.ajax({
			url : '/change4weixin/show',
			success : function(result) {
				var list = JSON.parse(result);
				if (list.length > 0) {
					console.log(list);
					console.log(list.length);
					var t = 0;
					var tab = $('#tab')
					tab.empty();
					var head = '<thead><tr>'
							+'<th>编号</th>' 
							+ '<th>提交者</th>' 
							+ '<th>运行需要时间</th>'
							+ '<th>开始时间</th>'
							+ '<th>当前剩余转的条数</th>'
							+ '<th>操作</th>' 
							+ '</tr>'
							+ '</thead>';
					tab.append(head);
					var tbody = $('tbody');

					for (var i = 0; i < list.length; i++) {
						var addem = '<tr class="success">' 
								+ '<td>'+list[i].site+'</td>'
								+ '<td>'+list[i].mail+'</td>'
								+ '<td>'+list[i].need+'</td>' 
								+ '<td>'+list[i].startDate+'</td>'
								+ '<td>'+list[i].surplusCount+'</td>'
								+ '<td>删除，插队</td>'
								+ '</tr>';
						tbody.append(addem);
					}
					tab.append(tbody);
				} else {
					var time = $('#time').empty();
					var addem = '暂无运行的文件';
					time.append(addem);
				}
			}
		});
	}
</script>
</head>
<body>
	<div>
		<span>有时候显示有点问题，耐心等待</span>
	</div>
	<div id="time"></div>
	<div class="container">
		<div class="row clearfix">
			<div class="col-md-12 column">
				<table class="table" id="tab">
					<thead>
						<tr>
							<th>编号</th>
							<th>提交者</th>
							<th>运行需要时间</th>
							<th>开始时间</th>
							<th>当前剩余转的条数</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>1</td>
							<td>TB - Monthly</td>
							<td>01/04/2012</td>
							<td>Default</td>
						</tr>
						<tr class="success">
							<td>1</td>
							<td>TB - Monthly</td>
							<td>01/04/2012</td>
							<td>Approved</td>
						</tr>
						<tr class="error">
							<td>2</td>
							<td>TB - Monthly</td>
							<td>02/04/2012</td>
							<td>Declined</td>
						</tr>
						<tr class="warning">
							<td>3</td>
							<td>TB - Monthly</td>
							<td>03/04/2012</td>
							<td>Pending</td>
						</tr>
						<tr class="info">
							<td>4</td>
							<td>TB - Monthly</td>
							<td>04/04/2012</td>
							<td>Call in to confirm</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>
	
</body>
</html>