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.147.103.33
Current Path : /var/www/oasis/js_old/ |
| Current File : /var/www/oasis/js_old/AbsentEntrySubjectWise.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 Loadabsententrysubjectwise() {
$g_abs_popup = 1;
$g_abs_save_after_error_flag = 0;
window.enable_proper_module = "absententrystudetwise";
$("#page_main_div").load("../html_modules/absent_entry.html", function() {
$module_name =
$g_screen_type == "AB"
? "Absent Entry Subjectwise "
: "Mal Practice Entry Subjectwise ";
$g_abs_entry_type = $g_screen_type == "AB" ? "A" : "M";
document.getElementById("display_module_name").innerHTML = $module_name;
document.getElementById("module_name_for_save").value =
"SaveAbsentEntrySubjectwise";
document.getElementById("header_name").value = "SaveAbsentEntrySubjectwise";
$("#header_name").html($module_name);
document.getElementById("is_add_edit").value = "Edit";
clearabsenttextboxs();
disableAbsentEntryButton();
getDefaultHeadFooterLinks("Absent Entry");
$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();
});
$("#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 enableNewAbsentEntry() {
$("#abs_default_reg_div").hide();
$("#abs_main_mark_entry_div").show();
$("#abs_subwise_regno_1").focus();
}
function RemovingTrFromAbsentTable() {
document.getElementById("abs_entry_table_header").innerHTML = "";
$("#abs_entry_table_header").html($g_abs_table_header_data);
}
function BindAbsentSubCategoryDropDown() {
$.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 GetDefaultAbsMPEntry() {
$("#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_sub_degree_code").val() == "") {
alert("Please Enter Degree Name");
$("#abs_entry_sub_degree_code").focus();
return;
}
$list_data = "Degcode=" + $("#abs_entry_sub_degree_code").val();
$list_data += "&Subcode=" + $("#abs_sub_final_subcode").val();
$list_data += "&fsession=" + $("#abs_session_state").val();
$list_data += "&date=" + date_format($("#abs_sub_date").val());
$list_data += "&Examno=" + $("#abs_sub_Examno").val();
$list_data += "&ScreenType=" + $g_abs_entry_type;
$.ajax({
type: "POST",
//async:false,
url: $host_url + "getDefaultAbsentEntrySubjectRegNos.demo",
data:
$list_data +
"&range=" +
encodeURIComponent(trim($("#abs_sub_range").val())) +
"&type=" +
$type +
"&limit=" +
$limit,
success: GetDefaultAbsMPEntryResponse
});
}
function GetDefaultAbsMPEntryResponse($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 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 + "getDefaultAbsentEntrySubjectRegNos.demo",
data:
$list_data +
"&range=" +
encodeURIComponent(trim($("#markentry_sub_range").val())) +
"&type=" +
$type +
"&limit=" +
$limit,
success: GetDefaultAbsMPEntryResponse
});
}
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 + "getDefaultAbsentEntrySubjectRegNos.demo",
data:
$list_data +
"&range=" +
encodeURIComponent(trim($("#markentry_sub_range").val())) +
"&type=" +
$type +
"&limit=" +
$limit,
success: GetDefaultAbsMPEntryResponse
});
}
function CheckAbsentEntryRegNo($id, $tr_id) {
$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,
url: $host_url + "CheckEnteredRegisterNo.demo",
success: PopulateAbsentCheckRegisterNoResponse
});
} else {
$("#abs_subwise_stuname_" + $tr_id).val("");
$("#abs_subwise_regno_" + $tr_id).focus();
return false;
}
}
//////////////////////// Check Register Number Response \\\\\\\\\\\\\\\\\\\\\\\\\\\\
function PopulateAbsentCheckRegisterNoResponse($responce) {
$responce = eval("(" + $responce + ")");
if ($responce.error_code == 0) {
$g_abs_valid_reg_no = 1;
$check_dup = $responce.data.fregno;
$check_dup_flag = 0;
$Textbox = document.getElementsByName("absent_subjectwise");
$NumTextBox = $Textbox.length;
for ($m = 1; $m <= $NumTextBox; $m++) {
if (
$m != $responce.data.id &&
$check_dup == $("#abs_subwise_regno_" + $m).val()
)
$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_checkstatus_" + $responce.data["id"])
.focus();
return true;
} else {
$g_abs_valid_reg_no = 0;
alert($responce.data["fregno"] + "allready Selected");
//document.getElementById("abs_subwise_regno_"+ $responce.data['id']).value="";
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='';
return false;
}
}
////////////////// Create Next Row \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function CreateNextRowAbsentEntry($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() {
CheckAbsentEntryRegNo(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() {
CreateNextRowAbsentEntry(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 SaveAbsEntryStudetwise() {
if ($("#abs_entry_sub_degree_code").val() == "") {
alert("Please Enter The Degree Code");
$("#abs_entry_sub_degree_code").focus();
return false;
}
if ($("#abs_sub_Examno").val() == "") {
alert("Please Enter The Examno");
$("#abs_sub_Examno").focus();
return false;
}
if ($("#abs_sub_final_subcode").val() == "") {
alert("Please Enter The subject code");
$("#abs_sub_final_subcode").focus();
return false;
}
$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 += "&type=" + $("#is_add_edit").val();
$list_data += "&date=" + date_format($("#abs_sub_date").val());
$list_data += "&Session=" + $("#abs_session_state").val();
$abs_setup_subwise = new Object();
// ######################### 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);
}
$.ajax({
type: "POST",
async: false,
url: $host_url + "saveAbsEntrySubjectwise.demo",
data: $list_data,
success: saveAbsEntrySubjectwiseResponce
});
}
function saveAbsEntrySubjectwiseResponce($responce) {
$responce = eval("(" + $responce + ")");
if ($responce.error_code == 0) {
alert($responce.data);
//clearabsenttextboxs();
RemovingTrFromAbsentTable();
$("#abs_entry_sub_degree_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 AddAbsentEntry() {
$("#header_add").hide();
$("#footer_add").hide();
document.getElementById("is_add_edit").value = "Add";
RemovingTrFromAbsentTable();
enableNewAbsentEntry();
$("#abs_default_reg_div").html("");
$("#abs_default_reg_div").hide();
}
|