<link href="/css/webht/bootstrap.min.css" rel="stylesheet">
<script src="http://www.mycht.cn/min?f=/js/jquery.js,/js/bootstrap.min.js"></script>
<div class="container">
	<div class="row">
		<h1>单程：<?php echo $data->queryResultList['0']->flight->departCityName.'-----'.$data->queryResultList['0']->flight->arriveCityName ?></h1>
		<div class="row" style="border-bottom:1px #ccc dashed;margin-bottom:20px;">
			<div class="col-md-6">In the Morning (06 ~ 12) <input type="radio" id="morning" name="fliter" class="fliter"/></div>
			<div class="col-md-6">In the Afternoon (12 ~ 18)<input type="radio" id="afternoon" name="fliter" class="fliter"/></div>
			<div class="col-md-6">In the Evening (18 ~ 24)<input type="radio" id="evening" name="fliter" class="fliter"/></div>
			<div class="col-md-6">All time<input type="radio" id="alltime" name="fliter"/></div>
		</div>
		<?php 
			foreach ($data->queryResultList as $items){
				echo '<div class="row flightItems" style="border-bottom:1px #ccc dashed;margin-bottom:10px;">';
				echo '<div class="col-md-4"><p>'.$items->flight->airlineCompany.' ('.$items->flight->flightNo.')</p></div>';
				echo '<div class="col-md-4">'.$items->flight->departAirportName.' ('.$items->flight->departAirportTerminal.') <span class="departime">'.$items->flight->departTime.'</span></div>';
				echo '<div class="col-md-2">'.$items->flight->duration.':00</div>';
				echo '<div class="col-md-4">'.$items->flight->arriveAirportName.' ('.$items->flight->arriveAirportTerminal.') '.$items->flight->arriveTime.'</div>';
				echo '<div class="col-md-2">'.$items->flight->craftType.' ('.$items->flight->meal.')</div>';
				echo '<div class="col-md-4">经济舱 ('.$items->resourceList['0']->price->cabinClassFullPrice.') 全价：<input type="radio" name="bookSeat" value="'.$items->flight->flightNo.','.$items->flight->departCityIataCode.','.$items->flight->arriveCityIataCode.','.$items->flight->departDate.','.$items->flight->arriveDate.','.$items->flight->departTime.','.$items->flight->departAirportCode.','.$items->flight->departAirportTerminal.','.$items->flight->arriveTime.','.$items->flight->arriveAirportCode.','.$items->flight->arriveAirportTerminal.',经济舱,'.$items->resourceList['0']->price->cabinClassFullPrice.','.$items->flight->meal.'" /></div>';
				echo '<div class="col-md-4"><a role="button" data-toggle="collapse" href="#'.$items->flight->flightNo.'" ria-expanded="true" aria-controls="collapseOne">展示舱位信息</a></div>';
				echo '</div>';
				echo '<div id="'.$items->flight->flightNo.'" class="panel-collapse collapse">';
				foreach ($items->resourceList as $seatItems){
					echo '<div class="row seatList" style="border-bottom:1px #ccc dashed;margin-bottom:8px;">';
					echo '<div class="col-md-4">'.$seatItems->cabinList['0']->cabinClassName.'('.$seatItems->cabinList['0']->cabinClass.')</div>';
					echo '<div class="col-md-4">免费托运行李额：'.$seatItems->cabinList['0']->freeLuggage.$seatItems->cabinList['0']->freeLuggageUnit.'</div>';
					if($seatItems->price->adultFacePrice != $seatItems->price->cabinClassFullPrice){
						echo '<div class="col-md-4">票面价(折扣)：'.$seatItems->price->adultFacePrice.' ('.round(($seatItems->price->adultFacePrice / $seatItems->price->cabinClassFullPrice),2) *10 .')</div>';
					}else{
						echo '<div class="col-md-4">票面价：'.$seatItems->price->adultFacePrice.'(全价)</div>';
					}
					//echo '<div class="col-md-4">全价：'.$seatItems->price->cabinClassFullPrice.'</div>';
					echo '<div class="col-md-4">余票数：'.$seatItems->cabinList['0']->seatStatus.'</div>';
					echo '<div class="col-md-4"><input class="bookSeat" type="radio" name="bookSeat" value="'.$items->flight->flightNo.','.$items->flight->departCityIataCode.','.$items->flight->arriveCityIataCode.','.$items->flight->departDate.','.$items->flight->arriveDate.','.$items->flight->departTime.','.$items->flight->departAirportCode.','.$items->flight->departAirportTerminal.','.$items->flight->arriveTime.','.$items->flight->arriveAirportCode.','.$items->flight->arriveAirportTerminal.','.$seatItems->cabinList['0']->cabinClassName.','.$seatItems->price->adultFacePrice.','.$items->flight->meal.'" /></div>';
					echo '</div>';
				}
				echo '</div>';
				
			}
		
		?>
	</div>
</div>
<script>
$(function(){
	$('.fliter').click(function(){
		var types = $(this).attr('id');
		var fliterRule = '';
		var time = '';
		$('.flightItems').hide();
		$('.departime').each(function(){
			if(types == 'morning'){
				fliterRuleMin = '06';
				fliterRuleMax = '12';
			}else if(types == 'afternoon'){
				fliterRuleMin = '12';
				fliterRuleMax = '18';
			}else if(types == 'evening'){
				fliterRuleMin = '19';
				fliterRuleMax = '24';
			}
			
			time = $(this).text();
			console.log(time);
			
			if(time > fliterRuleMin && time < fliterRuleMax){
				$(this).parent().parent().show();
			}
			
			//console.log($(this).text());
		});
	});
	
	$('#alltime').click(function(){
		$('.flightItems').show();
	});
	
	$('.seatList').hover(function(){
		$('.seatList').css('background-color','#fff');
		$(this).css('background-color','#ccc');
	});
});
</script>
