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.144.1.100


Current Path : /var/www/html/PrathibhaKaranji_stop/js/
Upload File :
Current File : /var/www/html/PrathibhaKaranji_stop/js/kusPhdAdm.js

var $host_url =
  "http://" +
  window.location.host +
  "/" +
  window.location.pathname.split("/")[1] +
  "/app.php?a=";

var $host_url1 =
  "http://" +
  window.location.host +
  "/" +
  window.location.pathname.split("/")[1] +
  "/";

var gRgPerinfo;
var photo_path;
var sign_path;
let subdet = [];
let rgMultiMarks = [];

// For loading the personal data of student in instruction page
function loadPerdata() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "getstudentdetails",
    success: function getStudPerdataResponce(responce) {
      responce = eval("(" + responce + ")");
      var error_code = responce.error_code;
      response = responce.data;

      var table = ` <button
      type="button"
      class="btn btn-lg btn-default waves-effect"
      onclick="applicationReport()"
      style = "float: right;margin-bottom: 10px;margin-left: 10px;">
      Report
    </button>
    &nbsp;&nbsp;
    <button
      type="button"
      class="btn btn-lg btn-default waves-effect"
      onclick="addApplication()"
      style = "float: right;margin-bottom: 10px;">
      Add Student
    </button>
    <br>
      <table id="studinfotable" border = "1" class="table">
      <thead>
        <tr>
          <th>Sl. No.</th>
          <th>Name</th>
          <th>DOB</th>
          <th>Father Name</th>
          <th>Mobile No.</th>
          <th>Event</th>
          <th>Action</th>
        </tr>
      </thead>
      <tbody>
      `;
      var z = 1;
      if (error_code == 0) {
        for (var i = 0; i < response.length; i++) {
          var name = response[i]["fname"];
          var dob = response[i]["dob"];
          var ffatname = response[i]["ffatname"];
          var fmobileno = response[i]["fmobileno"];
          var feventname = response[i]["feventname"];
          var fappno = response[i]["fappno"];

          table += `<tr>
                  <td><b>${z}</b></td>
                  <td><b>${name}</b></td>
                  <td><b>${dob}</b></td>
                  <td><b>${ffatname}</b></td>
                  <td><b>${fmobileno}</b></td>
                  <td><b>${feventname}</b></td>
                  <td><button type="button"
                  class="btn btn-lg btn-default waves-effect" onclick = "editApplication('${fappno}')" >Edit</button></td>
                </tr>               
                `;
          z++;
        }
      }
      $("#studinfo").html(table);
    }
  });
}

function addApplication() {
  window.location.href = "MainPage.html";
}

function editApplication(appno) {
  window.location.href = "MainPage.html?appno=" + appno;
}

function applicationReport() {
  window.location.href = $host_url + "printApplication";
}

function getpudet() {
  console.log(document.getElementById("kpu").checked);
  if (document.getElementById("kpu").checked == false) {
    $("#pureg").hide();
  } else {
    $("#pureg").show();
  }
}

function getadmissonDet() {
  // if (document.getElementById("kpu").checked == false) {
  window.location.href = "MainPage.html";
  // } else {
  //   if ($("#puregno").val() == "") {
  //     alert("Please Enter Register no.");
  //     $("#puregno").focus();
  //     return;
  //   }
  //   window.location.href = "MainPage.html";
  // }
}

function loadMasters() {
  login();
  $("#personal_det").show();
  $("#success_card").hide();
  var queryString = window.location.search;
  var urlParams = new URLSearchParams(queryString);
  var appno = urlParams.get("appno");

  if (appno == null) {
    appno = "";
    $("#fmode").val("I");
  } else {
    $("#fmode").val("U");
  }

  $.ajax({
    type: "POST",
    async: false,
    data: "&fappno=" + appno,
    url: $host_url + "getcmsdropdownmenuvalues",
    success: function GetCMSDropDownMenuValuesResponce(responce) {
      responce = eval("(" + responce + ")");

      var serv_arr = responce.data["event"];
      var serv_title = "";
      FillDropdownValues(serv_arr, "event", serv_title);

      //loadUpload();
      var serv_arr = responce.data["distic"];
      var serv_title = "";
      FillDropdownValues(serv_arr, "distic", serv_title);

      console.log(responce.data.perdet);

      if (responce.data.perdet != "F") {
        console.log($host_url1 + "" + responce.data.perdet["FPHOTOPATH"]);
        if (responce.data.perdet["FPHOTOPATH"] != "") {
          photo_path = responce.data.perdet["FPHOTOPATH"];
          $("#frmFileUpload").hide();
          $("#studphoto_img").attr(
            "src",
            $host_url1 + "" + responce.data.perdet["FPHOTOPATH"]
          );
          $("#studphoto").show();
        }
        $("#studphoto_img").attr(
          "src",
          $host_url1 + "" + responce.data.perdet["FPHOTOPATH"]
        );
        $("#idStudname").val(responce.data.perdet["FNAME"]);
        $("#idFatname").val(responce.data.perdet["FFATNAME"]);
        $("#idMotname").val(responce.data.perdet["FMOTNAME"]);
        $("#idDob").val(responce.data.perdet["FDOB"]);

        if (responce.data.perdet["FGENDER"] == "M")
          document.getElementById("radio_1").checked = true;
        else if (responce.data.perdet["FGENDER"] == "F")
          document.getElementById("radio_2").checked = true;
        else if (responce.data.perdet["FGENDER"] == "T")
          document.getElementById("radio_3").checked = true;

        $("#stuaadhrno").val(responce.data.perdet["FAADHAR"]);
        $("#stuMobileno").val(responce.data.perdet["FMOBILENO"]);
        $("#padd1").val(responce.data.perdet["FPERADD1"]);
        $("#padd2").val(responce.data.perdet["FPERADD2"]);
        $("#padd3").val(responce.data.perdet["FPERADD3"]);
        $("#pdistrict").val(responce.data.perdet["FPERDIST"]);
        $("#ppincode").val(responce.data.perdet["FPERPIN"]);
        $("#pstate").val(responce.data.perdet["FPERSTATE"]);
        $("#cadd1").val(responce.data.perdet["FSECADD1"]);
        $("#cadd2").val(responce.data.perdet["FSECADD2"]);
        $("#cadd3").val(responce.data.perdet["FSECADD3"]);
        $("#distic").val(responce.data.perdet["FSECDIST"]);
        $("#cpincode").val(responce.data.perdet["FSECPIN"]);
        $("#cstate").val(responce.data.perdet["FSECSTATE"]);
        $("#idaccno").val(responce.data.perdet["FACCOUNT"]);
        $("#idiifsc").val(responce.data.perdet["FIFSC"]);
        $("#idbank").val(responce.data.perdet["FBANK"]);
        $("#idbranch").val(responce.data.perdet["FBRANCH"]);
        $("#idteachnmae").val(responce.data.perdet["FTEACH"]);
        $("#idteachno").val(responce.data.perdet["FTEACHMOB"]);
        $("#idschname").val(responce.data.perdet["FTEACHSEC"]);
        $("#schadd").val(responce.data.perdet["FTEACHSECADD"]);
        $("#event").val(responce.data.perdet["FEVENT"]);
        $("#eventl").val(responce.data.perdet["FEVENTL"]);
        $("#eventw").val(responce.data.perdet["FEVENTWD"]);
        $("#eventp").val(responce.data.perdet["FEVENTP"]);
        $("#fappno").val(responce.data.perdet["FAPPNO"]);
      }
    }
  });
}

function changePhoto() {
  $("#frmFileUpload").show();
  $("#studphoto").hide();
}

function changeSign() {
  $("#signatureUpload").show();
  $("#studsign").hide();
}

function getBoardDet(obj) {
  if (obj.value == "") {
    alert("Select a Board");
    return;
  }
  var datastring = "boardCode=" + obj.value;

  $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    async: false,
    data: datastring,
    url: $host_url + "getboarddetails",
    success: function GetdegreedetailsResponce(responce) {
      $.unblockUI();
      responce = eval("(" + responce + ")");
      var boardDet = responce.data["boardDet"];
      if (obj.id == "idSchBoard") {
        $("#idSchState").val(boardDet["fboardsate"]);
        $("#idSchBoardAdd").val(boardDet["faddress"]);
        $("#idSchoolBoardPhone").val(boardDet["fphoneno"]);
      } else {
        $("#idUnvState").val(boardDet["fboardsate"]);
        $("#idUnvAdd").val(boardDet["faddress"]);
        $("#idUnvPhone").val(boardDet["fphoneno"]);
      }
    }
  });
}

function getdegreedetails() {
  var datastring = "&college=" + $("#idCollege").val();

  $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    async: false,
    data: datastring,
    url: $host_url + "getdegreedetails",
    success: function GetdegreedetailsResponce(responce) {
      $.unblockUI();
      responce = eval("(" + responce + ")");
      var serv_arr = responce.data["degree"];
      var serv_title = "";
      FillDropdownValues(serv_arr, "idDegree", serv_title);
    }
  });
}

function loadSubjectCombdet() {
  var datastring =
    "&college=" + $("#idCollege").val() + "&degree=" + $("#idDegree").val();

  $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    async: true,
    data: datastring,
    url: $host_url + "getcombinationdetailsdetails",
    success: function GetdegreedetailsResponce(responce) {
      $.unblockUI();
      responce = eval("(" + responce + ")");
      var serv_arr = responce.data["mascomb"];
      var serv_title = "";
      FillDropdownValues(serv_arr, "idDegComb", serv_title);
    }
  });
}

var totsub;

var selSubArr = [];

function homeLink() {
  var r = confirm("Do You Want To Logout!");
  if (r == true) {
    window.location.href = "index.html";
  } else {
  }
}

function in_array(needle, haystack, argStrict) {
  var key = "",
    strict = !!argStrict;

  if (strict) {
    for (key in haystack) {
      if (haystack[key] === needle) {
        return true;
      }
    }
  } else {
    for (key in haystack) {
      if (haystack[key] == needle) {
        return true;
      }
    }
  }
  return false;
}

function validateApplication() {
  var errcount = 0;
  jsonObj = [];
  gRgPerinfo = "";
  subdet = [];
  rgMultiMarks = [];
  missing_fields = [];

  if (photo_filename === undefined && photo_path == undefined) {
    $("#photo_err").addClass("hasError");
    missing_fields.push("Student Photo");
    errcount++;
  } else {
    $("#photo_err").removeClass("hasError");
    item = {};
    item["id"] = "photo_path";
    item["value"] = photo_filename;
    //console.log(photo_filename);
    jsonObj.push(item);
  }

  if (sign_filename === undefined && sign_path == undefined) {
    $("#sign_err").addClass("hasError");
    missing_fields.push("Student Signature");
    errcount++;
  } else {
    $("#sign_err").removeClass("hasError");
    item = {};
    item["id"] = "sign_path";
    item["value"] = sign_filename;
    jsonObj.push(item);
  }

  //validate and read values of text and select boxes
  $("#idPerDet input[type=text],#idPerDet select").each(function() {
    if ($(this).val() == "" && !in_array($(this).attr("id"), nonMandFields)) {
      $(this)
        .closest(".form-group")
        .find(".fieldError")
        .addClass("hasError");
      errcount++;
      missing_fields.push($(this).attr("name"));
    } else {
      $(this)
        .closest(".form-group")
        .find(".fieldError")
        .removeClass("hasError");
      item = {};
      item["id"] = $(this).attr("id");
      item["value"] = $(this).val();
      jsonObj.push(item);
    }
  });
  //validate and read values of Radio buttons

  if (!$('input[name="gender"]').is(":checked")) {
    $('input[name="gender"]')
      .closest(".form-group")
      .find(".fieldError")
      .addClass("hasError");
    missing_fields.push("gender");
    errcount++;
  } else {
    $('input[name="gender"]')
      .closest(".form-group")
      .find(".fieldError")
      .removeClass("hasError");
    value = $('input[name="gender"]:checked').val();
    item = {};
    item["id"] = "gender";
    item["value"] = value.toUpperCase();
    jsonObj.push(item);
  }

  $("#idPrevDet input[type=text],#idPrevDet select,#idPrevDet textarea").each(
    function() {
      if (
        $(this).val() == "" &&
        ($(this).attr("id") != "adhar" &&
          $(this).attr("id") != "landline" &&
          $(this).attr("id") != "fincomecert" &&
          $(this).attr("id") != "fcastecert")
      ) {
        $(this)
          .closest(".form-group")
          .find(".fieldError")
          .addClass("hasError");
        errcount++;
        missing_fields.push($(this).attr("name"));
      } else {
        $(this)
          .closest(".form-group")
          .find(".fieldError")
          .removeClass("hasError");
        item = {};
        item["id"] = $(this).attr("id");
        item["value"] = $(this).val();
        jsonObj.push(item);
      }
    }
  );

  if (document.getElementById("fph").checked == true) {
    var item = {};
    item["id"] = "fph";
    item["value"] = "Yes";
    jsonObj.push(item);
  } else {
    var item = {};
    item["id"] = "fph";
    item["value"] = "No";
    jsonObj.push(item);
  }

  // var marksEntry = false;
  // $("#qalsemdet tr.ui-widget-content td input").each((i, el) => {
  //   if (el.value == "") {
  //     errcount++;
  //     marksEntry = true;
  //   }
  // });
  // if (marksEntry == true) {
  //   $("#qalsemdet_err").addClass("hasError");
  // } else {
  //   $("#qalsemdet_err").removeClass("hasError");
  // }

  $("#qalsemdet tr.ui-widget-content").each((i, el) => {
    var rgQal = $(el).find("td input");
    var rgTr = [];
    $.each(rgQal, (j, val) => {
      var item = {};
      item["name"] = val.name;
      item["value"] = val.value;
      rgTr.push(item);
    });
    rgMultiMarks.push(rgTr);
  });

  var html_string = "";
  for (let field of missing_fields) {
    html_string += "<li style='padding: 0px; margin: 0px;'>" + field + "</li>";
  }
  if (missing_fields.length > 0) {
    swal({
      title: "The following fields are missing",
      text: `<div class="col-md-12">
	        <ol style="color: red;text-align:left;">${html_string}</ol></div>`,
      html: true,
      showCancelButton: false,
      confirmButtonColor: "#5495ff",
      confirmButtonText: "OK",
      closeOnConfirm: false
    });
  }

  subdet = JSON.stringify(subdet);
  gRgPerinfo = JSON.stringify(jsonObj);

  gRgPerinfo = encodeURI(JSON.stringify(jsonObj));

  rgMultiMarks = JSON.stringify(rgMultiMarks);
  return errcount;
}

var gAppNo;

function savetmpApplication() {
  //let error = validateApplication();

  jsonObj = [];
  gRgPerinfo = "";
  subdet = [];
  rgMultiMarks = [];
  //validate and read values of text and select boxes

  if ($("#idStudname").val() == "") {
    alert("Please Enter Student Name");
    $("#idStudname").focus();
    return;
  }

  if ($("#idFatname").val() == "") {
    alert("Please Enter Father Name");
    $("#idFatname").focus();
    return;
  }

  if ($("#idDob").val() == "") {
    alert("Please Enter DOB");
    $("#idFatname").focus();
    return;
  }

  if ($("#stuaadhrno").val() == "") {
    alert("Please Enter Aadhar No");
    $("#stuaadhrno").focus();
    return;
  }

  if ($("#stuMobileno").val() == "") {
    alert("Please Enter Mobile No");
    $("#stuMobileno").focus();
    return;
  }

  if ($("#padd1").val() == "") {
    alert("Please Enter Permanent Address 1");
    $("#padd1").focus();
    return;
  }

  if ($("#padd2").val() == "") {
    alert("Please Enter Permanent Address 2");
    $("#padd2").focus();
    return;
  }

  if ($("#pdistrict").val() == "") {
    alert("Please Enter Permanent District");
    $("#pdistrict").focus();
    return;
  }

  if ($("#ppincode").val() == "") {
    alert("Please Enter Permanent Pincode");
    $("#ppincode").focus();
    return;
  }

  if ($("#pstate").val() == "") {
    alert("Please Enter Permanent State");
    $("#pstate").focus();
    return;
  }

  if ($("#cadd1").val() == "") {
    alert("Please Enter School Address 1");
    $("#cadd1").focus();
    return;
  }

  if ($("#cadd2").val() == "") {
    alert("Please Enter School Address 2");
    $("#cadd2").focus();
    return;
  }

  if ($("#distic").val() == "") {
    alert("Please Enter School District");
    $("#distic").focus();
    return;
  }

  if ($("#cpincode").val() == "") {
    alert("Please Enter School Pincode");
    $("#cpincode").focus();
    return;
  }

  if ($("#cstate").val() == "") {
    alert("Please Enter School State");
    $("#cstate").focus();
    return;
  }

  if ($("#idaccno").val() == "") {
    alert("Please Enter Account No.");
    $("#idaccno").focus();
    return;
  }

  if ($("#idiifsc").val() == "") {
    alert("Please Enter AIFSC Code");
    $("#idiifsc").focus();
    return;
  }

  if ($("#idbank").val() == "") {
    alert("Please Enter Bank");
    $("#idbank").focus();
    return;
  }

  if ($("#idteachnmae").val() == "") {
    alert("Please Enter Guide Teacher Name");
    $("#idteachnmae").focus();
    return;
  }

  if ($("#idteachno").val() == "") {
    alert("Please Enter Teacher Contact No");
    $("#idteachno").focus();
    return;
  }

  if ($("#idschname").val() == "") {
    alert("Please Enter Teacher School Name");
    $("#idschname").focus();
    return;
  }

  if ($("#schadd").val() == "") {
    alert("Please Enter Teacher School Address");
    $("#schadd").focus();
    return;
  }

  if ($("#event").val() == "") {
    alert("Please Enter Event Name");
    $("#event").focus();
    return;
  }

  if ($("#eventl").val() == "") {
    alert("Please Enter Event Level");
    $("#eventl").focus();
    return;
  }

  if ($("#eventw").val() == "") {
    alert("Please Enter Date of Event Win");
    $("#eventw").focus();
    return;
  }

  if ($("#eventp").val() == "") {
    alert("Please Enter Place");
    $("#eventp").focus();
    return;
  }

  if (photo_filename === undefined && photo_path == undefined) {
    alert("Please Upload Photo");
    return;
  }
  item = {};
  item["id"] = "photo_path";
  item["value"] = photo_filename;
  jsonObj.push(item);

  $("#idPerDet input[type=text],#idPerDet select").each(function() {
    item = {};
    item["id"] = $(this).attr("id");
    item["value"] = $(this).val();
    jsonObj.push(item);
  });

  $("#idPerBank input[type=text],#idPerBank select").each(function() {
    item = {};
    item["id"] = $(this).attr("id");
    item["value"] = $(this).val();
    jsonObj.push(item);
  });

  $("#idPerTeach input[type=text],#idPerTeach select").each(function() {
    item = {};
    item["id"] = $(this).attr("id");
    item["value"] = $(this).val();
    jsonObj.push(item);
  });

  $("#idPerEvent input[type=text],#idPerEvent select").each(function() {
    item = {};
    item["id"] = $(this).attr("id");
    item["value"] = $(this).val();
    jsonObj.push(item);
  });

  //validate and read values of Radio buttons
  var radio_names = ["gender"];
  for (var i = 0; i < radio_names.length; i++) {
    $('input[name="' + radio_names[i] + '"]')
      .closest(".form-group")
      .find(".fieldError")
      .removeClass("hasError");
    value = $('input[name="' + radio_names[i] + '"]:checked').val();
    item = {};
    item["id"] = radio_names[i];
    item["value"] = value.toUpperCase();
    jsonObj.push(item);
  }

  gRgPerinfo = JSON.stringify(jsonObj);

  var fappno = $("#fappno").val();
  var schadd = $("#schadd").val();
  var eventp = $("#eventp").val();
  var fmode = $("#fmode").val();

  var datastring =
    "personal_info=" +
    gRgPerinfo +
    "&schadd=" +
    schadd +
    "&fappno=" +
    fappno +
    "&eventp=" +
    eventp +
    "&fmode=" +
    fmode;

  $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    data: datastring,
    url: $host_url + "savephdApplication",
    success: function(responce) {
      $.unblockUI();

      responce = eval("(" + responce + ")");
      if (responce.error_code === 0) {
        swal({
          title: `Updated successfully.`,
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: false
        });
        window.location.href = "instruction.html";
        return;
      } else {
        alert(responce.data.message);
        return;
      }
    }
  });
}

function FillDropdownValues(arr, ele_name, def_title) {
  document.getElementById(ele_name).options.length = 0;

  var option = "<option value=''>--Select--</option>";
  for (let value of arr) {
    option +=
      "<option value='" + value.int_code + "'>" + value.val + "</option>";
  }
  $("#" + ele_name).html(option);
}

function acceptNumbersOnlyForModule(evt) {
  var charCode;
  if (window.event) charCode = window.event.keyCode;
  //if IE
  else charCode = evt.which; //if firefox
  if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
  return true;
}

function charKeydown(evt) {
  var charCode;
  if (window.event) charCode = window.event.keyCode;
  //for IE
  else charCode = evt.which; //for firefox
  if (charCode == 32)
    //for &lt;space&gt; symbol
    return true;
  if (charCode > 31 && charCode < 65)
    //for characters before 'A' in ASCII Table
    return false;
  if (charCode > 90 && charCode < 97)
    //for characters between 'Z' and 'a' in ASCII Table
    return false;
  if (charCode > 122)
    //for characters beyond 'z' in ASCII Table
    return false;
  return true;
}

function addCurrencyDelimeter(obj) {
  var nStr = $(obj).val();
  var num = parseInt(nStr);
  num = num.toLocaleString("en-IN");

  $(obj).val(num);
}

function autoFilladd() {
  if ($("#basic_checkbox_1").is(":checked")) {
    $("#cadd1").val($("#padd1").val());
    $("#cadd2").val($("#padd2").val());
    $("#cadd3").val($("#padd3").val());
    $("#cdistrict").val($("#pdistrict").val());
    $("#cpincode").val($("#ppincode").val());
    $("#cstate").val($("#pstate").val());
  } else {
    $("#cadd1").val("");
    $("#cadd2").val("");
    $("#cadd3").val("");
    $("#cdistrict").val("");
    $("#cpincode").val("");
    $("#cstate").val("");
  }
}

function rePrintApplication() {
  // $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "rePrintApplication",
    success: function(responce) {
      // $.unblockUI();
      responce = eval("(" + responce + ")");
      if (responce.error_code == 0) {
        gAppNo = responce.appno;
        makePayment();
      } else {
        alert("Application can be printed only after final submission is made");
      }
    }
  });
}

function logout() {
  window.location.href = "index.html";
}