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 : /var/www/oasis/js_old/
Upload File :
Current File : /var/www/oasis/js_old/usersubj_identification.js

var $g_user_subjIdentfy_details = "";

function CallUserSubjIdentification() {
  $("#page_main_div").load(
    "../html_modules/user_subjIdentification.html?v=1",
    function() {
      window.location.g_FeePopUpExamNo = "";
      document.getElementById("display_module_name").innerHTML =
        "User Wise Subject Identification";
      document.getElementById("module_name_for_save").value =
        "saveUserSubjIdentfy";

      getDefaultHeadFooterLinks("User Wise Subject Identification");
      ClearUserSubjIdentify();
      $.ajax({
        type: "POST",
        url: $host_url + "getUserRightsDetails.demo",
        success: populateUserSubjDetailsResponse
      });
    }
  );
}

function getsection() {
  var degree = $("#user_subj_degree_code").val();
  if (degree != "") {
    $.ajax({
      type: "POST",
      data: "degree=" + degree,
      url: $host_url + "getsection",
      success: getsectionResponse
    });
  }
}

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

  if ($responce.error_code == 0) {
    document.getElementById("section").options.length = 0;

    $op = new Option("Select Section", "");
    $op.id = "0";
    document.getElementById("section").options.add($op);

    for ($i = 0; $i < $responce.data["section"].length; $i++) {
      $op = new Option(
        $responce.data["section"][$i]["value"],
        $responce.data["section"][$i]["value"]
      );
      $op.id = $responce.data["section"][$i]["value"];
      document.getElementById("section").options.add($op);
    }
  }
}

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

  document.getElementById("user_rights_user").options.length = 0;

  $op = new Option("Select One", "0");
  $op.id = "0";
  document.getElementById("user_rights_user").options.add($op);

  for ($i = 0; $i < $responce.data["user_rights_user"].length; $i++) {
    $op = new Option(
      $responce.data["user_rights_user"][$i]["value"],
      $responce.data["user_rights_user"][$i]["internal_code"]
    );
    $op.id = $responce.data["user_rights_user"][$i]["internal_code"]; //specifying the id  for options
    document.getElementById("user_rights_user").options.add($op);
  }

  document.getElementById("user_subject_table_data_div").innerHTML = "";
  //getUserRightModuleNames(0,'');
}

function ClearUserSubjIdentify() {
  $("#user_rights_user").val("");
  $("#user_subj_degree_code").val("");
  $("#user_subj_degree_name").val("");
  $("#user_subject_table_data_div").html("");
  document.getElementById("user_rights_user").disabled = false;
  document.getElementById("user_subj_degree_code").disabled = false;
  document.getElementById("user_rights_user").focus();
}

function PopulateUserSubjectList() {
  var userType = $("#user_rights_user").val();
  var degree = $("#user_subj_degree_code").val();
  var module = $("#iapr").val();
  if (empty(userType)) {
    alert("Select User");
    return;
  }
  if (empty(degree)) {
    alert("Select Degree");
    return;
  }
  if (empty(module)) {
    alert("Select Module");
    return;
  }

  $.ajax({
    type: "POST",
    data: "degree=" + degree + "&userType=" + userType + "&module=" + module,
    url: $host_url + "PopulateUserSubjectList",
    success: PopulateUserSubjectListResponce
  });
}

function PopulateUserSubjectListResponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    $g_user_subjIdentfy_details = $responce;
    $("#user_subject_table_data_div").html($responce.data["html_data"]);
    document.getElementById("user_rights_user").disabled = true;
    document.getElementById("user_subj_degree_code").disabled = true;
  }
}

function filter_subjects() {
  var subject = document.getElementById("filter_sub");
  var table = document.getElementById("user_rights_table_data");
  var filter = subject.value.toUpperCase();
  var tr = table.getElementsByTagName("tr");
  var i = 0;
  for (i = 0; i < tr.length; i++) {
    td = tr[i].getElementsByTagName("td")[1];
    if (td) {
      if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";
      }
    }
  }
}

function selectAllUserSubject() {
  if (document.getElementById("check_Allrow").checked == true) {
    for (
      $i = 0;
      $i < $g_user_subjIdentfy_details.data["module_id_details"].length;
      $i++
    ) {
      $id = $g_user_subjIdentfy_details.data["module_id_details"][$i].fsubcode;
      document.getElementById("check_row_" + $id).checked = true;
    }
  } else {
    for (
      $i = 0;
      $i < $g_user_subjIdentfy_details.data["module_id_details"].length;
      $i++
    ) {
      $id = $g_user_subjIdentfy_details.data["module_id_details"][$i].fsubcode;
      document.getElementById("check_row_" + $id).checked = false;
    }
  }
}

function SaveUserSubjIdentify() {
  var userType = $("#user_rights_user").val();
  var degree = $("#user_subj_degree_code").val();
  //var section  = $("#section").val();
  var module = $("#iapr").val();

  var subjSelected = "";
  for (
    $i = 0;
    $i < $g_user_subjIdentfy_details.data["module_id_details"].length;
    $i++
  ) {
    $id = $g_user_subjIdentfy_details.data["module_id_details"][$i].fsubcode;
    if (document.getElementById("check_row_" + $id).checked == true) {
      subjSelected += document.getElementById("check_row_" + $id).value + "*";
    }
  }
  $.ajax({
    type: "POST",
    data:
      "degree=" +
      degree +
      "&userType=" +
      userType +
      "&subjSelected=" +
      subjSelected +
      "&module=" +
      module,
    url: $host_url + "saveUserSelectedSubjectList",
    success: saveUserSelectedSubjectListResponce
  });
}

function saveUserSelectedSubjectListResponce($responce) {
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
}