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 : 18.118.128.17
function callPrincipalfreezingsubjestwise() {
$("#page_main_div").load(
"../html_modules/principalfreezingsubject.html?v=1001",
function () {
document.getElementById("display_module_name").innerHTML =
"Principal Freeze Subjectwise";
document.getElementById("module_name_for_save").value =
"Principal Freeze Subjectwise";
getDefaultHeadFooterLinks("Principal Freeze Subjectwise");
loadDgreerincipal();
}
);
}
function loadDgreerincipal() {
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "GET",
url: $host_url + "loadiadeg",
success: function (res) {
let response = JSON.parse(res);
// console.log(response.data.degcode);
if (response.status == "success") {
var option = `<option value=''>---Select---</option>`;
for (i = 0; i < response.data.degcode.length; i++) {
option += `<option value='${response.data.degcode[i].id}'>${response.data.degcode[i].value}</option>`;
}
document.getElementById("degree").innerHTML = option;
$.unblockUI();
}
$.unblockUI();
},
});
}
function semester() {
var degree = document.getElementById("degree").value;
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "GET",
url: $host_url + "getIaExamno",
data: "degcode=" + degree,
success: function (res) {
let response = JSON.parse(res);
// console.log(response);
var option = `<option value=''>---Select---</option>`;
for (i = 0; i < response.data.degexam.length; i++) {
option += `<option value='${response.data.degexam[i].id}'>${response.data.degexam[i].value}</option>`;
}
document.getElementById("sem").innerHTML = option;
$.unblockUI();
},
});
}
var freezearray = [];
function loadSubjectPrincipalFreeze() {
var degree = document.getElementById("degree").value;
var sem = document.getElementById("sem").value;
document.getElementById("datatable").innerHTML = "";
freezearray = [];
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "GET",
url: $host_url + "semesterfreeze",
data: "degcode=" + degree + "&sem=" + sem,
success: function (res) {
let response = JSON.parse(res);
console.log(response, "res");
if (response.status == "success") {
var table = "";
table += `<table style='width: 100%;' cellspacing='0'>`;
table += `<thead style='position:sticky; top:0'><tr>
<th colspan='7' style='padding:5px;' align='left' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper'>Principal Freezing Subjectwise</th></tr>
<tr align="center" class='ui-state-default ui-jqgrid-hdiv'>
<td class='column'>SI.NO</td>
<td class='column' >Subject</td>
<td class='column' style='border-right:0;'></td>
<td class='column' style='border-left:0;'>Teach. Freeze <br/> <input type="checkbox" id="checkTeach" onchange="checkalltofreeze('checkTeach', 'checkTeachFreez_', 'fiateachfreez')"></td>
<td class='column' >Principal Freeze <br/> <input type="checkbox" id="checkPrinci" onchange="checkalltofreeze('checkPrinci', 'checkPrinciFreez_', 'fiapricfreez')" ></th>
</tr>`;
for (let i = 0; i < response.data.data.length; i++) {
freezearray.push(response.data.data[i]);
teachChecked = "";
if (response.data.data[i].fiateachfreez == "T") {
teachChecked = "checked";
}
princiChecked = "";
if (response.data.data[i].fiapricfreez == "T") {
freezearray[i].fcheckedStatus = "T";
princiChecked = "checked";
}
let teachcode = "";
let split = response.data.data[i].fteachcode.split("|");
split.forEach((split) => {
if (split != "") {
teachcode = split;
}
});
let princidisable = "";
if (response.data.data[i].fiapricfreez == "T") {
princidisable = "disabled";
}
table += `<tr align='center'><td class='column'>${i + 1}</td>
<td class='column' align='initial'>${
response.data.data[i].fsubname
}</td>
<td class='column' style='border-right:0;' align='end'>
${teachcode}
</td>
<td class='column' style='border-left:0;'>
<input type="checkbox" id="checkTeachFreez_${i}"
onchange="checkFreezeData( ${i}, 'checkTeachFreez_', 'fiateachfreez')" ${teachChecked}>
</td>
<td class='column'>
<input type="checkbox" id="checkPrinciFreez_${i}"
onchange="checkFreezeData(${i}, 'checkPrinciFreez_', 'fiapricfreez')" ${princiChecked} ${princidisable}>
</td>
</tr>`;
}
table += `</table>`;
document.getElementById("datatable").innerHTML = table;
$.unblockUI();
}
$.unblockUI();
},
});
}
function checkalltofreeze(id, type, status) {
let checkAll = document.getElementById(id).checked;
let fstatus = "";
if (checkAll) {
fstatus = "T";
} else {
fstatus = "F";
}
for (let index = 0; index < freezearray.length; index++) {
if (freezearray[index].fcheckedStatus !== "T") {
if (freezearray[index].freezcnt === freezearray[index].totalcount) {
document.getElementById(type + index).checked = checkAll;
freezearray[index][status] = fstatus;
} else {
document.getElementById(type + index).checked = false;
}
}
}
}
function checkFreezeData(index, id, status) {
console.log(freezearray);
if (
(status === "fiapricfreez" && freezearray[index]["fiateachfreez"] == "T") ||
status === "fiateachfreez"
) {
var checkitem = document.getElementById(id + index).checked;
let fstatus = "";
if (checkitem) {
fstatus = "T";
} else {
fstatus = "F";
}
freezearray[index][status] = fstatus;
} else {
document.getElementById(id + index).checked = false;
}
if (freezearray[index].fiateachfreez == "F") {
document.getElementById("checkPrinciFreez_" + index).checked = false;
freezearray[index].fiapricfreez = "F";
}
console.log(freezearray);
}
function principalfreezingsubject() {
let formData = new FormData();
formData.append("data", JSON.stringify(freezearray));
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
url: $host_url + "savesterfreeze",
data: formData,
contentType: false,
processData: false,
cache: false,
success: function (res) {
var response = JSON.parse(res);
console.log(response);
if (response.data.error_code == 0) {
alert("saved");
}
$.unblockUI();
},
});
}
|