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


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

$g_abs_entry_default_data = "";
$g_abs_table_header_data = "";
$g_abs_save_after_error_flag = 0;
$g_abs_valid_reg_no = "";
$g_abs_entry_type = "";
$g_check = "";
var $g_table_data = $("#abs_entry_table_header").html();

function LoadabsententrysubjectwiseQP() {
  $g_abs_popup = 1;
  $NumTextBox = 1;
  $g_abs_save_after_error_flag = 0;
  window.enable_proper_module = "absententrystudetwiseQP";
  $("#page_main_div").load("../html_modules/absent_entry_qp.html", function () {
    $module_name =
      $g_screen_type == "ab"
        ? "Absent Entry Subjectwise QP"
        : "Mal Practice Entry Subjectwise QP";
    $g_abs_entry_type = $g_screen_type == "ab" ? "QpA" : "QpM";
    document.getElementById("display_module_name").innerHTML = $module_name;
    document.getElementById("module_name_for_save").value =
      "SaveAbsentEntrySubjectwiseQP";
    /* document.getElementById('header_name').value = 'SaveAbsentEntrySubjectwiseQP'; 
	$("#header_name").html($module_name); */
    document.getElementById("is_add_edit").value = "Edit";
    clearabsenttextboxs();
    disableAbsentEntryButton();
    getDefaultHeadFooterLinks("Absent Entry QP Code");
    $g_abs_table_header_data = $("#abs_entry_table_header").html();

    BindAbsentSubCategoryDropDown();
    $("#abs_entry_sub_degree_code").focus();
    $g_abs_entry_default_data = "";
    $("#abs_default_reg_div").html("");
    $("#abs_default_reg_div").hide();
    $("#print_row").hide();
    if (db == "demo") {
      $("#abs_entry_qp_code").val("15522");
      $("#abs_sub_qp_name").val("E022 Software Engineering Theory");
      $("#abs_sub_date").val("10/03/2021");
      $("#abs_session_state").val("AM");
    }
  });
  $("#module_details_div").hide();
}

function clearabsenttextboxs() {
  $("#abs_entry_sub_degree_code").val("");
  $("#abs_sub_degree_name").val("");
  $("#abs_sub_Examno").val("");
  $("#abs_sub_Exam_name").val("");
  $("#abs_sub_final_subcode").val("");
  $("#abs_sub_fsubname").val("");
  $("#abs_sub_fssubname").val("");
  $("#abs_entry_shortname").val("");
  $("#abs_sub_date").val("");
  $("#abs_sub_range").val("");
}

function enableNewAbsentEntryQp() {
  $("#abs_default_reg_div").hide();
  $("#abs_main_mark_entry_div").show();
  $("#abs_subwise_regno_1").focus();
  $g_focus_element = "1";
}

function RemovingTrFromAbsentTableQp() {
  document.getElementById("abs_entry_table_header").innerHTML = "";
  $("#abs_entry_table_header").html($g_abs_table_header_data);
}

function BindAbsentSubCategoryDropDown() {
  $("#header_add").hide();
  $.ajax({
    type: "POST",
    data: "type=" + $g_screen_type,
    url: $host_url + "GetSubSubjectCategory.demo",
    success: FillAbsentDropDownData,
  });
  document.getElementById("abs_entry_table_header").innerHTML = "";
}

function FillAbsentDropDownData($responce) {
  $responce = eval("(" + $responce + ")");
  document.getElementById("abs_SubCategory").options.length = 0;

  for ($i = 0; $i < $responce.data.length; $i++) {
    $op = new Option($responce.data[$i]["Name"], $responce.data[$i]["Code"]);
    $op.id = $responce.data[$i]["Name"]; //specifying the id  for options
    document.getElementById("abs_SubCategory").options.add($op);
    document.getElementById("abs_SubCategory").disabled = true;
  }
}

function GetDefaultAbsMPEntryQp() {
  $("#header_add").hide();
  $("#abs_main_mark_entry_div").hide();
  //changeButtonImage('view_row');
  if (document.getElementById("is_add_edit").value == "Add") $type = "Add";
  else $type = "Edit";
  $limit = 10;
  document.getElementById("is_add_edit").value = "Edit";
  if ($("#abs_entry_qp_code").val() == "") {
    alert("Please Enter QP Code");
    $("#abs_entry_qp_code").focus();
    return;
  }
  if (empty($("#abs_sub_date").val())) {
    return false;
  }

  $list_data = "Degcode=" + $("#abs_entry_sub_degree_code").val();
  $list_data = "qp_code=" + $("#abs_entry_qp_code").val();
  $list_data += "&Subcode=" + $("#abs_sub_final_subcode").val();
  $list_data += "&Examno=" + $("#abs_sub_Examno").val();
  $list_data += "&FDOE=" + date_format($("#abs_sub_date").val());
  $list_data += "&FSESSION=" + $("#abs_session_state").val();
  $list_data += "&ScreenType=" + $g_abs_entry_type;
  console.log($list_data);
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getDefaultAbsentEntrySubjectRegNosQp.demo",
    data:
      $list_data +
      "&range=" +
      encodeURIComponent(trim($("#abs_sub_range").val())) +
      "&type=" +
      $type +
      "&limit=" +
      $limit,
    success: GetDefaultAbsMPEntryQpResponse,
  });
}

function GetDefaultAbsMPEntryQpResponse($responce) {
  $responce = eval("(" + $responce + ")");
  console.log($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();
    AddNewQpRow();
  }
}

function AddNewQpRow() {
  $("#header_add").hide();
  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;
  }

  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:90%;border:0px' ";
  html +=
    "onkeypress='return pulsar(event,this);' onblur='CheckAbsentEntryRegNoQp(this.id," +
    last_row_id +
    "),AddNewQpRow();' ";
  html +=
    "onkeydown='return KayboardGetRegno(event,this.id)' onfocus='$g_focus_element=" +
    last_row_id +
    "' value=''/>";
  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='center' style='width:60px; padding:2px; border-right:1px solid #C5DBEC;' align='left'>";
  html +=
    "<span  id='abs_check_" +
    last_row_id +
    "' style='background-color: #a93535f0;border: none;color: white;padding: 5px 20px;text-align: center;text-decoration: none;display: inline-block;font-size: 9px;cursor: pointer;border-radius: 7px;' onclick='deleteabsentstudentfront(qp_row_" +
    last_row_id +
    ");' >Delete</span>";
  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 MarkEnterySubjectWiseTableNextPage() {
  $RegnoTextbox = document.getElementsByName("Regno");
  $Len = parseInt($RegnoTextbox.length);
  $lastRegno = $RegnoTextbox[$Len - 1].value;
  $list_data = "Degcode=" + $("#abs_entry_sub_degree_code").val();
  $list_data += "&Subcode=" + $("#abs_sub_final_subcode").val();
  $list_data += "&Examno=" + $("#abs_sub_Examno").val();
  $list_data += "&ScreenType=" + $g_abs_entry_type;
  $list_data += "&LastRegno=" + $lastRegno;
  $list_data += "&FirstRegno=''";
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getDefaultAbsentEntrySubjectRegNosQp.demo",
    data:
      $list_data +
      "&range=" +
      encodeURIComponent(trim($("#markentry_sub_range").val())) +
      "&type=" +
      $type +
      "&limit=" +
      $limit,
    success: GetDefaultAbsMPEntryQpResponse,
  });
}

// function deleteabsentstudent(el){
// 	console.log('hi',el);
// // 	console.log(el.val);
// // 	$( "span" ).click(function() {
// //   $( "span" ).remove( ":contains('')" );
// // });

// }
// var deletestudlist = [];
function deleteabsentstudentfront(rowId) {
  rowId = rowId.id;
  if (confirm("Are you sure you want to delete student absent history?")) {
    $("#" + rowId).fadeOut("slow", function () {
      $("#" + rowId).remove();
    });
  } else {
    return false;
  }
}
function deleteabsentstudent(rowId, el) {
  console.log(rowId.id, el.id);
  console.log($("#abs_entry_qp_code").val());

  rowId = rowId.id;
  if (confirm("Are you sure you want to delete student absent history?")) {
    $("#" + rowId).fadeOut("slow", function () {
      $("#" + rowId).remove();
      var deletestudlist = {
        qpc: $("#abs_entry_qp_code").val(),
        studregno: el.id,
      };
      console.log(deletestudlist);
      // deletestudlist.push(obj);
      // console.log(deletestudlist);
      $.ajax({
        type: "POST",
        async: false,
        url: $host_url + "deletestudentabsententry.demo",
        data: "&deletestudlist=" + JSON.stringify(deletestudlist),
        success: deletedresponseResponce,
      });
    });
  } else {
    return false;
  }
}

function deletedresponseResponce($responce) {
  $responce = eval("(" + $responce + ")");
  console.log($responce);
  if ($responce.error_code == 0) {
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "getDefaultAbsentEntrySubjectRegNosQp.demo",
      data:
        $list_data +
        "&range=" +
        encodeURIComponent(trim($("#markentry_sub_range").val())) +
        "&type=" +
        $type +
        "&limit=" +
        $limit,
      success: GetDefaultAbsMPEntryQpResponse,
    });
    console.log("Im in");
  }
}
function MarkEnterySubjectWiseTablePrevPage() {
  $RegnoTextbox = document.getElementsByName("Regno");
  $Len = parseInt($RegnoTextbox.length);
  $FirstRegno = $RegnoTextbox[1].value;
  $list_data = "Degcode=" + $("#abs_entry_sub_degree_code").val();
  $list_data += "&Subcode=" + $("#abs_sub_final_subcode").val();
  $list_data += "&Examno=" + $("#abs_sub_Examno").val();
  $list_data += "&ScreenType=" + $g_abs_entry_type;
  $list_data += "&FirstRegno=" + $FirstRegno;
  $list_data += "&LastRegno=''";
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getDefaultAbsentEntrySubjectRegNosQp.demo",
    data:
      $list_data +
      "&range=" +
      encodeURIComponent(trim($("#markentry_sub_range").val())) +
      "&type=" +
      $type +
      "&limit=" +
      $limit,
    success: GetDefaultAbsMPEntryQpResponse,
  });
}
function CheckAbsentEntryRegNoQp($id, $tr_id) {
  var module_name_for_save = document.getElementById(
    "module_name_for_save"
  ).value;
  $ids = document.getElementById($id);
  $Regno = $ids.value;
  if ($Regno != "" && $g_abs_save_after_error_flag == 0) {
    $.ajax({
      type: "POST",
      async: false,
      data:
        "Regno=" +
        $Regno +
        "&id=" +
        $id +
        "&module_name_for_save=" +
        module_name_for_save,
      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_check_" + $responce.data["id"]).focus();
      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");
      $("#abs_subwise_regno_" + $responce.data["id"]).focus();
      $("#abs_subwise_regno_" + $responce.data).removeAttr("value");
      return false;
    }
  } else {
    $g_abs_valid_reg_no = 0;
    alert("Invaild Register Number");
    document.getElementById("abs_subwise_stuname_" + $responce.data).innerHTML =
      "";
    $("#abs_subwise_regno_" + $responce.data).focus();
    $("#abs_subwise_regno_" + $responce.data).removeAttr("value");

    //document.getElementById("abs_subwise_regno_"+ $responce.data).value='';
    document
      .getElementsById("abs_subwise_stuname_" + $responce.data)[0]
      .setAttribute("onblur", "AddNewQpRow()");
    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 () {
      CheckAbsentEntryRegNoQp(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 SaveAbsEntryQpStudetwise() {
  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 += "&ScreenType=" + $g_abs_entry_type;

  $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();
    var FRegno = $("#abs_subwise_regno_" + 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]["a_type"] = a_type;
    k++;
  });
  /* // ######################### For Edit Update####################################
 if(document.getElementById('is_add_edit').value=='Edit')
 {
	for($k=0;$k<$g_abs_entry_default_data.length;$k++)
	{	
		$id=$g_abs_entry_default_data[$k]['FREGNO'];
		$abs_setup_subwise[$k]= new Object(); 
		$abs_setup_subwise[$k]['FRegno']=$("#abs_reg_no_"+$id).val();
		if($("#abs_check_"+$id).is(':checked'))
		$abs_setup_subwise[$k]['cheked']=1;
		else 
		$abs_setup_subwise[$k]['cheked']=0; 
	 } 
	var myJSONText = encodeURIComponent(JSON.stringify($abs_setup_subwise));  
	$list_data+="&output_details="+myJSONText;
  }	 
	
// ######################### For Add####################################

else  if(document.getElementById('is_add_edit').value=='Add')
{
	$Textbox = document.getElementsByName("absent_subjectwise");
	$NumRow = $Textbox.length;
	$abs_all_reg_nos='';
	//alert($NumRow);
	$count =1;
	for($i=1;$i<=$NumRow;$i++)
	{
		if($("#abs_subwise_checkstatus_"+$i).is(':checked') && $("#abs_subwise_regno_"+$i).val()!='')
		{
			$abs_setup_subwise[$count]= new Object();
			$abs_all_reg_nos+="'"+$("#abs_subwise_regno_"+$i).val()+"',";
			$abs_setup_subwise[$count]['FRegno']=$("#abs_subwise_regno_"+$i).val();
			//alert($("#abs_subwise_regno_"+$i).val());
			$count++;
		}
	} var myJSONText = encodeURIComponent(JSON.stringify($abs_setup_subwise));  
	$list_data+="&output_details="+myJSONText+"&all_reg_nos="+encodeURIComponent($abs_all_reg_nos);
  }	 */
  var myJSONText = encodeURIComponent(JSON.stringify($abs_setup_subwise));
  $list_data += "&output_details=" + myJSONText;
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "SaveAbsEntryQpStudetwise.demo",
    data: $list_data,
    success: SaveAbsEntryQpStudetwiseResponce,
  });
}

function SaveAbsEntryQpStudetwiseResponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    alert($responce.data);
    absententrysubjectwiseQP();
    //clearabsenttextboxs();
    //RemovingTrFromAbsentTableQp();
    //$('#abs_entry_qp_code').focus;
    //$g_abs_save_after_error_flag=0;
  } else {
    alert($responce.data);
    $g_abs_save_after_error_flag = 1;
    $("#abs_subwise_regno_1").focus();
  }
}
function disableAbsentEntryButton() {
  /* document.getElementById("row_edit").setAttribute("class", "tarkabutton-disabled");
	document.getElementById("delete_row").setAttribute("class", "tarkabutton-disabled");
	document.getElementById("add_row").setAttribute("class", "tarkabutton-disabled");
	document.getElementById("save_row").setAttribute("class", "tarkabutton-disabled"); */
}
function AddAbsentEntryQp() {
  $("#header_add").hide();
  document.getElementById("is_add_edit").value = "Add";
  RemovingTrFromAbsentTableQp();
  enableNewAbsentEntryQp();
  $("#abs_default_reg_div").html("");
  $("#abs_default_reg_div").hide();
}