<?php 
	// ini_set('display_errors', '1');
    // ini_set('display_startup_errors', '1');
    // error_reporting(E_ALL);
    include('header.php');
	session_start();

    // require('config/Database.php');
    // $db = Database::getInstance();
    // $mysqli = $db->getConnection();
	$reg_mob=$_SESSION['session_mobile_number'];
	$query = "SELECT * FROM std_ticket WHERE reg_mobile=".$reg_mob; 
	$stddt= $mysqli->query($query);	

	$totalbooked = $stddt->num_rows;
	$type_seat_selct = array();
	

	//$seat_query = "SELECT * FROM std_ticket WHERE reg_mobile=".$reg_mob; 
	$seat_query = "SELECT * FROM std_ticket WHERE 1=1"; 
	$seat_dt= $mysqli->query($seat_query);	
	if ($seat_dt->num_rows > 0) {
		while($row_seat = $seat_dt->fetch_assoc()){
			$type_seat_selct[$row_seat["seat_type"]][] = $row_seat["seat_no"];
		}
	}

	$current_selected_seats = $_SESSION['current_selected_seats'];
	//echo "<pre>";print_r($type_seat_selct);exit;
?>
<div class="details-pickup-section auto-container details-pickup2">
    <div class="container1">
		<form name="selectseat" id="selectseat" method="POST" action="confirmticket.php">
			<div class="theatre">
				<div class="screen-side">
					<div class="screen"><img src="images/screen-bg.png" alt=""></div>
				</div>
				<div class="left-container">
					<div class="reserved-text">Reserved<span>VVIP</span></div>
					<div class="sofa-area">
						<ul>
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						</ul>
						<ul class="sofa">
						<li>Sofa</li>	
						</ul>
						<ul>
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						<li></li>	
						</ul>
					</div>	
					<div class="exit exit--front left">
						<ol class="cabin">
							<li class="row row--2">
								<ol class="seats" type="A">
									<?php for($a=1;$a<=128;$a++){ ?>
										<li class="seat active">
											<input type="checkbox" name="seatno[a][]" value="<?= $a ?>" id="<?= 'a-'.$a ?>" <?= (in_array($a,$type_seat_selct['a']) ? '  disabled' : 'disabled')?> <?= (in_array($a,$current_selected_seats['a']) ? ' checked': '')?>>
											<label for="<?= 'a-'.$a ?>"><?= $a ?></label>
										</li>
									<?php } ?>                           
								</ol>
							</li>
						</ol>	                                                          
						<div class="reserved-text2">
							<span class="first-title">Reserved</span> <span>Prize distribution students & VIP Ashram Devotees</span>
						</div>														
					</div>              	  
					<div class="left-box color1">
						<div class="screen-area">
							Screen
						</div>
						<ol class="cabin">
							<?php for($a1=1;$a1<=170;$a1++){ ?>							
								<li class="seat seat2">
									<input type="checkbox" name="seatno[a1][]" value="<?= $a1 ?>" id="<?= 'a1-'.$a1 ?>" <?= (in_array($a1,$type_seat_selct['a1']) ? '  disabled' : '')?> <?= (in_array($a1,$current_selected_seats['a1']) ? ' checked': '')?>>
									<label for="<?= 'a1-'.$a1 ?>"><?= $a1 ?></label>
								</li>
							<?php } ?>       		   
						</ol>           
						<div class="title1">A1-170</div>
				
				
						<div class="left-box left-box2 color4">
							<ol class="cabin">
								<?php for($a2=1;$a2<=150;$a2++){ ?>
									<li class="seat seat2">
										<input type="checkbox" name="seatno[a2][]" value="<?= $a2 ?>" id="<?= 'a2-'.$a2 ?>" <?= (in_array($a2,$type_seat_selct['a2']) ? '  disabled' : '')?> <?= (in_array($a2,$current_selected_seats['a2']) ? ' checked': '')?>>
										<label for="<?= 'a2-'.$a2 ?>"><?= $a2 ?></label>
									</li>	
								<?php } ?>     		   
							</ol>               	  
							<div class="title1">A2-150</div>


							<div class="left-box left-box3 color2">
								<ol class="cabin">
									<?php for($a3=1;$a3<=132;$a3++){ ?>
										<li class="seat seat2">
											<input type="checkbox" name="seatno[a3][]" value="<?= $a3 ?>" id="<?= 'a3-'.$a3 ?>" <?= (in_array($a3,$type_seat_selct['a3']) ? '  disabled' : '')?> <?= (in_array($a3,$current_selected_seats['a3']) ? ' checked': '')?>>
											<label for="<?= 'a3-'.$a3 ?>"><?= $a3 ?></label>
										</li>
									<?php } ?>						
								</ol>           
								<div class="title1">A3-132</div>

						
								<div class="left-box left-box4 color7">
									<ol class="cabin">
										<?php for($a4=1;$a4<=110;$a4++){ ?>
											<li class="seat seat2">
												<input type="checkbox" name="seatno[a4][]" value="<?= $a4 ?>" id="<?= 'a4-'.$a4 ?>" <?= (in_array($a4,$type_seat_selct['a4']) ? '  disabled' : '')?> <?= (in_array($a4,$current_selected_seats['a4']) ? ' checked': '')?>>
												<label for="<?= 'a4-'.$a4 ?>"><?= $a4 ?></label>
											</li>
										<?php } ?>			    		   
									</ol>    	              
									<div class="title1">A4-110</div>
								</div>
							</div>
						</div>    	   
					</div>
				<div class="right-box right-box1 color2">
					<ol class="cabin">
						<?php for($b1=1;$b1<=221;$b1++){ ?>							
							<li class="seat seat2">
								<input type="checkbox" name="seatno[b1][]" value="<?= $b1 ?>" id="<?= 'b1-'.$b1 ?>" <?= (in_array($b1,$type_seat_selct['b1']) ? '  disabled' : '')?> <?= (in_array($b1,$current_selected_seats['b1']) ? ' checked': '')?>>
								<label for="<?= 'b1-'.$b1 ?>"><?= $b1 ?></label>
							</li>
						<?php } ?>      		   
					</ol>                     		
					<div class="title1">B1-221</div>

					<div class="right-box right-box2 color5">
						<ol class="cabin">
							<?php for($b2=1;$b2<=150;$b2++){ ?>							
								<li class="seat seat2">
									<input type="checkbox" name="seatno[b2][]" value="<?= $b2 ?>" id="<?= 'b2-'.$b2 ?>" <?= (in_array($b2,$type_seat_selct['b2']) ? '  disabled' : '')?> <?= (in_array($b2,$current_selected_seats['b2']) ? ' checked': '')?>>
									<label for="<?= 'b2-'.$b2 ?>"><?= $b2 ?></label>
								</li>
							<?php } ?> 
						</ol>    	   
						<div class="title1">B2-150</div>
			
				
						<div class="right-box right-box3 color1">           
							<ol class="cabin">
								<?php for($b3=1;$b3<=132;$b3++){ ?>							
									<li class="seat seat2">
										<input type="checkbox" name="seatno[b3][]" value="<?= $b3 ?>" id="<?= 'b3-'.$b3 ?>" <?= (in_array($b3,$type_seat_selct['b3']) ? '  disabled' : '')?> <?= (in_array($b3,$current_selected_seats['b3']) ? ' checked': '')?>>
										<label for="<?= 'b3-'.$b3 ?>"><?= $b3 ?></label>
									</li>
								<?php } ?> 				
							</ol>    	   				   
							<div class="title1">B3-132</div>


							<div class="right-box right-box4 color8">
								<ol class="cabin">
									<?php for($b4=1;$b4<=110;$b4++){ ?>							
										<li class="seat seat2">
											<input type="checkbox" name="seatno[b4][]" value="<?= $b4 ?>" id="<?= 'b4-'.$b4 ?>" <?= (in_array($b4,$type_seat_selct['b4']) ? '  disabled' : '')?> <?= (in_array($b4,$current_selected_seats['b4']) ? ' checked': '')?>>
											<label for="<?= 'b4-'.$b4 ?>"><?= $b4 ?></label>
										</li>
									<?php } ?>
								</ol>    	              
								<div class="title1">B4-110</div>
							</div>
						</div>
					</div>    	   
				</div>
				<div class="bottom-area">
					<div class="bottom-title"><span><img src="images/a.png" alt=""></span></div>
					<div class="bottom-title"><span><img src="images/b.png" alt=""></span></div>    	   
				</div>    
			</div>    
			<div class="right-container">
				<div class="sofa-area">
					<ul>
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					</ul>
					<ul class="sofa">
					<li>Sofa</li>	
					</ul>
					<ul>
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					<li></li>	
					</ul>
				</div>
				<div class="exit exit--front left">    	      
					<ol class="cabin">                 
						<li class="row row--">
							<ol class="seats" type="A">
								<?php for($b=1;$b<=96;$b++){ ?>
									<li class="seat active">
										<input type="checkbox" name="seatno[b][]" value="<?= $b ?>" id="<?= 'b-'.$b ?>" <?= (in_array($b,$type_seat_selct['b']) ? '  disabled' : 'disabled')?> <?= (in_array($b,$current_selected_seats['b']) ? ' checked': '')?>>
										<label for="<?= 'b-'.$b ?>"><?= $b ?></label>
									</li>
								<?php } ?>   
							</ol>
						</li>                 
					</ol>
					<div class="reserved-text2"><span class="first-title">Reserved</span><span>PTA Members</span></div>
				</div>

				<div class="left-box color1">
					<div class="screen-area">
						Screen
					</div>
					<ol class="cabin">
						<?php for($d1=1;$d1<=170;$d1++){ ?>
							<li class="seat ">
								<input type="checkbox" name="seatno[d1][]" value="<?= $d1 ?>" id="<?= 'd1-'.$d1 ?>" <?= (in_array($d1,$type_seat_selct['d1']) ? '  disabled' : '')?> <?= (in_array($d1,$current_selected_seats['d1']) ? ' checked': '')?>>
								<label for="<?= 'd1-'.$d1 ?>"><?= $d1 ?></label>
							</li>
						<?php } ?> 
					</ol>           
					<div class="title1">D1-170</div>


					<div class="right-box right-box2 color5">
						<ol class="cabin">
							<?php for($d2=1;$d2<=150;$d2++){ ?>
								<li class="seat ">
									<input type="checkbox" name="seatno[d2][]" value="<?= $d2 ?>" id="<?= 'd2-'.$d2 ?>" <?= (in_array($d2,$type_seat_selct['d2']) ? '  disabled' : '')?> <?= (in_array($d2,$current_selected_seats['d2']) ? ' checked': '')?>>
									<label for="<?= 'd2-'.$d2 ?>"><?= $d2 ?></label>
								</li>
							<?php } ?>
						</ol>    	   
						<div class="title1">D2-150</div>

						<div class="right-box right-box3 color1">            
							<ol class="cabin">
								<?php for($d3=1;$d3<=132;$d3++){ ?>
									<li class="seat ">
										<input type="checkbox" name="seatno[d3][]" value="<?= $d3 ?>" id="<?= 'd3-'.$d3 ?>" <?= (in_array($d3,$type_seat_selct['d3']) ? '  disabled' : '')?> <?= (in_array($d3,$current_selected_seats['d3']) ? ' checked': '')?>>
										<label for="<?= 'd3-'.$d3 ?>"><?= $d3 ?></label>
									</li>
								<?php } ?>
							</ol>    	    			   
							<div class="title1">D3-132</div>


							<div class="right-box right-box4 color8">
								<ol class="cabin">
									<?php for($d4=1;$d4<=110;$d4++){ ?>
										<li class="seat">
											<input type="checkbox" name="seatno[d4][]" value="<?= $d4 ?>" id="<?= 'd4-'.$d4 ?>" <?= (in_array($d4,$type_seat_selct['d4']) ? '  disabled' : '')?> <?= (in_array($d4,$current_selected_seats['d4']) ? ' checked': '')?>>
											<label for="<?= 'd4-'.$d4 ?>"><?= $d4 ?></label>
										</li>
									<?php } ?>
								</ol>    	              
								<div class="title1">D4-110</div>           			
							</div>
						</div>
					</div>
					
				</div>
				<div class="right-box color2">
					<ol class="cabin">
						<?php for($c1=1;$c1<=221;$c1++){ ?>
							<li class="seat">
								<input type="checkbox" name="seatno[c1][]" value="<?= $c1 ?>" id="<?= 'c1-'.$c1 ?>" <?= (in_array($c1,$type_seat_selct['c1']) ? '  disabled' : '')?> <?= (in_array($c1,$current_selected_seats['c1']) ? ' checked': '')?>>
								<label for="<?= 'c1-'.$c1 ?>"><?= $c1 ?></label>
							</li>
						<?php } ?>
					</ol>						
					<div class="title1">C1-221</div>
				
					<div class="left-box left-box2 color4">
						<ol class="cabin">
							<?php for($c2=1;$c2<=150;$c2++){ ?>
								<li class="seat">
									<input type="checkbox" name="seatno[c2][]" value="<?= $c2 ?>" id="<?= 'c2-'.$c2 ?>" <?= (in_array($c2,$type_seat_selct['c2']) ? '  disabled' : '')?> <?= (in_array($c2,$current_selected_seats['c2']) ? ' checked': '')?>>
									<label for="<?= 'c2-'.$c2 ?>"><?= $c2 ?></label>
								</li>
							<?php } ?>
						</ol>			    	  
						<div class="title1">C2-150</div>

						<div class="left-box left-box3 color2">           
							<ol class="cabin">
								<?php for($c3=1;$c3<=132;$c3++){ ?>
									<li class="seat">
										<input type="checkbox" name="seatno[c3][]" value="<?= $c3 ?>" id="<?= 'c3-'.$c3 ?>" <?= (in_array($c3,$type_seat_selct['c3']) ? '  disabled' : '')?> <?= (in_array($c3,$current_selected_seats['c3']) ? ' checked': '')?>>
										<label for="<?= 'c3-'.$c3 ?>"><?= $c3 ?></label>
									</li>
								<?php } ?>
							</ol>           
							<div class="title1">C3-132</div>

							<div class="left-box left-box4 color7">
								<ol class="cabin">
									<?php for($c4=1;$c4<=110;$c4++){ ?>
										<li class="seat">
											<input type="checkbox" name="seatno[c4][]" value="<?= $c4 ?>" id="<?= 'c4-'.$c4 ?>" <?= (in_array($c4,$type_seat_selct['c4']) ? '  disabled' : '')?> <?= (in_array($c4,$current_selected_seats['c4']) ? ' checked': '')?>>
											<label for="<?= 'c4-'.$c4 ?>"><?= $c4 ?></label>
										</li>
									<?php } ?>
								</ol>    	              
								<div class="title1">C4-110</div>
							</div>
						</div>
					</div>    	   
				</div>
				<div class="bottom-area">
					<div class="bottom-title"><span><img src="images/c.png" alt=""></span></div>
					<div class="bottom-title"><span><img src="images/d.png" alt=""></span></div>
				</div>
			</div>
			<a href="dashboard.php" class="back-btn" name="back" id="back" value="Back">Back</a>
			<input type="submit" class="save-btn" name="saveseat" id="saveseat" value="Book Ticket">
		</form>
	</div>          
</div>
<script>
	var totalbooked = '<?= $totalbooked ?>';
	var current_select_seat_count = '<?= (isset($_SESSION['current_select_seat_count']) ? $_SESSION['current_select_seat_count'] : 0) ?>';	
</script>
<?php 
    include('footer.php');
?>
