<!-- include 'header' -->
<body xmlns="http://www.w3.org/1999/html">
	<div class="mainLayout">
		<div class="mainMenu">
			<div class="menuItem">
				<a href="#" class="mLogo">CLD</a>
				<ul>
					<!-- include 'menu' -->
				</ul>
			</div>
		</div>
		<div class="warpContent">
			<div class="subMenu fL">
				<div class="menuItem">
					<ul>
						<!-- include 'holiday_menu' -->
					</ul>
				</div>
			</div>
			<div class="adminContent autoHeight" style="height: 821px;">
				<legend><div class="fR"><a class="button" href="#addClose" data-toggle="modal">结算登记</a></div>请假结算</legend>
				<div class="demandCate">
					<ul class="cateList">
	  					<li><a href="/holidayclose">正式员工</a><a href="/holidayclose2" class="now">实习生</a></li>
						<li>
							<select id="year">
								{{option}}
							</select>
							<select id="month">
								<option value="1" <!-- if {{thismonth}} == 1 -->selected<!-- endif -->>1月</option>
								<option value="2" <!-- if {{thismonth}} == 2 -->selected<!-- endif -->>2月</option>
								<option value="3" <!-- if {{thismonth}} == 3 -->selected<!-- endif -->>3月</option>
								<option value="4" <!-- if {{thismonth}} == 4 -->selected<!-- endif -->>4月</option>
								<option value="5" <!-- if {{thismonth}} == 5 -->selected<!-- endif -->>5月</option>
								<option value="6" <!-- if {{thismonth}} == 6 -->selected<!-- endif -->>6月</option>
								<option value="7" <!-- if {{thismonth}} == 7 -->selected<!-- endif -->>7月</option>
								<option value="8" <!-- if {{thismonth}} == 8 -->selected<!-- endif -->>8月</option>
								<option value="9" <!-- if {{thismonth}} == 9 -->selected<!-- endif -->>9月</option>
								<option value="10" <!-- if {{thismonth}} == 10 -->selected<!-- endif -->>10月</option>
								<option value="11" <!-- if {{thismonth}} == 11 -->selected<!-- endif -->>11月</option>
								<option value="12" <!-- if {{thismonth}} == 12 -->selected<!-- endif -->>12月</option>
							</select>
						</li>
	  				</ul>
	  			</div>
				<div class="saeaList">
					<div class="entry">
						<table class="table table-bordered table-condensed table-hover">
							<tbody>
							<tr><th class="taC" width="50"></th><th class="taC">实习生</th><th class="taC">上班</th><th class="taC">事假</th><th class="taC">病假</th><th class="taC">旷工</th></tr>
							<!-- loop stafflist -->
							<!-- loop stafflist' value.cidstafflist -->
							<tr>
								<!-- if !empty({{stafflist' cidstafflist' value.first}}) -->
								<th rowspan="{{stafflist' value.count}}">{{stafflist' value.categoryname}}</th>
								<!-- endif -->
								<th>{{stafflist' cidstafflist' value.username}}</th>
								<td class="taC">{{stafflist' cidstafflist' value.14}}</td>
								<td class="taC">{{stafflist' cidstafflist' value.1}}</td>
								<td class="taC">{{stafflist' cidstafflist' value.2}}</td>
								<td class="taC">{{stafflist' cidstafflist' value.3}}</td>
							</tr>
							<!-- endloop -->
							<!-- endloop -->
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--弹出-->
<div class="modal hide fade" id="addClose">
	<div class="modal-dialog ">
		<div class="modal-content">
	    <div class="modal-header">
	    	<h3>结算登记</h3>
	    </div>
			<form method="post" action="/addholiday2" onsubmit="return addholiday();">
				<div class="modal-body saeaList">
					<table class="table table-bordered table-condensed">
						<tbody>
						<tr>
							<th class="taC" width="100"><span class="colRed">*</span>员工</th>
							<td>
								<select disabled><option>实习生</option></select>
								<select id="cidstaff" name="uid">
									<option value="0">选择员工</option>
									<!-- loop internstafflist -->
									<option value="{{internstafflist' value.sid}}">{{internstafflist' value.username}}</option>
									<!-- endloop -->
								</select>
							</td>
						</tr>
						<tr>
							<th class="taC" width="100"><span class="colRed">*</span>登记类型</th>
							<td>
								<select id="selecttype" name="type">
									<option value="14">上班</option>
									<option value="1">事假</option>
									<option value="2">病假</option>
									<option value="3">旷工</option>
								</select>
							</td>
						</tr>
						<tr id="tr_all" class="changetr" style="display: none">
							<th class="taC" width="100"><span class="colRed">*</span><span id="holidaytype">事假</span>天数</th><td>
							<input type="date" name="day" id="holidayday" disabled="true"></td>
						</tr>
						<tr id="tr_day" class="changetr" style="display: none">
							<th class="taC" width="100"><span class="colRed">*</span>时间</th>
							<td>
								<select name="daytype">
									<option value="1">全天（1天）</option>
									<option value="2">上午（0.5天）</option>
									<option value="3">下午（0.5天）</option>
								</select>
							</td>
						</tr>
						<tr id="tr_14" class="changetr">
							<th class="taC" width="100"><span class="colRed">*</span>上班天数</th>
							<td>
								<select id="selectmonth" name="monthselect">
								{{monthlist}}
								</select>
								<input placeholder="请输入上班天数" id="daynum" name="daynum" type="number" step="0.5">
							</td>
						</tr>
						<tr>
							<th class="taC" width="100">备注</th><td><textarea class="span4" name="description" placeholder="选填"></textarea></td>
						</tr>
						</tbody>
					</table>
				</div>
				<div class="modal-footer">
					<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
					<button type="submit" class="button" name="close2">确定</button>
				</div>
			</form>
		</div>
	</div>
</div>
    <!--弹出内容-->
<script type="text/javascript">autoFlashHeight();</script>
<script>
	$(function() {
		$('#year').change(function(){
			var html = '/year/'+$(this).val()+'/month/'+$('#month').val();
			window.location.href = '/holidayclose2' + html;
		});

		$('#month').change(function(){
			var html = '/year/'+$('#year').val()+'/month/'+$(this).val();
			window.location.href = '/holidayclose2' + html;
		});

		$('#selecttype').change(function(){
			$('.changetr').hide();
			$('.changetr input').attr('disabled',true);
			$('.changetr select').attr('disabled',true);
			if($(this).val() != 14){
				$('#tr_all').show();
				$('#tr_all input').removeAttr('disabled');
				$('#tr_day').show();
				$('#tr_day select').removeAttr('disabled');
				$('#holidaytype').text($(this).find("option:selected").text());
			}else{
				$('#tr_14').show();
				$('#tr_14 input').removeAttr('disabled');
			}
		})
	});
	function addholiday(){
		if($('#cidstaff').val() == 0){
			alert('请选择员工');
			return false;
		}
		if($('#selecttype').val() != 14){
			if($('#holidayday').val() == ''){
				alert('请选择日期');
				return false;
			}
		}else {
			if ($('#selectmonth').val() == 0) {
				alert('请选择月份');
				return false;
			}
			if ($('#daynum').val() == '') {
				alert('请输入上班天数');
				return false;
			}
		}
	}
</script>
</body>
