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 : 13.58.221.124
function callAttendenceShortage() {
$("#page_main_div").load("../html_modules/attendemceshort.html?v=1001", {
function() {
document.getElementById("display_module_name").innerHTML =
"Attendence Shortage";
document.getElementById("module_name_for_save").value =
"Attendence Shortage";
getDefaultHeadFooterLinks("Attendence Shortage");
getDeggrp();
},
});
}
var iaattarray = [];
function getDeggrp() {
$.ajax({
url: $host_url + "attendenceshort",
success: function (res) {
var response = JSON.parse(res);
console.log(response, "degree");
if (response.status == "success") {
var option = `<option value=''>---Select---</option>`;
for (i = 0; i < response.data.data.length; i++) {
option += `<option value='${response.data.data[i].FDEGREE}'>${response.data.data[i].FDEGREE}-${response.data.data[i].FDESCPN}</option>`;
}
document.getElementById("deg").innerHTML = option;
}
},
});
}
function showData() {
var degree = document.getElementById("deg").value;
$.ajax({
url: $host_url + "attendenceshortagedata",
data: "deg=" + degree,
success: function (res) {
var response = JSON.parse(res);
console.log(response, "tabledata");
if (response.error_code == -1) {
let table = "";
table += `<h5>No Data Found</h5>`;
document.getElementById("attdatatable").innerHTML = table;
} else {
let 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'>Attendence Shortage</th></tr>
<tr align="center" class='ui-state-default ui-jqgrid-hdiv'>
<th class='column'>Sl. No.</th>
<th class='column'>Reg.No</th>
<th class='column'>Name</th>
<th class='column'>Subject Name</th>
<th class='column'>Attendence Shortage</th>
<th class='column'>IA Shortage</th>
<th class='column'><input type="checkbox" id="checkall" onchange="checkalliaatt()"></th>
</tr>
</thead>`;
for (let i = 0; i < response.data.data.length; i++) {
iaattarray.push(response.data.data[i]);
table += `<tr align='center'>
<td class='column'>${i + 1}</td>
<td class='column'>${response.data.data[i].regno}</td>
<td class='column'>${response.data.data[i].fname}</td>
<td class='column'>${response.data.data[i].subjectcode}</td>
<td class='column'>${response.data.data[i].attper}</td>
<td class='column'>${response.data.data[i].iaper}</td>
<td class='column'>
<input type="checkbox" id="checkonebyone_${i}"
onchange='checkIaAttData(${i})' />
</td>
</tr>`;
}
table += `</table>`;
document.getElementById("attdatatable").innerHTML = table;
}
},
});
}
function checkalliaatt() {
let checkAll = document.getElementById("checkall").checked;
for (let index = 0; index < iaattarray.length; index++) {
document.getElementById("checkonebyone_" + index).checked = checkAll;
iaattarray[index]["fstatus"] = checkAll;
}
}
function checkIaAttData(index) {
var checkitem = document.getElementById("checkonebyone_" + index).checked;
if (checkitem) {
iaattarray[index]["fstatus"] = checkitem;
} else {
iaattarray[index]["fstatus"] = checkitem;
}
}
function attendenceshort() {
let formdata = new FormData();
formdata.append("data", JSON.stringify(iaattarray));
$.ajax({
type: "POST",
url: $host_url + "attshorttable",
data: formdata,
contentType: false,
processData: false,
cache: false,
success: function (res) {
let response = JSON.parse(res);
console.log(response, "anita");
if (response.error_code == 0) {
console.log("data saved");
alert("Data Saved");
}
},
});
}
|