<?php
include_once '../resource/sessions.php';
require_once '../dbconnections/Config.php';
require_once 'model/UsersModel.php';
$UsersObj = new UsersModel();








?>
<!DOCTYPE html>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Provide Address</title>
    <meta name="robots" content="noindex, follow" />
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Favicon -->
    <link rel="shortcut icon" type="image/x-icon" href="./assets/images/favicon.png">

    <!-- CSS (Font, Vendor, Icon, Plugins & Style CSS Preferences) -->

    <!-- Font CSS -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap" rel="stylesheet">

    <?php require "../imports/importcss.php" ?>
    <link rel="stylesheet" href="../assets/css/form-style.css">


</head>

<body class="dashboard-page dashboard-nav-fixed">

    <!-- Dashboard Nav Start -->
    <?php require "../sections/topnavbar.php" ?>
    <!-- Dashboard Nav End -->

    <!-- Dashboard Main Wrapper Start -->
    <main class="dashboard-main-wrapper">

    <?php require "../sections/header.php" ?>
    

        <!-- Dashboard Content Start -->
        <div class="dashboard-content">

            <div class="card">
                <div class="body">
                    

                        <div class="container">
                            <br>
                            <h4 class="dashboard-title">Enter Return Address</h4>
                            <!--search form-->
                           
                            <form class="form-horizontal Users_form" method="post" class="" enctype="multipart/form-data" accept-charset="utf-8">

                                <input type="hidden" class="status" name="status" value="returnaddress">
                                

                                
                                <!-- <hr> -->
                                <div class="row">
                                    
                                    
                                        <div>
                                            <label for="address" class=" form-label">Enter Address</label>
                                            <input type="text" name="address" id="address" value="" class=" form-control" min="0" required>
                                        </div>
                                    
                                    <!--product listing date input field-->
                                    <!-- <div class="col-lg-3 col-md-3 col-sm-12 mb-3">
                                        <div>
                                            <label for="listing_date" class=" form-label">Listing date</label>
                                            <input type="date" name="listing_date" id="listing_date" class=" form-control">
                                        </div>
                                    </div> -->

                                    <!--finished input field-->
                                    <!-- <div class="col-lg-2 col-md-6 col-sm-12 mb-3">
                                        <div>
                                            <label for="" class=" form-label">Finished?</label>
                                            <select name="" id="" class="form-control">
                                                <option value="">--Select --</option>
                                                <option value="Yes">Yes</option>
                                                <option value="No">No</option>
                                            </select>
                                        </div>
                                    </div> -->
                                </div>
                                <hr>
                                <div class=" d-flex justify-content-center mt-3 mb-3">
                                    <button type="submit" class="btn  btn-primary" value="true">
                                        <i class="fa fa-floppy-o" aria-hidden="true"></i>
                                        Submit
                                    </button>
                                </div>
                            </form>
                        </div>

                    

                </div>
            </div>


        </div>
        <!-- Dashboard Content End -->


    </main>
    <!-- Dashboard Main Wrapper End -->


    <?php require "../imports/importjs.php" ?>
    <script src="../../assets/js/beeps.js"></script>

    <script type="text/javascript">
        
        $(document).ready(function() {

            $('.Users_form').submit(function(event) {
                event.preventDefault();
                
                


                    var status = $(".status").val();
                    
                    $.ajax({
                        url: 'model/UsersController.php',
                        type: 'POST',
                        data: new FormData(this),
                        contentType: false,
                        cache: false,
                        processData: false,
                        
                        success: function(result) {

                            var fields = result.split('|');
                            var id = fields[0];
                            var msg = fields[1];

                            if (id == 1) {
                                beepSuccess(msg);
                                setTimeout(redir,3000);
                                function redir(){
                                window.location.href = "https://axiominventorymanagement.com/axiom/parent/inventory/pendingagedinventory.php";
                                }
                            } else if (id == 2) {
                                alert(msg);
                            }
                        },
                        error: function(err) {
                            alert(err);
                        }
                    });
                
            });
            //ENd of form
        });

       
    </script>
</body>

</html>