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


Current Path : /var/www/oasis/js/popups/
Upload File :
Current File : //var/www/oasis/js/popups/qp_subject_popup.js

//Jijo Added OpenQpPopup.

function OpenQpSubjectPopup() {
  switch (document.getElementById("module_name_for_save").value) {
    case "StudentEntry":
      qp_popPopHtml("FCADSTATUS");
      break;

    default:
      OpenSubjectQpPopupHtml("");
      break;
  }
}

var $g_ref_data_arr = "";
$host_url = getCookie("host_url");
$image_path = getCookie("image_path");

function OpenSubjectQpPopupHtml($module) {
  $("#dialog").dialog("open");
  $("#dialog").data("height.dialog", 222);
  $(".ui-dialog").css({ width: 460 });
  $("#ui-dialog-title-dialog").html("QP Details");

  $main =
    "<table id='qp_subject_grid' class='scroll' ondblclick='SelectSubjectQpCode();'></table> <div  id='sub_grid_div3' class='scroll' style='text-align:center;'></div>";
  document.getElementById("dialog").innerHTML = $main;
  var module_name_for_save = document.getElementById("module_name_for_save")
    .value;
  var qp_pop = jQuery("#qp_subject_grid")
    .jqGrid({
      url:
        $host_url +
        "OpenQpSubjectPopup&module_name_for_save=" +
        module_name_for_save,
      datatype: "json",
      colNames: ["QPCode", "Subject", "FSSUBNAME"],
      colModel: [
        { name: "FQPCODE", index: "FQPCODE", width: 80 },
        { name: "FSUBCODE", index: "FSUBCODE", width: 80 },
        { name: "FSSUBNAME", index: "FSSUBNAME", width: 80 }
      ],
      rowNum: 10,
      rowList: [5, 10, 15, 20, 25, 30],
      imgpath: $image_path,
      pager: jQuery("#sub_grid_div3"),
      sortname: "id",
      height: "119",
      width: "457",
      viewrecords: true,
      sortorder: "desc",
      multiselect: false,
      cellEdit: true,
      //forceFit : true,
      //cellsubmit: 'clientArray',
      addCaption: "Add Recordddd"
    })
    .navGrid(
      "#sub_grid_div3",
      { edit: false, add: false, del: false, search: false },
      {},
      {},
      {},
      { multipleSearch: true }
    )
    .navButtonAdd("#sub_grid_div3", {
      caption: "",
      buttonicon: "ui-icon-search",
      onClickButton: function() {
        qp_pop[0].toggleToolbar();
      }
    })
    .navButtonAdd("#sub_grid_div3", {
      caption: "Select",
      onClickButton: function() {
        SelectQpCode();
      }
    });
  qp_pop.filterToolbar();
  $("#gs_FQPCODE").focus();
  $(".ui-search-toolbar").bind("keydown", function(evt) {
    var kC = evt.which ? evt.which : evt.keyCode;
    if (kC == 40) jQuery("#qp_subject_grid").editCell(0, 0, false);
  });
}

function SelectSubjectQpCode() {
  var id = jQuery("#qp_subject_grid").getGridParam("selrow");
  if (id != null) {
    GetQpSubjectCodeDetails(id);
    $("#dialog").dialog("close");
  } else {
    alert("Please select row");
  }
  return;
}
function GetQpSubjectCodeDetails(qp_code) {
  if (!empty(qp_code)) {
    $.ajax({
      type: "POST",
      async: false,
      data:
        "qp_code=" +
        qp_code +
        "&module_name_for_save=" +
        $("#module_name_for_save").val(),
      url: $host_url + "SelectSubjectQpCode",
      success: SelectSubjectQpCodeResponse
    });
  }
}

function SelectSubjectQpCodeResponse($responce) {
  // console.log($response);
  $responce = eval("(" + $responce + ")");
  console.log($responce);
  if ($responce.error_code == "0") {
    switch (document.getElementById("module_name_for_save").value) {
      case "SaveAbsentEntrySubjectwiseQP":
        $("#error_msg").html(" ");
        $("#abs_entry_qp_code").val($responce.data.FQPCODE);
        $("#abs_sub_qp_name").val(
          $responce.data.FSUBCODE + " " + $responce.data.FSSUBNAME
        );
        $("#abs_sub_date").val($responce.data.FDOE);
        $("#abs_session_state").val($responce.data.FSESSION);
        //$("#abs_sub_name").val($responce.data.FSSUBNAME);
        // $("#abs_sub_date").focus();
        console.log($responce.data.FDOE);
        if ($responce.data.FDOE == "00/00/0000") {
          alert("Exam Date is not defined for qpcode Contact Help Desk");
          $("#view_button_absent_entry").hide();
          return -1;
        }

        break;
      case "Room Allotment":
        $("#error_msg").html(" ");
        $("#abs_entry_qp_code").val($responce.data.FQPCODE);
        $("#abs_sub_qp_name").val(
          $responce.data.FSUBCODE + " " + $responce.data.FSSUBNAME
        );
        $("#ra_date").val($responce.data.FDOE);
        $("#ra_time").val($responce.data.FSESSION);
        $("#ra_stu_cnt").val($responce.data.reg_cnt);

        break;
      case "saveDispatchAnswersScriptQp":
        $("#error_msg").html(" ");
        var id = $g_dispatch_degree_code.split("_")[2];
        $("#dispatch_degree_" + id).val($responce.data.FQPCODE);
        $("#dispatch_name_" + id).val($responce.data.FSSUBNAME);
        $("#dispatch_degree_" + id).focus();
        break;
      case "DailyReportQP":
        $("#error_msg").html(" ");

        $("#" + $g_focus_element).val($responce.data.FQPCODE);
        $("#" + $g_focus_element).focus();
        break;
      case "Appearing List (QP Wise)":
        $("#error_msg").html(" ");

        $("#" + $g_focus_element).val($responce.data.FQPCODE);
        $("#" + $g_focus_element).focus();
        break;

      case "Bundle Dispatch":
        $("#error_msg").html(" ");
        $("#bun_disp_qp_code").val($responce.data.FQPCODE);
        $("#bun_disp_qp_name").val(
          $responce.data.FSUBCODE + " " + $responce.data.FSSUBNAME
        );
        $("#date_of_exam").val($responce.data.FDOE);
        $("#qp_session").val($responce.data.FSESSION);
        $("#abs_sub_date").focus();

        break; //Appearing List (QP Wise)
      case "Center Wise Appearing List (QP Wise)":
        $("#error_msg").html(" ");

        $("#" + $g_focus_element).val($responce.data.FQPCODE);
        $("#" + $g_focus_element).focus();
        break;
    }
  } else {
    switch (document.getElementById("module_name_for_save").value) {
      case "SaveAbsentEntrySubjectwiseQP":
        alert($responce.data);
        $("#abs_entry_qp_code").val("");
        $("#abs_sub_qp_name").val("");
        //$("#abs_sub_name").val("");
        $("#abs_sub_date").focus();

        break;
      case "Evaluation":
        alert($responce.data);
        $("#abs_sub_qp_name").val("");
        $("#abs_sub_name").val("");
        $("#abs_entry_qp_code").val("");

        break;
      case "Room Allotment":
        alert($responce.data);
        $("#error_msg").html(" ");
        $("#abs_entry_qp_code").val("");
        $("#abs_sub_qp_name").val("");
        $("#ra_date").val("00/00/0000");
        $("#ra_time").val("");
        $("#ra_stu_cnt").val("0");

        break;
      case "saveDispatchAnswersScriptQp":
        $("#error_msg").html(" ");
        var id = $g_dispatch_degree_code.split("_")[2];
        $("#dispatch_degree_" + id).val("");
        $("#dispatch_name_" + id).val("");
        alert("Invalid Qp COde");
        $("#dispatch_degree_" + id).focus();

        break;
      case "DailyReportQP":
        $("#error_msg").html(" ");

        $("#" + $g_focus_element).val("");
        $("#" + $g_focus_element).focus();
        alert("Invalid Qp COde");
        break;

      case "Bundle Dispatch":
        alert($responce.data);
        $("#error_msg").html(" ");
        $("#bun_disp_qp_code").val("");
        $("#bun_disp_qp_name").val("");
        $("#bun_disp_qp_code").focus();

        break;
      case "Appearing List (QP Wise)":
        alert($responce.data);
        $("#error_msg").html(" ");
        $("#bun_disp_qp_code").val("");
        $("#bun_disp_qp_name").val("");
        $("#bun_disp_qp_code").focus();

        break;
    }
  }
}

function GetSubjectQpCodeDetails() {
  switch (document.getElementById("module_name_for_save").value) {
    case "SaveAbsentEntrySubjectwiseQP":
      var qp_code = trim($("#evaluation_qp_code").val());
      if (!$("#dialog").is(":visible")) {
        if (empty(qp_code)) {
          alert("Enter the QP Code");
          $("#evaluation_qp_code").val("");
          $("#evaluation_qp_name").val("");
          document.getElementById("evaluation_qp_code").focus();
          return;
        } else {
          $.ajax({
            type: "POST",
            async: false,
            data: "qp_code=" + qp_code,
            url: $host_url + "GetSubjectQpCodeDetails",
            success: GetSubjectQpCodeDetailsResponse
          });
        }
      }
      break;
  }
}
function GetSubjectQpCodeDetailsResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    switch (document.getElementById("module_name_for_save").value) {
      case "SaveAbsentEntrySubjectwiseQP":
        $("#error_msg").html(" ");
        var qp_code_val = $responce.data.FQPCODE;
        var qp_subject_val = $responce.data.FSUBNAME;
        var qp_max_mark_val = $responce.data.FMAXMARKS;

        $("#evaluation_qp_code").val(qp_code_val);
        $("#evaluation_qp_name").val(qp_subject_val);
        $("#evaluation_max_mark").val(qp_max_mark_val);

        break;
    }
  } else {
    switch (document.getElementById("module_name_for_save").value) {
      case "SaveAbsentEntrySubjectwiseQP":
        alert($responce.data);
        $("#evaluation_qp_code").val("");
        $("#evaluation_qp_name").val("");
        $("#evaluation_max_mark").val("");

        break;
    }
  }
}