0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.146.65.209


Current Path : /var/www/html/cuk/orms_nt_stop/js/
Upload File :
Current File : //var/www/html/cuk/orms_nt_stop/js/index.js

var urlarr = window.location.pathname.split("/");
var $url = "http://" + window.location.host + "/";
var $hoststr = "";
for (var j = 1; j < urlarr.length - 1; j++) {
  $hoststr += window.location.pathname.split("/")[j] + "/";
}
$host_url = $url + $hoststr + "app.php?a=";
$image_path = $url + $hoststr + "jqGrid3.5/cmes/tarka/images/";

$(document).ready(function() {
  getheaderdetail();
});

function getheaderdetail() {
  $.ajax({
    url: $host_url + "getheaderdetails",
    success: function(responce) {
      responce = eval("(" + responce + ")");
      if (responce.error_code == 0) {
        setCookie("title", responce.data.FUNIVNAME);
        setCookie("logo", responce.data.FLOGOPATH);
        setCookie("datestr", responce.data.datestr);
        //document.getElementById("title").innerHTML = responce.data.FUNIVNAME;
        //document.getElementById("logo").innerHTML = responce.data.FLOGOPATH;
        document.getElementById("datestr").innerHTML = responce.data.datestr;
      }
    }
  });
}

function newregistration() {
  var myobject;
  fldorder = "T1,T2,T3";
  mandfields = "T1,T2,T3";

  myobject = onsavevalidate.call(myobject, 999);
  if (myobject != 999) {
    document.getElementById(myobject).focus();
    return false;
  }
  var e = document.createEvent("Event");
  emailid = document.getElementById("T2").value;
  if (!validateemail(e, emailid)) {
    alert("Invalid email id");
    document.getElementById("T2").focus();
    return false;
  }

  var username = document.getElementById("T1").value;
  var emailid = document.getElementById("T2").value;
  var mobileno = document.getElementById("T3").value;
  // var cat = document.getElementById("T8").value;
  // var dob = document.getElementById("T9").value;
  // var age = document.getElementById("T10").value;
  // var cukemp = document.getElementById("T11").value;

  // +
  // "&cat=" +
  // cat +
  // "&dob=" +
  // dob +
  // "&age=" +
  // age +
  // "&cukemp=" +
  // cukemp

  var parameters =
    "username=" + username + "&emailid=" + emailid + "&mobileno=" + mobileno;
  $.ajax({
    url: $host_url + "newregistration",
    data: parameters,
    success: newregistrationResponse
  });
}

function newregistrationResponse(responce) {
  responce = eval("(" + responce + ")");
  if (responce.error_code == 0) {
    alert(responce.data);
    document.getElementById("T1").value = "";
    document.getElementById("T2").value = "";
    document.getElementById("T3").value = "";
  } else {
    alert(responce.data);
    document.getElementById("T1").focus();
    return false;
  }
}

function sendpassword() {
  var emailid = document.getElementById("T7").value;
  if (emailid == "") {
    alert("Enter Email Id");
    document.getElementById("T7").focus();
    return;
  }

  var parameters = "emailid=" + emailid;
  $.ajax({
    url: $host_url + "sendpassword",
    data: parameters,
    success: sendpasswordresponse
  });
}

function sendpasswordresponse(responce) {
  responce = eval("(" + responce + ")");
  if (responce.error_code == 0) {
    alert(responce.data);
    document.getElementById("T1").value = "";
  } else {
    alert(responce.data);
    document.getElementById("T1").focus();
    return;
  }
}

function loginvalidate() {
  var myobject;

  fldorder = "T4,T5";
  mandfields = "T4,T5";

  myobject = onsavevalidate.call(myobject, 999);
  if (myobject != 999) {
    document.getElementById(myobject).focus();
    return false;
  }
  var e = document.createEvent("Event");
  var emailid = document.getElementById("T4").value;
  if (!validateemail(e, emailid)) {
    alert("Invalid email id");
    document.getElementById("T4").focus();
    return false;
  }
  var emailid = document.getElementById("T4").value;
  var paswrd = document.getElementById("T5").value;
  var parameters = "emailid=" + emailid + "&paswrd=" + paswrd;
  $.ajax({
    url: $host_url + "loginvalidate",
    data: parameters,
    success: loginvalidateResponse
  });
}

function loginvalidateResponse(responce) {
  responce = eval("(" + responce + ")");
  if (responce.error_code == 0) {
    window.location.href = "home.html";
    setCookie("userid", responce.data.fuserid);
    setCookie("username", responce.data.fusername);
    loadhomepage();
  } else {
    alert(responce.data);
    document.getElementById("T4").focus();
    return false;
  }
}

function logoutsession() {
  $.ajax({
    url: $host_url + "logoutsession",
    success: function(responce) {
      responce = eval("(" + responce + ")");
      window.location.href = "index.html?v=11102017";
    }
  });
}

function isloggedinvalidate() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "isloggedinvalidate",
    success: function(responce) {
      responce = eval("(" + responce + ")");
      if (responce.data["data"] == 0) {
        alert("Please Login");
        window.location.href = "index.html?v=11102017";
      } else {
        ResetTimer();
        loadhomepage();
      }
    }
  });
}

function loadhomepage() {
  loadhomedropdown();

  document.getElementById("user_name").innerHTML = getCookie("username");
  document.getElementById("datestr").innerHTML = getCookie("datestr");
}

function getdepartment() {
  var postappiled = document.getElementById("1S1").value;
  //var postapp = document.getElementById('1S3').value;
  var postapp = "";
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "getdepartment",
    data: "&postappiled=" + postappiled + "&postapp=" + postapp,
    success: function getcatcoderesponce(responce) {
      responce = eval("(" + responce + ")");
      document.getElementById("1S2").options.length = 0;
      var course = responce.data["course"];
      setCookie("course", course);
      $op = new Option("-Select-", "");
      $op.id = 0; //specifying the id  for options
      document.getElementById("1S2").options.add($op);
      for ($i = 0; $i < course.length; $i++) {
        $op = new Option(course[$i]["value"], course[$i]["internal_code"]);
        $op.id = course[$i]["internal_code"]; //specifying the id  for options
        document.getElementById("1S2").options.add($op);
      }

      //loadapplieddetails();
    }
  });
}

function getwithvacdepartment() {
  var postapp = "";
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "getwithvacdepartment",
    data: "&postapp=" + postapp,
    success: function getcatcoderesponce(responce) {
      responce = eval("(" + responce + ")");
      document.getElementById("1S2").options.length = 0;
      var course = responce.data["course"];
      setCookie("course", course);
      $op = new Option("-Select-", "");
      $op.id = 0; //specifying the id  for options
      document.getElementById("1S2").options.add($op);
      for ($i = 0; $i < course.length; $i++) {
        $op = new Option(course[$i]["value"], course[$i]["internal_code"]);
        $op.id = course[$i]["internal_code"]; //specifying the id  for options
        document.getElementById("1S2").options.add($op);
      }

      //loadapplieddetails();
    }
  });
}

/* function loaddata()
{
		
} */
function home() {
  window.location.href = "home.html";
}

function loaddata() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "isloggedinvalidate",
    success: function(responce) {
      responce = eval("(" + responce + ")");
      if (responce.data["data"] == 0) {
        alert("Please Login");
        window.location.href = "index.html?v=11102017";
      } else {
        post = getCookie("post");
        vacancies = getCookie("vacancies");
        ResetTimer();
        var str1 = post;
        document.getElementById("postdata").innerHTML = str1;
        document.getElementById("user_name").innerHTML = getCookie("username");
        document.getElementById("datestr").innerHTML = getCookie("datestr");
        document.getElementById("appno").value = getCookie("app");
        document.getElementById("post_id").value = getCookie("post");

        loadPersonalDetails();
        loadtabs("tab1");
      }
    }
  });
}

function getage() {
  if (isDate($("#T9").val())) {
    var age = calculateAge(parseDate($("#T9").val()), new Date());
    $("#T10").val(age);
  } else {
    $("#T10").val("");
  }
}

//convert the date string in the format of dd/mm/yyyy into a JS date object
function parseDate(dateStr) {
  var dateParts = dateStr.split("/");
  return new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
}

//is valid date format
function calculateAge(dateOfBirth, dateToCalculate) {
  var calculateYear = dateToCalculate.getFullYear();
  var calculateMonth = dateToCalculate.getMonth();
  var calculateDay = dateToCalculate.getDate();

  var birthYear = dateOfBirth.getFullYear();
  var birthMonth = dateOfBirth.getMonth();
  var birthDay = dateOfBirth.getDate();

  var age = calculateYear - birthYear;
  var ageMonth = calculateMonth - birthMonth;
  var ageDay = calculateDay - birthDay;

  if (ageMonth < 0 || (ageMonth == 0 && ageDay < 0)) {
    age = parseInt(age) - 1;
  }
  return age;
}

function isDate(txtDate) {
  var currVal = txtDate;
  if (currVal == "") return true;

  //Declare Regex
  var rxDatePattern = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
  var dtArray = currVal.match(rxDatePattern); // is format OK?

  if (dtArray == null) return false;

  //Checks for dd/mm/yyyy format.
  var dtDay = dtArray[1];
  var dtMonth = dtArray[3];
  var dtYear = dtArray[5];

  if (dtMonth < 1 || dtMonth > 12) return false;
  else if (dtDay < 1 || dtDay > 31) return false;
  else if (
    (dtMonth == 4 || dtMonth == 6 || dtMonth == 9 || dtMonth == 11) &&
    dtDay == 31
  )
    return false;
  else if (dtMonth == 2) {
    var isleap = dtYear % 4 == 0 && (dtYear % 100 != 0 || dtYear % 400 == 0);
    if (dtDay > 29 || (dtDay == 29 && !isleap)) return false;
  }

  return true;
}