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 : 52.14.26.141


Current Path : /proc/thread-self/root/var/www/oasis/js/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/js/iasectionwise.js

function callIAEntrySectionwise() {
  $("#page_main_div").load("../html_modules/iasectionwise.html", function () {
    document.getElementById("display_module_name").innerHTML =
      "Marks Entry (Subjectwise)";
    document.getElementById("module_name_for_save").value =
      "Marks Entry (Subjectwise)";
    getDefaultHeadFooterLinks("Mark Entry Sectionwise");
    loadIAteachcode();
  });
}

function loadIAteachcode() {
  $.ajax({
    type: "POST",
    url: $host_url + "loadIAteachcode",
    //async: false,
    success: function (response) {
      var res = JSON.parse(response);
      var teachnameoptions = "";

      teachnameoptions = "<option value=''>---Select Teacher---</option>";

      for (var i = 0; i < res.data.length; i++) {
        teachnameoptions += `<option value='${res.data[i].fteachcode}'>${res.data[i].fteachcode} - ${res.data[i].fteachname}</option>`;
      }

      $("#teachname").html(teachnameoptions);
    },
  });
}

function getIAclassnames() {
  var techcode = document.getElementById("teachname").value;
  console.log(techcode);
  if (techcode == "") {
    return;
  }
  $.ajax({
    type: "POST",
    data: "&techcode=" + techcode,
    url: $host_url + "getIAclassnames",
    success: function (response) {
      var res = JSON.parse(response);
      console.log(res);
      var classnameoption = "<option value=''>---Select Class Name---</option>";
      for (var i = 0; i < res.data.length; i++) {
        classnameoption += `<option value='${res.data[i].fclassid}'>${res.data[i].fclassname} - ${res.data[i].fclassid}</option>`;
      }
      $("#classnameoptions").html(classnameoption);
    },
  });
}

function getDegSemSubDet() {
  var techcode = document.getElementById("teachname").value;
  var classid = document.getElementById("classnameoptions").value;
  console.log(techcode);
  if (techcode == "") {
    return;
  }
  $.ajax({
    type: "POST",
    data: "&techcode=" + techcode + "&classid=" + classid,
    url: $host_url + "getDegSemSubDet",
    success: function (response) {
      var res = JSON.parse(response);
      // $("#degcode").val(res.data.fdescpn);
      // $("#hdegcode").val(res.data.fdegree);
      // $("#sem").val(res.data.fexamname);
      // $("#hsem").val(res.data.fexamno);
      // $("#subcode").val(res.data.fsubname);
      // $("#hsubcode").val(res.data.fsubcode);

      let subelement = res.data.subelement;
      var classnameoption = "<option value=''>---Select---</option>";
      for (var i = 0; i < subelement.length; i++) {
        classnameoption += `<option value='${subelement[i].fsubcode}'>${subelement[i].fsubcode} - ${subelement[i].subname}</option>`;
      }
      $("#subelement").html(classnameoption);
    },
  });
}

function viewIASubclass() {
  var techcode = document.getElementById("teachname").value;
  var classid = document.getElementById("classnameoptions").value;
  var subelement = document.getElementById("subelement").value;

  if (techcode == "") {
    alert("Please select teacher");
    return;
  }

  if (classid == "") {
    alert("Please select class");
    return;
  }

  if (subelement == "") {
    alert("Please select Subject");
    return;
  }

  $.ajax({
    type: "POST",
    url: $host_url + "viewIASubclass",
    data:
      "&techcode=" +
      techcode +
      "&classid=" +
      classid +
      "&subelement=" +
      subelement,
    success: viewIASubclassSuccess,
  });
}

function viewIASubclassSuccess($responce) {
  $responce = eval("(" + $responce + ")");
  $("#createview").html("");
  $("#createview").html($responce.data["tabledata"]);
}

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 saveIAEntrySectionwise() {
  var techcode = document.getElementById("teachname").value;
  var classid = document.getElementById("classnameoptions").value;
  var subelement = document.getElementById("subelement").value;

  if (techcode == "") {
    alert("Please select teacher");
    return;
  }

  if (classid == "") {
    alert("Please select class");
    return;
  }

  if (subelement == "") {
    alert("Please select Subject");
    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[2];
      sublen["subcode"] = sucodeid[1];
      sublen["marks"] = $(`#mes_marks_${sucodeid[1]}_${sucodeid[2]}`).val();
      subarry.push(sublen);
    }
  });
  console.log(subarry);
  $.ajax({
    type: "POST",
    url: $host_url + "saveIAEntrySectionwise",
    data:
      "&techcode=" +
      techcode +
      "&classid=" +
      classid +
      "&subelement=" +
      subelement +
      `&subarry=` +
      JSON.stringify(subarry),
    success: saveIAEntrySectionwiseSuccess,
  });
}

function saveIAEntrySectionwiseSuccess($responce) {
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
  $("#createview").html("");
  return;
}

function getupdate(id) {
  let arry = id.split("_");
  console.log(arry);
  console.log(`#hidden_${arry[2]}_${arry[3]}`);
  $(`#hidden_${arry[2]}_${arry[3]}`).val("U");
}

function getTestMaxQn() {
  var techcode = document.getElementById("teachname").value;
  var classid = document.getElementById("classnameoptions").value;
  console.log(teachcode, classid);
  if (techcode == "") {
    return;
  }
}