<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>私塾家</title>
<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
<script th:include="sys/common/metaJS" th:remove="tag"></script> 
</head>
<style>
	.tablelink{margin-right:10px;}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">后台系统管理</a></li>
		<li><a href="#">即将过期推送管理</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/role/pushlist.html}" method="post">
	<ul class="seachform">
		<li>
			<label>小孩姓名</label>
			<input name="name" type="text" class="scinput" th:value="${search.get('name')}"/>
		</li>
		<li>
			<label>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
			<ul class="toolbar">
				<a href="javascript:;" onclick="pushAll()"><li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>全部推送</li></a>
			</ul>
		</li>
	</ul>
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <th style="width: 50px;">序号</th>
		        <th>服务名称</th>
		        <th>价格</th>
		        <th>结束时间</th>
		        <th>家长姓名</th>
		        <th>小孩姓名</th>
		        <th>卡号</th>
		        <th>所属图书馆</th>
		        <th>操作</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				<td th:text="${itemStat.count}" ></td>
				<td th:text="${item.get('details')}"></td>
				<td th:text="${item.get('price')}" ></td>
				<td th:text="${#calendars.format(item.get('end_time'),'yyyy-MM-dd HH:mm:ss')}" ></td>
				<td th:text="${item.get('parent_name')}" ></td>
				<td th:text="${item.get('child_name')}" ></td>
				<td th:text="${item.get('flow_id')}" ></td>
				<td th:text="${item.get('league_name')}" ></td>
				<td>
					<a href="javascript:;" th:onclick="'deleteById(\''+${item.get('child_name')}+'\',\''+${item.get('details')}+'\',\''+${item.get('flow_id')}+'\',\''+${item.get('price')}+'\',\''+${item.get('end_time')}+'\',\''+${item.get('lib_id')}+'\',\''+${item.get('xs_openid')}+'\',\''+${item.get('league_name')}+'\',\''+${item.get('wx_account')}+'\')'"  class="tablelink" >推送</a>
				</td>
			</tr>
		</tbody>
	</table>
	<!-- 分页 -->
	<div class="pagin">
    	<div class="message">共<i class="blue">[[${page.rowCnt}]]</i>条记录，当前显示第&nbsp;<i class="blue">[[${page.pageNo }]]&nbsp;</i>页</div>
    	<div th:utext='${listNavigatHtml}' th:remove="tag" ></div>
   	</div>
</div>
<script type="text/javascript">
function deleteById(child_name,details,flowId,price,endTime,libId,xs_openid,league_name,wx_account){
	parent.layer.confirm("确定推送吗？",
			{icon: 4, btn: ['确定','取消']
	}, function(){
		$.ajax({
			url: '[[${sysUrl}]]/sys/role/pushOne',
			type: "post",
			data:{
				'child_name': child_name,
				'details':details,
				'flowId':flowId,
				'price':price,
				'endTime':endTime,
				'libId':libId,
				'xs_openid':xs_openid,
				'league_name':league_name,
				'wx_account':wx_account
			},
			dataType: "json",
			success:function(data){
					
					if(data.meta.success){
						parent.layer.msg("推送成功",{icon:1});
					}else{
						parent.layer.msg(data.meta.message,{icon:11});
					}
			}
		});
	});
}
function pushAll(){
	parent.layer.confirm("确定推送吗？",
			{icon: 4, btn: ['确定','取消']
	}, function(){
	$.ajax({
		url: '[[${sysUrl}]]/sys/role/pushAll',
		type: "post",
		dataType: "json",
		success:function(data){
				if(data.meta.success){
					parent.layer.msg("推送成功",{icon:1});
				}else{
					parent.layer.msg(data.meta.message,{icon:11});
				}
		}
	});
	});
}
</script>
</body>
</html>