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


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

function callanswerbookissued() {
  $("#page_main_div").load(
    "../html_modules/answer_book_issued.html?v=10082017",
    function() {
      document.getElementById("display_module_name").innerHTML =
        "AnswerBook Supplied";
      document.getElementById("module_name_for_save").value =
        "Answer Book Issued";
      getDefaultHeadFooterLinks("Answer Book Issued");
      Getansbooklist();
    }
  );
}

function Getansbooklist() {
  $list_data = "";
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "Getansbooklist.demo",
    data: $list_data,
    success: GetansbooklistResponse
  });
}

function GetansbooklistResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    $("#abs_default_reg_div").show();
    $("#abs_default_reg_div").html($responce.data.html);
    $g_abs_entry_default_data = $responce.data.table_data;
    $("#add_row").focus();
  }
}

function AddNewQpRowans() {
  if ($("#tbl_absent_subjectwise").length > 0)
    var last_row_id = $("#tbl_absent_subjectwise tr:last")[0]["id"].split(
      "_"
    )[2];
  else
    var last_row_id = $("#abs_entry_table_header tr:last")[0]["id"].split(
      "_"
    )[2];
  if (empty(last_row_id)) last_row_id = 1;
  else last_row_id = eval(parseInt(last_row_id) + 1);

  prev_row = eval(parseInt(last_row_id) - 1);
  if (
    last_row_id > 1 &&
    prev_row > 1 &&
    empty($("#abs_subwise_regno_" + prev_row).val())
  ) {
    return false;
  }

  if (last_row_id == "1") last_row_id = 2;
  var html =
    "<tr class='ui-widget-content jqgrow' id='qp_row_" + last_row_id + "'  >";
  html +=
    "<td class='tbl_row_new' align='center' style='width:111px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'> ";
  html +=
    "<input  id='abs_subwise_regno_" +
    last_row_id +
    "' type='text' style='width:70px;border:0px' ";
  html +=
    "onkeypress='return pulsar(event,this);' onblur='CheckAbsentEntryRegNoQpans(this.id," +
    last_row_id +
    ");'";
  html +=
    "onkeydown='return KayboardGetRegno(event,this.id)' onfocus='$g_focus_element=" +
    last_row_id +
    "'; />";
  html += "</td>";
  html +=
    "<td  class='tbl_row_new' align='left' style='width: 160px;padding:2px; border-right:1px solid #C5DBEC;' align='left' id='abs_subwise_stuname_" +
    last_row_id +
    "' >";
  html += "</td>";
  html +=
    "<td  class='tbl_row_new' align='left' style='width: 160px;padding:2px; border-right:1px solid #C5DBEC;' align='left' id='' >";
  html +=
    "<input type = 'text' readOnly tabindex = -1 id='abs_subwise_ansbookno_" +
    last_row_id +
    "' style='width:70px;border:0px' >";
  html += "</td>";
  html +=
    "<td  class='tbl_row_new' align='left' style='width: 160px;padding:2px; border-right:1px solid #C5DBEC;' align='left' id='' >";
  html +=
    "<input type = 'text'  id='abs_subwise_newansbookno_" +
    last_row_id +
    "' style='width:70px;border:0px' >";
  html += "</td>";
  html +=
    "<td  class='tbl_row_new' align='left' style='width: 160px;padding:2px; border-right:1px solid #C5DBEC;' align='left' id='' >";
  html +=
    "<input type = 'text'  id='abs_subwise_remarks_" +
    last_row_id +
    "' onblur='AddNewQpRowans()' style='width:70px;border:0px' >";
  html += "</td>";
  //html+="<td  class='tbl_row_new' align='center' style='width:60px; padding:2px; border-right:1px solid #C5DBEC;' align='left'>";
  ////html+="<input type='checkbox'  id='abs_check_"+last_row_id+"'   onblur='AddNewQpRowans()'> ";
  //html+="<input id='st_"+last_row_id+"' type=hidden value='I'> ";
  //html+="</td>";
  html += "</tr>";
  if ($("#tbl_absent_subjectwise").length > 0) {
    $("#tbl_absent_subjectwise").append(html);
  } else {
    $("#abs_entry_table_header").append(html);
  }
  $("#abs_subwise_regno_" + last_row_id).focus();
}

function CheckAbsentEntryRegNoQpans($id, $tr_id) {
  var module_name_for_save = document.getElementById("module_name_for_save")
    .value;
  var qpcode = document.getElementById("abs_entry_qp_code").value;
  $ids = document.getElementById($id);
  $Regno = document.getElementById($id).value;
  //$Regno = $ids.value;
  if ($Regno != "") {
    $.ajax({
      type: "POST",
      async: false,
      data:
        "Regno=" +
        $Regno +
        "&id=" +
        $id +
        "&module_name_for_save=" +
        module_name_for_save +
        "&qpcode=" +
        qpcode,
      url: $host_url + "CheckEnteredRegisterNo.demo",
      success: PopulateAbsentCheckRegisterNoQpResponse
    });
  } else {
    $("#abs_subwise_stuname_" + $tr_id).val("");
    $("#abs_subwise_regno_" + $tr_id).focus();
    return false;
  }
}

//////////////////////// Check Register Number Response
function PopulateAbsentCheckRegisterNoQpResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    $g_abs_valid_reg_no = 1;
    $check_dup = $responce.data.fregno;
    $check_dup_flag = 0;

    var obj = $("input[id*='abs_subwise_regno_']");

    jQuery.each(obj, function(k, v) {
      row_id = v["id"].split("_")[3];
      var FRegno = $("#abs_subwise_regno_" + row_id).val();
      if (row_id != $responce.data.id && $check_dup == FRegno)
        $check_dup_flag = 1;
    });

    if ($check_dup_flag == 0) {
      $g_check = 1;

      document.getElementById(
        "abs_subwise_stuname_" + $responce.data["id"]
      ).innerHTML = $responce.data["fname"];
      document.getElementById(
        "abs_subwise_ansbookno_" + $responce.data["id"]
      ).value = $responce.data["fansbookno"];
      //document.getElementById("abs_check_"+ $responce.data['id']).focus();
      //document.getElementById("abs_subwise_ansbookno_"+$responce.data.['id']).value = $responce.data.['fansbookno'];
      return true;
    } else {
      $g_abs_valid_reg_no = 0;

      document.getElementById(
        "abs_subwise_regno_" + $responce.data["id"]
      ).value = "";
      //document.getElementById("abs_subwise_stuname_"+ $responce.data['id']).value="";
      alert($responce.data["fregno"] + " allready Selected");
      return false;
    }
  } else {
    $g_abs_valid_reg_no = 0;
    alert("Invaild Register Number");
    document.getElementById("abs_subwise_stuname_" + $responce.data).innerHTML =
      "";
    document.getElementById("abs_subwise_regno_" + $responce.data).value = "";
    document.getElementById("abs_subwise_regno_" + $responce.data).focus();
    return false;
  }
}

function CreateNextRowAbsentEntryQpsssssssssssss($id) {
  $Textbox = document.getElementsByName("absent_subjectwise");
  $NumTextBox = $Textbox.length;
  $previous_NumTextBox = $Textbox.length;
  $sub = $id.substring($id.lastIndexOf("_") + 1);
  // get Previous Register Number
  $PrevRegNo = $("#abs_subwise_regno_" + $NumTextBox).val();

  $fn = function() {
    return AbsentEntryPopup(window, e, null);
  };

  $NumTextBox += 1;
  if (parseInt($NumTextBox % 2) == 0) {
    $input_class = "tbl_row_input";
    $class = "tbl_row";
  } else {
    $class = "tbl_row1";
    $input_class = "tbl_row1_input";
  }

  if (
    $g_abs_valid_reg_no == 1 &&
    $sub == $previous_NumTextBox &&
    $PrevRegNo != ""
  ) {
    document.getElementById(
      "abs_subwise_regno_" + $previous_NumTextBox
    ).readOnly = true;
    $tbody = document.getElementById("abs_entry_table_header");
    $rowcount = $tbody.rows.length;
    $tr = $tbody.insertRow($rowcount);
    $tr.id = $NumTextBox;
    $tr.className = $class;

    //  Create  Register Number Textbox
    $td_one = $tr.insertCell(0);
    $Regno = document.createElement("input");
    $Regno.type = "text";
    $Regno.className = $input_class;
    $Regno.id = "abs_subwise_regno_" + $NumTextBox;
    $Regno.name = "absent_subjectwise";
    $Regno.align = "center";
    $td_one.style.borderLeft = "solid #C5DBEC 1px";
    $td_one.style.borderRight = "solid #C5DBEC 1px";
    $td_one.style.borderBottom = "solid #C5DBEC 1px";
    $td_one.style.padding = "2px";
    $Regno.onkeydown = AbsentEntryPopup;
    $Regno.onblur = function() {
      CheckAbsentEntryRegNoQpans(this.id, $NumTextBox);
    };
    $td_one.appendChild($Regno);
    $td_one.style.width = "111px";
    $td_one.align = "center";

    // Create Student Name  TD
    $td_two = $tr.insertCell(1);
    $td_two.id = "abs_subwise_stuname_" + $NumTextBox;
    $td_two.style.width = "160px";
    $td_two.align = "left";
    $td_two.style.borderRight = "solid #C5DBEC 1px";
    $td_two.style.borderBottom = "solid #C5DBEC 1px";
    $td_two.style.padding = "2px";

    // Create Check Box
    $td_three = $tr.insertCell(2);
    $status = document.createElement("input");
    $status.type = "checkbox";
    $status.checked = "checked";
    $status.className = $input_class;
    $status.id = "abs_subwise_checkstatus_" + $NumTextBox;
    $status.align = "center";
    $status.onblur = function() {
      CreateNextRowAbsentEntryQp(this.id);
    };
    $status.onfocus = function() {
      if ($g_abs_valid_reg_no == 0)
        $("#abs_subwise_regno_" + $NumTextBox).focus();
    };
    $td_three.style.width = "40px";
    $td_three.style.borderRight = "solid #C5DBEC 1px";
    $td_three.style.borderBottom = "solid #C5DBEC 1px";
    $td_three.style.padding = "2px";
    $td_three.align = "center";
    $td_three.appendChild($status);

    document.getElementById("abs_subwise_regno_" + $NumTextBox).style.width =
      "70px";
    document.getElementById("abs_subwise_regno_" + $NumTextBox).align =
      "center";
    document.getElementById("abs_subwise_regno_" + $NumTextBox).style.border =
      "0px";

    document.getElementById("abs_subwise_stuname_" + $NumTextBox).style.width =
      "168px";
    document.getElementById(
      "abs_subwise_stuname_" + $NumTextBox
    ).style.padding = "4px";
    setfocus();
  }
}

function AbsentEntryPopup(evt) {
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 112) {
    $g_abs_popup = 1;
    PopupMarkEntrySubGetRegno();
  }
}

function setfocus() {
  $Textbox = document.getElementsByName("absent_subjectwise");
  $Num = $Textbox.length;
  $("#abs_subwise_regno_" + $Num).focus();
}

function SaveansEntryQpStudetwise() {
  if ($("#abs_entry_qp_code").val() == "") {
    alert("Please Enter The Qp Code");
    $("#abs_entry_qp_code").focus();
    return false;
  }

  $list_data = "qp_code=" + $("#abs_entry_qp_code").val();

  $list_data += "&date=" + date_format($("#abs_sub_date").val());
  $list_data += "&Session=" + $("#abs_session_state").val();
  $abs_setup_subwise = new Object();
  var obj = $("input[id*='abs_subwise_regno_']");
  var k = 0;
  jQuery.each(obj, function(k, v) {
    row_id = v["id"].split("_")[3];
    $abs_setup_subwise[k] = new Object();
    var a_type = $("#st_" + row_id).val();
    a_type = "U";
    var FRegno = $("#abs_subwise_regno_" + row_id).val();
    var fremarks = $("#abs_subwise_remarks_" + row_id).val();
    var ansbookno = $("#abs_subwise_ansbookno_" + row_id).val();
    var newansbookno = $("#abs_subwise_newansbookno_" + row_id).val();

    if ($("#abs_check_" + row_id).is(":checked"))
      $abs_setup_subwise[k]["delete"] = 1;
    else $abs_setup_subwise[k]["delete"] = 0;

    $abs_setup_subwise[k]["FRegno"] = FRegno;
    $abs_setup_subwise[k]["fremarks"] = fremarks;
    $abs_setup_subwise[k]["ansbookno"] = ansbookno;
    $abs_setup_subwise[k]["newansbookno"] = newansbookno;
    $abs_setup_subwise[k]["a_type"] = a_type;
    k++;
  });

  var myJSONText = encodeURIComponent(JSON.stringify($abs_setup_subwise));
  $list_data += "&output_details=" + myJSONText;
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "SaveansEntryQpStudetwise.demo",
    data: $list_data,
    success: SaveansEntryQpStudetwiseResponce
  });
}

function SaveansEntryQpStudetwiseResponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    alert($responce.data);
    callansbookcancel();
  } else {
    alert($responce.data);
    $g_abs_save_after_error_flag = 1;
    $("#abs_subwise_regno_1").focus();
  }
}

function checkrenarksblank(e, id) {
  var charCode = e.which ? e.which : e.keyCode;
  fremarks = document.getElementById(id).value;

  if (fremarks == "") {
    alert("Please Enter Remarks");
    document.getElementById(id).value = "";
    setTimeout(function() {
      document.getElementById(id).focus();
    }, 0);
  }
  return false;
}