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


Current Path : /proc/thread-self/root/var/www/html/reva/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/reva/js/studSubIdent.js

function callStudSubIdent() {
  $("#page_main_div").load("html_modules/studSubIdent.html", function () {
    document.getElementById("display_module_name").innerHTML =
      "Subject Identification";
    document.getElementById("module_name_for_save").value =
      "Subject Identification";
    getDefaultHeadFooterLinks("Subject Identification");
    getDegreeName();
  });
}

function getDegreeName() {
  $.ajax({
    type: "POST",
    url: $host_url + "getExamAppDegName",
    success: getExamAppDegNameSuccess,
  });
}

function getExamAppDegNameSuccess($responce) {
  $responce = eval("(" + $responce + ")");

  document.getElementById("degree").options.length = 0;
  var deg = $responce.data["degree"];

  //console.log(deg);
  $op = new Option("--Select--", "");
  document.getElementById("degree").options.add($op);
  for ($i = 0; $i < deg.length; $i++) {
    $op = new Option(deg[$i]["VALUE"], deg[$i]["internal_code"]);
    //console.log(deg[$i]['value']);
    $op.id = deg[$i]["internal_code"];
    document.getElementById("degree").options.add($op);
  }
}

function getExamDegreeExamName() {
  var degree = $("#degree").val();

  $.ajax({
    type: "POST",
    url: $host_url + "getExamDegreeExamName",
    data: "&degree=" + degree,
    success: getExamDegreeExamNameSuccess,
  });
}

function getExamDegreeExamNameSuccess($responce) {
  $responce = eval("(" + $responce + ")");
  document.getElementById("degexam").options.length = 0;
  document.getElementById("section").options.length = 0;
  var deg = $responce.data["degexam"];
  var section = $responce.data["section"];
  //console.log(deg);
  $op = new Option("--Select--", "");
  document.getElementById("degexam").options.add($op);
  for ($i = 0; $i < deg.length; $i++) {
    $op = new Option(deg[$i]["VALUE"], deg[$i]["internal_code"]);
    //console.log(deg[$i]['value']);
    $op.id = deg[$i]["internal_code"];
    document.getElementById("degexam").options.add($op);
    //console.log(degree);
  }

  $op = new Option("All", "All");
  document.getElementById("section").options.add($op);
  for ($i = 0; $i < section.length; $i++) {
    $op = new Option(section[$i]["VALUE"], section[$i]["internal_code"]);
    //console.log(deg[$i]['value']);
    $op.id = section[$i]["internal_code"];
    document.getElementById("section").options.add($op);
  }
}

function displayStudList() {
  var degree = document.getElementById("degree").value;
  var degexam = document.getElementById("degexam").value;
  var section = document.getElementById("section").value;

  if (degree == "") {
    alert("Please select Degree");
    return;
  }

  if (degexam == "") {
    alert("Please select Semister");
    return;
  }

  $.ajax({
    type: "POST",
    url: $host_url + "displayStudList",
    data: "&degree=" + degree + "&degexam=" + degexam + "&section=" + section,
    success: displayStudListSuccess,
  });
}

function displayStudListSuccess($responce) {
  $responce = eval("(" + $responce + ")");
  $("#btc_default_reg_div").html("");
  $("#btc_default_reg_div").html($responce.data["tabledata"]);
  let mandsub = $responce.data["mandsub"];
  let totsub = $responce.data["totsub"];
  mandsub.forEach((element) => {
    // console.log(element);
    console.log(element["ftotsub"]);
    let subarry = element["subcode"];
    console.log(subarry);
    let subcodes = subarry.split(",");
    let z = 0;
    // console.log(element["ftotsub"]);
    for (let i = 1; i <= element["ftotsub"]; i++) {
      console.log(subcodes.length);
      if (i > subcodes.length) {
      } else {
        let subcode = subcodes[z].split("-");
        $(`#${element["FREGNO"]}_${i}`).val(subcode[0]);
        $(`#o_${element["FREGNO"]}_${i}`).val(subcode[0]);
        if (subcode[1] == "F")
          document.getElementById(`${element["FREGNO"]}_${i}`).disabled = true;
      }
      z++;
    }
  });
}

function getValidateMarks(maxmarks, regno, subcode) {
  let marks = $("#mes_marks_" + subcode + "_" + regno).val();
  if (marks == "") {
    marks = 0;
  }
  if (parseInt(marks) > parseInt(maxmarks)) {
    alert("Please Enter Valid Marks");
    $("#mes_marks_" + subcode + "_" + regno).val("");
    document.getElementById("mes_marks_" + subcode + "_" + regno).focus();
    return;
  }
}

function saveStudSubIdent() {
  var degree = document.getElementById("degree").value;
  var degexam = document.getElementById("degexam").value;

  if (degree == "") {
    alert("Please select Degree");
    return;
  }

  if (degexam == "") {
    alert("Please select Semister");
    return;
  }

  let subarry = [];
  $("#showteachsub input[type=hidden]").each(function () {
    let id = $(this).attr("id");

    if ($(`#${id}`).val() == "U") {
      let sucodeid = $(this).attr("id").split("_");
      let sublen = {};
      sublen["regno"] = sucodeid[1];
      sublen["subcode"] = $(`#${sucodeid[1]}_${sucodeid[2]}`).val();
      sublen["osubcode"] = $(`#o_${sucodeid[1]}_${sucodeid[2]}`).val();
      subarry.push(sublen);
    }
  });

  $.ajax({
    type: "POST",
    url: $host_url + "saveStudSubIdent",
    data:
      `&degree=` +
      degree +
      `&degexam=` +
      degexam +
      `&subarry=` +
      JSON.stringify(subarry),
    success: saveStudSubIdentSuccess,
  });
}

function saveStudSubIdentSuccess($responce) {
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
  callStudSubIdent();
  $("#btc_default_reg_div").html("");
  return;
}

function getupdate(id) {
  $(`#h_${id}`).val("U");
}