<?php 
include 'header.php';
	
$tnumbs = "1234567890";
$tnumbs = str_shuffle($tnumbs);
$tnumbs = substr($tnumbs, 0, $track_num);
$tnumbs = $track_prefix."-".date('m')."-".$tnumbs;

$msg = "";

$sendersname = $senderscontact = $sendersmail = $sendersaddress = $receiversname = $receiverscontact = $receiverscontact = $receiversmail =  $receiversaddress = $status = $dispatchl = $dispatch = $delivery = $desc = "";

$carrier = $carrier_ref = $weight = $payment_mode = $ship_mode = $quantity = $delivery_time = $err = $dest = "";

	if (isset($_POST['submit'])) {
	 $sendersname = text_input($_POST['sname']);	
     $senderscontact = text_input($_POST['scontact']);  
     $sendersmail = text_input($_POST['smail']);  
     $sendersaddress = text_input($_POST['saddress']);
     $receiversname = text_input($_POST['rname']);  
     $receiverscontact = text_input($_POST['rcontact']);  
     $receiversmail = text_input($_POST['rmail']);  
     $receiversaddress = text_input($_POST['raddress']);
     $status = text_input($_POST['status']);  
     $dispatchl = text_input($_POST['dispatchl']);  
     $dispatch = text_input($_POST['dispatch']);  
     $delivery = text_input($_POST['delivery']);  
     $desc = text_input($_POST['desc']); 

     $carrier = text_input($_POST['carrier']);  
     $carrier_ref = text_input($_POST['carrier_ref']);  
     $weight = text_input($_POST['weight']);  
     $payment_mode = text_input($_POST['payment_mode']);  
     $ship_mode = text_input($_POST['ship_mode']);  
     $quantity = text_input($_POST['quantity']);  
     $delivery_time = text_input($_POST['delivery_time']);  
     $dest = text_input($_POST['dest']);  

     if(isset($_FILES['image'])){
        $file_name = $_FILES['image']['name'];
        $file_size =$_FILES['image']['size'];
        $file_tmp =$_FILES['image']['tmp_name'];
        $file_type=$_FILES['image']['type'];
        $file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
        $imgname = uniqid().".".$file_ext;
        $extensions= array("jpeg","jpg","png");
        
        if(in_array($file_ext,$extensions)=== false){
           echo "<script>alert('extension not allowed, please choose a JPEG or PNG file.')</script>";
        }
     }else{

     }
      
    if (
        empty($sendersname) || 
        empty($senderscontact) || 
        empty($sendersmail) || 
        empty($sendersaddress) || 
        empty($receiversname) || 
        empty($receiverscontact) || 
        empty($receiversmail) || 
        empty($receiversaddress) || 
        empty($status) || 
        empty($dispatchl) || 
        empty($dispatch) || 
        empty($delivery) || 
        empty($carrier) || 
        empty($carrier_ref) || 
        empty($weight) || 
        empty($payment_mode) || 
        empty($ship_mode) || 
        empty($quantity) ||
         empty($delivery_time) || 
         empty($dest) ) {
       echo "<script>alert('Check !!! Some fields are empty')</script>";
     }else{
       $insert = mysqli_query($link, " INSERT INTO tracking (tracking_number, sender_name, sender_contact, sender_email, sender_address, status, dispatch_location, receiver_email, receiver_name, receiver_contact, receiver_address, dispatch_date, delivery_date, pdesc, carrier, carrier_ref, weight, payment_mode, ship_mode, quantity, delivery_time, image, destination) VALUES ('$tnumbs', '$sendersname', '$senderscontact', '$sendersmail', '$sendersaddress', '$status', '$dispatchl', '$receiversmail', '$receiversname', '$receiverscontact', '$receiversaddress', '$dispatch', '$delivery', '$desc', '$carrier', '$carrier_ref', '$weight', '$payment_mode', '$ship_mode', '$quantity', '$delivery_time', '$imgname', '$dest' ) ");
       if ($insert) {
        move_uploaded_file($file_tmp,"../uploads/".$imgname);

          //send mail
          if ($mail_track_save == "Yes") {
              $subject = "$sitename";
              $body = "<p>Dear $receiversname</p> <p>We are pleased to inform you that your shipment has been registered with us at <strong>$sitename</strong>.</p>  <center>Tracking Information</center> <p> <strong>Tracking Number - $tnumbs </strong> </p> <p> <strong>Status - $status </strong> </p> <p> <strong>Package - $desc </strong> </p> <p> <strong>Dispatch Location - $dispatchl </strong> </p> <p> <strong>Estimated Delivery Date - $delivery </strong> </p> <p>For more information visit the <a href='$site_url/tracking.php'>Tracking Page</a> </p> ";
              sendMail($receiversmail,$subject,$body);
          }

          echo "<script>
            alert('New Tracking Added Successfully');
            window.location.href = 'dashboard.php';
          </script>";
       }else{
        echo mysqli_error($link);
       }
     }
     
	}

?>

        <!-- NFTmax Dashboard -->
        <section class="nftmax-adashboard nftmax-show">
            <div class="container-fulid">
                <div class="row">

                    <div class="col-lg-12 setting-main  ">
                        <div class="d-flex align-items-start">
                            
                            <div class="tab-content" id="v-pills-tabContent">
                                <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel"
                                    aria-labelledby="v-pills-home-tab">


                                    <div class="row">
    <div class="col-lg-12">
        <div class="personal-informations-head">
            <h3>Add Tracking</h3>
        </div>

        <div class="card">
			<div class="card-body">
				<label style="font-weight: bold;font-size: 25px;">TRACKING NUMBER</label>
				<input type="text" readonly="" value="<?php echo $tnumbs ?>" name="tracking_number" class="form-control" id="exampleInputUsername1" placeholder="Username">
			</div>
		</div>

        <form action="" method="POST" enctype="multipart/form-data">
        <div class="personal-informations-from">
            <!-- Sender Information -->
            <div class="personal-informations-from-item">
                <h5>Sender Information</h5>
                <div class="personal-informations-from-item-inner">
                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="sname" class="form-label">Sender's Name</label>
                            <input type="text" name="sname" id="sname" class="form-control" aria-label="Sender's Name">
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="scontact" class="form-label">Sender's Contact</label>
                            <input type="text" name="scontact" id="scontact" class="form-control" aria-label="Sender's Contact">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="smail" class="form-label">Sender's Email</label>
                            <input type="email" name="smail" id="smail" class="form-control" aria-label="Sender's Email">
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="saddress" class="form-label">Sender's Address</label>
                            <input type="text" name="saddress" id="saddress" class="form-control" aria-label="Sender's Address">
                        </div>
                    </div>
                </div>
            </div>

            <!-- Receiver Information -->
            <div class="personal-informations-from-item">
                <h5>Receiver Information</h5>
                <div class="personal-informations-from-item-inner">
                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="rname" class="form-label">Receiver's Name</label>
                            <input type="text" name="rname" id="rname" class="form-control" aria-label="Receiver's Name">
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="rcontact" class="form-label">Receiver's Contact</label>
                            <input type="text" name="rcontact" id="rcontact" class="form-control" aria-label="Receiver's Contact">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="rmail" class="form-label">Receiver's Email</label>
                            <input type="email" name="rmail" id="rmail" class="form-control" aria-label="Receiver's Email">
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="raddress" class="form-label">Receiver's Address</label>
                            <input type="text" name="raddress" id="raddress" class="form-control" aria-label="Receiver's Address">
                        </div>
                    </div>
                </div>
            </div>

            <!-- Package Information -->
            <div class="personal-informations-from-item">
                <h5>Package Information</h5>
                <div class="personal-informations-from-item-inner">
                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="status" class="form-label">Status</label>
                            <select class="form-control" name="status">
                                <option value="Confirmed">Confirmed</option>
                            </select>
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="dispatchl" class="form-label">Dispatch Location(Format: City, Country)</label>
                            <input type="text" name="dispatchl" id="dispatchl" class="form-control" aria-label="Dispatch Location">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="dispatch" class="form-label">Dispatch Date</label>
                            <input type="date" name="dispatch" id="dispatch" class="form-control" aria-label="Dispatch Date">
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="delivery" class="form-label">Delivery Date</label>
                            <input type="date" name="delivery" id="delivery" class="form-control" aria-label="Delivery Date">
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="dispatch" class="form-label">description  </label>
                            <input type="text" name="desc" id="dispatch" class="form-control" aria-label="Dispatch Date">
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="delivery" class="form-label">Ship mode</label>
                            <input type="text" name="ship_mode" id="delivery" class="form-control" aria-label="Delivery Date">
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="dispatch" class="form-label">Quantity</label>
                            <input type="text" name="quantity" id="dispatch" class="form-control" aria-label="Dispatch Date">
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="delivery" class="form-label">Delivery Time</label>
                            <input type="time" name="delivery_time" id="delivery" class="form-control" aria-label="Delivery Date">
                        </div>

                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="delivery" class="form-label">Destination </label>
                            <input type="text" name="dest" id="delivery" class="form-control" aria-label="Delivery Date">
                        </div>


                        
                    </div>
                </div>
            </div>

            <!-- Additional Details -->
            <div class="personal-informations-from-item">
                <h5>Additional Details</h5>
                <div class="personal-informations-from-item-inner">
                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="carrier" class="form-label">Carrier</label>
                            <input type="text" name="carrier" id="carrier" class="form-control" aria-label="Carrier">
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="carrier_ref" class="form-label">Carrier Reference</label>
                            <input type="text" name="carrier_ref" id="carrier_ref" class="form-control" aria-label="Carrier Reference">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="weight" class="form-label">Weight</label>
                            <input type="number" step="0.01" name="weight" id="weight" class="form-control" aria-label="Weight">
                        </div>
                        <div class="col-12 col-md-12 col-lg-6">
                            <label for="payment_mode" class="form-label">Payment Mode</label>
                            <input type="text" name="payment_mode" id="payment_mode" class="form-control" aria-label="Payment Mode">
                        </div>
                    </div>
                </div>
            </div>

            <!-- Upload Image -->
            <div class="personal-informations-from-item">
                <div class="personal-informations-from-item-inner">
                    <div class="row">
                        <div class="col-12">
                            <label for="image" class="form-label">Upload Image</label>
                            <input type="file" name="image" id="image" class="form-control" aria-label="Upload Image">
                        </div>
                    </div>
                </div>
            </div>

            <!-- Submit Button -->
            <div class="personal-informations-from-btn">
                    <button type="submit" name="submit" class="btn-one">Add Tracking</button>
            </div>
        </form>
        </div>
    </div>
</div>







                                </div>



                            </div>
                        </div>

                    </div>


                </div>
            </div>
        </section>
        <!-- End NFTmax Dashboard -->
    </div>

    <script src="assets/js/jquery-3.6.3.min.js"></script>
    <script src="assets/js/slick.min.js"></script>
    <script src="assets/js/bootstrap.bundle.min.js"></script>
    <script src="assets/js/custom.js"></script>


    <script>
        //Theme controll 
        let darkMode = false
        if (darkMode) {
            document.getElementById("dark-icon").style.setProperty("display", "block")
            document.getElementById("light-icon").style.setProperty("display", "none")
            document.getElementsByClassName("logo")[0].style.setProperty("display", "none")
            document.getElementsByClassName("logo-dark")[0].style.setProperty("display", "block")
        } else {
            document.getElementById("dark-icon").style.setProperty("display", "none")
            document.getElementById("light-icon").style.setProperty("display", "block")
            document.getElementsByClassName("logo")[0].style.setProperty("display", "block")
            document.getElementsByClassName("logo-dark")[0].style.setProperty("display", "none")
        }



        document.getElementById("theme-controll").addEventListener("click", event => {
            darkMode = !darkMode
            const main = document.querySelector("html")
            main.classList.toggle("dark")

            if (darkMode) {

                document.documentElement.style.setProperty("--headding-color", "#fff")
                document.documentElement.style.setProperty("--paragraph-color", "#E2E8F0")
                document.documentElement.style.setProperty("--primary-color", "#febe42")
                document.documentElement.style.setProperty("--warning-color", "#FACC15")
                document.documentElement.style.setProperty("--alerts-color", "#FF4747")
                document.documentElement.style.setProperty("--other-color", "#FF784B")
                document.documentElement.style.setProperty("--grey-color", "#2A313C")
                document.documentElement.style.setProperty("--grey-color-border", "#edf2f7")
                document.documentElement.style.setProperty("--body-bg-color", "#23262B")
                document.documentElement.style.setProperty("--bg-color", "#1D1E24")
                document.documentElement.style.setProperty("--greyscale-3", "#191B1F")
                document.documentElement.style.setProperty("--greyscale-4", "#293644")
                document.documentElement.style.setProperty("--greyscale-200", "rgba(226, 232, 240, 0.7)")
                document.documentElement.style.setProperty("--greyscale-1", "#2A313C")
                document.documentElement.style.setProperty("--bg-color-2", "#23262B")
                document.documentElement.style.setProperty("--bg-rgb", "#1D1E24")

                document.getElementById("dark-icon").style.setProperty("display", "block")
                document.getElementById("light-icon").style.setProperty("display", "none")
                document.getElementsByClassName("logo")[0].style.setProperty("display", "none")
                document.getElementsByClassName("logo-dark")[0].style.setProperty("display", "block")
            } else {

                document.documentElement.style.setProperty("--headding-color", "#111827")
                document.documentElement.style.setProperty("--paragraph-color", "#747681")
                document.documentElement.style.setProperty("--primary-color", "#febe42")
                document.documentElement.style.setProperty("--warning-color", "#FACC15")
                document.documentElement.style.setProperty("--alerts-color", "#FF4747")
                document.documentElement.style.setProperty("--other-color", "#FF784B")
                document.documentElement.style.setProperty("--grey-color", "#F7FAFC")
                document.documentElement.style.setProperty("--grey-color-border", "#edf2f7")
                document.documentElement.style.setProperty("--bg-color", "#FAFAFA")
                document.documentElement.style.setProperty("--body-bg-color", "#F6F6F6")
                document.documentElement.style.setProperty("--greyscale-200", "rgba(42, 49, 60, 0.7)")
                document.documentElement.style.setProperty("--greyscale-1", "#EDF2F7")
                document.documentElement.style.setProperty("--greyscale-3", "#EEEFF2")
                document.documentElement.style.setProperty("--greyscale-4", "#CBD5E0")
                document.documentElement.style.setProperty("--bg-color-2", "#f7fafc")
                document.documentElement.style.setProperty("--bg-rgb", "rgba(237, 242, 247, 0.5)")

                document.getElementById("dark-icon").style.setProperty("display", "none")
                document.getElementById("light-icon").style.setProperty("display", "block")
                document.getElementsByClassName("logo")[0].style.setProperty("display", "block")
                document.getElementsByClassName("logo-dark")[0].style.setProperty("display", "none")
            }
        })
    </script>
</body>


<!-- Mirrored from quomodosoft.com/html/bankcohtml/setting.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 04 Jan 2025 01:45:36 GMT -->
</html>