<?php include_once('../function/__data_app_db.php'); ?>
<!DOCTYPE html>

  <html class="loading" lang="en" data-textdirection="ltr">
  <!-- BEGIN: Head-->
  <?php include_once('head.php');?>
  <!-- END: Head-->

  <!-- BEGIN: Body-->
  <body class="vertical-layout vertical-menu-modern 2-columns navbar-sticky footer-static menu-expanded pace-done dark-layout" data-open="click" data-menu="vertical-menu-modern" data-col="2-columns">

    <!-- BEGIN: Header-->
    <?php include_once('header.php');?>
    <!-- END: Header-->

    <!-- BEGIN: Main Menu-->
    <?php include_once('sidemenu.php');?>
    <!-- END: Main Menu-->

    <!-- BEGIN: Content-->
    <div class="app-content content">
      <div class="content-overlay"></div>
      <div class="content-wrapper">
        <div class="content-header row"></div>
        <div class="content-body">
            <section id="basic-input">
                <div class="row">
                    <div class="col-md-12">
                        <div class="card pb-2">
                            <div class="card-header">
                                <h4 class="card-title">Create Tracking Order</h4>
                            </div>
                            <hr>
                            <div class="card-content">
                                <div class="card-body">
                                 <form  id="data-form" action="function/insert/add-track">
                                    <div class="row">
                                        <div class="col-md-4">
                                            <fieldset class="form-group">
                                                <label for="doc_no">Doc No.</label>
                                                <input type="text" id="doc_no" name="doc_no" class="form-control form-main" value="" placeholder="" required>
                                            </fieldset>
                                        </div>

                                        <div class="col-md-4">
                                            <fieldset class="form-group">
                                                <label for="company_name">Customer/Company Name</label>
                                                <input type="text" maxlength="100" id="company_name" name="company_name" class="form-control form-main" value="" placeholder="" >
                                            </fieldset>
                                        </div>

                                        <div class="col-md-4">
                                            <label for="book_date">Booking Date*</label>
                                            <fieldset class="form-group position-relative has-icon-left">
                                                <input type="text" class="form-control pickadate" placeholder="" value="<?php echo date('d-m-Y');?>" name="book_date" id="book_date">
                                                <div class="form-control-position">
                                                    <i class='bx bx-calendar'></i>
                                                </div>
                                            </fieldset>
                                        </div>
                                    </div>
                                     <hr class="mt-2 mb-2">
                                     <div class="row">
                                         <div class="col-md-3 col-12">
                                             <fieldset class="form-group">
                                                 <label for="type">Type <small class="text-muted">Ex. <i>Document/Household Goods</i></small></label>
                                                 <input type="text" name="type" id="type" class="form-control form-main" value="" placeholder="" >
                                             </fieldset>
                                         </div>
                                         <div class="col-md-3 col-12">
                                             <fieldset class="form-group">
                                                 <label for="weight">Weight</label>
                                                 <input type="text" name="weight" id="weight" class="form-control form-main" value="" placeholder="" >
                                             </fieldset>
                                         </div>
                                         <div class="col-md-3 col-12">
                                             <fieldset class="form-group">
                                                 <label for="invoice_number">Invoice Number</label>
                                                 <input type="text" name="invoice_number" id="invoice_number" class="form-control form-main" value="" placeholder="" >
                                             </fieldset>
                                         </div>
                                         <div class="col-md-3 col-12">
                                             <fieldset class="form-group">
                                                 <label for="quantity">Quantity</label>
                                                 <input type="text" name="quantity" id="quantity" class="form-control form-main" value="" placeholder="" >
                                             </fieldset>
                                         </div>
                                     </div>
                                     <div class="row hidden">
                                         <div class="col-md-3">
                                             <fieldset class="form-group">
                                                 <label for="freight">Freight</label>
                                                 <input type="text" name="freight" id="freight" class="form-control form-main" value="" placeholder="" >
                                             </fieldset>
                                         </div>
                                         <div class="col-md-3">
                                             <fieldset class="form-group">
                                                 <label for="pick_date">Pick Date</label>
                                                 <input type="text" class="form-control pickadate" placeholder="" value="<?php echo date('d-m-Y');?>" name="pick_date" id="pick_date">
                                             </fieldset>
                                         </div>
                                         <div class="col-md-3">
                                             <fieldset class="form-group">
                                                 <label for="pick_time">Pick Time</label>
                                                 <input type="time" name="pick_time" id="pick_time" class="form-control form-main" value="" placeholder="" >
                                             </fieldset>
                                         </div>
                                     </div>
                                     <hr class="mt-2 mb-2">
                                    <div class="row">
                                        <div class="col-md-4">
                                            <fieldset class="form-group">
                                                <label for="ship_from_name">Ship From Name*</label>
                                                <input type="text" maxlength="30" id="ship_from_name" name="ship_from_name" class="form-control form-main" value="" placeholder="" >
                                            </fieldset>
                                        </div>
										<div class="col-md-4 col-5">
                                            <fieldset class="form-group">
                                                <label for="ship_from_phone">Ship From Phone*</label>
                                                <input type="number" name="ship_from_phone" id="ship_from_phone" maxlength="18" minlength="10" class="form-control form-main" value="" placeholder="" >
                                            </fieldset>
                                        </div>
										<div class="col-md-4 col-7">
                                            <fieldset class="form-group">
                                                <label for="ship_from_email">Ship From Email*</label>
                                                <input type="email" id="ship_from_email" maxlength="55" name="ship_from_email" value="" class="form-control form-main" placeholder="" >
                                            </fieldset>
                                        </div>
                                    </div>
                                    <div class="row">
										 <div class="col-md-3">
										  <div class="row pl-07 pr-07">
                                              <div class="col-md-12 col-6">
                                                  <fieldset class="form-group">
                                                      <label for="ship_from_country">Ship From Country*</label>

                                                      <input type="text" name="ship_from_country" id="ship_from_country" class="form-control form-main" value="" placeholder="" >
                                                  </fieldset>
                                              </div>
                                              <div class="col-md-12 col-6">
                                                  <fieldset class="form-group">
                                                      <label for="ship_from_state">Ship From State*</label>

                                                      <input type="text" name="ship_from_state" id="ship_from_state" class="form-control form-main" value="" placeholder="" >
                                                  </fieldset>
                                              </div>
                                          </div>
                                        </div>
										 <div class="col-md-3">
										  <div class="row pl-07 pr-07">
                                              <div class="col-md-12 col-6">
                                                  <fieldset class="form-group">
                                                      <label for="ship_from_city">Ship From City*</label>
                                                      <input type="text" name="ship_from_city" id="ship_from_city" class="form-control form-main" value="" placeholder="" >
                                                  </fieldset>
                                              </div>
                                              <div class="col-md-12 col-6">
                                                  <fieldset class="form-group">
                                                      <label for="ship_from_pincode">Ship From PinCode*</label>
                                                      <input type="text" name="ship_from_pincode" id="ship_from_pincode"class="form-control form-main" value="" placeholder="" >
                                                  </fieldset>
                                              </div>
                                          </div>
                                        </div>
										 <div class="col-md-6">
                                            <fieldset class="form-group">
                                                <label for="ship_from_address">Ship From Address*</label>
                                                <textarea class="form-control" id="ship_from_address" rows="5" name="ship_from_address" ></textarea>
                                            </fieldset>
                                        </div>
                                    </div>
                                    <hr class="mt-2 mb-2">
                                     <div class="row">
                                         <div class="col-md-4">
                                             <fieldset class="form-group">
                                                 <label for="ship_to_name">Ship To Name*</label>
                                                 <input type="text" maxlength="30" id="ship_to_name" name="ship_to_name" class="form-control form-main" value="" placeholder="" >
                                             </fieldset>
                                         </div>
                                         <div class="col-md-4 col-5">
                                             <fieldset class="form-group">
                                                 <label for="ship_to_phone">Ship To Phone*</label>
                                                 <input type="number" name="ship_to_phone" id="ship_to_phone" maxlength="18" minlength="10" class="form-control form-main" value="" placeholder="" >
                                             </fieldset>
                                         </div>
                                         <div class="col-md-4 col-7">
                                             <fieldset class="form-group">
                                                 <label for="ship_to_email">Ship To Email*</label>
                                                 <input type="email" id="ship_to_email" maxlength="55" name="ship_to_email" value="" class="form-control form-main" placeholder="" >
                                             </fieldset>
                                         </div>
                                     </div>
                                    <div class="row">
                                        <div class="col-md-3">
                                            <div class="row pl-07 pr-07">
                                                <div class="col-md-12 col-6">
                                                    <fieldset class="form-group">
                                                        <label for="ship_to_country">Ship To Country*</label>
                                                        <input type="text" name="ship_to_country" id="ship_to_country" class="form-control form-main" value="" placeholder="" >
                                                    </fieldset>
                                                </div>
                                                <div class="col-md-12 col-6">
                                                    <fieldset class="form-group">
                                                        <label for="ship_to_state">Ship To State*</label>
                                                        <input type="text" name="ship_to_state" id="ship_to_state" class="form-control form-main" value="" placeholder="" >
                                                    </fieldset>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-3">
                                            <div class="row pl-07 pr-07">
                                                <div class="col-md-12 col-6">
                                                    <fieldset class="form-group">
                                                        <label for="ship_to_city">Ship To City*</label>
                                                        <input type="text" name="ship_to_city" id="ship_to_city" class="form-control form-main" value="" placeholder="" >
                                                    </fieldset>
                                                </div>
                                                <div class="col-md-12 col-6">
                                                    <fieldset class="form-group">
                                                        <label for="ship_to_pincode">Ship To Pincode*</label>
                                                        <input type="text" name="ship_to_pincode" id="ship_to_pincode"class="form-control form-main" value="" placeholder="" >
                                                    </fieldset>
                                                </div>
                                            </div>
                                        </div>
										<div class="col-md-6">
                                            <fieldset class="form-group">
                                                <label for="ship_to_address">Ship To Address*</label>
                                                <textarea class="form-control" id="ship_to_address" rows="5" name="ship_to_address" ></textarea>
                                            </fieldset>
                                        </div>
                                    </div>
                                     <input type="hidden" value="<?php echo $_SESSION['signup_token'];?>" name="tkn">
                                    <hr class="mb-2">
                                    <div class="row">
                                        <div class="col-md-6 offset-md-6">
                                          <button class="btn btn-success position-relative w-100 ladda-button submit-btn" data-style="zoom-in" type="submit" name="action"><span class="ladda-label">SUBMIT</span> <span class="ladda-spinner"></span> <i id="icon-arrow" class="bx bx-right-arrow-alt"></i></button>
                                        </div>
                                    </div>
                                 </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        </div>
      </div>
    </div>
    <!-- END: Content-->

    <!-- BEGIN: Footer-->
    <?php include_once('footer.php');?>
    <!-- END: Footer-->

    <?php include_once('foot.php');?>
    <script type="text/javascript">
        $('form').parsley();
        $('form#data-form').submit(function (e) {
            e.preventDefault();
            var action = $(this).attr('action');
            var m_form_data = new FormData(this);
            if($(this).parsley().isValid()){
                var l = Ladda.create(document.querySelector('.submit-btn'));
                l.start();
                $.ajax({
                    type: "POST",
                    url: action,
                    data: m_form_data,
                    cache: false,
                    dataType:"json",
                    enctype: 'multipart/form-data',
                    processData: false,  // tell jQuery not to process the data
                    contentType: false,   // tell jQuery not to set contentType
                    success: function(data){
                        //alert(data);
                        l.stop();
                        var goTo ='';
                        var notify_type = data.notif_type;
                        var notify_title = data.notif_title;
                        var notify_desc = data.notif_desc;
                        $.notify({
                            // options
                            title: notify_title,
                            message: notify_desc
                        },{
                            // settings
                            type: notify_type
                        });
                        if(data.res == 'true'){
                            goTo = data.goTo;
                            window.setTimeout(function(){
                                window.location.href = goTo;
                            }, 1000);
                        }
                    },
                    error: function (jqXHR, exception) {
                        var msg = '';
                        if (jqXHR.status === 0) {
                            msg = "oops error";
                        } else if (jqXHR.status === 404) {
                            msg = "404 error";
                        } else if (jqXHR.status === 500) {
                            msg = "505 error";
                        } else if (exception === 'parsererror') {
                            msg = "error";
                        } else if (exception === 'timeout') {
                            msg = "timeout";
                        } else if (exception === 'abort') {
                            msg = "abort";
                        } else {
                            msg = "oops somthing want wrong"
                        }
                        l.stop();
                        alert(msg);
                    }
                });
            };
        });
    </script>

  </body>
  <!-- END: Body-->
</html>