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


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

function openSubjectAppearingPopup() {
  switch (document.getElementById("module_name_for_save").value) {
    case "StudentEntry":
      $degree_code = $("#student_entry_degree_code").val();
      $exam = $("#student_entry_exam").val();
      subjectAppearingPopupDetails($degree_code, $exam, "F");
      break;
    case "Acknowledge Admission Applications":
      $exam = $("#student_entry_exam").val();
      $degree_code = $("#student_entry_degree_code").val();
      subjectAppearingPopupDetails($degree_code, $exam, "F");
      break;
    case "Admission Entry":
      $degree_code = $("#student_entry_degree_code").val();
      //$exam="A";
      $exam = $("#student_entry_exam").val();
      subjectAppearingPopupDetails($degree_code, $exam, "F");
      break;
    case "Admission Entry reg":
      $degree_code = $("#student_entry_degree_code").val();
      $exam = $("#student_entry_exam").val();
      subjectAppearingPopupDetails($degree_code, $exam, "F");
      break;
    case "candidate_list":
      $degree_code = $("#candidate_list_degree_code").val();
      $div_name_split = window.location.$keyboardSubjectAppearingPopupfieldId.split(
        "_"
      );
      $exam = $div_name_split[1];
      subjectAppearingPopupDetails($degree_code, $exam, "");
      break;
    case "IdentifySubjFreshEx":
      $degree_code = $("#candidate_list_degree_code").val();
      $div_name_split = window.location.$keyboardSubjectAppearingPopupfieldId.split(
        "_"
      );
      $exam = $div_name_split[1];
      subjectAppearingPopupDetails($degree_code, $exam, "IdentifySubjFreshEx");
      break;
  }
}

// used to store resonce from the table
var $g_ref_data_arr = "";
$host_url = getCookie("host_url");
$image_path = getCookie("image_path");

function subjectAppearingPopupDetails($degree_code, $exam, $mand_field) {
  $("#dialog").dialog("open");
  $("#dialog").data("height.dialog", 350);
  $(".ui-dialog").css({ width: 660 });
  $("#ui-dialog-title-dialog").html("Subject Details");

  $main =
    "<table id='subject_details_grid' class='scroll' ondblclick='selectSubjectCode();'></table> <div id='sub_grid_div3' class='scroll' style='text-align:center;'></div>";
  document.getElementById("dialog").innerHTML = $main;

  var subject_details = jQuery("#subject_details_grid")
    .jqGrid({
      // the url parameter tells from where to get the data from server
      // adding ?nd='+new Date().getTime() prevent IE caching
      url:
        $host_url +
        "subjectDetailsPopup.demo&degree_code=" +
        $degree_code +
        "&exam=" +
        $exam +
        "&mand_field=" +
        $mand_field,
      // datatype parameter defines the format of data returned from the server
      // in this case we use a JSON data
      datatype: "json",
      // colNames parameter is a array in which we describe the names
      // in the columns. This is the text that apper in the head of the grid.
      colNames: ["Sub Code", "Short Name", "Subject Name"],
      colModel: [
        { name: "FSUBCODE", index: "FSUBCODE", width: 10 },
        { name: "FSUBSHORT", index: "FSUBSHORT", width: 10 },
        { name: "FSUBNAME", index: "FSUBNAME", width: 80 }
      ],
      rowNum: 500,
      rowList: [200, 300, 400, 500, 600, 900],
      imgpath: $image_path,
      pager: jQuery("#sub_grid_div3"),
      sortname: "id",

      height: "250",
      width: "660",
      viewrecords: true,
      sortorder: "desc",
      multiselect: false,
      cellEdit: true
    })
    .navGrid("#sub_grid_div3", { edit: false, add: false, del: false })
    .navButtonAdd("#sub_grid_div3", {
      caption: "Select",
      onClickButton: function() {
        selectSubjectCode();
      }
    });
  subject_details.filterToolbar();
  $("#gs_FSUBCODE").focus();
  $(".ui-search-toolbar").bind("keydown", function(evt) {
    var kC = evt.which ? evt.which : evt.keyCode;
    if (kC == 40) jQuery("#subject_details_grid").editCell(0, 0, false);
  });
}
function selectSubjectCode() {
  // from dynamic text boxes
  var id = jQuery("#subject_details_grid").getGridParam("selrow");
  if (id != null) {
    switch (document.getElementById("module_name_for_save").value) {
      case "StudentEntry":
        $degree_code = $("#student_entry_degree_code").val();
        $exam = $("#student_entry_exam").val();
        $.ajax({
          type: "POST",
          async: false,
          data:
            "subject_code=" +
            id +
            "&degree_code=" +
            $degree_code +
            "&exam=" +
            $exam,
          url: $host_url + "getSubjectNames.demo",
          success: PopulateSubjectNameResponse
        });
        $("#dialog").dialog("close");
        break;
      case "Acknowledge Admission Applications":
        $degree_code = $("#student_entry_degree_code").val();
        $exam = $("#student_entry_exam").val();
        $.ajax({
          type: "POST",
          async: false,
          data:
            "subject_code=" +
            id +
            "&degree_code=" +
            $degree_code +
            "&exam=" +
            $exam,
          url: $host_url + "getSubjectNames.demo",
          success: PopulateSubjectNameResponse
        });
        $("#dialog").dialog("close");
        break;
      case "Admission Entry":
        $degree_code = $("#student_entry_degree_code").val();
        $exam = $("#student_entry_exam").val();
        $.ajax({
          type: "POST",
          async: false,
          data:
            "subject_code=" +
            id +
            "&degree_code=" +
            $degree_code +
            "&exam=" +
            $exam,
          url: $host_url + "getSubjectNames.demo",
          success: PopulateSubjectNameResponse
        });
        $("#dialog").dialog("close");
        break;
      case "Admission Entry reg":
        $degree_code = $("#student_entry_degree_code").val();
        $exam = $("#student_entry_exam").val();
        $.ajax({
          type: "POST",
          async: false,
          data:
            "subject_code=" +
            id +
            "&degree_code=" +
            $degree_code +
            "&exam=" +
            $exam,
          url: $host_url + "getSubjectNames.demo",
          success: PopulateSubjectNameResponse
        });
        $("#dialog").dialog("close");
        break;
      case "candidate_list":
        $degree_code = $("#candidate_list_degree_code").val();
        $div_name_split = window.location.$keyboardSubjectAppearingPopupfieldId.split(
          "_"
        );
        $exam = $div_name_split[1];
        $.ajax({
          type: "POST",
          async: false,
          data:
            "subject_code=" +
            id +
            "&degree_code=" +
            $degree_code +
            "&exam=" +
            $exam,
          url: $host_url + "getSubjectNames.demo",
          success: PopulateSubjectNameResponse
        });
        $("#dialog").dialog("close");
        break;
      case "IdentifySubjFreshEx":
        $degree_code = $("#candidate_list_degree_code").val();
        $div_name_split = window.location.$keyboardSubjectAppearingPopupfieldId.split(
          "_"
        );
        $exam = $div_name_split[1];
        $.ajax({
          type: "POST",
          async: false,
          data:
            "subject_code=" +
            id +
            "&degree_code=" +
            $degree_code +
            "&exam=" +
            $exam,
          url: $host_url + "getSubjectNames.demo",
          success: PopulateSubjectNameResponse
        });
        $("#dialog").dialog("close");
        break;
    }
  } else {
    alert("Please select row");
  }
  return;
}
function PopulateSubjectNameResponse($responce) {
  $responce = eval("(" + $responce + ")");
  switch (document.getElementById("module_name_for_save").value) {
    case "StudentEntry":
      $check_dup = $responce.data.FSUBCODE;
      $check_dup_flag = 0;
      $split_clicked_subject_id = window.location.$g_popup_sub_code_field_id.split(
        "_"
      );
      $clicked_subject_id = $split_clicked_subject_id[3];

      for ($m = 0; $m < $g_subject_appearing.total_count; $m++) {
        if (
          $m != $clicked_subject_id &&
          ($check_dup == $("#se_sub_code_" + $m).val() ||
            $check_dup == $("#se_sub_code_" + $m).html())
        )
          $check_dup_flag = 1;
      }
      if ($check_dup_flag == 0) {
        $("#se_sub_code_" + $clicked_subject_id).val($responce.data.FSUBCODE);
        $("#se_short_name_" + $clicked_subject_id).val(
          $responce.data.FSUBSHORT
        );
        $("#se_sub_name_" + $clicked_subject_id).val($responce.data.FSUBNAME);
      } else {
        alert("Sub Code " + $check_dup + " allready Selected");
        $("#se_sub_code_" + $clicked_subject_id).focus();
        $("#se_sub_code_" + $clicked_subject_id).val("");
        return;
      }
      break;
    case "Acknowledge Admission Applications":
      $check_dup = $responce.data.FSUBCODE;
      $check_dup_flag = 0;
      $split_clicked_subject_id = window.location.$g_popup_sub_code_field_id.split(
        "_"
      );
      $clicked_subject_id = $split_clicked_subject_id[3];

      /*for($m=0;$m<$g_subject_appearing.total_count;$m++)
			{
				if($m!=$clicked_subject_id && ($check_dup==$("#se_sub_code_"+$m).val() || $check_dup==$("#se_sub_code_"+$m).html()) )
				$check_dup_flag=1;
			}*/
      if ($check_dup_flag == 0) {
        $("#se_sub_code_" + $clicked_subject_id).val($responce.data.FSUBCODE);
        $("#se_short_name_" + $clicked_subject_id).val(
          $responce.data.FSUBSHORT
        );
        $("#se_sub_name_" + $clicked_subject_id).val($responce.data.FSUBNAME);
      } else {
        alert("Sub Code " + $check_dup + " allready Selected");
        $("#se_sub_code_" + $clicked_subject_id).focus();
        $("#se_sub_code_" + $clicked_subject_id).val("");
        return;
      }
      break;
    case "Admission Entry":
      $check_dup = $responce.data.FSUBCODE;
      $check_dup_flag = 0;
      $split_clicked_subject_id = window.location.$g_popup_sub_code_field_id.split(
        "_"
      );
      $clicked_subject_id = $split_clicked_subject_id[3];

      /*for($m=0;$m<$g_subject_appearing.total_count;$m++)
			{
				if($m!=$clicked_subject_id && ($check_dup==$("#se_sub_code_"+$m).val() || $check_dup==$("#se_sub_code_"+$m).html()) )
				$check_dup_flag=1;
			}*/
      if ($check_dup_flag == 0) {
        $("#se_sub_code_" + $clicked_subject_id).val($responce.data.FSUBCODE);
        $("#se_short_name_" + $clicked_subject_id).val(
          $responce.data.FSUBSHORT
        );
        $("#se_sub_name_" + $clicked_subject_id).val($responce.data.FSUBNAME);
      } else {
        alert("Sub Code " + $check_dup + " allready Selected");
        $("#se_sub_code_" + $clicked_subject_id).focus();
        $("#se_sub_code_" + $clicked_subject_id).val("");
        return;
      }
      break;
    case "Admission Entry reg":
      $check_dup = $responce.data.FSUBCODE;
      $check_dup_flag = 0;
      $split_clicked_subject_id = window.location.$g_popup_sub_code_field_id.split(
        "_"
      );
      $clicked_subject_id = $split_clicked_subject_id[3];

      /*for($m=0;$m<$g_subject_appearing.total_count;$m++)
			{
				if($m!=$clicked_subject_id && ($check_dup==$("#se_sub_code_"+$m).val() || $check_dup==$("#se_sub_code_"+$m).html()) )
				$check_dup_flag=1;
			}*/

      if ($check_dup_flag == 0) {
        $("#se_sub_code_" + $clicked_subject_id).val($responce.data.FSUBCODE);
        $("#se_short_name_" + $clicked_subject_id).val(
          $responce.data.FSUBSHORT
        );
        $("#se_sub_name_" + $clicked_subject_id).val($responce.data.FSUBNAME);
      } else {
        alert("Sub Code " + $check_dup + " allready Selected");
        $("#se_sub_code_" + $clicked_subject_id).focus();
        $("#se_sub_code_" + $clicked_subject_id).val("");
        return;
      }
      break;
    case "candidate_list":
      $div_name_split = window.location.$keyboardSubjectAppearingPopupfieldId.split(
        "_"
      );
      $div_name = $div_name_split[1];
      $clicked_subject_id = $div_name_split[5];
      $check_dup = $responce.data.FSUBCODE;
      $check_dup_flag = 0;
      $total_count_for_div =
        $g_total_count_of_each_div[
          "candidate_list_exam_" + $div_name + "_details"
        ];
      for ($m = 0; $m < $total_count_for_div; $m++) {
        if (
          $m != $clicked_subject_id &&
          ($check_dup == $("#exam_" + $div_name + "_ce_sub_code_" + $m).val() ||
            $check_dup == $("#exam_" + $div_name + "_ce_sub_code_" + $m).html())
        )
          $check_dup_flag = 1;
      }
      if ($check_dup_flag == 0) {
        $("#exam_" + $div_name + "_ce_sub_code_" + $clicked_subject_id).val(
          $responce.data.FSUBCODE
        );
        $("#exam_" + $div_name + "_ce_short_name_" + $clicked_subject_id).html(
          $responce.data.FSUBSHORT
        );
        $("#exam_" + $div_name + "_ce_desc_" + $clicked_subject_id).html(
          $responce.data.FSUBNAME
        );
        if (
          $(
            "#exam_" +
              $div_name +
              "_ce_sub_code_" +
              eval($clicked_subject_id + 1)
          )
        )
          $(
            "#exam_" +
              $div_name +
              "_ce_sub_code_" +
              eval($clicked_subject_id + 1)
          ).focus();
      } else {
        alert("Sub Code " + $check_dup + " allready Selected");
        $("#exam_" + $div_name + "_ce_sub_code_" + $clicked_subject_id).focus();
        $("#exam_" + $div_name + "_ce_short_name_" + $clicked_subject_id).html(
          ""
        );
        $("#exam_" + $div_name + "_ce_desc_" + $clicked_subject_id).html("");
        return;
      }

      break;
    case "IdentifySubjFreshEx":
      $div_name_split = window.location.$keyboardSubjectAppearingPopupfieldId.split(
        "_"
      );
      $div_name = $div_name_split[1];
      $clicked_subject_id = $div_name_split[5];
      $check_dup = $responce.data.FSUBCODE;
      $check_dup_flag = 0;
      $total_count_for_div =
        $g_total_count_of_each_div[
          "candidate_list_exam_" + $div_name + "_details"
        ];
      for ($m = 0; $m < $total_count_for_div; $m++) {
        if (
          $m != $clicked_subject_id &&
          ($check_dup == $("#exam_" + $div_name + "_ce_sub_code_" + $m).val() ||
            $check_dup == $("#exam_" + $div_name + "_ce_sub_code_" + $m).html())
        )
          $check_dup_flag = 1;
      }
      if ($check_dup_flag == 0) {
        $("#exam_" + $div_name + "_ce_sub_code_" + $clicked_subject_id).val(
          $responce.data.FSUBCODE
        );
        $("#exam_" + $div_name + "_ce_short_name_" + $clicked_subject_id).html(
          $responce.data.FSUBSHORT
        );
        $("#exam_" + $div_name + "_ce_desc_" + $clicked_subject_id).html(
          $responce.data.FSUBNAME
        );
        if (
          $(
            "#exam_" +
              $div_name +
              "_ce_sub_code_" +
              eval($clicked_subject_id + 1)
          )
        )
          $(
            "#exam_" +
              $div_name +
              "_ce_sub_code_" +
              eval($clicked_subject_id + 1)
          ).focus();
      } else {
        alert("Sub Code " + $check_dup + " allready Selected");
        $("#exam_" + $div_name + "_ce_sub_code_" + $clicked_subject_id).focus();
        $("#exam_" + $div_name + "_ce_short_name_" + $clicked_subject_id).html(
          ""
        );
        $("#exam_" + $div_name + "_ce_desc_" + $clicked_subject_id).html("");
        return;
      }

      break;
  }
}

// Coomanded  by  Beemaraj Because of Js error in IE.
/* document.onkeydown = function(evt){

 var charCode = (evt.which) ? evt.which : evt.keyCode;

if(charCode=='13')
selectDegreeCode();
}
 */