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


Current Path : /var/www/html/stph/js/
Upload File :
Current File : /var/www/html/stph/js/subIAMarksEntry.js

function callIAMarksEntry() {
  $("#page_main_div").load("html_modules/subIAMarksEntry.html", function () {
    document.getElementById("display_module_name").innerHTML = "Mark Entry Subjectwise";
    document.getElementById("module_name_for_save").value = "Mark Entry Subjectwise";
    getDefaultHeadFooterLinks("Mark Entry Subjectwise");
    getDegreeName();
  });
}

function getpopup() {
  $.ajax({
    type: "POST",
    url: $host_url + "getDegreeGroup",
    success: degreeDropDownMenusSuccess,
  });
}

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

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

  //console.log(deg);
  $op = new Option("--Select--", "");
  document.getElementById("deggrp").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("deggrp").options.add($op);
    //console.log(degree);
  }
}

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

function getIADegreeNameSuccess($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 getIADegreeExamName() {
  var degree = $("#degree").val();

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

function getIADegreeExamNameSuccess($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 getIADegreeSubject() {
  var degree = $("#degree").val();
  var exam = $("#degexam").val();

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

function getIADegreeSubjectSuccess($responce) {
  
  $responce = eval("(" + $responce + ")");
  document.getElementById("subcode").options.length = 0;
  var deg = $responce.data["subcode"];

  //console.log(deg);
  $op = new Option("--Select--", "");
  document.getElementById("subcode").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("subcode").options.add($op);
    //console.log(degree);
  }
}

function getIADegreeSubjectTest() {
  var degree = $("#degree").val();
  var exam = $("#degexam").val();
  var subcode = $("#subcode").val();

  $.ajax({
    type: "POST",
    url: $host_url + "getIADegreeSubjectTest",
    data: "&degree=" + degree+"&exam="+exam+"&subcode="+subcode,
    success: getIADegreeSubjectTestSuccess,
  });
}

function getIADegreeSubjectTestSuccess($responce) {
  
  $responce = eval("(" + $responce + ")");
  document.getElementById("test").options.length = 0;
  var deg = $responce.data["test"];

  //console.log(deg);
  $op = new Option("--Select--", "");
  document.getElementById("test").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("test").options.add($op);
    //console.log(degree);
  }
}


function displayStudSubDet()
{
  var degree = document.getElementById("degree").value;
  var degexam = document.getElementById("degexam").value;
  var subcode = document.getElementById("subcode").value;
  //var test = document.getElementById("test").value;
  var section = document.getElementById("section").value;

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

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

  if(subcode == '')
  {
    alert("Please select subject");
    return;
  }

  // if(test == '')
  // {
  //   alert("Please select Test");
  //   return;
  // }


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

}

function displayStudSubDetSuccess($responce)
{
  $responce = eval("(" + $responce + ")");
  $('#btc_default_reg_div').html("");
  $('#btc_default_reg_div').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 saveIAMarkEntry()
{

var degree = document.getElementById("degree").value;
  var degexam = document.getElementById("degexam").value;
  var subcode = document.getElementById("subcode").value;

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

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

  if(subcode == '')
  {
    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 + "saveIAMarkEntry",
    data: `&degree=` + degree+`&degexam=`+degexam+`&subcode=`+subcode+`&subarry=`+JSON.stringify(subarry),
    success: saveIAMarkEntrySuccess,
  });
}

function saveIAMarkEntrySuccess($responce)
{
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
  $('#btc_default_reg_div').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");
}