MMCT TEAM
Server IP : 82.112.239.40  /  Your IP : 18.218.129.191
Web Server : LiteSpeed
System : Linux in-mum-web1676.main-hosting.eu 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
User : u641149403 ( 641149403)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u641149403/domains/cabz4you.com/public_html/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u641149403/domains/cabz4you.com/public_html/admin/blist.php
<style type="text/css">
	.listbooking{
		position: absolute;
		top: 60px;
		right: 230px;
	}
	.listbooking i{
		border: 1px solid #000;
	}
	.mkact{
		display: block !important;
	}
	.modal-content .btn-sm{
		display: none;
	}
	tfoot{
		background: #232325;
		text-transform: uppercase;
		color: #fff;
	}
	tfoot th{
		padding: 11px!important;
	}
	.btn-green{
		background: #22bb33!important;
		color: #fff!important;
	}
	.color_white{
		color: #fff!important;
	}
	.btn-orange{
		background: orange!important;
		color: #fff!important;
	}
	.w-100{
		color: #fff!important;
	}
	.dropdown-menu{
		/*background: -webkit-linear-gradient(left, #99CC00, #99CC00)!important;*/
		margin-top: 8px!important;
	}
	/*#buttons button,a{
		background: -webkit-linear-gradient(left, #99CC00, #99CC00)!important;
		color: #fff!important;
	}*/
	.dropdown-menu button:hover{
		color: #000!important;
	}
	.dropdown-menu label:hover{
		color: #000!important;
	}
	.dropdown-menu li input{
		color: #525456!important;
		font-weight: 600!important;
	}
	.dropdown-menu li button{
		color: #fff!important;
		font-weight: 600!important;
	}
	.dropdown-menu li #edit_booking{
		padding: 5px 6px!important;
	}
	/*.dropdown-menu button,a{
		padding: 6px!important;
		color: #fff!important;
	}*/
	.searchable input {
		width: 100%;
		/*height: 50px;*/
		margin-top: 2px;
		font-size: 14px;
		padding: 6px;
		-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
		-moz-box-sizing: border-box; /* Firefox, other Gecko */
		box-sizing: border-box; /* Opera/IE 8+ */
		display: block;
		font-weight: 400;
		line-height: 1.6;
		color: #495057;
		background-color: #fff;
		background-clip: padding-box;
		border: 1px solid #ced4da;
		border-radius: .25rem;
		transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
		background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center/8px 10px;
	}
	.searchable ul {
		display: none;
		list-style-type: none;
		background-color: #fff;
		border-radius: 0 0 5px 5px;
		border: 1px solid #add8e6;
		border-top: none;
		max-height: 180px;
		margin: 0;
		overflow-y: scroll;
		overflow-x: hidden;
		padding: 0;
	}
	.searchable ul li {
		padding: 7px 9px;
		border-bottom: 1px solid #e1e1e1;
		cursor: pointer;
		color: #6e6e6e;
	}
	.searchable ul li.selected {
		background-color: #e8e8e8;
		color: #333;
	}
	.search_list{
		position: absolute;
		z-index: 1000;
	}
	input::-webkit-input-placeholder {
		font-size: 15px;
	}
	input:focus{
		border: 1px solid #e2e2e2!important;
	}
	.input-group .form-control:focus{
		border: 1px solid #e2e2e2!important;
	}
	.card .dataTables_wrapper .table td, .card .dataTables_wrapper .table th{
		padding: 8px 20px!important;
		text-align: center!important;
	}
	.bg_success{
		background: #0bc736!important;
	}
	.bg_success td{
		color: #fff;
	}
	table label{
		font-size: .8125rem!important;
		padding: 10px!important;
		margin-bottom: 0;
		width: 100%;
	}
	.cancel_types,#penalty_amount{
		display: none;
	}
</style>
<?php
require_once 'header.php';
require_once 'navbar.php';
if(!isset($_GET['type']))
{
	header("location:404");
}

if (isset($_POST['notify'])) {
	$book_id=$_POST['notify'];
	$sql="select booking_from,booking_to from bookings where id=$book_id";
	$result = $conn->query($sql);
	$book = $result->fetch_assoc();

	$title="New Outstation Booking";
	$content=$book['booking_from']." to ".$book['booking_to'];
	pushapi($title,$content,$link);
}

if($_SERVER["REQUEST_METHOD"] == "POST")
{
	if(isset($_POST['commition']))
	{
		$time_stamp = date('Y-m-d H:i:s');
		$commition=$_POST['commition'];
		$booking_id=$_POST['pass_id'];
		$sql="update bookings set admin_commission=$commition,status='vendor_pass',time_stamp='$time_stamp' where id=$booking_id";
		if($conn->query($sql)===true)
		{
			$success=true;
			$sql="select booking_from,booking_to from bookings where id=$booking_id";
			$result = $conn->query($sql);
			$book = $result->fetch_assoc();

			$title="New Outstation Booking";
			$content=$book['booking_from']." to ".$book['booking_to'];
			pushapi($title,$content,$link);
		}
	}

	if(isset($_POST['ccbooking_id']) && isset($_POST['ccvendor_id'] ))
	{
		$vendor_id=$_POST['ccvendor_id'];
		$booking_id=$_POST['ccbooking_id'];
		$driver_id=$_POST['new_driver'];
		$cab_id=$_POST['new_cab'];
		if($driver_id>0 && $cab_id > 0)
		{
			$sql="update bookings set driver_id=$driver_id,cab_id=$cab_id where id=$booking_id";
			if($conn->query($sql)===true)
			{
				$success=true;
			}
			else
			{
				$error=true;
			}
		}
		else
		{
			$error=true;
		}
	}
	if(isset($_POST['custom_vendor']))
	{
		$custom_vendor=$_POST['custom_vendor'];
		$booking_id=$_POST['custom_id'];
		
		$commition=$_POST['comission'];

		$select_vendor = $conn->query("SELECT *,vendor_login.contact as vendor_contact FROM bookings INNER JOIN vendor_profile ON vendor_profile.vendor_id=bookings.vendor_id INNER JOIN vendor_login ON vendor_login.id=bookings.vendor_id LEFT JOIN drivers ON drivers.id=bookings.driver_id WHERE bookings.id=$booking_id AND bookings.vendor_id!=$custom_vendor AND bookings.vendor_id!=0 AND bookings.vendor_id!=''");
		if ($select_vendor->num_rows>0) {
			$fetch_data = $select_vendor->fetch_assoc();
			$vendor_contact = $fetch_data['vendor_contact'];
			
			$msg = "Hi ЁЯСЛ ".$fetch_data['full_name']." inform that BOOKING ID: C4U".$booking_id." DEL-".$fetch_data['d_l_no']." ".$fetch_data['booking_from']." To, ".$fetch_data['booking_to']." ".$fetch_data['cab_type']." ".$fetch_data['trip_type']." TRIP Date ".$fetch_data['pickup_date']." Time ".$fetch_data['pickup_time'].". 

			BOOKING has been Assigned

			Thanks For 
			Cabz4you.";
			whatsapp($vendor_contact,$msg);

		}

		$sql="update bookings set admin_commission=$commition,vendor_id=$custom_vendor,status='confirmed' where id=$booking_id";
		if($conn->query($sql)===true)
		{
			$res=$conn->query("SELECT * FROM vendor_login LEFT JOIN vendor_profile ON vendor_profile.vendor_id=vendor_login.id WHERE id=$custom_vendor");
			$vendor_data = $res->fetch_assoc();
			$vendor_contact = $vendor_data['contact'];
			$booking_data = $conn->query("SELECT bookings.*,payment_log.txn_amount FROM bookings LEFT JOIN payment_log ON payment_log.booking_id=bookings.id WHERE bookings.id=$booking_id");
			$bookings = $booking_data->fetch_assoc();

			$included_exclude='';
			if ($bookings['toll_tax']==0) {
				$included_exclude.="Toll Tax - Included \n";
			}else{
				$included_exclude.="Toll Tax - Excluded \n";
			}
			if ($bookings['state_tax']==0) {
				$included_exclude.="State Tax - Included \n";
			}else{
				$included_exclude.="State tax - Excluded \n";
			}
			if ($bookings['parking']==1) {
				$included_exclude.="Parking - Included \n";
			}else{
				$included_exclude.="Parking - Excluded";
			}
			
			$vendor_amount = $bookings['price']-$bookings['admin_commission'];
			$msg = "Hi ЁЯСЛ ".$vendor_data['full_name']." inform that BOOKING ID: C4U".$booking_id." ".$bookings['booking_from']." To, ".$bookings['booking_to']." ".$bookings['cab_type']." ".$bookings['trip_type']." Trip Date ".$bookings['pickup_date']." Time ".$bookings['pickup_time'].". 

			BOOKING has been Assigned

			Important ЁЯдФ information тД╣я╕П

			Please Update Car ЁЯЪЧ & Driver Details...

			30 minutes ЁЯТп Penalties..

			Vendor Amount of: Rup.".$vendor_amount."/-

			Cash ЁЯдСЁЯТ░ Collect: Rup.".$bookings['txn_amount']."/-

			".$included_exclude."
			Night Charge ".$bookings['night_charge']."/-Rupees
			Airport Entry тЫФ charge Etc,

			Distance  ".$bookings['distance']."Kms.

			рдХреГрдкрдпрд╛ рдзреНрдпрд╛рди рд░рд╣реЗ рдХрд╕реНрдЯрдорд░ рдХреА рдЯреНрд░рд┐рдк рд╕реНрдЯрд╛рд░реНрдЯ рдХрд░рддреЗ рд╕рдордп рдФрд░ рдЯреНрд░рд┐рдк рдПрдВрдб рдХрд░рддреЗ рд╕рдордп рдУрдЯреАрдкреА рд╡реЗрд░реАрдлрд╛рдИ рдХрд░рдирд╛ рдЖрд╡рд╢реНрдпрдХ рд╣реИ рдФрд░ рдЕрдкрдиреЗ рдСрдбреЛрдореАрдЯрд░ рдХреА рдлреЛрдЯреЛ рдЦреАрдВрдЪрдХрд░ рдЯреНрд░рд┐рдк рд╕реНрдЯрд╛рд░реНрдЯ рдХрд░рддреЗ рд╕рдордп рдФрд░ рдЯреНрд░рд┐рдк рдРрдб рдХрд░рддреЗ рд╕рдордп рд╣рдореЗрдВ рдЗрд╕ рд╡реНрд╣рд╛рдЯреНрд╕рдПрдк рдирдВрдмрд░ рдкрд░ рднреЗрдЬреЗрдВ рдРрд╕рд╛ рди рдХрд░рдиреЗ рдкрд░ рд░реБ300 рд╕реЗ тВ╣500 рддрдХ рдХреА рдкреЗрдирд▓реНрдЯреА рд▓рдЧ рд╕рдХрддреА рд╣реИ

			Thanks For
			Cabz4u Team";
			whatsapp($vendor_contact,$msg);

			$time_stamp=date('Y-m-d H:i:s');
			$query=$conn->query("SELECT * FROM vendor_profile WHERE vendor_id=$custom_vendor");
			$row=$query->fetch_assoc();
			$wallet_amount = $row['w_amount'];

			$sql="update vendor_profile set w_amount=w_amount-$commition where vendor_id=$custom_vendor";
			if($conn->query($sql)===true)
			{
		             // booking confirm id24 id
				$sql="Insert into transaction_log(vendor_id,amount,txn_type,action,wallet_amount,time) values($custom_vendor,$commition,'Debit','Charges for booking confirmation give by admin','$wallet_amount','$time_stamp')";
				if($conn->query($sql)===true)
				{
					$success=true;
				}
			}
		}
		else
		{
			$error=true;
		}
		
	}
}
$type=test_input($_GET['type']);
$current_time=date('Y-m-d H:i:s');
if($_POST['date']){
	$date = explode('-', $_POST['date']);
	$date1 = date('Y-m-d', strtotime($date[0]));
	$date2 = date('Y-m-d', strtotime($date[1]));
	$filter="AND DATE(time_stamp) BETWEEN '$date1' AND '$date2'";

}else{
	$filter='';
}

switch($type)
{
	
	case "pending":
	$one=true;
	$sql="SELECT bookings.*,bookings.id as bk_id,payment_log.txn_amount,payment_log.booking_id,users.* FROM bookings LEFT JOIN payment_log ON payment_log.booking_id=bookings.id LEFT JOIN users ON users.id=bookings.user_id WHERE bookings.status='booked' $filter ORDER BY bookings.pickup_date DESC";
	
	break;

	case "all":
	$sql="SELECT bookings.*,bookings.id as bk_id,payment_log.txn_amount,payment_log.booking_id,users.* FROM bookings LEFT JOIN payment_log ON payment_log.booking_id=bookings.id LEFT JOIN users ON users.id=bookings.user_id $filter ORDER BY bookings.pickup_date DESC";
	break;

	case "post_booking":
	$sql = "select bookings.*,bookings.id as bk_id,payment_log.txn_amount,payment_log.booking_id,users.* from bookings,payment_log,users where users.id=bookings.user_id and  payment_log.txn_status is true and bookings.id=payment_log.booking_id and bookings.booking_type='Vendor App' $filter order by bookings.pickup_date desc";
	break;

	case "vendor_pass":
	$sql="SELECT bookings.*,bookings.id as bk_id,payment_log.txn_amount,payment_log.booking_id,users.* FROM bookings LEFT JOIN payment_log ON payment_log.booking_id=bookings.id LEFT JOIN users ON users.id=bookings.user_id WHERE bookings.status='vendor_pass' AND TIMESTAMP(`pickup_date`, `pickup_time`)>='$current_time' $filter ORDER BY bookings.pickup_date DESC";
	
	break;
	case "cancelled":
	$sql="SELECT bookings.*,bookings.id as bk_id,payment_log.txn_amount,payment_log.booking_id,users.* FROM bookings LEFT JOIN payment_log ON payment_log.booking_id=bookings.id LEFT JOIN users ON users.id=bookings.user_id WHERE bookings.status='cancelled' $filter ORDER BY bookings.pickup_date DESC";
	
	break;
	case "completed":
	$sql="SELECT bookings.*,bookings.id as bk_id,payment_log.txn_amount,payment_log.booking_id,users.* FROM bookings LEFT JOIN payment_log ON payment_log.booking_id=bookings.id LEFT JOIN users ON users.id=bookings.user_id WHERE bookings.status='completed' $filter ORDER BY bookings.pickup_date DESC";

	break;
	case "new":
	$sql="SELECT bookings.*,bookings.id as bk_id,payment_log.txn_amount,payment_log.booking_id,users.* FROM bookings LEFT JOIN payment_log ON payment_log.booking_id=bookings.id LEFT JOIN users ON users.id=bookings.user_id WHERE bookings.booking_type!='Admin' AND seen=0 $filter ORDER BY bookings.pickup_date DESC";

	break;
	case "expired":
	$sql="SELECT bookings.*,bookings.id as bk_id,payment_log.txn_amount,payment_log.booking_id,users.* FROM bookings LEFT JOIN payment_log ON payment_log.booking_id=bookings.id LEFT JOIN users ON users.id=bookings.user_id WHERE bookings.status='vendor_pass' AND TIMESTAMP(`pickup_date`, `pickup_time`)<'$current_time' $filter ORDER BY bookings.pickup_date DESC";

	break;
	default:
	$sql="SELECT bookings.*,bookings.id as bk_id,payment_log.txn_amount,payment_log.booking_id,users.* FROM bookings LEFT JOIN payment_log ON payment_log.booking_id=bookings.id LEFT JOIN users ON users.id=bookings.user_id WHERE bookings.status='confirmed' $filter ORDER BY bookings.pickup_date DESC";
	
}
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    // output data of each row
	while($row = $result->fetch_assoc()) {
		$table_data[]=$row;
	}
}

$sql="select * from vendor_profile,vendor_login where vendor_login.id=vendor_profile.vendor_id";
$res=$conn->query($sql);
while($row=$res->fetch_assoc())
{
	$vendors[]=$row;
}
?>
<style>
	/*.daterange{
		position: absolute;
	    top: 60px;
	    left: 125px;
	    z-index: 1000;
	}*/
	.listbooking{
		position: static;
	}
</style>
<!-- Page content -->
<div class="container-fluid pt-8">
	<div class="page-header mt-0  p-3">
		<h3 class="mb-sm-0 text-capitalize"><?= str_replace('_', ' ', $type);?> Bookings</h3>
		<ol class="breadcrumb mb-0">
			<li class="breadcrumb-item"><a href="#"><i class="fa fa-home"></i></a></li>
			<li class="breadcrumb-item active" aria-current="page"><?=str_replace('_', ' ', $type);?> Bookings</li>
		</ol>
	</div>
	<?php
	if(isset($success))
	{
		?>
		<div class="alert alert-success" id="success">Success! Your Request has been submited.</div>
		<?php
	}
	else if(isset($error))
	{
		?>
		<div class="alert alert-danger" id="success">Error! Your Request could not be submited.</div>
		<?php
	}
	?>
	<div class="alert " id="msg" style="display:none"></div>
	<div class="card shadow">
		<div class="card-body">
			
			<div class="row">
				<div class="col-lg-3">
					<form method="post">
						<div class="input-group daterange">
							<input id="reportrange" type="text" name="date" class="form-control" placeholder="Search">
							<i class="ni ni-calendar-grid-58"></i>
							<div class="input-group-append">
								<button class="btn btn-success" type="submit">Go</button>
							</div>
						</div>
					</form>
				</div>
				<?php if($filter!=''){ ?>
					<div class="col-lg-2 text-right">
						<a class="btn btn-danger" href="">Remove Filter</a>
					</div>
				<?php } ?>
				<div class="col-lg-7">
					<div class="listbooking d-flex align-items-center justify-content-end">
						<h4 class="badge badge-dark mb-0 py-2 px-3 mr-4 text-uppercase"><?= str_replace('_', ' ', $type);?>&nbsp; : <?=$result->num_rows?></h4>
						<span class="mr-2">
							<i class="fas fa-square text-white"></i> ADMIN
						</span>
						<span class="mr-2">
							<i class="fas fa-square bg-danger text-danger"></i> VENDOR
						</span>
					</div>
				</div>
			</div>

			<div class="table-responsive" style="overflow-x:auto;">

				<table id="example" class="table text-center table-striped table-bordered text-nowrap">
					<thead class="">
						<tr>
							<th class="wd-15p">S.No</th>
							<th class="wd-15p">View</th>
							<th class="wd-10p">action</th>
							<th class="wd-15p">Booking ID</th>
							<?php if($type=='post_booking' || $type=='all'){?>
								<th class="wd-15p">Status</th>
							<?php } ?>
							<th class="wd-15p">From </th>
							<th class="wd-15p">To</th>
							<th class="wd-20p">Name</th>
							<th class="wd-20p">Contact</th>
							<th class="wd-20p">Trip type</th>
							<th class="wd-20p">Cab Type</th>
							<th class="wd-15p">Pickup Date</th>
							<th class="wd-20p">pickup time</th>
							<th class="wd-20p">Drop Date</th>
							<th class="wd-20p">EMail</th>
							<th class="wd-20p">Alt Contact</th>
							<th class="wd-15p">Amount</th>
							<th class="wd-15p">Advance Amount</th>
							<th class="wd-15p">Balance Amount</th>
							<th class="wd-15p">Admin Commission</th>
							<th class="wd-15p">Vendor Commission</th>
							<th class="wd-15p">Pickup Address</th>
							<th class="wd-15p">Drop Address</th>
							<th class="wd-15p">Toll Tax</th>
							<th class="wd-15p">State Tax</th>
							<th class="wd-15p">Parking</th>
							<th class="wd-15p">Night Charge</th>
							<th class="wd-15p">Extra Price</th>
							<th class="wd-15p">Remark</th>
							<th class="wd-15p">Booking Type</th>
							<th class="wd-15p">Post Vendor ID</th>
							<th class="wd-15p">Post Vendor Name</th>
							<th class="wd-15p">Post Vendor Contact</th>
							<?php if ($type!='pending' && $type!='vendor_pass') { ?>
								<th class="wd-15p">Accept Vendor id</th>
								<th class="wd-15p">Accept Vendor Name</th>
								<th class="wd-15p">Accept Vendor Contact</th>
								<!-- <th class="wd-15p">Agent id</th> -->
								<th class="wd-15p">cab Id</th>
								<th class="wd-15p">Driver id</th>
							<?php } ?>
							<th class="wd-15p">Posted Date/Time</th>
							<?php if ($type!='pending') { ?>
								<th class="wd-15p">Accepted Date/Time</th>
								<?php if($type=='completed'){ ?>
									<th class="wd-15p">Completed Date/Time</th>
								<?php } if($type=='cancelled'){ ?>
									<th class="wd-15p">Cancelled Date/Time</th>
								<?php } } ?>
							</tr>
						</thead>


					</table>
				</div>
			</div>
		</div>
	</div>
	<!--Add Modal To Display-->
	<div class="modal fade" id="confirm" style="z-index:99999999">
		<div class="modal-dialog">
			<div class="modal-content" style="width:108%!important">
				<div class="card-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<div class="alert alert-danger"   id="error" style="display:none">Error! Your Request could not be submited.</div>
					<h4 style="text-align: left">Pass this ride to all vendors</h4><div class="col-md-6 float-right" id="alert"></div>
				</div> 
				<form method="post" id="add_vendor">
					<div class="modal-body" id="display-modal">
						<!-- div when the admin pass the ride all vendor-->
						<div class="row" id="pass" style="display:none">
							<form method="post">
								<div class="col-md-12">
									<label>Enter your commission :</label><input  type="text" class="form-control" id="cccoo" name="commition" required>
									<input  type="hidden" name="pass_id" id="pass_id" required>
									<input  type="hidden" name="admin_bid" id="admin_bid" value="none" required>
								</div>
								<div class="col-md-12">
									<br>
									<button type="submit" name="request" id="pass_id" class="btn btn-primary"style="float:right" >Add</button>
								</div>
							</form>
						</div>
						<!-- div when the admin select the custom vendor-->
						<form method="post">
							<div class="row" id="custom" style="display:none">
								<div class="col-md-6">
									<label>Please Select Custom Vendor:</label>
									<input  type="hidden" name="custom_id"style="float:right" id="custom_id" required>
									<input type="hidden" class="form-control select2 w-100"  name="custom_vendor" id="vendor">
									<div class="form-group searchable">
										<!-- <label>Select Vendor</label> -->
										<input type="text" placeholder="Select Vendor" class="select2 select_vendor" onkeyup="filterFunction(this,event)" required>
										<ul class="search_list"> 
											<!-- <li class="selectvendor" value="all">All Vendor</li> -->
											<?php
											foreach($vendors as $vendor)
											{
												?>
												<li class="selectItem" value="<?=$vendor['id'];?>"><?=$vendor['contact']." - ".$vendor['full_name'];?></li>
												<?php
											}
											?>
										</ul>
									</div>
                       <!-- <select name="custom_vendor" class="form-control">
                           <option value="0"  >Select Vendor</option>
                            <?php
                            foreach ($vendors as $vendor)
                            {
                            ?>
                              <option value="<?=$vendor['vendor_id'];?>"><?=$vendor['full_name']." - ".$vendor['contact'];?></option>
                            <?php
                            }
                            ?>
                        </select> -->
                    </div>
                    <div class="col-md-6">
                    	<label>Please Enter your Commission:</label>
                    	<input type="number" class="form-control" id="commission" name="comission" value="0" style="height:38px!important">
                    </div>
                    <div class="col-md-12">
                    	<br>
                    	<button type="submit"  name="request" id="add" class="btn btn-primary" style="float:right">Add</button>
                    </div>
                </div>
            </form>
        </div>
    </form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>		
<!--Add Modal To Display-->
<div class="modal fade" id="change" style="z-index:99999999">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="card-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<div class="alert alert-danger"   id="error2" style="display:none">Error! Your Request could not be submited.</div>
				<h4 style="text-align: left">Asign Driver and Cab to this booking</h4><div class="col-md-6 float-right" id="alert"></div>
			</div> 
			<form method="post">
				<div class="modal-body">
					<div class="row" id="custom" >
						<div class="col-md-6">
							<select name="new_cab" id="cccabs"  class="form-control">
								<option value="0">Select cab</option>
							</select>
						</div>
						<input type="hidden" name="ccbooking_id" id="ccbooking_id">
						<input type="hidden" name="ccvendor_id" id="ccvendor_id">
						<div class="col-md-6">
							<select name="new_driver" id="ccdriver"  class="form-control">
								<option value="0"  >Select Driver</option>
							</select>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="submit" name="request" id="add" class="btn btn-primary" style="float:right">Asign</button>
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
				</div>
			</form>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<div class="modal fade" id="cancel_modal" style="z-index:99999999">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="card-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<div class="alert alert-danger"   id="error2" style="display:none">Error! Your Request could not be submited.</div>
				<h4 style="text-align: left">Mention Reason For Cancellation</h4><div class="col-md-6 float-right" id="alert"></div>
			</div> 
			<form method="post" id="cancel_modal_reason">
				<div class="modal-body">
					<div class="row" id="custom" >

						<div class="col-md-12 mb-3">
							<div class="form-check-inline">
								<label><input type="radio" class="booking_status form-check-input" name="booking_status" value="cancel" checked>Parmanent Cancel</label>
							</div>
							<div class="form-check-inline">
								<label><input type="radio" class="booking_status form-check-input" name="booking_status" value="new">Create New Booking</label>
							</div>
						</div>
						<div class="col-lg-12 cancel_types">
							<div class="form-check-inline">
								<label><input type="checkbox" class="form-check-input refund_commission" name="refund" value="Cancel With Refund">Cancel With Refund</label>
							</div>
						</div>
						<div class="col-lg-12 cancel_types">
							<label>Cancellation Type</label>
							<select name="cancel_type" class="form-control cancellation_type" onchange="cancel_tye(this.value)">
								<option value="Cancel Without Penalty">Cancel Without Penalty</option>
								<option value="Cancel With Penalty">Cancel With Penalty</option>
							</select>
						</div>
						<div class="col-lg-12 mt-2" id="penalty_amount">
							<label>Penalty Amount</label>
							<input type="number" value="0" class="form-control penalty_amount" name="penalty_amount">
						</div>

						<div class="col-md-12 mt-2">
							<label>Cancel Reason (Optional)</label>
							<input type="text" class="form-control" id="reason_cancel">
						</div>
						<input type="hidden" id="cancel_reason_booking_id">
					</div>
				</div>
				<div class="modal-footer">
					<button type="submit" class="btn btn-primary" style="float:right">Submit</button>
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
				</div>
			</form>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>



<!--Add Modal To Display-->
<div class="modal fade" id="commissiong_log" style="z-index:99999999">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="card-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<div id="alert2"></div>
				<h4 style="text-align: left">Add Post Vendor Commission</h4>
				<div class="col-md-6 float-right" id="alert"></div>
			</div>
			<form method="post" id="add_vendor_commission">
				<div class="modal-body" id="display-modal">
					<div class="row">
						<div class="col-md-12">
							<label>Admin commission :</label>
							<input type="hidden" name="post_vendor_id" id="post_vendor_id">
							<input type="hidden" name="post_booking_id" id="post_booking_id">
							<input type="text" class="form-control" name="post_admin_commission" id="post_admin_commission" required>
						</div>
						<div class="col-md-12">
							<label>Enter Post Vendor commission :</label>
							<input type="text" class="form-control" name="post_vendor_commission" required>
						</div>
						<div class="col-md-12">
							<label>Message :</label>
							<textarea class="form-control" name="message" rows="3"></textarea>
						</div>
						<div class="col-md-12">
							<br>
							<button type="submit" class="btn btn-primary" style="float:right">Add Commission</button>
						</div>
					</div>
				</div>
			</form>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>

<?php 
require_once 'footer.php';
require_once 'jslinks.php';
?>
<script>

	//function for Vendor Commission
	function commissiong_log(post_vendor_id,booking_id) {
		var admin_commission = $('#com'+booking_id).text();
		$('#commissiong_log').modal('show');
		$('.dtr-bs-modal').modal('hide');
		$('#post_vendor_id').val(post_vendor_id);
		$('#post_booking_id').val(booking_id);
		$('#post_admin_commission').val(admin_commission);
	}

	$('#add_vendor_commission').submit(function(e) {
		e.preventDefault();
		$.ajax({
			url: "ajax_commission_log.php",
			type: "POST",
			data: $("#add_vendor_commission").serialize(),
			success: function(response) {
				if(response == 1) {
					$('#alert2').html('<span class="p-1 m-1 alert alert-success">Successfully Added.</span>').show()
					setTimeout(function(){
						$('#alert2').hide();
						$('#commissiong_log').modal("hide");
					}, 2000)
				}
				else {
					$('#alert2').html('<span class="p-1 m-1 alert alert-danger">Something Wrong, can\'t add.</span>').show()
					setTimeout(function(){
						$('#alert2').hide()
					}, 2000)
				}
				$('#add_vendor_commission').trigger("reset");
			}
		})
	})




	var i;
		//function for pass the informatio between user and driver
	function passinfo(str)
	{
		var confir=confirm("Are you sure to pass information to this ride?");
		if(confir)
		{
			$.ajax({
				type:"POST",
				url:"ajax_passinfo.php",
				data:{
					'booking_id':str,
				},
				success:function(data)
				{
					var x = JSON.parse(data);
					if(x.msg=="ok")
					{
						$(".dtr-bs-modal").modal('toggle');
						$("#msg").addClass(" alert-success");
						$("#msg").css('display','block');
						$("#msg").text("Success! Ride information successfully passed");
					}
				}
			});
		}
	}
	//change driver and cab
	
	function change_driver(vendor,booking)
	{
		$("#ccbooking_id").val(booking);
		$("#ccvendor_id").val(vendor);
		$('#change').modal('show');
		$.ajax({
			type:"POST",
			url:"fetch_data.php",
			data:{
				'booking_id':booking,
				'vendor_id':vendor,
			},
			success:function(data)
			{
				var obj =JSON.parse(data);
				if(obj.cabmsg=='ok')
				{
					$.each( obj.cabs, function( key, value ) {
						$('#cccabs').append('<option value="'+value.id+'">'+value.cab_name+','+value.rc_no+'</option>');
					});
				}
				else
				{
					alert("Cab not found for this vendor");
					$('#change').modal('hide');
				}
				if(obj.drivermsg=='ok')
				{
					$.each( obj.drivers, function( key, value ) {
						$('#ccdriver').append('<option value="'+value.id+'">'+value.driver_name+','+value.contact+'</option>');
					});
				}
				else
				{
					alert("Driver not found for this vendor");
					$('#change').modal('hide');
				}
			}
		});
	}
	
	
	//complate ride
	
	function complete(str)
	{
		var confir=confirm("Are you sure to complete to this ride?");
		if(confir)
		{
			$.ajax({
				type:"POST",
				url:"ajax_complete.php",
				data:{
					'booking_id':str,
				},
				success:function(data)
				{
					var x = JSON.parse(data);
					if(x.msg=="ok")
					{
						location.reload(); 
					}
					else
					{
						$(".dtr-bs-modal").modal('toggle');
						$("#msg").addClass(" alert-danger");
						$("#msg").show();
					}
				}
			});
		}
	}
	
	
	//function for click booking confirm
	function confirm_booking(str,ee)
	{
		var comm="#com"+ee;
		var val=$(comm).html();
		if(str=='pass')
		{
			$('#cccoo').val(val);
			$('#pass').show();
			$('#custom').hide();
			$('#confirm').modal('show');
			document.getElementById('pass_id').value=ee;
			if($('.add_bid'+ee).is(":checked")){
				var bid_amt=($('input.bid_amt'+ee).eq(1)).val();
				document.getElementById('admin_bid').value=bid_amt;
			}
			else{
				document.getElementById('admin_bid').value='none';
			}
		}
		else if(str=='custom')
		{
			$('#custom').show();
			$('#pass').hide();
			$('#confirm').modal('show');
			$('#commission').val(val);
			document.getElementById('custom_id').value=ee;
		}
	}
	
	//function for cancel the booking
	function cancel_booking(booking_id)
	{
		$("#cancel_reason_booking_id").val(booking_id);
	}

	$("#cancel_modal_reason").submit(function(e){
		e.preventDefault();
		var confir=confirm("Are you sure to cancel this ride");
		if(confir)
		{
			$("#loader").show();
			var booking_status = $(".booking_status:checked").val();
			var refund_commission = $(".refund_commission:checked").val();
			var cancellation_type = $(".cancellation_type").val();
			var penalty_amount = $(".penalty_amount").val();

			$.ajax({
				type:"POST",
				url:"ajax_cancel_booking.php",
				data:{
					'cancel_id': $("#cancel_reason_booking_id").val(),
					'reason_for_cancel': $("#reason_cancel").val(),
					'booking_status': booking_status,
					'cancellation_type': cancellation_type,
					'penalty_amount': penalty_amount,
					'refund_commission': refund_commission,
				},
				success:function(data)
				{
					$("#loader").hide();
					$('#cancel_modal').modal('hide');
					if(data=="ok")
					{
						$(".dtr-bs-modal").modal('toggle');
						$("#msg").addClass(" alert-success");
						$("#msg").css('display','block');
						$("#msg").text("Succes! Your booking has been cancelled")
						setTimeout(function(){
							location.reload()
						}, 2000)
					}
					else
					{
						$(".dtr-bs-modal").modal('toggle');
						$("#msg").addClass(" alert-danger");
						$("#msg").show();
						$("#msg").text(x.msg);
					}
				}
			});
		}
	})

	$('.booking_status').click(function(){
		var val = $('.booking_status:checked').val();
		if (val=='new') {
			$('.cancel_types').show();
		}else{
			$('.cancel_types').hide();
		}
	})

	function cancel_tye(e){
		if (e=='Cancel With Penalty') {
			$('#penalty_amount').show();
		}else{
			$('#penalty_amount').hide();
		}
	}
</script>
<script>
	function check_bid(ee){
		if($('.add_bid'+ee).is(":checked")){
			$('.bid_amt'+ee).show(200);
		}
		else{
			$('.bid_amt'+ee).hide(200);
		}
	}
</script>
<div class="modal fade" id="view_modal" 
tabindex="-1" 
aria-labelledby="exampleModalLabel" 
aria-hidden="true">
<div class="modal-dialog">
	<div class="modal-content">
		<div class="modal-header">
			<h3 class="modal-title" 
			id="exampleModalLabel">
			Details 
		</h3>
		<button type="button" 
		class="close" 
		data-dismiss="modal" 
		aria-label="Close">
		<span aria-hidden="true">
			├Ч
		</span>
	</button>
</div>
<div class="modal-body">
	<table class="table table-bordered">
		<tr>
			<th class="wd-15p">Booking Id</th>
			<td id="book_id" class="pl-5 ml-5"> </td>
			<tr>
				<tr>
					<th class="wd-15p">From</th>
					<td id="from" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">To</th>
					<td id="to" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Pickup Date</th>
					<td id="pickup_date" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Drop Date</th>
					<td id="drop_date" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Pickup Time</th>
					<td id="pickup_time" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Cab Type</th>
					<td id="cab_type" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Trip Type</th>
					<td id="trip_type" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Name</th>
					<td id="name" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Contact</th>
					<td id="contact" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Email</th>
					<td id="email" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Alt Contact</th>
					<td id="alt_contact" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Amount</th>
					<td id="amount" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Advance Amount</th>
					<td id="advance_amount" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Balance Amount</th>
					<td id="balance_amount" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Your Commission</th>
					<td id="commissions" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Pickup Address</th>
					<td id="pickup_address" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Drop Address</th>
					<td id="drop_address" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Toll Tax</th>
					<td id="toll_tax" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">State Tax</th>
					<td id="state_tax" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Parking</th>
					<td id="parking" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Night Charge</th>
					<td id="night_charge" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Extra Price</th>
					<td id="extra_price" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Remark</th>
					<td id="remark" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Booking Type</th>
					<td id="booking_type" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Post Vendor ID</th>
					<td id="postvendor_id" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Post Vendor Name</th>
					<td id="post_vendor_name" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Post Vendor Contact</th>
					<td id="post_vendor_contact" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Accept Vendor ID</th>
					<td id="accept_vendor_id" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Accept Vendor Name</th>
					<td id="accept_vendor_name" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Accept Vendor Contact</th>
					<td id="accept_vendor_contact" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Cab Details</th>
					<td id="cab_detail" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Driver Details</th>
					<td id="driver_detail" class="pl-5 ml-5"></td>
				</tr>
				<tr>
					<th class="wd-15p">Posted Date/Time</th>
					<td id="time_stamp" class="pl-5 ml-5"></td>
				</tr>
				<?php if ($type!='pending') { ?>
					<tr>
						<th class="wd-15p">Accepted Date/Time</th>
						<td id="accept_time" class="pl-5 ml-5"></td>
					</tr>
					<?php if($type=='completed'){ ?>
						<tr>
							<th class="wd-15p">Completed Date/Time</th>
							<td id="completed_time" class="pl-5 ml-5"></td>
						</tr>
					<?php } if($type=='cancelled'){ ?>
						<tr>
							<th class="wd-15p">Cancelled Date/Time</th>
							<td id="cancelled_time" class="pl-5 ml-5"></td>
						</tr>
					<?php } } ?>





				</table>
				<button type="button" 
				class="btn btn-warning btn-sm" 
				data-toggle="modal"
				data-target="#exampleModal">
				Proceed
			</button>
		</div>
	</div>
</div>
</div>
</div>

<script>
	$(document).ready(function() {
		$('#example').DataTable({
			"iDisplayLength": 10,
			"processing": true,
			"serverSide": true,
			"ajax": "booking_ajax.php?type=<?=$type?>",
			"columnDefs": [
				{ "orderable": false, "targets": "_all" }
				],
			layout: {
				topStart: {
					buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
				}
			},
		});
	});
</script>

<script type="text/javascript">

	$('.view_btn').click(function (e){
		e.preventDefault();
    			// alert('hello');
		var	book_id =$(this).closest('tr').find('.list_booking').text();
		var	from =$(this).closest('tr').find('.from').text();
		var	to =$(this).closest('tr').find('.to').text();
		var	pickup_date =$(this).closest('tr').find('.pickup_date').text();
		var	drop_date =$(this).closest('tr').find('.drop_date').text();
		var	pickup_time =$(this).closest('tr').find('.pickup_time').text();
		var	cab_type =$(this).closest('tr').find('.cab_type').text();
		var	trip_type =$(this).closest('tr').find('.trip_type').text();
		var	name =$(this).closest('tr').find('.name').text();
		var	contact =$(this).closest('tr').find('.contact').text();
		var	email =$(this).closest('tr').find('.email').text();
		var	alt_contact =$(this).closest('tr').find('.alt_contact').text();
		var	amount =$(this).closest('tr').find('.amount').text();
		var	advance_amount =$(this).closest('tr').find('.advance_amount').text();
		var	balance_amount =$(this).closest('tr').find('.balance_amount').text();
		var	commission =$(this).closest('tr').find('.commission').text();
		var	pickup_address =$(this).closest('tr').find('.pickup_address').text();
		var	drop_address =$(this).closest('tr').find('.drop_address').text();
		var	toll_tax =$(this).closest('tr').find('.toll_tax').text();
		var	state_tax =$(this).closest('tr').find('.state_tax').text();
		var	parking =$(this).closest('tr').find('.parking').text();
		var	night_charge =$(this).closest('tr').find('.night_charge').text();
		var	extra_price =$(this).closest('tr').find('.extra_price').text();
		var	remark =$(this).closest('tr').find('.remark').text();
		var	booking_type =$(this).closest('tr').find('.booking_type').text();
		var	post_vendor_id =$(this).closest('tr').find('.post_vendor_id').text();
		var	post_vendor_name =$(this).closest('tr').find('.post_vendor_name').text();
		var	post_vendor_contact =$(this).closest('tr').find('.post_vendor_contact').text();
		var	accept_vendor_id =$(this).closest('tr').find('.accept_vendor_id').text();
		var	accept_vendor_name =$(this).closest('tr').find('.accept_vendor_name').text();
		var	accept_vendor_contact =$(this).closest('tr').find('.accept_vendor_contact').text();
		var	cab_detail =$(this).closest('tr').find('.cab_detail').text();
		var	driver_detail =$(this).closest('tr').find('.driver_detail').text();
		var	time_stamp =$(this).closest('tr').find('.time_stamp').text();
		var	accept_time =$(this).closest('tr').find('.accept_time').text();
		var	completed_time =$(this).closest('tr').find('.completed_time').text();
		var	cancelled_time =$(this).closest('tr').find('.cancelled_time').text();

		$('#book_id').html(book_id);
		$('#from').html(from);
		$('#to').html(to);
		$('#pickup_date').html(pickup_date);
		$('#drop_date').html(drop_date);
		$('#pickup_time').html(pickup_time);
		$('#cab_type').html(cab_type);
		$('#trip_type').html(trip_type);
		$('#name').html(name);
		$('#contact').html(contact);
		$('#email').html(email);
		$('#alt_contact').html(alt_contact);
		$('#amount').html(amount);
		$('#advance_amount').html(advance_amount);
		$('#balance_amount').html(balance_amount);
		$('#commissions').html(commission);
		$('#pickup_address').html(pickup_address);
		$('#drop_address').html(drop_address);
		$('#toll_tax').html(toll_tax);
		$('#state_tax').html(state_tax);
		$('#parking').html(parking);
		$('#night_charge').html(night_charge);
		$('#extra_price').html(extra_price);
		$('#time_stamp').html(time_stamp);
		$('#remark').html(remark);
		$('#booking_type').html(booking_type);
		$('#postvendor_id').html(post_vendor_id);
		$('#post_vendor_name').html(post_vendor_name);
		$('#post_vendor_contact').html(post_vendor_contact);
		$('#accept_vendor_id').html(accept_vendor_id);
		$('#accept_vendor_name').html(accept_vendor_name);
		$('#accept_vendor_contact').html(accept_vendor_contact);
		$('#cab_detail').html(cab_detail);
		$('#driver_detail').html(driver_detail);
		$('#view_modal').modal('show');
	});
</script>

<script type="text/javascript">
	function filterFunction(that, event) {
		let container, input, filter, li, input_val;
		container = $(that).closest(".searchable");
		input_val = container.find("input").val().toUpperCase();
		if (["ArrowDown", "ArrowUp", "Enter"].indexOf(event.key) != -1) {
			keyControl(event, container)
		} else {
			li = container.find("ul li");
			li.each(function (i, obj) {
				if ($(this).text().toUpperCase().indexOf(input_val) > -1) {
					$(this).show();
				} else {
					$(this).hide();
				}
			});
			container.find("ul li").removeClass("selected");
			setTimeout(function () {
				container.find("ul li:visible").first().addClass("selected");
			}, 100)
		}
	}
	function keyControl(e, container) {
		if (e.key == "ArrowDown") {
			if (container.find("ul li").hasClass("selected")) {
				if (container.find("ul li:visible").index(container.find("ul li.selected")) + 1 < container.find("ul li:visible").length) {
					container.find("ul li.selected").removeClass("selected").nextAll().not('[style*="display: none"]').first().addClass("selected");
				}
			} else {
				container.find("ul li:first-child").addClass("selected");
			}
		} else if (e.key == "ArrowUp") {
			if (container.find("ul li:visible").index(container.find("ul li.selected")) > 0) {
				container.find("ul li.selected").removeClass("selected").prevAll().not('[style*="display: none"]').first().addClass("selected");
			}
		} else if (e.key == "Enter") {
			container.find("input").val(container.find("ul li.selected").text()).blur();
			onSelect(container.find("ul li.selected").text())
		}
		container.find("ul li.selected")[0].scrollIntoView({
			behavior: "smooth",
		});
	}
	function onSelect(val) {
		(val)
	}
	$(".searchable input").focus(function () {
		$(this).closest(".searchable").find("ul").show();
		$(this).closest(".searchable").find("ul li").show();
	});
	$(".searchable input").blur(function () {
		let that = this;
		setTimeout(function () {
			$(that).closest(".searchable").find("ul").hide();
		}, 300);
	});
	$(document).on('click', '.searchable ul li', function () {
		$(this).closest(".searchable").find("input").val($(this).text()).blur();
		onSelect($(this).text())
	});
	$(".searchable ul li").hover(function () {
		$(this).closest(".searchable").find("ul li.selected").removeClass("selected");
		$(this).addClass("selected");
	});
	$(document).ready(function() {
		$(".selectItem").click(function() {
			var itemValu = $(this).val();
			$("#vendor").val(itemValu);
		});
	});



// new booking with notification sound

	function removebooking(id){
		$.ajax({
			type: 'POST',
			url: "check_new_booking.php",
			data:{'booking_id':id},
			success: function (response) {
				console.log(response); 
				location.reload();
			}
		});
	}

</script>

<script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" />
<script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>

<script>
	$(function() {

		var start = moment().subtract(29, 'days');
		var end = moment();

		function cb(start, end) {
			$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
		}

		$('#reportrange').daterangepicker({
			startDate: start,
			endDate: end,
			ranges: {
				'Today': [moment(), moment()],
				'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
				'Last 7 Days': [moment().subtract(6, 'days'), moment()],
				'Last 30 Days': [moment().subtract(29, 'days'), moment()],
				'This Month': [moment().startOf('month'), moment().endOf('month')],
				'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
			}
		}, cb);

		cb(start, end);

	});
</script>

MMCT - 2023