function createattclass() { $("#page_main_div").load("../html_modules/createattclass.html?", function () { document.getElementById("display_module_name").innerHTML = "Create Class"; document.getElementById("module_name_for_save").value = "Create Class"; getDefaultHeadFooterLinks("Create Class"); if (window.db == "jssu") { $("#dept_row").hide(); } loadTeaherList(); }); } function loadTeaherList() { $.blockUI({ message: "

", }); $.ajax({ type: "GET", async: false, data: "dept=" + $("#deptcode").val(), url: $host_url + "loadTeaherList", success: function (response) { var res = JSON.parse(response); if (res.error_code == 0) { if (res.data["masteach"].length == 1) { var teacheoptions = ""; $("#teachcode").prop("disabled", true); } else { var teacheoptions = ""; $("#teachcode").prop("disabled", false); } for (var i = 0; i < res.data["masteach"].length; i++) { teacheoptions += ``; } $("#teachcode").html(teacheoptions); var deptopt = ""; for (var i = 0; i < res.data["masdept"].length; i++) { deptopt += ``; } $("#deptcode").html(deptopt); $.unblockUI(); } else { alert(res.data.msg); $.unblockUI(); return; } }, }); } function loadteachdept() { $.blockUI({ message: "

", }); $.ajax({ type: "GET", async: false, data: "dept=" + $("#deptcode").val(), url: $host_url + "loadteachdept", success: function (response) { var res = JSON.parse(response); if (res.error_code === 0) { if (res.data["masteach"].length == 1) { var teacheoptions = ""; $("#teachcode").prop("disabled", true); } else { var teacheoptions = ""; $("#teachcode").prop("disabled", false); } for (var i = 0; i < res.data["masteach"].length; i++) { teacheoptions += ``; } $("#teachcode").html(teacheoptions); } $.unblockUI(); }, }); } function viewAttClassCreate() { $("#page_main_div").load("../html_modules/editattclass.html?", function () { loadTachClass(); }); } function loadTachClass() { var teachfrom = $("#teachfrom").val(); var teachto = $("#teachto").val(); var parameters = "&teachfrom=" + teachfrom + "&teachto=" + teachto; $.blockUI({ message: "

", }); $.ajax({ type: "GET", data: parameters, url: $host_url + "viewAttClassCreate", success: function (response) { var encode = JSON.parse(response); var table = ``; var slno = 1; var checked = ""; if (encode.error_code == 0) { for (var i = 0; i < encode.data.length; i++) { let btn = ""; if (window.db === "jssstu") { btn = ""; } else { btn = `Edit`; } table += ``; table += ``; } table += `
Class Details
Sl. No. Class ID Teacher Name Class Name Action
${slno++} ${ encode.data[i].fclassid } ${ encode.data[i].fteachname } ${ encode.data[i].fclassname } ${btn} Delete
`; } $("#createview").html(table); $.unblockUI(); }, }); } function editAttClass(fclassid, fteachcode, fclassname) { $("#page_main_div").load("../html_modules/createattclass.html?", function () { document.getElementById("display_module_name").innerHTML = "Create Class"; document.getElementById("module_name_for_save").value = "Create Class"; getDefaultHeadFooterLinks("Create Class"); loadTeaherList(); $("#teachcode").val(fteachcode); $("#classname").val(fclassname); $("#classid").val(fclassid); }); } function deleteAttClass(fclassid, fteachcode, fclassname) { let text = "Are you sure you want to delete?"; if (confirm(text) == true) { $.ajax({ type: "GET", url: $host_url + "deleteAttClass", data: "teachcode=" + fteachcode + "&classname=" + fclassname + "&classid=" + fclassid, success: function (response) { var res = JSON.parse(response); if (res.error_code == "0") { alert(res.data); loadTachClass(); } else { alert(res.data); return; } }, }); } else { } } function saveAttClass() { var teachcode = $("#teachcode").val(); var classname = $("#classname").val(); var classid = $("#classid").val(); if (teachcode == "") { alert("Select Teacher Name"); $("#teachcode").focus(); return; } if (classname == "") { alert("Enter Class Name"); $("#classname").focus(); return; } $.blockUI({ message: "

", }); $.ajax({ type: "GET", url: $host_url + "saveAttClass", data: "teachcode=" + teachcode + "&classname=" + classname + "&classid=" + classid, success: function (response) { var res = JSON.parse(response); if (res.error_code == "0") { alert(res.data); viewAttClassCreate(); } else { alert(res.data); $.unblockUI(); return; } $.unblockUI(); }, }); } function reportCreateAttClass() { var teachfrom = $("#teachfrom").val(); var teachto = $("#teachto").val(); var parameters = "&teachfrom=" + teachfrom + "&teachto=" + teachto; window.open($host_url + "reportAttClassCreate" + parameters); }