<?php
include_once"include/db.php";
?>
<html dir="ltr" lang="en"><head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="robots" content="noindex,nofollow">
    <title>Customer Data</title>
    <link rel="canonical" href="https://www.wrappixel.com/templates/materialpro-lite/">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon.png">
    <!-- Custom CSS -->
    <link href="css/style.min.css" rel="stylesheet">
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
.searchBx .fleft{
 float:left;
 padding-bottom:35px;
 margin-left:1%;
}
.searchBx .fleft input{
 border:1px solid #999;
 padding:4px;
}
.searchBx .fleft select{
 border:1px solid #999;
 padding:4px;
}
.searchBx .fleft span{
	font-weight:600;
}
.searchBx .fleft button{
 margin:18px 25px;	
}
.card{
	position:relative;
	top:-190px;
}
.card input{
	border:1px solid #999;
	padding:4px;
	background:#eee;
}
.fa-edit{
	color:green !important;
	font-size:19px;
}
.fa-trash{
	color:#ff0000 !important;
	font-size:19px;
}
</style>
</head>

<body>
    <!-- ============================================================== -->
    <!-- Preloader - style you can find in spinners.css -->
    <!-- ============================================================== -->
    <div class="preloader" style="display: none;">
        <div class="lds-ripple">
            <div class="lds-pos"></div>
            <div class="lds-pos"></div>
        </div>
    </div>
   
    <div id="main-wrapper" data-layout="vertical" data-navbarbg="skin5" data-sidebartype="full" data-sidebar-position="absolute" data-header-position="absolute" data-boxed-layout="full">
        
      <?php include"include/header.php"; ?>
        
        <div class="page-wrapper">
            <div class="page-breadcrumb">
                <div class="row align-items-center">
                    <div class="col-md-6 col-8 align-self-center">
                        <h3 class="page-title mb-0 p-0">Customer Data</h3>
                        <div class="d-flex align-items-center">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                                    <li class="breadcrumb-item active" aria-current="page">Data</li>
                                </ol>
                            </nav>
                        </div>
                    </div>
                   
                </div>
            </div>
            
           
            <div class="container-fluid">
                <div class="row">
				 <div class="col-lg-12 searchBx" style="background:white;">
				 <form action="" method="post">
				 <br>
				 <h2>Booking List</h2>
				 <div class="clearfix"></div><hr><br>
					<div class="col-md-3 fleft">
					    <span>Booking No</span>
						<input type="text" placeholder="Search By BookingNo" class="form-control">
					</div>
					<div class="col-md-2 fleft">
					    <span>Status</span>
						<select name="status" class="form-control">
							<option value="Cancel">Cancel</option>
							<option value="Pending">Pending</option>
						</select>
					</div>
					<div class="col-md-2 fleft">
					    <span>From Date</span>
						<input type="date" placeholder="From Date" class="form-control">
					</div>
					<div class="col-md-2 fleft">
					    <span>To Date</span>
						<input type="date" placeholder="From Date" class="form-control">
					</div>
					<div class="col-md-2 fleft">
                            <button type="submit" name="search" class="btn btn-danger d-none d-md-inline-block text-white">
							SEARCH
                            </button>
                        </div>
				 </form>
				 </div>
			</div>
			</div>
			
			
               
                    <!-- column -->
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-body">
                                <!--<div class="col-md-3">
									<strong>Total MCO</strong>
									<input type="text" placeholder="0" class="form-control">
									</div>-->
                               
                                <div class="table-responsive">
                                    <table class="table user-table">
                                        <thead>
                                            <tr>
                                                <th>S.No</th>
                                                <th>BookingNo</th>
                                                <th>Departure</th>
                                                <th>Destination</th>
												<th>Depart Date</th>
												<th>Return Date</th>
												<th>Booking Date</th>
												<th>Agent</th>
												<th>PaxName/Count</th>
												<th>Gross</th>
												<th>Booking Status</th>
												<th>Action</th>
												 
                                            </tr>
                                        </thead>
                                        <tbody>
										<?php
										$i=1;
										$selectBooking = "SELECT * FROM booking_db ORDER BY id DESC";
										$bookingQuery  = mysqli_query($conn, $selectBooking);
										while($bk = mysqli_fetch_array($bookingQuery)){	
										$dataId = $bk['id'];
										
										$selectPax = "SELECT * FROM passenger_details WHERE booking_id='$dataId'";
										$count_pax = mysqli_query($conn,$selectPax);
										$countPax = mysqli_num_rows($count_pax);

										$flightDetails = "SELECT * FROM flight_details WHERE booking_id='$dataId'";
										$flightQuery  = mysqli_query($conn, $flightDetails);
										while($flg = mysqli_fetch_array($flightQuery)){			
										?>
                                            <tr>
                                                <td><?php echo $i++; ?></td>
                                                <td><?php echo $bk['booking_id']; ?></td>
                                                <td><?php echo $flg['depIata']; ?></td>
                                                <td><?php echo $flg['arrIata']; ?></td>
												<td><?php echo $flg['depDate']; ?></td>
                                                <td><?php 
												if($flg['tripType'] == '1'){
												?>
												One-way
												<?php } else{ ?>
												Return
												<?php } ?>
												</td>
                                                <td><?php echo $bk['booking_date']; ?></td>
												<td>Vinay</td>
                                                <td><?php echo $bk['cus_name']; ?>/Pax-<?php echo $countPax; ?></td>
                                                <td>$<?php echo $bk['total_booking_amount']; ?></td>
												<td>Pending</td>
												<td><a href="view_details?view=<?php echo $dataId; ?>"><i class="fa fa-edit"></i></a>  | <a href="delete_data?delData=<?php echo $dataId; ?>"><i class="fa fa-trash"></i></a> </td>
                                            </tr>
										<?php }} ?> 
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
              
                
           
            <footer class="footer"> © 2022 travelobien.com </a>
            </footer>
           
        </div>
      
    </div>
    <script src="assets/plugins/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap tether Core JavaScript -->
    <script src="assets/plugins/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="js/app-style-switcher.js"></script>
    <!--Wave Effects -->
    <script src="js/waves.js"></script>
    <!--Menu sidebar -->
    <script src="js/sidebarmenu.js"></script>
    <!--Custom JavaScript -->
    <script src="js/custom.js"></script>


</body></html>