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.144.4.50
function marksentrycoursewisetwonew() {
$("#page_main_div").load(
"../html_modules/marksenrty_two_new.html?v=1122",
function () {
document.getElementById("display_module_name").innerHTML =
"Marks Entry (Course Wise 2 N)";
document.getElementById("module_name_for_save").value =
"Marks Entry (Course Wise 2 N)";
getDefaultHeadFooterLinks("Marks Entry (Course Wise 2 New)");
marksentrytwoteachloadNew();
if (window.db === "jssstu" || window.db === "jssu") {
$("#test_row").hide();
$("#unit_row").hide();
}
if (window.db === "jssstu") {
$("#showNote").show();
}
}
);
}
function marksentrytwoteachloadNew() {
$.ajax({
type: "POST",
url: $host_url + "loadIAteachcodenew",
//async: false,
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>`;
}
$("#teachname").html(teachnameoptions);
},
});
}
function marksentrytwoloadclassnamesnew() {
var techcode = document.getElementById("teachname").value;
if (techcode == "") {
return;
}
$.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>`;
}
$("#classnameoptions").html(classnameoption);
},
});
}
function marksentrytwoloadsubjectelements() {
var techcode = document.getElementById("teachname").value;
var classid = document.getElementById("classnameoptions").value;
$.ajax({
type: "POST",
data: "&techcode=" + techcode + "&classid=" + classid,
url: $host_url + "getDegSemSubDetnew",
success: function (response) {
var res = JSON.parse(response);
var checkdiv = "";
let checksrt = "";
if (res.error_code == 0) {
for (var i = 0; i < res.data.subelement.length; i++) {
checksrt += `<span style="padding-left: 5px;font-size: 15px;">${res.data.subelement[i].subname}</span><span style="position: relative; bottom: 9px;padding-left: 5px;"><input onclick="checkboxcheck('${res.data.subelement[i].fsubcode}')" type="checkbox" id="sub_${res.data.subelement[i].fsubcode}" value="${res.data.subelement[i].fsubcode}"/></span>| `;
}
checkdiv = `<tr>
<td style="display: flex;flex-wrap: wrap;">${checksrt}</td>
</tr>`;
}
$("#checksub").html(checkdiv);
},
});
}
var checkarr = [];
function checkboxcheck(subcode) {
var check = document.getElementById(`sub_${subcode}`).value;
checkarr.push(check);
let filter = checkarr.filter((el, i, checkarr) => checkarr.indexOf(el) == i);
}
function getTestMaxQnnew() {
var teachcode = document.getElementById("teachname").value;
var classid = document.getElementById("classnameoptions").value;
var subelement = document.getElementById("subElement").value;
let parameter =
"&teachname=" +
teachcode +
"&classid=" +
classid +
"&subelemnt=" +
subelement;
if (teachcode == "") {
return;
}
$.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>`;
}
}
$("#testName").html(test_options);
$("#txtmarks").val(response.data.sub.fvalmax);
$("#txtunits").val(response.data.sub.FNOQN);
$("#txtmarks").attr("disabled", true);
$("#txtunits").attr("disabled", true);
},
});
}
function getSubjectElementnew() {
var teachcode = document.getElementById("teachname").value;
var classid = document.getElementById("classnameoptions").value;
let parameter = "&techcode=" + teachcode + "&classid=" + classid;
if (teachcode == "") {
return;
}
$.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++) {
sub_options += `<option value="${response.data.subelement[i].fsubcode}*${response.data.subelement[i].subname}">${response.data.subelement[i].fsubcode} - ${response.data.subelement[i].subname}</option>`;
}
$("#subElement").html(sub_options);
} else {
alert(response.data.msg);
return;
}
},
});
}
function viewIAUnitwisenew() {
var teachcode = document.getElementById("teachname").value;
var classid = document.getElementById("classnameoptions").value;
var subelement = document.getElementById("subElement").value;
var txtmarks = document.getElementById("txtmarks").value;
var txtunits = document.getElementById("txtunits").value;
var testName = document.getElementById("testName").value;
let myArray = subelement.split("*");
subelement = myArray[0];
testName = myArray[1];
if (teachcode == "") {
alert("Please select teacher");
return;
}
if (classid == "") {
alert("Please select class");
return;
}
if (subelement == "") {
alert("Please select Subject");
return;
}
// if (txtunits == "") {
// alert("Units can be Empty");
// return;
// }
if (testName == "" || testName == null) {
alert("Test can be Empty");
return;
}
let parameter =
"teachcode=" +
teachcode +
"&classid=" +
classid +
"&subelement=" +
subelement +
"&txtmarks=" +
txtmarks +
"&txtunits=" +
txtunits +
"&testName=" +
testName;
$.ajax({
method: "GET",
url: $host_url + "viewIAUnitwisenew",
data: parameter,
success: function (res) {
var response = JSON.parse(res);
var sub_options = "";
if (response.error_code == 0) {
$("#createview").html(response.data.html);
} else {
alert(response.data.msg);
return;
}
},
});
}
function validateUnitMarks(maxmarks, regno, subcode, slno) {
let marks = $("#mes_marks_" + subcode + "_" + regno + "_" + slno).val();
if (marks == "") {
marks = 0;
}
if (parseFloat(marks) > parseFloat(maxmarks)) {
alert("Please Enter Valid Marks");
$("#mes_marks_" + subcode + "_" + regno + "_" + slno).val("");
document
.getElementById("mes_marks_" + subcode + "_" + regno + "_" + slno)
.focus();
return;
}
}
function addUnittottal(slno, regno, subcode) {
let x = 1;
let tot = "0";
let markscheck = slno;
for (let i = 0; i < slno; i++) {
let marks = $(`#mes_marks_${subcode}_${regno}_${x}`).val();
if (marks == "") {
marks = 0;
markscheck--;
} else if (marks.toLowerCase() == "ab") {
marks = 0;
markscheck--;
}
tot = parseFloat(tot) + parseFloat(marks);
x++;
}
if (markscheck == "0") tot = "-1";
$(`#mes_marks_tot_${regno}`).val(tot);
}
function gethidenupdate(id) {
let arry = id.split("_");
$(`#hidden_${arry[2]}_${arry[3]}`).val("U");
}
function saveIAEntryUnitnwisenew() {
var techcode = document.getElementById("teachname").value;
var classid = document.getElementById("classnameoptions").value;
var subelement = document.getElementById("subElement").value;
var txtmarks = document.getElementById("txtmarks").value;
var txtunits = document.getElementById("txtunits").value;
var testName = document.getElementById("testName").value;
if (techcode == "") {
alert("Please select teacher");
return;
}
if (classid == "") {
alert("Please select class");
return;
}
if (subelement == "") {
alert("Please select Subject");
return;
}
let subarry = [];
$("#showteachsub input[type=hidden]").each(function () {
let id = $(this).attr("id");
//console.log(id);
if ($(`#${id}`).val() == "U") {
let sucodeid = $(this).attr("id").split("_");
//console.log(sucodeid);
let sublen = {};
sublen["regno"] = sucodeid[2];
sublen["subcode"] = sucodeid[1];
let x = 1;
for (let i = 0; i < txtunits; i++) {
let marksval = "fmarks1" + x;
//console.log(marksval);
sublen[marksval] = $(
`#mes_marks_${sucodeid[1]}_${sucodeid[2]}_${x}`
).val();
x++;
}
subarry.push(sublen);
}
});
$.ajax({
type: "POST",
url: $host_url + "saveIAEntryUnitnwisenew",
data:
"&techcode=" +
techcode +
"&classid=" +
classid +
"&subelement=" +
subelement +
"&txtunits=" +
txtunits +
"&testName=" +
testName +
`&subarry=` +
JSON.stringify(subarry),
success: saveIAEntryUnitnwiseSuccess,
});
}
function saveIAEntryUnitnwiseSuccess($responce) {
$responce = eval("(" + $responce + ")");
alert($responce.data);
$("#createview").html("");
return;
}
function isNumberKey(evt, id) {
try {
var charCode = evt.which ? evt.which : event.keyCode;
if (charCode == 46) {
var txt = document.getElementById(id).value;
if (!(txt.indexOf(".") > -1)) {
return true;
}
}
if (charCode == 97 || charCode == 65 || charCode == 98 || charCode == 66) {
return true;
}
if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
return true;
} catch (w) {
alert(w);
}
}
|