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.218.250.241
function callTeachFreeze() {
$("#page_main_div").load(
"../html_modules/teachfreeze.html?v=1122",
function () {
document.getElementById("display_module_name").innerHTML =
"Teacher Freeze";
document.getElementById("module_name_for_save").value = "Teacher Freeze";
getDefaultHeadFooterLinks("Teacher Freeze Teach");
loadteachfreezecode();
loadclassnamefreeze();
console.log(window);
}
);
}
function loadteachfreezecode() {
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
url: $host_url + "loadteachfreeze",
success: function (response) {
var res = JSON.parse(response);
console.log(res);
var teachnameoption = "";
if (res.data.length > 1) {
teachnameoption = "<option value=''>---Select Teacher---</option>";
}
for (var i = 0; i < res.data.length; i++) {
teachnameoption += `<option value='${res.data[i].fteachcode}'>${res.data[i].fteachcode} - ${res.data[i].fteachname}</option>`;
}
$("#teachload").html(teachnameoption);
$.unblockUI();
},
});
}
function loadclassnamefreeze() {
let teach = document.getElementById("teachload").value;
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
data: "&teach=" + teach,
url: $host_url + "loadclassnamefreeze",
success: function (res) {
var response = JSON.parse(res);
console.log(res);
var classnameoption = "";
classnameoption = "<option value=''>---Select Classname---</option>";
for (var i = 0; i < response.data.length; i++) {
classnameoption += `<option value='${response.data[i].fclassid} - ${response.data[i].fdegree} - ${response.data[i].fexamno}'>${response.data[i].fclassname}</option>`;
}
$("#classnameload").html(classnameoption);
$.unblockUI();
},
});
}
function viewteachFreeze() {
let teach = document.getElementById("teachload").value;
let classname = document.getElementById("classnameload").value;
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
data: "&teach=" + teach + "&classname=" + classname,
url: $host_url + "loadsubjectfreeze",
success: function (res) {
let response = JSON.parse(res);
// console.log(response);
// return;
var table = "";
if (response.error_code == 0) {
table += `<table align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
<tbody>
<tr style="position: sticky;
top: 0px;">
<th align="left" colspan="8" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper"
style="font-size:12px; padding-left:6px; height:24px;">Teacher Freeze</th>
</tr>
<tr class="ui-state-default ui-jqgrid-hdiv">
<th align="center" style="width:30px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Sl. No.</th>
<th align="center" style="width:50px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Subject Code</th>
<th align="center" style="width:150px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Subject Name</th>
<th align="center" style="width:40px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Teacher Freeze</th>
<th align="center" style="width:40px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Report Type</th>
<th align="center" style="width:100px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Action</th>
</tr>`;
var check = "";
let disabled = "";
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].fiateachfreez == "T") {
check = "checked";
disabled = "disabled";
} else {
check = "";
}
table += `<tr class="ui-widget-content jqgrow">
<td class="tbl_row_new" style="border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
i + 1
}</td>
<td class="tbl_row_new" style="border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
response.data[i].fsubcode
}</td>
<td class="tbl_row_new" style="border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${
response.data[i].fssubname
}</td>
<td class="tbl_row_new" style="border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;"><input id="checked_${
response.data[i].fsubcode
}" ${check} type="checkbox" value="T" ${disabled}/></td>
<td class="tbl_row_new" style="border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<select id='rep_opt_${i}' style="width: 100%;height: 29px;"><option value='pdf'>PDF</option><option value='excel'>EXCEL</option></select>
</td>
<td class="tbl_row_new" style="border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<span id="btnedit" onclick="teacherfreezereport('${classname}','${
response.data[i].fsubcode
}','${response.data[i].fexamno}','${
response.data[i].fdegree
}', ${i})" style="background-color: #008CBA; border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;"">Report</span>
</td>
</tr>`;
}
table += `</table>`;
$.unblockUI();
} else {
alert(response.data.msg);
$.unblockUI();
return;
}
$.unblockUI();
$("#teachertabledata").html(table);
},
});
}
function saveTeacherFreeze() {
let teach = document.getElementById("teachload").value;
let classname = document.getElementById("classnameload").value;
var arraydata = [];
$("#teachertabledata tr").each(function () {
var rowDataObjectdata = {};
var actualObject = $(this).find("td");
let i = 0;
if (actualObject.length > 0) {
let subcode = "";
actualObject.each(function () {
if (i == 1) {
subcode = $(this).text();
rowDataObjectdata["subcode"] = $(this).text();
}
if (i == 2) {
rowDataObjectdata["subname"] = $(this).text();
}
if (i == 3) {
if (document.getElementById(`checked_${subcode}`).checked == true) {
rowDataObjectdata["teacherfreeze"] = "T";
} else {
rowDataObjectdata["teacherfreeze"] = "F";
}
}
i++;
});
arraydata.push(rowDataObjectdata);
}
});
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
url: $host_url + "saveTeacherFreeze",
data:
"&teach=" +
teach +
"&classname=" +
classname +
"&data=" +
JSON.stringify(arraydata),
success: function (res) {
var response = JSON.parse(res);
console.log(response);
if (response.error_code == 0) {
alert(response.data);
$.unblockUI();
callTeachFreeze();
} else {
alert(response.data);
$.unblockUI();
return;
}
},
});
}
function teacherfreezereport(fclassid, fsubcode, fexamno, fdegree, index) {
console.log("rep_opt_" + index);
let rtype = document.getElementById("rep_opt_" + index).value;
let teach = document.getElementById("teachload").value;
var parameters = "&teachcode=" + teach + "&classid=" + fclassid;
if (rtype === "pdf") {
window.open($host_url + "printMarkListDetailsWisenew_sjbitx" + parameters);
} else if (rtype === "excel") {
window.open($host_url + "printMarkListDetailsWisenewExcel" + parameters);
}
}
function clearTeacherFreeze() {
callTeachFreeze();
}
|