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.222.161.57
function callSubjectDetails() {
$("#page_main_div").load("../html_modules/subdet.html", function () {
document.getElementById("display_module_name").innerHTML =
"Subject Details";
document.getElementById("module_name_for_save").value = "Subject Details";
getDefaultHeadFooterLinks("Subject Details");
});
loadDegree();
}
function loadDegree() {
$.ajax({
type: "GET",
url: $host_url + "getDegreeSubDetails",
success: function (res) {
let response = JSON.parse(res);
let deg = `<option>---Select---</option>`;
if (response.error_code == 0) {
for (var i in response.data) {
deg += `<option value='${response.data[i].FDEGREE}'>${response.data[i].FDEGREE} - ${response.data[i].FDESCPN}</option>`;
i++;
}
$("#degree").html(deg);
} else {
alert("No data found");
return;
}
},
});
}
function loadSemester() {
var degree = $("#degree").val();
$.ajax({
type: "GET",
url: $host_url + "getSemSubDetails" + "°ree=" + degree,
success: function (res) {
let response = JSON.parse(res);
let sem = `<option>---Select---</option>`;
if (response.error_code == 0) {
for (var i in response.data) {
sem += `<option value='${response.data[i].FEXAMNO}'>${response.data[i].FEXAMNO} - ${response.data[i].FEXAMNAME}</option>`;
i++;
}
$("#sem").html(sem);
} else {
alert("No data found");
return;
}
},
});
}
function loadSubject() {
var degree = $("#degree").val();
var sem = $("#sem").val();
$.ajax({
type: "GET",
url: $host_url + "getSubSubDetails" + "°ree=" + degree + "&sem=" + sem,
success: function (res) {
let response = JSON.parse(res);
let sub = `<option>---Select---</option>`;
if (response.error_code == 0) {
for (var i in response.data) {
sub += `<option value='${response.data[i].fcsubcode}'>${response.data[i].fcsubcode} - ${response.data[i].fsubname}</option>`;
i++;
}
$("#subject").html(sub);
} else {
alert("No data found");
return;
}
},
});
}
function getSubDetData() {
var degree = $("#degree").val();
var sem = $("#sem").val();
var sub = $("#subject").val();
if (degree == "---Select---" || degree == "" || degree == null) {
alert("Select Degree");
return;
}
if (sem == "---Select---" || sem == "" || sem == null) {
alert("Select Sem");
return;
}
if (sub == "---Select---" || sub == "" || sub == null) {
alert("Select Subject");
return;
}
let param = "°ree=" + degree + "&sem=" + sem + "&sub=" + sub;
$.ajax({
type: "POST",
url: $host_url + "getSubDetData",
data: param,
success: function (res) {
let response = JSON.parse(res);
var tabledata = `<table align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
<tr class="ui-state-default ui-jqgrid-hdiv">
<th align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Element</th>
<th align="center" style="width:80px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Sub. Name</th>
<th align="center" style="width:120px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Th./Pr.</th>
<th align="center" style="width:70px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Max. Marks</th>
<th align="center" style="width:60px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Qn. No.</th>
<th align="center" style="width:50; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">No. of Tests</th>
<th align="center" style="width:50px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">U1 Max</th>
<th align="center" style="width:50px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">U2 Max</th>
<th align="center" style="width:50px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Order</th>
<th align="center" style="width:50px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Action</th>
</tr>
<tr>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<input type = 'text' id="element" maxlength="1" style="width: 70px; height: 25px" onblur="getElementsubDet()" onkeypress="return onlyNumberKey(event)"></td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<input type = 'text' id="subname" style="width: 100px; height: 25px"></td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<select id="theory" style="width: 126px;height: 30px;">
<option value='T'>Theory</option>
<option value='P'>Practical</option>
</select></td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<input type = 'text' id="maxmarks" style="width: 68px; height: 25px"></td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<input type = 'text' id="qnno" style="width: 60px; height: 25px"></td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<input type = 'text' id="notest" style="width: 82px; height: 25px"></td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<input type = 'text' id="u1max" style="width: 50px; height: 25px"></td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<input type = 'text' id="u2max" style="width: 50px; height: 25px"></td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<input type = 'text' id="order" style="width: 50px; height: 25px"></td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
<span
style="
background-color: #008cba;
border: none;
color: white;
padding: 7px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 13px;
cursor: pointer;
border-radius:4px;
"
onclick="saveSubDetData()"
>Save</span></td>
</tr>
</table>`;
$("#savetable").html(tabledata);
if (response.error_code == 0) {
let table = `<table align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
<tr>
<th align="left" colspan="14" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper"
style="font-size:12px; padding-left:6px; height:24px;">Subject Details</th>
</tr>
<tr class="ui-state-default ui-jqgrid-hdiv">
<th align="center" style="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="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Degree</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Exam No.</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Subject</th>
<th align="center" style="font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Element</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Sub. Name</th>
<th align="center" style="font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Th./Pr.</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Max Marks</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Qn. No.</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">No. of Tests</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">U1 Max</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">U2 Max</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Order</th>
<th align="center" style="font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Action</th>
</tr>`;
for (var i = 0; i < response.data.length; i++) {
table += `<tr>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${i + 1}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fdegree}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fexamno}
</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fcsubname}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fsubcode}
</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fsubname}
</td>
<td class="tbl_row_new" style="text-align:center; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].ftheory}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fmaxmarks}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fqnno}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fnotest}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fu1max}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].fu2max}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
${response.data[i].forder}
</td>
<td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;display:flex">
<span
onclick="editSubDetData(
'${response.data[i].fdegree}',
'${response.data[i].fexamno}',
'${response.data[i].fcsubcode}',
'${response.data[i].fsubcode}',
'${response.data[i].fsubname}',
'${response.data[i].fmaxmarks}',
'${response.data[i].fqnno}',
'${response.data[i].fnotest}',
'${response.data[i].fu1max}',
'${response.data[i].fu2max}',
'${response.data[i].forder}',
'${response.data[i].ftheory}'
)"
style="
background-color: #008cba;
border: none;
color: white;
padding: 6px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 13px;
cursor: pointer;
border-radius: 3px;">Edit</span>
<span
onclick="deleteSubDet(
'${response.data[i].fdegree}',
'${response.data[i].fexamno}',
'${response.data[i].fcsubcode}',
'${response.data[i].fsubcode}',
)"
style="
background-color: #FF0000;
border: none;
color: white;
padding: 6px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 13px;
cursor: pointer;
margin-left:5px;
border-radius: 3px;">Delete</span>
</td>
</tr>`;
}
table += `</table>`;
$("#getData").html(table);
}
},
});
}
function saveSubDetData() {
var degree = $("#degree").val();
var sem = $("#sem").val();
var sub = $("#subject").val();
var element = $("#element").val();
var subname = $("#subname").val();
var maxmarks = $("#maxmarks").val();
var qnno = $("#qnno").val();
var notest = $("#notest").val();
var u1max = $("#u1max").val();
var u2max = $("#u2max").val();
var order = $("#order").val();
var theory = $("#theory").val();
if (degree == "---Select---" || degree == "" || degree == null) {
alert("Select Degree");
return;
}
if (sem == "---Select---" || sem == "" || sem == null) {
alert("Select Sem");
return;
}
if (sub == "---Select---" || sub == "" || sub == null) {
alert("Select Subject");
return;
}
if (element == "") {
alert("Enter Element");
$("#element").focus();
return;
}
if (subname == "") {
alert("Enter Subject Name");
$("#subname").focus();
return;
}
if (maxmarks == "") {
alert("Enter Maximum Marks");
$("#maxmarks").focus();
return;
}
if (qnno == "") {
alert("Enter Question Number");
$("#qnno").focus();
return;
}
if (notest == "") {
alert("Enter Test Number");
$("#notest").focus();
return;
}
if (u1max == "") {
alert("Enter U1 Maximum Marks");
$("#u1max").focus();
return;
}
if (u2max == "") {
alert("Enter U2 Maximum Marks");
$("#u2max").focus();
return;
}
let param =
"degree=" +
degree +
"&sem=" +
sem +
"&sub=" +
sub +
"&element=" +
element +
"&subname=" +
subname +
"&maxmarks=" +
maxmarks +
"&qnno=" +
qnno +
"¬est=" +
notest +
"&u1max=" +
u1max +
"&u2max=" +
u2max +
"&order=" +
order +
"&theory=" +
theory;
$.ajax({
type: "POST",
url: $host_url + "saveSubDetData",
data: param,
success: function (res) {
let response = JSON.parse(res);
if (response.error_code == 0) {
alert(response.data.msg);
getSubDetData();
return;
} else {
alert(response.data.msg);
return;
}
},
});
}
function editSubDetData(
degree,
examno,
fcsubcode,
fsubcode,
fsubname,
fmaxmarks,
fqnno,
fnotest,
fu1max,
fu2max,
order,
theory
) {
$("#degree").val(degree);
$("#sem").val(examno);
$("#subject").val(fcsubcode);
$("#element").val(fsubcode);
$("#subname").val(fsubname);
$("#maxmarks").val(fmaxmarks);
$("#qnno").val(fqnno);
$("#notest").val(fnotest);
$("#u1max").val(fu1max);
$("#u2max").val(fu2max);
$("#element").prop("disabled", true);
$("#degree").prop("disabled", true);
$("#sem").prop("disabled", true);
$("#subject").prop("disabled", true);
$("#order").val(order);
$("#theory").val(theory);
}
function deleteSubDet(degree, examno, fcsubcode, fsubcode) {
var text = "Are You Sure?";
var params =
"degree=" +
degree +
"&sem=" +
examno +
"&sub=" +
fcsubcode +
"&element=" +
fsubcode;
if (confirm(text) == true) {
$.ajax({
type: "POST",
url: $host_url + "deleteSubDet",
data: params,
success: function (res) {
let response = JSON.parse(res);
if (response.error_code == 0) {
alert(response.data.msg);
getSubDetData();
return;
}
},
});
} else {
console.log("cancelled");
return;
}
}
function getElementsubDet() {
var degree = $("#degree").val();
var sem = $("#sem").val();
var sub = $("#subject").val();
var element = $("#element").val();
var params =
"degree=" + degree + "&sem=" + sem + "&sub=" + sub + "&element=" + element;
$.ajax({
type: "GET",
url: $host_url + "getElementsubDet",
data: params,
success: function (res) {
var response = JSON.parse(res);
if (response.error_code == 0) {
alert(response.data.msg);
$("#element").focus();
return;
}
},
});
}
function onlyNumberKey(evt) {
var ASCIICode = evt.which ? evt.which : evt.keyCode;
if (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57)) return false;
return true;
}
|