<?php

session_start();

if (!isset($_SESSION['email'])) {
    echo("<script>location.href = 'login.php';</script>");
}
require_once 'db.php';
$id = $_SESSION['id'];
$query = "SELECT * FROM parcel WHERE id = '$id'";
$result = mysqli_query($db, $query);
$row = mysqli_fetch_assoc($result);
?>



<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="assects/css/bootstrap.min.css">
  <!-- Font Awesome -->
  
  <!-- Theme style -->
  <link rel="stylesheet" href="assects/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
  folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="assects/css/_all-skins.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="assects/css/dataTables.bootstrap.min.css">
  <script src="https://use.fontawesome.com/2aec379aeb.js"></script>

  <!-- 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/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<!-- Google Font -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition skin-purple sidebar-mini">
  <div class="wrapper">

    <title>Admin Panel | Courier Cargo</title>
    <header class="main-header">
      <!-- Logo -->
      <a href="index.php" class="logo">
        <!-- mini logo for sidebar mini 50x50 pixels -->
        <span class="logo-mini"><b>Admin</b></span>
        <!-- logo for regular state and mobile devices -->
        <span class="logo-lg"><b>Admin</b> Panel</span>
      </a>
      <!-- Header Navbar: style can be found in header.less -->
      <nav class="navbar navbar-static-top">
        <!-- Sidebar toggle button-->
        <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
          <span class="sr-only">Toggle navigation</span>
        </a>

        <div class="navbar-custom-menu">
          <ul class="nav navbar-nav">
            <li class="dropdown user user-menu">
              <a><span class="hidden-xs">Welcome Admin</span></a>
            </li>
          </ul>
        </div>
      </nav>
    </header>
    <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">
      <!-- sidebar: style can be found in sidebar.less -->
      <section class="sidebar">

        <ul class="sidebar-menu" data-widget="tree">
          <li ><a href="index.php"><i class="fa fa-dashboard"></i> <span>Dashboard</span></a></li>
          <li class="treeview active">
            <a href="#">
              <i class="fa fa-truck"></i> <span>Shipment</span>
              <span class="pull-right-container">
                <i class="fa fa-angle-left pull-right"></i>
              </span>
            </a>
            <ul class="treeview-menu">
              <li ><a href="new.php"><i class="fa fa-angle-double-right"></i> Add Shipment</a></li>
              <li class='active'><a href="index.php"><i class="fa fa-angle-double-right"></i> List of Pending Shipment</a></li>
            </ul>
          </li>

          <li><a href="logout.php"><i class="fa fa-sign-out"></i> <span>Logout</span></a></li>
        </ul>
      </section>
      <!-- /.sidebar -->
    </aside>

    <link rel="stylesheet" href="assects/css/bootstrap-timepicker.min.css">
    <link href="assects/css/jquery-ui.min.css" rel="stylesheet" type="text/css" />
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
      <!-- Content Header (Page header) -->
      <section class="content-header">
        <h1>
          Shipment
          <small>Add Shipment</small>
        </h1>
        <ol class="breadcrumb">
          <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li>
          <li class="active">Shipment - Add Shipment</li>
        </ol>
      </section>

      <!-- Main content -->
      <section class="content"> 
        <!-- Small boxes (Stat box) -->
        <div class="row">

          <div class="col-md-12">
            <form name="addshipment" id="addshipment" method="post" action="process.php">
              <div class="box">
                <div class="box-header">
                  <h3 class="box-title">Add Shipment</h3>
                </div>


                <!-- /.box-header -->
                <div class="box-body">
                  <div class="col-md-12">

                    <?php if (isset($_SESSION['msg-s'])) { ?>
        <div class="alert alert-success alert-dismissible">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <h4><i class="icon fa fa-check"></i> Success!</h4> <?php echo $_SESSION['msg-s']; ?>
                </div>
<?php unset($_SESSION['msg-s']); } ?>

<?php if (isset($_SESSION['msg-e'])) { ?>
        <div class="alert alert-error alert-dismissible">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <h4><i class="icon fa fa-check"></i> Error!</h4> <?php echo $_SESSION['msg-e']; ?>
                </div>
<?php unset($_SESSION['msg-e']); } ?>


                    <div class="col-md-6">
                      <h3 class="box-title">Shipper info :</h3>
                      <div class="form-group">

                      </div>
                      <div class="form-group">
                        <label for="shippername">Shipper Name<span class="text-red">*</span></label>
                        <input type="text" class="form-control" value="<?php echo $row['sname']; ?>" name="shippername" id="shippername" maxlength="35" required="required">
                      </div>
                      <div class="form-group">
                        <label for="phone">Phone</label>
                        <input type="text" class="form-control" value="<?php echo $row['sphone']; ?>" name="shipperphone" id="shipperphone" maxlength="30" required="required">
                      </div>
                      <div class="form-group">
                        <label for="shipperaddress">Address<span class="text-red">*</span></label>
                        <input type="text" class="form-control" value="<?php echo $row['saddress']; ?>" name="shipperaddress1" id="shipperaddress1" required="required"><br />
                        <input type="hidden" class="form-control" value="Address Line 2" name="shipperaddress2" id="shipperaddress2">
                      </div>
                      <div class="form-group">
                        <label for="email">Email</label>
                        <input type="email" class="form-control" value="<?php echo $row['semail']; ?>" name="shipperemail" id="shipperemail" maxlength="55" required="required">
                      </div>
                    </div>

                    <div class="col-md-6">
                      <h3 class="box-title">Receiver info :</h3>
                      <div class="form-group">

                      </div>
                      <div class="form-group">
                        <label for="name">Name<span class="text-red">*</span></label>
                        <input type="text" class="form-control" value="<?php echo $row['rname']; ?>" name="receivername" id="receivername" maxlength="35" required="required">
                      </div>
                      <div class="form-group">
                        <label for="phone">Phone</label>
                        <input type="text" class="form-control" value="<?php echo $row['rphone']; ?>" name="receiverphone" id="receiverphone" maxlength="35" required="required">
                      </div>
                      <div class="form-group">
                        <label for="receiveraddress">Address<span class="text-red">*</span></label>
                        <input type="text" class="form-control" value="<?php echo $row['raddress']; ?>" name="receiveraddress1" id="receiveraddress1" required="required"><br />
                        <input type="hidden" class="form-control" value="Address Line 2" name="receiveraddress2" id="receiveraddress2">
                      </div>
                      <div class="form-group">
                        <label for="email">Email</label>
                        <input type="email" class="form-control" value="<?php echo $row['remail']; ?>" name="receiveremail" id="receiveremail" maxlength="55" required="required">
                      </div>
                    </div>
                  </div>

                  <div class="col-md-12">
                    <h3 class="box-title">Shipment info :</h3>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="consignmentnumber">Consignment No<span class="text-red">*</span></label>
                        <input type="text" class="form-control" value="<?php echo $row['cno']; ?>" name="consignmentnumber" id="consignmentnumber" maxlength="50" readonly  required="required">
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="typeofshipment">Type of Shipment</label>
                        <select name="typeofshipment" id="typeofshipment" class="form-control">
                          <option value="<?php echo $row['type']; ?>"><?php echo $row['type']; ?></option>
                          <option value="Documents">Documents</option>
                          <option value="Sentiments">Sentiments</option>
                          <option value="Parcel">Parcel</option>
                          <option value="Perishable">Perishable</option>
                        </select>
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="weight">Weight</label>
                        <input type="text" class="form-control" value="<?php echo $row['weight']; ?>" name="weight" id="weight" maxlength="25">
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="courier">Courier</label>
                        <input type="text" class="form-control" value="<?php echo $row['courier']; ?>" name="courier" id="courier" maxlength="50">
                      </div>
                    </div>
                    <div class="clearfix"></div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="packages">Packages</label>
                        <input type="text" class="form-control" value="<?php echo $row['package']; ?>" name="packages" id="packages" maxlength="30">
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="Mode">Mode</label>
                        <select name="bookmode" id="bookmode" class="form-control" required="required"> 
                          <option value="<?php echo $row['mode']; ?>"><?php echo $row['mode']; ?></option>
                          <option value="Air">Air</option>
                          <option value="Road">Road</option>
                          <option value="Sea">Sea</option>

                        </select>
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="product">Product</label>
                        <input type="text" class="form-control" value="<?php echo $row['product']; ?>" name="product" id="product" maxlength="35">
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="qnty">Qnty</label>
                        <input type="text" class="form-control" value="<?php echo $row['qnty']; ?>" name="qnty" id="qnty" maxlength="40">
                      </div>
                    </div>
                    <div class="clearfix"></div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="paymentmode">Payment Mode<span class="text-red">*</span></label>
                        <select name="paymentmode" id="paymentmode" class="form-control">                                   
                          <option value="<?php echo $row['payment']; ?>"><?php echo $row['payment']; ?></option>
                          <option value="To Pay">To Pay</option>
                          <option value="Paid">Paid</option>
                          <option value="Credit">Credit</option>
                          <option value="Cash">Cash</option>
                          <option value="cheque">cheque</option>
                          <option value="online paypal">online paypal</option>
                          <option value="Account">Account</option>

                        </select>
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="totalfreight">Total Freight</label>
                        <input type="text" class="form-control" value="<?php echo $row['total']; ?>" name="totalfreight" id="totalfreight" maxlength="40">
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="carrier">Carrier</label>
                        <select name="carrier" id="carrier" class="form-control">                                   
                          <option value="<?php echo $row['carrier']; ?>"><?php echo $row['carrier']; ?></option>
                          <option value="WORLDWIDE PERFECT SHIPPING">WORLDWIDE PERFECT SHIPPING</option>
                          <option value="DHL">DHL</option>
                          <option value="FEDEX">FEDEX</option>
                          <option value="DPD UK">DPD UK</option>
                          <option value="AIR France">AIR France</option>
                          <option value="MCS LOGISTIC">MCS LOGISTIC</option>
                          <option value="MCS LOGISTIC">MCS LOGISTIC</option>

                        </select>
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="carrierreferencenumber">Carrier Reference Number</label>
                        <input type="text" class="form-control" value="<?php echo $row['reference']; ?>" name="carno" id="carno" maxlength="35">
                      </div>
                    </div>
                    <div class="clearfix"></div>
                    <div class="col-md-3 bootstrap-timepicker">
                      <div class="form-group">
                        <label for="depttime">Depttime</label>
                        <input type="text" class="form-control timepicker" value="<?php echo $row['weight']; ?>depttime" name="depttime" id="depttime" maxlength="15" readonly="readonly">
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="origin">Origin<span class="text-red">*</span></label>
                        <input type="text" class="form-control" value="<?php echo $row['origin']; ?>" name="origin" id="carno" maxlength="35">                                   
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="destination">Destination<span class="text-red">*</span></label>
                        <input type="text" class="form-control" value="<?php echo $row['destination']; ?>" name="destination" id="carno" maxlength="35">                                   
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="pickupdate">Pickup Date<span class="text-red">*</span></label>
                        <input type="text" class="form-control" value="<?php echo $row['pdate']; ?>" name="pickupdate" id="pickupdate" readonly="readonly" value="14-04-2020">
                      </div>
                    </div>
                    <div class="clearfix"></div>
                    <div class="col-md-3 bootstrap-timepicker">
                      <div class="form-group">
                        <label for="pickuptime">Pickup Time</label>
                        <input type="text" class="form-control timepicker" value="<?php echo $row['ptime']; ?>" name="pickuptime" id="pickuptime" readonly="readonly">
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="destination">Status</label>
                        <select name="status" id="status" class="form-control">
                          <option value="<?php echo $row['status']; ?>"><?php echo $row['status']; ?></option>
                          <option value="In Transit">In Transit</option>
                          <option value="Pending" >Pending</option>
                          <option value="Delivered" >Delivered</option>
                          <option value="Delayed" >Delayed</option>
                          <option value="On Hold" >On Hold</option>
                          <option value="Landing" >Landing</option>
                          <option value="Clearance" >Clearance </option>
                          <option value="In  Sorting" >in  Sorting</option>
                          <option value="Shipment Pickup" >Shipment Pickup</option>
                        </select>
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="exptdeliverydate">Expected Delivery date<span class="text-red">*</span></label>
                        <input type="text" class="form-control" value="<?php echo $row['expdelivdate']; ?>" name="exptdeliverydate" id="exptdeliverydate" maxlength="15" readonly="readonly" value="14-04-2020">
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label for="destination">Comments</label>
                        <textarea class="form-control" value="<?php echo $row['comment']; ?>" placeholder="<?php echo $row['comment']; ?>" name="comments" id="comments"></textarea>
                      </div>
                    </div>

                  </div>
                  <input type="hidden" name="id" id="add" value="<?php echo $row['id']; ?>">
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                  <button type="submit" name="update_p" class="btn btn-primary pull-right">Update</button>
                </div>
              </div>
            </form>
          </div>

        </div>
        <!-- /.row -->

      </section>
      <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <footer class="main-footer">
      <strong>Copyright &copy; 2022.</strong> All rights reserved.
    </footer>
  </div>
  <!-- ./wrapper -->

  <!-- jQuery 3 -->
  <script src="assects/js/jquery.min.js"></script>
  <!-- jQuery UI 1.11.4 -->
  <script src="assects/js/jquery-ui.min.js"></script>
  <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <!-- Bootstrap 3.3.7 -->
  <script src="assects/js/bootstrap.min.js"></script>
  <!-- DataTables -->
  <script src="assects/js/jquery.dataTables.min.js"></script>
  <script src="assects/js/dataTables.bootstrap.min.js"></script>
  <!-- AdminLTE App -->
  <script src="assects/js/adminlte.min.js"></script>
  <!-- AdminLTE for demo purposes -->
  <script src="assects/js/demo.js"></script>
</body>
</html>
<script src="assects/js/bootstrap-timepicker.min.js"></script>
<script type="text/javascript">
  $( function() {
    $( "#pickupdate,#exptdeliverydate" ).datepicker({
      dateFormat: "dd-mm-yy"
    });
    $(".timepicker").timepicker({
      showInputs: false
    });
  });
</script>  
<script src="assects/js/jquery.validate.min.js"></script>    
