<?php
session_start();
require'Database.php';
$database = new Database;
if(!$_SESSION['username']){
	header('Location: ../index.php');
	die();
}else{
    

?>	
<!DOCTYPE html>
<html lang="en">
  <?php include'head.php'; ?>
  <body class="app sidebar-mini rtl">
    <!-- Navbar-->
    <?php include'topnav.php'; ?>
    <!-- Sidebar menu-->
    <div class="app-sidebar__overlay" data-toggle="sidebar"></div>
    <?php include'nav.php'; ?>
    <main class="app-content">
      
        <div class="clearfix"></div>
        <div class="col-md-12">
          <div class="tile">
            <h3 class="tile-title">Register Shipment</h3>
            <div class="table-responsive">
              <form method="post"action="invoice.php" class="form">
              <div class="row">
                <div class="col-6">
                  <h5 class="tile-title">Basic Information</h5>
                  <input type="text" name="track" class="form-control" placeholder="Tracking Number"><br/>
                  <input type="text" name="sender" class="form-control" placeholder="Sender's Name"><br/>
                  <input type="text" name="receiver" class="form-control" placeholder="Receiver's Name"><br/>
                  <input type="text" name="receiver_add" class="form-control" placeholder="Receiver's Address"><br/>
                  <input type="text" name="receiver_phone" class="form-control" placeholder="Receiver's Phone"><br/>
                  <label for="del-date"><b>Actual Delivery Date</b></label>
                  <input type="date" name="del_date" class="form-control" placeholder="Delivery Date"><br/>
                  <input type="text" name="package" class="form-control" placeholder="Package"><br/>
                  <input type="text" name="shipper_ref" class="form-control" placeholder="Shipper Reference"><br/>
                  <input type="text" name="service" class="form-control" placeholder="Service"><br/>
                </div>
                <div class="col-6">
                <h5 class="tile-title">Parcel Information</h5>
                <input type="text" name="num_shipment" class="form-control" placeholder="Number of Shipment"><br/>
                 <select name="status" class="form-control">
                    <option>Select Status</option>
                    <option>Processing</option>
                    <option>Pending</option>
                    <option>Canceled</option>
                    <option>Moving</option>
                    <option>Paused</option>
                    <option>Delivered</option>
                  </select><br/>
                  <input type="text" name="package_name" class="form-control" placeholder="Package Name"><br/>
                  <input type="text" name="weight" class="form-control" placeholder="Weight"><br/>
                  
                  <label for="del-date"><b>Expected Delivery Date</b></label>
                  <input type="date" name="delivered" class="form-control" placeholder="Delivered On"><br/>
                  <input type="text" name="location" class="form-control" placeholder="Location"><br/>
                  <input type="text" name="local" class="form-control" placeholder="Local Time"><br/>
                  <input type="text" name="loc_country" class="form-control" placeholder="Location Country"><br/>
                  <input type="text" name="email" class="form-control" placeholder="Email Address"><br/>
                  
              
                </div>

              </div>
                  <input type="submit" name="submit" value="Submit" class="form-control"><br>


              
            </div>
          </div>
            <?php
    include "../connect.php";
if(isset($_POST["submit"])){
    $track = $_POST['track'];
    $sender = $_POST['sender'];
    $receiver = $_POST['receiver'];
    $receiver_add = $_POST['receiver_add'];
    $del_date = $_POST['del_date'];
    $package = $_POST['package'];
    $shipper_ref = $_POST['shipper_ref'];
    $service = $_POST['service'];
    $num_shipment = $_POST['num_shipment'];
    $status = $_POST['status'];
    $package_name = $_POST['package_name'];
    $weight = $_POST['weight'];
    $receiver_phone = $_POST['receiver_phone'];
    $delivered = $_POST['delivered'];
    $location = $_POST['location'];
    $local = $_POST['local'];
    $loc_country = $_POST['loc_country'];
    $email = $_POST['email'];
    

        $adduser = $conn->query("INSERT INTO shipment(track_no,sender,receiver,receiver_add,receiver_phone,actual_date,package,shipper_ref,service,number_of_shipment,status,package_name,weight,expected_date,location,local_time,location_country,email) VALUES('$track','$sender','$receiver','$receiver_add','$receiver_phone','$del_date','$package','$shipper_ref','$service','$num_shipment','$status','$package_name','$weight','$delivered','$location','$local','$loc_country','$email')");
        
   


if($adduser){
			//Send Email
			$from = "support@Airsuitlogcompany.com";
			$to = "$email";
			$subject = " DELIVERY DETAILS";
	   
			$headers = "From:" .$from . "\r\n";
			$headers .= "MIME-Version: 1.0" . "\r\n";
			$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
			$headers .= "<center><img src='https://airsuitlogcompany.com/logo.png'/></center>" . "\r\n";
			$headers .= "<center><h3 style='color:#fffff;'>PACKAGE RECIEVED, $sender</h3></center>" . "\r\n";
			$headers .= "<center><h5 style='color:#8B0815;'>Your delivery has been Recieved Successfully!</h5></center>" . "\r\n";
			$headers .= "<center><h4 style='color:#fffff;'>Your Tracking Number is: $track</h4></center>" . "\r\n";
			
			$headers .= "<center><h5 style='color:#8B0815;'>kindly visit our website to track your delivery, for more information please contact our support team!</h5></center>" . "\r\n";
			
			$headers .= "<center><h5 style='color:#fffff;'>Thank you for choosing wideserviceintldelivery The Best delivery platform</h5></center>" . "\r\n";
  
  
			$headers .= "<center></center>" . "\r\n";
			
			
		  
			mail($to,$subject,$message,$headers);               
		}
		  echo "<font color='black'><b>Your Registration was successful<b></font>";
}

?>
        </div>
        </div>
    </main>

    <!-- Essential javascripts for application to work-->
    <script src="js/jquery-3.2.1.min.js"></script>
    <script src="js/popper.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/main.js"></script>
    <!-- The javascript plugin to display page loading on top-->
    <script src="js/plugins/pace.min.js"></script>
    <!-- Page specific javascripts-->
    <!-- Google analytics script-->
    <script type="text/javascript">
      if(document.location.hostname == 'pratikborsadiya.in') {
      	(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      	(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      	m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      	})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      	ga('create', 'UA-72504830-1', 'auto');
      	ga('send', 'pageview');
      }
    </script>
  </body>
</html>
<?php
}
?>