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


Current Path : /var/www/oasis/js/
Upload File :
Current File : /var/www/oasis/js/enableStudReg.js

$g_fmacs_total_row_count = 0;
$g_fmacas_org_rem_sub = "";
$g_fmacas_rem_sub = "";

function callcallenableStudReg() {
  $g_fmacs_total_row_count = 0;
  $g_fmacas_rem_sub = "";
  $g_fmacas_org_rem_sub = "";
  $("#page_main_div").load("../html_modules/enableStudReg.html", function () {
    document.getElementById("display_module_name").innerHTML = "Enable Registration";
    getDefaultHeadFooterLinks("Enable Registration");
    loadStudRegDegree();
  });
}

function loadStudRegDegree() {
  $.ajax({
    type: "POST",
    url: $host_url + "loadStudRegDegree",
    success: function (responce) {
      //let res = JSON.parse(response);
      let res = eval("(" + responce + ")");
      let degdata = res.data.degcode;
      console.log(res.data);
      if (res.error_code === 0) {
        var opt = `<option value=''>---select---</option>`;

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

        $("#ech_degree_code").html(opt);
      } else {
        // alert(res.data.msg);
        return;
      }
    },
  });
}

function getStudRegSem() {
  $.ajax({
    type: "POST",
    url: $host_url + "getStudRegSem",
    data: "degree=" + $("#ech_degree_code").val(),
    success: function (response) {
      let res = JSON.parse(response);

      if (res.error_code === 0) 
      {
        var opt = `<option value=''>---select---</option>`;

        for (var i = 0; i < res.data.sem.length; i++) 
        {
          opt += `<option value='${res.data.sem[i].id}'>${res.data.sem[i].value}</option>`;
        }

        $("#ech_sub_Examno").html(opt);
      } else {
        alert(res.data.msg);
        return;
      }
    },
  });
}

function getStudentsRegDet() {
  
  if (trim(document.getElementById("ech_degree_code").value) == "") {
    alert("Please enter the Degree Code");
    $("#ech_degree_code").focus();
    return;
  }

  if (trim(document.getElementById("ech_sub_Examno").value) == "") {
    alert("Please enter the Degree. Code");
    $("#ech_sub_Examno").focus();
    return;
  }

  $("#ech_module_student_data").html("");
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });

  $.ajax({
    type: "POST",
    data:
    "&degree=" +
      $("#ech_degree_code").val() +
      "&exam_no=" +
      $("#ech_sub_Examno").val()+"&stype="+$('#stype').val(),
    url: $host_url + "getStudentsRegDet.demo",
    success: getStudentsRegDetResponce,
  });
}

var total;
function getStudentsRegDetResponce($responce) {
  $.unblockUI();
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    document.getElementById("ech_degree_code").disabled = true;
    document.getElementById("ech_sub_Examno").disabled = true;

    $("#ech_module_student_data").show();
    $("#ech_module_student_data").html("");
    $("#ech_module_student_data").html($responce.data.html_data);
    total = $responce.data.total_count;

    $g_fmacas_org_rem_sub = $responce.data.rem_sub;
    $g_fmacas_rem_sub = $responce.data.rem_sub;
  } else {
    $("#ech_module_student_data").show();
    $("#ech_module_student_data").html("");
    // $g_fmacas_total_row_count=0;
    alert($responce.data.msg);
  }
}

function saveStudReg() {
  if (trim(document.getElementById("ech_degree_code").value) == "") {
    alert("Please enter the Degree. Code");
    document.getElementById("ech_degree_code").focus();
    return;
  }
  if (trim(document.getElementById("ech_sub_Examno").value) == "") {
    alert("Please enter the Degree. Code");
    document.getElementById("ech_sub_Examno").focus();
    return;
  }
  var rgECH = [];
  if ($("#ech_module_student_data [name='hidden']:checked").length == 0) {
    alert("No changes Made!");
    $("#ech_module_student_data").html("");
    document.getElementById("ech_degree_code").disabled = false;
    document.getElementById("ech_sub_Examno").disabled = false;
    return;
  }
  $("#ech_module_student_data [name='hidden']:checked").each(function () {
    var obj = {};
    let regno = $(this).attr("id");
    obj.regno = regno.substr(2);

    
    if ($(this).parents("tr").find("input[name='hallticket']").is(":checked")) {
      obj.hallticket = "F";
    } else {
      obj.hallticket = "T";
    }
    rgECH.push(obj);
  });
  var strECH = JSON.stringify(rgECH);
  console.log(strECH);

  $.ajax({
    type: "POST",
    data:
      "degree=" +
      $("#ech_degree_code").val() +
      "&exam_no=" +
      document.getElementById("ech_sub_Examno").value +
      "&strECH=" +
      strECH,
    url: $host_url + "saveStudReg.demo",
    success: saveStudRegResponce,
  });
}

function saveStudRegResponce($responce) {
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
  $g_fmacas_rem_sub = $g_fmacas_org_rem_sub;
  $("#ech_module_student_data").html("");
  document.getElementById("ech_degree_code").disabled = false;
  document.getElementById("ech_sub_Examno").disabled = false;
}

function statusChanged(obj) {
  $(obj).parents("tr").find("input[name='hidden']").attr("checked", "checked");
}

function ClearECHblk() {
  document.getElementById("ech_degree_code").value = "";
  //document.getElementById("ech_degree_name").value = "";
  document.getElementById("ech_sub_Examno").value = "";
  //document.getElementById("ech_sub_Exam_name").value = "";
  document.getElementById("ech_module_student_data").innerHTML = "";
}

function selectall() {
  var k;
  if (document.getElementById("elig").checked == true) {
    for (k = 1; k < parseInt(total); k++) {
      var regno = document.getElementById("hregno_" + k).value;
      // document.getElementById("eligibility_" + k).checked = true;
      $("#eligibility_" + k + ":enabled").attr("checked", "checked");
      document.getElementById("h_" + regno).checked = true;
    }
  } else {
    for (k = 1; k < total; k++) {
      var regno = document.getElementById("hregno_" + k).value;
      // document.getElementById("eligibility_" + k).checked = false;
      $("#eligibility_" + k + ":enabled").attr("checked", false);
      document.getElementById("h_" + regno).checked = true;
    }
  }
}

function selecthtall() {
  var k;
  if (document.getElementById("ht").checked == true) {
    //alert(total);
    for (k = 1; k < parseInt(total); k++) {
      var regno = document.getElementById("hregno_" + k).value;
      document.getElementById("ht_" + k).checked = true;
      document.getElementById("h_" + regno).checked = true;
    }
  } else {
    for (k = 1; k < total; k++) {
      var regno = document.getElementById("hregno_" + k).value;
      document.getElementById("ht_" + k).checked = false;
      document.getElementById("h_" + regno).checked = true;
    }
  }
}