<?php
include('../../../function/__data_app_db.php');
$__data_action = 'false';
 $_name_in_jsnj  = $__go_to = $inq_id=$job_id=$job_card_no=$errData = $item_list_name=$item_list = $vehicles_details='';
$item_qty='0';
if(isset($_POST["tkn"]) && $_POST["tkn"] == $_SESSION['signup_token']){
if(isset($_POST["doc_no"])){

    $c_id = validate_jsnj_data($_POST["c_id"]);
    $doc_no = validate_jsnj_data($_POST["doc_no"]);
    $remark = validate_jsnj_data($_POST["remark"]);
    $status = validate_jsnj_data($_POST["status"]);
    $dispatch_from = validate_jsnj_data($_POST["dispatch_from"]);
    $t_type = validate_jsnj_data($_POST["t_type"]);
    $t_date = jsnj_date_ymd($_POST["t_date"])." $TimeForInsert";
    $_ip_jsnj = validate_jsnj_data($ip);
    $db_query = "insert into tbl_courier_track ( doc_no, c_id, t_from, t_type, t_date_time, status, remark,  ip)values('$doc_no', '$c_id','$dispatch_from', '$t_type','$t_date','$status', '$remark', '$_ip_jsnj')";
    if($errData=='') {
        $res = mysqli_query($_conn_db, $db_query);
        if($res){
            $errData='';
        } else {
            $errData='| Something want wrong. Try again! |';
        }
    };

 if($errData=='')
 {
  if($res){
    $__notif_title = 'Tracking Details Updated';
	$__notif_disc = 'Successfully';
	$__notif_type = 'success';
	$__go_to = "#";
	$__data_action = 'true';
  }
  else{
	$__notif_title = 'Oops!';
	$__notif_disc = 'Something want wrong please reload this page';
	$__notif_type = 'danger';
  }
 }else{
   $__notif_title = 'Oops!';
   $__notif_disc = $errData;
   $__notif_type = 'warning';
 } 
} else {
	$__notif_title = 'Error';
	$__notif_disc = 'Dispatch From is required';
	$__notif_type = 'danger';
}
$dataResult = array('page' => 'track-order', 'res' => $__data_action, 'notif_title' => $__notif_title, 'notif_desc' => $__notif_disc,  'notif_type' => $__notif_type, 'goTo' => $__go_to);
echo json_encode($dataResult);
} else {
    echo 'lol';
};
?>