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.137.186.26
Current Path : /var/www/oasis/js/ |
| Current File : /var/www/oasis/js/identifyCoMarksNew.js |
function callIdentifyCoMarksNew() {
$("#page_main_div").load(
"../html_modules/identifyCoMarksNew.html?v=1122",
function () {
document.getElementById("display_module_name").innerHTML =
"Identify CO Marks New";
document.getElementById("module_name_for_save").value =
"Identify CO Marks New";
getDefaultHeadFooterLinks("Identify CO Marks New");
loadTeacherDataNew();
}
);
}
function loadTeacherDataNew() {
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
url: $host_url + "loadIAteachcodenew",
success: function (response) {
var res = JSON.parse(response);
var teachnameoptions = "";
teachnameoptions = "<option value=''>---Select Teacher---</option>";
for (var i = 0; i < res.data.length; i++) {
teachnameoptions += `<option value='${res.data[i].fteachcode}'>${res.data[i].fteachcode} - ${res.data[i].fteachname}</option>`;
}
$("#teachnamenew").html(teachnameoptions);
$.unblockUI();
},
});
}
function getClassNamesNew() {
let techcode = document.getElementById("teachnamenew").value;
if (techcode == "") {
return;
}
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
data: "&techcode=" + techcode,
url: $host_url + "getIAclassnamesnew",
success: function (response) {
var res = JSON.parse(response);
var classnameoption = "<option value=''>---Select Class Name---</option>";
for (var i = 0; i < res.data.length; i++) {
classnameoption += `<option value='${res.data[i].fclassid}'>${res.data[i].fclassname} - ${res.data[i].fclassid}</option>`;
}
$("#classnameoptionsnew").html(classnameoption);
$.unblockUI();
},
});
}
function getSubeleNew() {
let teachcode = document.getElementById("teachnamenew").value;
let classid = document.getElementById("classnameoptionsnew").value;
let parameter = "&techcode=" + teachcode + "&classid=" + classid;
if (teachcode == "") {
return;
}
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
method: "GET",
url: $host_url + "getDegSemSubDetnew",
data: parameter,
success: function (res) {
var response = JSON.parse(res);
var sub_options = "";
if (response.error_code == 0) {
sub_options += `<option>---Select---</option>`;
for (var i = 0; i < response.data.subelement.length; i++) {
let subname_opt = response.data.subelement[i].subname;
let subname = subname_opt.split(" ").join("_");
sub_options += `<option value=${
response.data.subelement[i].fsubcode + "*" + subname
}>${response.data.subelement[i].fsubshort} - ${
response.data.subelement[i].subname
}</option>`;
}
$("#subElementnew").html(sub_options);
$.unblockUI();
} else {
alert(response.data.msg);
$.unblockUI();
return;
}
},
});
}
function getTestMaximumNew() {
let teachcode = document.getElementById("teachnamenew").value;
let classid = document.getElementById("classnameoptionsnew").value;
let subelement = document.getElementById("subElementnew").value;
let splitSub = subelement.split("*");
let parameter =
"&teachname=" +
teachcode +
"&classid=" +
classid +
"&subelemnt=" +
splitSub[0];
if (teachcode == "") {
return;
}
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
method: "GET",
url: $host_url + "getTestMaxQnnew",
data: parameter,
success: function (res) {
var response = JSON.parse(res);
var test_options = "";
if (response.error_code == 0) {
for (let i = 1; i <= response.data.sub.ftest; i++) {
test_options += `<option value='Test ${i}'>Test ${i}</option>`;
}
}
$("#testNamenew").html(test_options);
$("#txtmarksnew").val(response.data.sub.fvalmax);
$("#txtmarksnew").attr("disabled", true);
$.unblockUI();
},
});
}
let arr = [];
function viewCoMarksDataNew() {
arr = [];
let alpha = [];
let qnmax = 10;
if(db == 'rrit')
alpha = ["A", "B"];
else
alpha = ["A", "B", "C", "D", "E"];
let co = `<table id='comarkstable' class='table' width='70%' cellspacing='0' cellpadding='0'>
<thead style='position: sticky; top: 0; z-index: 1'>
<tr><th align='left' colspan='17' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size: 12px;padding-left: 6px;height: 22px;border: 0;padding: 5px;'>
Marks Details
</th></tr>
<tr class='ui-state-default ui-jqgrid-hdiv'>
<th class="column" align="center" width='10%'>Sl. No.</th>
<th class="column" align="center" width='10%'>Question No.</th>
<th class="column" align="center" width='10%'>Max Marks</th>
<th class="column" align="center" width='70%'>Details</th>
</tr>
</thead><tbody>`;
let k = 0;
for (let i = 1; i <= qnmax; i++) {
for (let j = 0; j < alpha.length; j++) {
let marksid = `${i + alpha[j]}`;
let coid = `co_${i + alpha[j]}`;
co += `<tr class='ui-widget-content jqgrow'>`;
if (j == 0) {
co += `<td class='column' align='center' rowspan='${alpha.length}'>${i}</td>`;
}
co += `<td class='column' align='center'>${i}.${alpha[j]}</td>
<td class='column' align='center'><input type='text' id='${marksid}' value='' onblur="getMaxMarks('${marksid}')"/></td>
<td class='column'>`;
for (let l = 1; l <= 6; l++) {
co += ` CO${l}<input type='checkbox' id='${
coid + l
}' style='margin-right:10px;' onchange="checkHandler('${
coid + l
}', '${l}', '${i + alpha[j]}')"/>`;
}
co += `</td>
</tr>
`;
let obj = {};
obj.qnno = i + alpha[j];
obj.fqn = i;
arr.push(obj);
}
k++;
}
co += `</tbody></table>`;
$("#comarksnew").html(co);
viewData();
}
function viewData() {
let classid = document.getElementById("classnameoptionsnew").value;
let subelement = document.getElementById("subElementnew").value;
var testName = document.getElementById("testNamenew").value;
if (classid == "") {
alert("please select class");
return;
}
if (subelement == "") {
alert("please select Subject");
return;
}
if (testName == "") {
alert("please select test");
return;
}
let splitSubElement = subelement.split("*");
let subcode = splitSubElement[0];
let subject = splitSubElement[1];
let parameter =
"&classid=" + classid + "&subcode=" + subcode + "&testName=" + testName;
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "GET",
url: $host_url + "viewCOMarks",
data: parameter,
success: function (response) {
let res = JSON.parse(response);
console.log(res);
if (res.error_code === 0) {
$.unblockUI();
for (let i = 0; i < res.data.length; i++) {
document.getElementById(res.data[i]["FQNNO"]).value =
res.data[i]["FMARKS"];
if (res.data[i]["FCO"] != "") {
document.getElementById(
"co_" + res.data[i]["FQNNO"] + res.data[i]["FCO"]
).checked = true;
}
getMaxMarks(res.data[i]["FQNNO"]);
let id = "co_" + res.data[i]["FQNNO"] + res.data[i]["FCO"];
checkHandler(id, res.data[i]["FCO"], res.data[i]["FQNNO"]);
}
}
$.unblockUI();
},
});
}
function getMaxMarks(id) {
let marks = document.getElementById(id).value;
console.log(marks, "id");
for (let i = 0; i < arr.length; i++) {
if (arr[i].qnno === id) {
arr[i]["marks"] = marks;
}
}
}
function checkHandler(id, coVal, qn) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].qnno === qn && coVal != "") {
if (document.getElementById(id).checked) {
arr[i]["co"] = coVal;
}
}
}
}
function saveCoMarksNew() {
let classid = document.getElementById("classnameoptionsnew").value;
let subelement = document.getElementById("subElementnew").value;
var testName = document.getElementById("testNamenew").value;
let splitSubElement = subelement.split("*");
let subcode = splitSubElement[0];
console.log(arr);
const formdata = new FormData();
formdata.append("testName", testName);
formdata.append("classId", classid);
formdata.append("subelement", subcode);
formdata.append("data", JSON.stringify(arr));
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
url: $host_url + "saveCoMarksNew",
data: formdata,
processData: false,
contentType: false,
success: function (response) {
let res = JSON.parse(response);
if (res.error_code === 0) {
alert(res.data);
} else {
alert(res.data);
$.unblockUI();
return;
}
$.unblockUI();
},
});
}
|