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.227.105.164
var tablesummaryarr = [];
var tableDetArr = [];
function callQpPattern() {
// console.log('hi');
$("#page_main_div").load("html_modules/qppattern.html", function () {
document.getElementById("display_module_name").innerHTML = "QP Pattern";
document.getElementById("module_name_for_save").value = "QP Pattern";
getDefaultHeadFooterLinks("QP Pattern");
});
loadQpPattern();
}
function loadQpPattern() {
$.ajax({
type: "GET",
url: $host_url + "loadQpPattern",
success: function (response) {
var encode = JSON.parse(response);
var slno = 1;
var table = `<table align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
<tbody>
<tr>
<th align="left" colspan="7" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper"
style="font-size:12px; padding-left:6px; height:24px;">Qp Pattern</th>
</tr>
<tr class="ui-state-default ui-jqgrid-hdiv">
<td >Sl.<br>No.</td>
<td align="center" style="width:85px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Template Code</td>
<td align="center" style="width:255px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Template Name</td>
<td align="center" style="width:255px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Description</td>
<td align="center" style="width:70px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Action</td>
</tr>`;
if (encode.error_code == 0) {
for (var i = 0; i < encode.data.length; i++) {
// console.log(encode.data[i].fstatus);
// return;
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;">${slno++}</td>
<td class="tbl_row_new" style="text-align:initial;border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
encode.data[i].ftempcode
}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${
encode.data[i].ftempname
}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${
encode.data[i].ftempdesc
}</td>
<td><span id="btnedit" onclick="editqppatterndet('${
encode.data[i].ftempcode
}')" 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;"">Edit</span></td>
</tr>`;
}
table += `</table>`;
$("#tabledata").html(table);
}
},
});
}
function addPattern() {
$("#page_main_div").load("html_modules/qppatterntemplate.html", function () {
document.getElementById("display_module_name").innerHTML = "QP Pattern";
document.getElementById("module_name_for_save").value = "QP Pattern";
getDefaultHeadFooterLinks("QP Pattern");
var data = "add";
$("#adddata").val(data);
$("#div-sum-content").show();
var tabsummary = `<table id="tsummarydata" align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
<tbody>
<tr>
<th align="left" colspan="8" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper"
style="font-size:12px; padding-left:6px; height:24px;">Qp Pattern</th>
</tr>
<tr class="ui-state-default ui-jqgrid-hdiv">
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Sl.<br>No.</td>
<td align="center" style="width:85px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Part Code</td>
<td align="center" style="width:350px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Part Description</td>
<td align="center" style="width:120px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Max. Qns.</td>
<td align="center" style="width:120px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Mand. Qns.</td>
<td align="center" style="width:120px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Max. Marks</td>
<td align="center" style="width:120px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Min.Qns</td>
<td align="center" style="width:70px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Action</td>
</tr></table>`;
$("#summarytab").html(tabsummary);
});
}
function summaryContent() {
$("#div-sum-content").show();
$("#det-content").hide();
$("#detailedtab").hide();
}
function DetailedContent() {
$("#div-sum-content").hide();
$("#detailedtab").show();
var tempcode = document.getElementById("temp_code").value;
$.ajax({
type: "GET",
data: "tempcode=" + tempcode,
url: $host_url + "loadContentDet",
success: function (response) {
var encode = JSON.parse(response);
// console.log(encode);
var det_content = "";
if (encode.error_code == 0) {
$("#det-content").show();
for (var i = 0; i < encode.data.length; i++) {
det_content += `<span id="${encode.data[i].fpartcode}" onclick="btnPartCode('${encode.data[i].fpartcode}', '${tempcode}')">${encode.data[i].fpartcode}</span>`;
}
$("#det-content").html(det_content);
// btnPartCode(encode.fpartcode, tempcode);
} else {
btnPartCode();
}
},
});
}
function editqppatterndet(tempcode) {
addPattern();
$.ajax({
type: "GET",
data: "tempcode=" + tempcode,
url: $host_url + "editqppatterndet",
success: function (response) {
var encode = JSON.parse(response);
var slno = 1;
var tabsummary = `<table id="tsummarydata" align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
<tbody>
<tr>
<th align="left" colspan="8" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper"
style="font-size:12px; padding-left:6px; height:24px;">Qp Pattern</th>
</tr>
<tr class="ui-state-default ui-jqgrid-hdiv">
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Sl.<br>No.</td>
<td align="center" style="width:85px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Part Code</td>
<td align="center" style="width:350px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Part Description</td>
<td align="center" style="width:120px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Max. Qns.</td>
<td align="center" style="width:120px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Mand. Qns.</td>
<td align="center" style="width:120px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Max. Marks</td>
<td align="center" style="width:120px; font-size:12px; padding:5px 5px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Min.Qns</td>
<td align="center" style="width:70px; font-size:12px;
border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Action</td>
</tr>`;
if (encode.error_code == 0) {
$("#div-sum-content").show();
$("#temp_code").val(encode.data.tempcode.ftempcode);
$("#temp_despn").val(encode.data.tempcode.ftempdesc);
$("#temp_name").val(encode.data.tempcode.ftempname);
$("#max_marks").val(encode.data.tempcode.fmaxmarks);
$("#mans_qns").val(encode.data.tempcode.ftotmandqn);
$("#temp_code").attr("disabled", "disabled");
$("#temp_despn").attr("disabled", "disabled");
$("#temp_name").attr("disabled", "disabled");
$("#max_marks").attr("disabled", "disabled");
$("#mans_qns").attr("disabled", "disabled");
for (var i = 0; i < encode.data.table.length; i++) {
tablesummaryarr.push(encode.data.table[i]);
tabsummary += `<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;">${slno++}</td>
<td class="tbl_row_new" style="text-align:initial;border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
encode.data.table[i].fpartcode
}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${
encode.data.table[i].fpartdesc
}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${
encode.data.table[i].fmaxqn
}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${
encode.data.table[i].fmandqn
}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${
encode.data.table[i].fmaxmarks
}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${
encode.data.table[i].fminqn
}</td>
<td><span id="btnedit" onclick="deleteSummaryDetails('${
encode.data.table[i].fpartcode
}', '${
encode.data.table[i].ftempcode
}')" style="background-color: #ff0000; border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;"">Delete</span></td>
</tr>`;
}
tabsummary += `</table>`;
$("#summarytab").html(tabsummary);
var data = "";
$("#adddata").val(data);
// console.log(tablesummaryarr);
// return;
}
},
});
}
function btnPartCode(partcode, tempcode) {
$.ajax({
type: "GET",
data: "partcode=" + partcode + "&tempcode=" + tempcode,
url: $host_url + "btnPartCode",
success: function (response) {
var encode = JSON.parse(response);
var slno = 1;
// console.log(encode.data.partcode);
// return;
var tabledetdata = `<table id="tdatadet" align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
<tbody>
<tr>
<th colspan="11" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper"
style="font-size:12px; padding-left:6px; height:24px;text-align-last: right;">
<span style="background-color: #00ff80; border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;" onclick="addDet('${partcode}','${tempcode}')">Add</span>
<span style="background-color: #0080ff; border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;" onclick="saveDet('${partcode}', '${tempcode}')">Save</span></th>`;
$("#partdata").val(partcode);
// console.log(partcode);
// return;
tabledetdata += `</tr>
<tr class="ui-state-default ui-jqgrid-hdiv">
<td align="center" style="width:30px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Sl.<br>No.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Qn. Code</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Qn. No.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Level</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Parent</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Max. Marks</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Sub Qns.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Max Qns.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Mand Qns.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Order</td>
<td align="center" style="width:70px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Action</td>
</tr>`;
if (encode.error_code == 0) {
for (var i = 0; i < encode.data.table.length; i++) {
// $(`qncode_${i}`).attr('disabled', 'disabled');
tableDetArr.push(encode.data.table[i]);
tabledetdata += `<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;">${slno++}</td>
<td class="tbl_row_new" style="border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<input style="width:50px;text-align:center;" type="text" id = 'qncode_${i}' value="${
encode.data.table[i].fqncode
}" disabled></td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<input style="width:50px;text-align:center;" type="text" id='qnno_${i}' value="${
encode.data.table[i].fqnno
}"></td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<input style="width:50px;text-align:center;" type="text" id='qnlevel_${i}' value="${
encode.data.table[i].fqnlevel
}"></td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<input style="width:50px;text-align:center;" type="text" id='qnparent_${i}' value="${
encode.data.table[i].fqnparent
}"></td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<input style="width:50px;text-align:center;" type="text" id='maxmarks_${i}' value="${
encode.data.table[i].fmaxmarks
}"></td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<input style="width:50px;text-align:center;" type="text" id='subqp_${i}' value="${
encode.data.table[i].fsubqp
}"></td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<input style="width:50px;text-align:center;" type="text" id='submaxqn_${i}' value="${
encode.data.table[i].fsubmaxqn
}"></td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<input style="width:50px;text-align:center;" type="text" id='submandqn_${i}' value="${
encode.data.table[i].fsubmandqn
}"></td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
<input style="width:50px;text-align:center;" type="text" id='qnord_${i}' value="${
encode.data.table[i].fqnord
}"></td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;"><span id="btnedit" onclick="deleteDetailedReport('${
encode.data.table[i].fpartcode
}','${encode.data.table[i].fqncode}','${
encode.data.table[i].ftempcode
}')" style="background-color: #ff0000; border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;"">Delete</span></td>
</tr>`;
}
$("#detailedtab").html(tabledetdata);
} else {
var tabledetdata = `<table id="tdatadet" align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
<tbody>
<tr>
<th colspan="11" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper"
style="font-size:12px; padding-left:6px; height:24px;text-align-last: right;">
<span style="background-color: #00ff80; border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;" onclick="addDet('${partcode}','${tempcode}')">Add</span>
<span style="background-color: #0080ff; border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;" onclick="saveDet('${partcode}', '${tempcode}')">Save</span></th>`;
$("#partdata").val(partcode);
// console.log(partcode);
// return;
tabledetdata += `</tr>
<tr class="ui-state-default ui-jqgrid-hdiv">
<td align="center" style="width:30px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Sl.<br>No.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Qn. Code</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Qn. No.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Level</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Parent</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Max. Marks</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Sub Qns.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Max Qns.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Mand Qns.</td>
<td align="center" style="width:50px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Order</td>
<td align="center" style="width:70px; font-size:12px;
border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC;
border-bottom:1px solid #C5DBEC;">Action</td>
</tr></table>`;
$("#detailedtab").html(tabledetdata);
}
},
});
}
function addsummary() {
// console.log(tablesummaryarr);
// return;
var part_code = document.getElementById("part_code").value;
var part_disc = document.getElementById("part_disc").value;
var max_qns = document.getElementById("max_qns").value;
var mand_qns = document.getElementById("mand_qns").value;
var max_mks = document.getElementById("max_mks").value;
var min_qns = document.getElementById("min_qns").value;
if (document.getElementById("part_code").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("part_disc").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("max_qns").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("mand_qns").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("max_mks").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("min_qns").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("temp_code").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("temp_name").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("temp_despn").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("mans_qns").value == "") {
alert("fill all the details");
return;
}
if (document.getElementById("max_marks").value == "") {
alert("fill all the details");
return;
}
var addobj = {
fpartcode: part_code,
fpartdesc: part_disc,
fmaxqn: max_qns,
fmandqn: mand_qns,
fmaxmarks: max_mks,
fminqn: min_qns,
};
tablesummaryarr.push(addobj);
let i = tablesummaryarr.length;
// console.log(i);
var addtab = ` <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}</td>
<td class="tbl_row_new" style="text-align:initial;border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${addobj.fpartcode}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${addobj.fpartdesc}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${addobj.fmaxqn}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${addobj.fmandqn}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${addobj.fmaxmarks}</td>
<td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${addobj.fminqn}</td>
<td><span id="btnedit" onclick="editqppatterndet()" style="background-color: #ff0000; border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;"">Delete</span></td>
</tr>`;
$("#tsummarydata").append(addtab);
}
function addDet(data) {
console.log(tableDetArr);
let j = tableDetArr.length;
console.log(j);
if (
$(`#qncode_${j - 1}`).val() == "" ||
$(`#qnno_${j - 1}`).val() == "" ||
$(`#qnlevel_${j - 1}`).val() == "" ||
$(`#qnparent_${j - 1}`).val() == "" ||
$(`#maxmarks_${j - 1}`).val() == "" ||
$(`#subqp_${j - 1}`).val() == "" ||
$(`#submaxqn_${j - 1}`).val() == "" ||
$(`#submandqn_${j - 1}`).val() == "" ||
$(`#qnord_${j - 1}`).val() == ""
) {
alert("Please fill all the details..!");
return;
}
var addDetails = {
fqncode: `<input style="width:50px;" type="text" id="qncode_${j}" name="qncode" value="" onblur="checkqncode()"/>`,
fqnno: `<input style="width:50px;" type="text" id="qnno_${j}" name="qnno" value=""/>`,
fqnlevel: `<input style="width:50px;" type="text" id="qnlevel_${j}" name="level" value=""/>`,
fqnparent: `<input style="width:50px;" type="text" id="qnparent_${j}" name="parent" value=""/>`,
fmaxmarks: `<input style="width:50px;" type="text" id="maxmarks_${j}" name="maxmarks" value=""/>`,
fsubqp: `<input style="width:50px;" type="text" id="subqp_${j}" name="subqns" value=""/>`,
fsubmaxqn: `<input style="width:50px;" type="text" id="submaxqn_${j}" name="maxqns" value=""/>`,
fsubmandqn: `<input style="width:50px;" type="text" id="submandqn_${j}" name="mandqns" value=""/>`,
fqnord: `<input style="width:50px;" type="text" id="qnord_${j}" name="order" value=""/>`,
};
tableDetArr.push(addDetails);
addrow = `<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;">${
j + 1
}</td>
<td class="tbl_row_new" style="border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
addDetails.fqncode
}</td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
addDetails.fqnno
}</td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
addDetails.fqnlevel
}</td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
addDetails.fqnparent
}</td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
addDetails.fmaxmarks
}</td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
addDetails.fsubqp
}</td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
addDetails.fsubmaxqn
}</td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
addDetails.fsubmandqn
}</td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
addDetails.fqnord
}</td>
<td class="tbl_row_new" style=" border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;"><span id="btnedit" onclick="deleteDetailedReport()"
style="border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;""></span></td>`;
$("#tdatadet").append(addrow);
// console.log(tableDetArr);
// return;
}
function saveDet(partcode, tempcode) {
var finalarr = [];
for (var j = 0; j < tableDetArr.length; j++) {
var qncode = $(`#qncode_${j}`).val();
var qnno = $(`#qnno_${j}`).val();
var level = $(`#qnlevel_${j}`).val();
var parent = $(`#qnparent_${j}`).val();
var maxmarks = $(`#maxmarks_${j}`).val();
var subqp = $(`#subqp_${j}`).val();
var submaxqn = $(`#submaxqn_${j}`).val();
var submandqn = $(`#submandqn_${j}`).val();
var qnord = $(`#qnord_${j}`).val();
var detInput = {
fqncode: qncode,
fqnno: qnno,
fqnlevel: level,
fqnparent: parent,
fmaxmarks: maxmarks,
fsubqp: subqp,
fsubmaxqn: submaxqn,
fsubmandqn: submandqn,
fqnord: qnord,
};
finalarr.push(detInput);
var tdata = finalarr;
// console.log(tdata);
}
// console.log(finalarr);
var j = tableDetArr.length;
if (
$(`#qncode_${j - 1}`).val() == "" ||
$(`#qnno_${j - 1}`).val() == "" ||
$(`#qnlevel_${j - 1}`).val() == "" ||
$(`#qnparent_${j - 1}`).val() == "" ||
$(`#maxmarks_${j - 1}`).val() == "" ||
$(`#subqp_${j - 1}`).val() == "" ||
$(`#submaxqn_${j - 1}`).val() == "" ||
$(`#submandqn_${j - 1}`).val() == "" ||
$(`#qnord_${j - 1}`).val() == ""
) {
alert("Please fill all the details..!");
return;
} else {
$.ajax({
type: "POST",
data:
"&tdata=" +
JSON.stringify(tdata) +
"&tempcode=" +
tempcode +
"&partcode=" +
partcode,
url: $host_url + "saveDetailedData",
success: function (response) {
var encode = JSON.parse(response);
if (encode.error_code == 0) {
alert(encode.data.msg);
DetailedContent();
btnPartCode(partcode, tempcode);
} else {
alert(encode.data.msg);
}
},
});
}
}
// }
function deleteDetailedReport(part, qnno, tempcode) {
// console.log(part, qnno, tempcode);
if (confirm("Are You sure? you want to delete ")) {
$.ajax({
type: "POST",
data: "part=" + part + "&qnno=" + qnno + "&tempcode=" + tempcode,
url: $host_url + "deleteDetailedReport",
success: function (response) {
var encode = JSON.parse(response);
if (encode.error_code == 0) {
alert(encode.data.msg);
btnPartCode(part, tempcode);
} else {
alert(encode.data.msg);
return;
}
},
});
}
}
function savePattern() {
var tdata = tablesummaryarr;
var temp_code = $("#temp_code").val();
var temp_name = $("#temp_name").val();
var temp_desc = $("#temp_despn").val();
var mans_qns = $("#mans_qns").val();
var max_marks = $("#max_marks").val();
var part_code = document.getElementById("part_code").value;
var part_disc = document.getElementById("part_disc").value;
var max_qns = document.getElementById("max_qns").value;
var mand_qns = document.getElementById("mand_qns").value;
var max_mks = document.getElementById("max_mks").value;
var min_qns = document.getElementById("min_qns").value;
var data = $("#adddata").val();
// console.log(temp_code);
// return;
if (data == "") {
$.ajax({
type: "POST",
data:
"&temp_code=" +
temp_code +
"&max_marks=" +
max_marks +
"&temp_name=" +
temp_name +
"&temp_desc=" +
temp_desc +
"&mans_qns=" +
mans_qns +
"&tdata=" +
JSON.stringify(tdata),
url: $host_url + "saveSummaryPattern",
success: function (response) {
var encode = JSON.parse(response);
if (encode.error_code == 0) {
alert(encode.data.msg);
editqppatterndet(temp_code);
} else {
alert(encode.data.msg);
return;
}
},
});
} else {
$.ajax({
type: "POST",
data:
"&data=" +
data +
"&temp_code=" +
temp_code +
"&temp_name=" +
temp_name +
"&temp_desc=" +
temp_desc +
"&mans_qns=" +
mans_qns +
"&max_marks=" +
max_marks +
"&part_code=" +
part_code +
"&part_disc=" +
part_disc +
"&max_qns=" +
max_qns +
"&mand_qns=" +
mand_qns +
"&max_mks=" +
max_mks +
"&min_qns=" +
min_qns +
"&tdata=" +
JSON.stringify(tdata),
url: $host_url + "addsummarydetails",
success: function (response) {
var encode = JSON.parse(response);
if (encode.error_code == 0) {
alert(encode.data.msg);
addPattern();
}
},
});
}
}
function deleteSummaryDetails(part, temp) {
if (confirm("Are You sure? you want to delete ")) {
$.ajax({
type: "POST",
data: "part=" + part + "&temp=" + temp,
url: $host_url + "deleteSummaryDetails",
success: function (response) {
var encode = JSON.parse(response);
if (encode.error_code == 0) {
alert(encode.data.msg);
editqppatterndet(temp);
} else {
alert(encode.data.msg);
return;
}
},
});
}
}
function checkqncode(partcode) {
let j = tableDetArr.length;
var qncode = $(`#qncode_${j - 1}`).val();
var tempcode = $("#temp_code").val();
var partcode = $("#partdata").val();
// console.log(partcode);
// return;
$.ajax({
type: "GET",
data:
"qncode=" + qncode + "&tempcode=" + tempcode + "&partcode=" + partcode,
url: $host_url + "checkqncode",
success: function (response) {
var encode = JSON.parse(response);
if (encode.error_code == 0) {
alert(encode.data.msg);
$(`#qncode_${j - 1}`).focus();
return;
}
},
});
}
|