<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> 
<script src="sys/js/jquery.validate.min.js" th:src="@{/static/sys/js/jquery.validate.min.js}"></script>
<script src="sys/js/jquery-validation/messages_zh.js" th:src="@{/static/sys/js/jquery-validation/messages_zh.js}"></script>
<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
 <style>
    	.clearfix:after {
			visibility: hidden;
			display: block;
			font-size: 0;
			content: " ";
			clear: both;
			height: 0;
		}
		.clearfix { display: inline-table; }
		* html .clearfix { height: 1%; }
		.clearfix { display: block; }
		.fl{display:inline;float:left}
		clearfix >control-label-error{display:inline;float:left;marign-left:10px}
		 label.control-label-error {
  				color: Red;
             }
          .lispan {line-height: 34px;}   
          
          .select1{
   		    width:100%;
		    height: 32px;
		    line-height: 32px;
		    border-top: solid 1px #a7b5bc;
		    border-left: solid 1px #a7b5bc;
		    border-right: solid 1px #ced9df;
		    border-bottom: solid 1px #ced9df;
		    opacity:1;
	        margin-bottom: 10px;
    	}
    </style>
</head>

<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">图书馆管理</a></li>
		<li><a th:href="@{/sys/lib/libVipList.html}">暑寒假日期管理</a></li>
	</ul>
</div>
<div class="formbody">
	<div class="formtitle"><span>暑寒假配置</span></div>
	<form id="submitFrom"   method="post" class="form-horizontal form-validate">
		     
		<ul class="forminfo">
				
			<li class="clearfix">
				<label>暑假日期:<b>*</b></label>
				 <input id="date-start1" style="width: 200px" name="date-start1"  type="text"  class="dfinput fl"
					        	onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
				 <label style="width: 20px;text-align: center;">--</label>
	        	 <input id="date-end1" style="width: 200px" name="date-end1"  type="text"  class="dfinput fl"
	        	onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
			</li>
			
			<li class="clearfix">
				<label>寒假日期:<b>*</b></label>
				 <input id="date-start2" style="width: 200px"  name="date-start2"  type="text"   class="dfinput fl"
					        	onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
				 <label style="width: 20px;text-align: center;">--</label>
	        	 <input id="date-end2" style="width: 200px" name="date-end2"  type="text"  class="dfinput fl"
	        	onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
			</li>
			
			
			<li>
				<label>&nbsp;</label>
				<button type="button" style="display: none" id="subbtn" class="btn">保存</button>
			</li>
		</ul>
	</form>
	<div class="formtitle"><span>已配置的日期</span></div>
	<ul style="padding-left: 30px">
		<li th:each="item:${workDays}" >
			<label th:if="${#calendars.format(item.date,'MM')>'10' || #calendars.format(item.date,'MM')<='03'} " th:text="'寒假:'+${#calendars.format(item.date,'yyyy-MM-dd')}" ></label>
			<label th:if="${#calendars.format(item.date,'MM')<='10' && #calendars.format(item.date,'MM')>'03'}" th:text="'暑假:'+${#calendars.format(item.date,'yyyy-MM-dd')}" ></label>
		</li>
	</ul>
	
</div>
</body>

<script type="text/javascript">
var libId="[[${libJoin.id}]]"
var leagueCode="[[${libJoin.leagueCode}]]"
$(function(){
	
	if(leagueCode.indexOf("SZ")<=-1){
		alert('此功能只在深圳区域开放配置');
	}else{
		$("#subbtn").show();
	}

	$("#subbtn").click(function (){
		roleFrom();
	})
});
function roleFrom(){
	var url="[[${sysUrl}]]/sys/lib/libWorkDaySave";
	var datestart1=$("#date-start1").val();
	var datestart2=$("#date-start2").val();
	var dateend1=$("#date-end1").val();
	var dateend2=$("#date-end2").val();
	var params = {datestart1:datestart1,datestart2:datestart2,dateend1:dateend1,dateend2:dateend2,libId:libId}
	$.post(url,params,function(data){
		if(data != null){
				if(data.meta.success){
					layer.msg("操作成功!",{icon:1});
			    	setTimeout(function(){
			    		window.location.href ='[[${sysUrl}]]/sys/lib/libWorkDay.html?libId='+libId;
					},1000);
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
		}
		
	});
}

</script>
</html>