<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;}
	.stylecss{
	      color: red;
	}
	.select_width{
	     width: 70px;
	}
	.date_width{
	     width: 100px;
	}
	td div{
     word-break:break-all;
	}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">图书馆管理</a></li>
		<li><a th:href="@{/sys/lib/libJoinList.html}">图书馆</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/lib/libJoinList.html}" method="post">
	 <input id="url" name="url" type="hidden">
	 <input id="leagueName" name="leagueName" type="hidden">
	<ul class="seachform">
		<li>
			<label>图书馆名称</label>
			<input name="LIKE_leagueName" type="text" class="scinput" th:value="${search.get('LIKE_leagueName')}"/>
		</li>
		<li>
			<label>图书馆CODE</label>
			<input name="LIKE_leagueCode" type="text" class="scinput" th:value="${search.get('LIKE_leagueCode')}"/>
		</li>
		<li>
			<label>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null  && (#httpSession.getAttribute('admin').loginName eq 'admin' || #httpSession.getAttribute('admin').loginName eq 'sishujia' )  } "  >
				<ul class="toolbar">
					<a th:href="@{/sys/lib/libJoinAdd.html}"><li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增</li></a>
				</ul>
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null   } " >
				<ul class="toolbar">
					<a href="javascript:;" onclick="qrCodeDown();"><li class="click"><span><img th:src="@{/static/sys/images/generate.png}" /></span>导出二维码</li></a>
					
				</ul>
		</li>
	</ul>
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <th style="width: 40px;">序号</th>
		        <th>图书馆名称</th>
		        <th>CODE</th>
		        <th>销售二维码</th>
		        <th>图书馆地址</th>
		        <th>图书馆电话</th>
		        <th>创建时间</th>
		        <th style="text-align: center;">操作</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				<td th:text="${itemStat.count}" ></td>
					<td th:title="${item.leagueName}" th:text="${item.leagueName} ? (${#strings.length(item.leagueName)} &gt; 15 ? ${#strings.substring(item.leagueName,0,15)} :${item.leagueName} ) :'' ">
					</td>
					<td th:text="${item.leagueCode}" ></td>
					<td  class="imgtd">
							<img  th:if="${item.qrCode}!=null" th:src="${imgUrl}+''+${item.qrCode}" class="tablelink" style="width: 50px;height: 50px;" />
							<a href="javascript:;" th:if="${item.qrCode}!=null" th:onclick="'downloadById(\''+${item.qrCode}+'\',\''+${item.leagueName}+'\')'"  class="tablelink" style="color: red;">下载</a>
					</td>
					<td th:title="${item.leagueAddress}" th:text="${item.leagueAddress} ? (${#strings.length(item.leagueAddress)} &gt; 15 ? ${#strings.substring(item.leagueAddress,0,15)} :${item.leagueAddress} ) :'' ">
					</td>
					<td th:text="${item.leaduePhone}" ></td>
					<td th:text="${#calendars.format(item.createTime,'yyyy-MM-dd')}" ></td>
					<td>
					  <div>
						<a th:href="@{/sys/lib/libManagerList.html(libId=${item.id},orgCode=${item.orgCode},libtype=${item.libtype})}" class="tablelink" >图书馆管理员</a>
						<a th:href="@{/sys/lib/libJoinAdd.html(id=${item.id})}" th:if="${ #httpSession.getAttribute('admin') !=null   && (#httpSession.getAttribute('admin').loginName eq 'admin' || #httpSession.getAttribute('admin').loginName eq 'manting' || #httpSession.getAttribute('admin').loginName eq 'sishujia' )  } "  class="tablelink">修改</a>
						<a href="javascript:;" th:onclick="'createQrById(\''+${item.id}+'\')'" class="tablelink"  th:if="${ #httpSession.getAttribute('admin') !=null  && #httpSession.getAttribute('admin').loginName eq 'admin'   } "  >生成二维码</a>
						<a th:href="@{/sys/problem/checklist.html(libId=${item.id},type=1)}" th:if="${item.libtype eq 1}" class="tablelink">批量签到</a>
						<a th:href="@{/sys/problem/checklist.html(libId=${item.id},type=2)}" th:if="${item.libtype eq 1}"  class="tablelink">批量签离</a>

					  </div>
					  <div>
						<!--  <a th:href="@{/sys/sales/staffingList.html(EQ_libId=${item.id},orgCode=${item.orgCode})}" class="tablelink" th:if="${item.libtype eq 1}"  >销售人员</a>
						  <a  th:href="@{/sys/sales/salesPriceList.html(EQ_libId=${item.id})}" class="tablelink" >产品售卡价格</a>
						  <a   th:href="@{/sys/sales/libVipCodeList.html(EQ_libId=${item.id})}" class="tablelink" >销售卡折扣</a>
						  <a th:href="@{/sys/sales/orderList.html(libId=${item.id})}" class="tablelink" style="color: red;">销售订单</a>-->
						  <a   th:href="@{/sys/sales/ssjzybmemberList.html(EQ_libId=${item.id},type=2)}" class="tablelink" >作业吧会员</a>
						  <a   th:href="@{/sys/lib/usercount.html(libId=${item.id})}" class="tablelink" >小塾统计数据</a>
						 </div>

				    </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>
</body>
<script type="text/javascript">

function createQrById(id){
	parent.layer.open({
	    type: 2,
	    title: "创建图书二维码",
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    //offset: '100px',
	    area: ['40%', '50%'],
	    content: '[[${sysUrl}]]/sys/lib/libDetailAdd.html?libId='+id
	});
}

function qrCodeDown(){
	
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/lib/ajaxDetailQrCode";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/lib/libJoinList.html";
};

function downloadById (url,leagueName){
	$('#url').val(url);
	$('#leagueName').val(leagueName);
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/lib/downloadQrCode";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/lib/libJoinList.html";
}


function pushNotice(libId){
	$.ajax({
		url: '[[${sysUrl}]]/sys/lib/pushNotice',
		type: "post",
		data:{
			libId:libId
		},
		dataType: "json",
		success:function(data){
				
				if(data.meta.success){
					layer.msg("同步成功",{icon:1});
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
		}
	});
}
</script>
</html>