function callstudnamecurr() { $("#page_main_div").load("../html_modules/studnamecorr.html", function () { document.getElementById("display_module_name").innerHTML = "Student Name Correction"; document.getElementById("module_name_for_save").value = "Student Name Correction"; getDefaultHeadFooterLinks("Student Name Correction"); loadstudnamecurr(); }); } function fetchtab() { var regno = document.getElementById("regno").value; console.log(regno); $.ajax({ type: "GET", data: "®no=" + regno, url: $host_url + "fetchtab", success: function (response) { var encode = JSON.parse(response); // console.log(encode); if (encode.error_code == 0) { $("#oldname").val(encode.data.fname); $("#oldname").attr("disabled", "disabled"); $("#degree").val(encode.data.fdegree); $("#degree").attr("disabled", "disabled"); $("#newname").val(encode.data.fname); $("#fcollcode").val(encode.data.fcollcode); } else { alert(encode.data.msg); } }, }); } function savestudname() { var file_data = $("#doc").prop("files")[0]; var form_data = new FormData(); form_data.append("file", file_data); $.ajax({ type: "POST", url: $host_url + "uploadstuddoc", dataType: "text", cache: false, contentType: false, processData: false, data: form_data, success: function (response) { var encode = JSON.parse(response); // console.log(encode.studupload); // return; if (encode.err_code == 0) { $("#doc_upload").val(encode.studupload); savestuddetails(); } else { alert(encode.data.msg); return; } }, }); } function savestuddetails() { // console.log("hi") // return; var regno = document.getElementById("regno").value; var oldname = document.getElementById("oldname").value; var degree = document.getElementById("degree").value; var newname = document.getElementById("newname").value; var doccument = document.getElementById("doc_upload").value; var fcollcode = document.getElementById("fcollcode").value; var doc = document.getElementById("doc").value; var insert = "®no=" + regno + "&oldname=" + oldname + "°ree=" + degree + "&newname=" + newname + "&doccument=" + doccument + "&fcollcode=" + fcollcode; // console.log(insert); // return; if (regno == "") { window.alert("please enter Register number"); document.getElementById("regno").focus(); return false; } else if (oldname == "") { window.alert("please enter oldname"); document.getElementById("oldname").focus(); return false; } else if (degree == "") { window.alert("please enter degree"); document.getElementById("degree").focus(); return false; } else if (newname == "") { window.alert("please enter newname"); document.getElementById("newname").focus(); return false; } else if (doc == "") { window.alert("please select a file..."); document.getElementById("newname").focus(); return false; } else { $.ajax({ type: "POST", data: insert, url: $host_url + "savestuddetails", success: function (response) { var encode = JSON.parse(response); if (encode.error_code == 0) { alert(encode.data.msg); callstudnamecurr(); } else { alert(encode.data.msg); return; } }, }); } } function loadstudnamecurr() { $.ajax({ type: "GET", url: $host_url + "loadstudnamecurr", success: function (response) { var encode = JSON.parse(response); var table = ``; if (encode.error_code == 0) { for (var i = 0; i < encode.data.length; i++) { // console.log(encode.data[i].fstatus); // return; table += ``; if (encode.data[i].fstatus == "pending") { table += ``; } table += ``; } table += `
Student Name Correction Details
App.
No.
Reg. No. Old Name New Name Degree Status Action
${encode.data[i].fapp} ${encode.data[i].fregno} ${encode.data[i].foldname} ${encode.data[i].fnewname} ${encode.data[i].fdegree} ${encode.data[i].fstatus}Edit
`; $("#tabledata").html(table); } }, }); } function editDetails(regno) { addcorrectionname(); $.ajax({ type: "GET", data: "®no=" + regno, url: $host_url + "editDetails", success: function (response) { var encode = JSON.parse(response); if (encode.error_code == 0) { $("#oldname").val(encode.data.foldname); $("#newname").val(encode.data.fnewname); $("#degree").val(encode.data.fdegree); $("#regno").val(encode.data.fregno); $("#oldname").attr("disabled", "disabled"); $("#degree").attr("disabled", "disabled"); $("#regno").attr("disabled", "disabled"); } }, }); } function addcorrectionname() { $("#page_main_div").load( "../html_modules/addnamecorrection.html", function () { document.getElementById("display_module_name").innerHTML = "Student Name Correction"; document.getElementById("module_name_for_save").value = "Student Name Correction"; getDefaultHeadFooterLinks("Student Name Correction"); } ); }