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.21.244.34
Current Path : /var/www/oasis/js/ |
| Current File : /var/www/oasis/js/theorymarksentry.js |
function calltheorymarksentry() {
$("#page_main_div").load(
"../html_modules/theorymarksentry.html?v=1001",
function () {
document.getElementById("display_module_name").innerHTML =
"Theory Marks Entry";
document.getElementById("module_name_for_save").value =
"Theory Marks Entry";
getDefaultHeadFooterLinks("Theory Marks Entry");
getSemester();
getexamdate();
}
);
}
function getexamdate() {
$.ajax({
type: "GET",
url: $host_url + "getExamdates",
success: function (res) {
let response = JSON.parse(res);
if (response.error_code == 0) {
var date1 = "";
date1 += `<option>---Select---</option>`;
for (i = 0; i < response.data.length; i++) {
date1 += `<option value="${response.data[i].exam}">${response.data[i].exam}</option>`;
}
document.getElementById("examdate").innerHTML = date1;
} else {
alert(response.data.msg);
return;
}
},
});
}
function getNameDeg() {
let regNo = document.getElementById("reg").value;
if (regNo == "") {
alert("Enter Reg.No.");
return;
}
$.ajax({
type: "GET",
data: "reg=" + regNo,
url: $host_url + "getNameDegree",
success: function (res) {
let response = JSON.parse(res);
if (response.error_code == 0) {
document.getElementById("name").value = response.data.fname;
document.getElementById("degree").value = response.data.fdegree;
document.getElementById("s_semister").value = response.data.fexamno;
} else {
alert(response.data.msg);
return;
}
},
});
}
function getSemester() {
$.ajax({
type: "GET",
url: $host_url + "getSemForThMarks",
success: function (res) {
let response = JSON.parse(res);
if (response.error_code == 0) {
var opt3 = "";
opt3 += `<option>---Select---</option>`;
for (i = 0; i < response.data.length; i++) {
opt3 += `<option value="${response.data[i].fexamno}">${response.data[i].fexamno}</option>`;
}
document.getElementById("s_semister").innerHTML = opt3;
}
},
});
}
var thmarksarray = [];
function Getmarksddet() {
let regNo = document.getElementById("reg").value;
let degree = document.getElementById("degree").value;
let semester = document.getElementById("s_semister").value;
let examdate = document.getElementById("examdate").value;
if (regNo == "") {
alert("Enter Reg. No");
return;
}
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
thmarksarray = [];
$.ajax({
type: "GET",
data:
"°ree=" +
degree +
"®=" +
regNo +
"&s_semister=" +
semester +
"&examdate=" +
examdate,
url: $host_url + "theorymarksEntries",
success: function (res) {
let response = JSON.parse(res);
if (response.error_code == 0) {
var table = "";
table += `<table style='width: 80%; margin-left:10%;' 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'>Theory Marks</th></tr>
<tr align="center" class='ui-state-default ui-jqgrid-hdiv'>
<th align="center" class='column' >Sub Short</th>
<th align="center" class='column' >Subject Name</th>
<th align="center" class='column'>Max Marks</th>
<th align="center" class='column'>Marks</th>
<th align="center" class='column'>Pass Month</th>
</tr>`;
for (let i = 0; i < response.data.length; i++) {
thmarksarray.push(response.data[i]);
if (response.data[i].fmarks == undefined) {
$con = "";
} else {
$con = response.data[i].fmarks;
}
if (response.data[i].fpassmth == undefined) {
$conn = "";
} else {
$conn = response.data[i].fpassmth;
}
table += `<tr align='center' id='row_${i}' >
<td style=" font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC; text-align:center;"
>
${response.data[i].fcsubcode}
</td>
<td style=" font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC; text-align:left;"
>
${response.data[i].fsubname}
</td>
<td style=" width:55px; font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC; text-align:center;"
>
${response.data[i].fvalmax}
</td>
<td style=" font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC; text-align:center;"
>
<input style="width:55px;text-align:center;" value="${$con}" id="marks_${i}" oninput="getmarksdata('${i}',${response.data[i].fvalmax})"></input>
</td>
<td style=" font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC; text-align:center;"
>
<input style="width:100px;text-align:center;" value="${$conn}" id="passmth_${i}" onblur="getpassmthdata('${i}')"></input>
</td>`;
}
document.getElementById("datatable").innerHTML = table;
$.unblockUI();
} else {
document.getElementById(
"datatable"
).innerHTML = `<h3><b>Data Not Found</b></h3>`;
$.unblockUI();
}
},
});
}
function getmarksdata(i, valmarks) {
var marks = document.getElementById("marks_" + i).value;
thmarksarray[i]["fmarks"] = marks;
if (marks > valmarks) {
alert("Enter Valid Marks");
document.getElementById("marks_" + i).value = "";
document.getElementById("marks_" + i).focus();
return;
}
}
function getpassmthdata(i) {
var passmth = document.getElementById("passmth_" + i).value;
thmarksarray[i]["fpassmth"] = passmth;
}
function savetheorymarks() {
let examdate = document.getElementById("examdate").value;
let formdata = new FormData();
formdata.append("examdate", examdate);
formdata.append("data", JSON.stringify(thmarksarray));
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
url: $host_url + "savetocurrentmarkstable",
data: formdata,
contentType: false,
processData: false,
cache: false,
success: function (res) {
let response = JSON.parse(res);
if (response.error_code == 0) {
alert("Data Saved");
$.unblockUI();
return;
}
},
});
}
|