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.219.81.129
function loadPrincipalFreeze() {
$("#page_main_div").load(
"../html_modules/principalfreeze.html?",
function () {
document.getElementById("display_module_name").innerHTML =
"Principal Freeze";
document.getElementById("module_name_for_save").value =
"Principal Freeze";
getDefaultHeadFooterLinks("Principal Freeze");
loadTeacher();
}
);
}
function loadTeacher() {
$.ajax({
type: "GET",
url: $host_url + "loadTeacherName",
success: function (res) {
let response = JSON.parse(res);
var teach = "";
if (response.error_code == 0) {
teach += `<option value="">---select---</option>`;
for (var i = 0; i < response.data.length; i++) {
teach += `<option value = '${response.data[i].FTEACHCODE}'>${response.data[i].FTEACHCODE} - ${response.data[i].FTEACHNAME}</option>`;
}
} else {
alert(response.data.msg);
return;
}
$("#selectTeacher").html(teach);
},
});
}
function loadClassNamePrincipal() {
let teachcode = $("#selectTeacher").val();
$.ajax({
type: "GET",
url: $host_url + "loadClassNamePrincipal",
data: "&teachcode=" + teachcode,
success: function (res) {
let response = JSON.parse(res);
let classname = "";
if (response.error_code == 0) {
classname += ` <option value="">---select---</option>`;
for (var i = 0; i < response.data.length; i++) {
classname += `<option value='${response.data[i].fclassid} - ${response.data[i].fdegree} - ${response.data[i].fexamno}'>${response.data[i].fclassname}</option>`;
}
} else {
alert(response.data.msg);
return;
}
$("#selectclassname").html(classname);
},
});
}
function loadSubjectNamePrincipal() {
let teachcode = $("#selectTeacher").val();
let classcode = $("#selectclassname").val();
$.ajax({
type: "GET",
url: $host_url + "loadSubjectNamePrincipal",
data: "&teachcode=" + teachcode + "&classcode=" + classcode,
success: function (res) {
let response = JSON.parse(res);
var table = "";
// console.log(response);
// return
if (response.error_code == 0) {
table += `<table id="tabledatatable" align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
<thead style="position:sticky;top:0">
<tr class="ui-state-default ui-jqgrid-hdiv">
<td align="center" style="width:40px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">SLNO.</td>
<td align="center" style="width:100px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Subject Code</td>
<td align="center" style="width:200px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Subject Name</td>
<td align="center" style="width:150px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Teacher Freeze<br/>
</td>
<td align="center" style="width:150px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Principal Freeze<br/>
</td>
</td>
<td align="center" style="width:200px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Action<br/>
</td>
</tr>
</thead> <tbody>`;
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].fiapricfreez == "T") {
check = "checked";
} 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="checkedTeach_${
response.data[i].fsubcode
}" 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;"><input ${check} check id="checkedprinci_${
response.data[i].fsubcode
}" type="checkbox" value="T"/></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 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;" onclick="getPrincipalFreezeReport('${
response.data[i].fsubcode
}')">Report</span></td>
</tr>`;
// console.log(response.data[i].fsubcode);
}
table += `</table>`;
} else {
alert(response.data.msg);
return;
}
$("#tabledata").html(table);
},
});
}
function savePrincipalFreeze() {
let teachcode = $("#selectTeacher").val();
let classcode = $("#selectclassname").val();
var array = [];
$("#tabledatatable tr").each(function () {
var rowDataObject = {};
var actualObject = $(this).find("td");
// console.log(actualObject);
// return;
let i = 0;
if (actualObject.length > 0) {
var subcode = "";
actualObject.each(function () {
if (i == 1) {
subcode = $(this).text();
rowDataObject["subcode"] = $(this).text();
}
if (i == 2) {
rowDataObject["subname"] = $(this).text();
}
// if (i == 3) {
// if ($("#checkedTeach_" + subcode).prop("checked")) {
// rowDataObject["teacherfreeze"] = "T";
// } else {
// rowDataObject["teacherfreeze"] = "F";
// }
// }
if (i == 4) {
if ($("#checkedprinci_" + subcode).prop("checked")) {
rowDataObject["princfreeze"] = "T";
} else {
rowDataObject["princfreeze"] = "F";
}
}
i++;
});
array.push(rowDataObject);
}
});
$.ajax({
type: "POST",
url: $host_url + "savePrincipalFreeze",
data:
"&teachcode=" +
teachcode +
"&classcode=" +
classcode +
"&data=" +
JSON.stringify(array),
success: function (res) {
var response = JSON.parse(res);
console.log(response);
if (response.error_code == 0) {
alert(response.data);
return;
} else {
alert(response.data);
return;
}
},
});
}
function getPrincipalFreezeReport(subcode) {
let teachcode = $("#selectTeacher").val();
let classcode = $("#selectclassname").val();
window.open(
$host_url +
"principalFreeze_report" +
"&subcode=" +
subcode +
"&teachcode=" +
teachcode +
"&classcode=" +
classcode
);
}
|