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 : 52.14.140.108
var total = 0;
function callSendNotification() {
$("#page_main_div").load("../html_modules/sendnotification.html", function() {
document.getElementById("display_module_name").innerHTML =
"Send Notification";
document.getElementById("module_name_for_save").value = "Send Notification";
getDefaultHeadFooterLinks("Send Notification");
$.ajax({
type: "POST",
data: "type=loadsub",
url: $host_url + "getdegsn",
success: function(responce) {
var responce = eval("(" + responce + ")");
if (responce.error_code == 0) {
var degree = responce.data;
var options;
options += `<option value="">--Select--</option>`;
for (var i = 0; i < degree.length; i++) {
options += `<option value="${degree[i].fdegree}">${degree[i].fdescpn}</options>`;
}
$("#fdegree").html(options);
}
}
});
});
}
function getStudents() {
if (trim($("#fdegree").val()) == "") {
alert("Select Degree Code!!");
$("#fdegree").focus();
return;
}
$.ajax({
type: "POST",
data:
"fdegree=" +
trim($("#fdegree").val()) +
"&sem=" +
trim($("#sem").val()) +
"®from=" +
trim($("#regfrom").val()) +
"®to=" +
trim($("#regto").val()),
url: $host_url + "getStudents",
success: function(responce) {
var responce = eval("(" + responce + ")");
if (responce.error_code == 0) {
responce.data.table;
$("#send_student_data").html(responce.data.table);
total = responce.data.total;
} else {
alert(responce.data);
$("#send_student_data").html("");
return;
}
}
});
}
function selectAllStudents() {
var k;
if (document.getElementById("send").checked == true) {
for (k = 1; k < parseInt(total); k++) {
document.getElementById(k).checked = true;
}
} else {
for (k = 1; k < total; k++) {
document.getElementById(k).checked = false;
}
}
}
function sendNotification() {
if (trim($("#fdegree").val()) == "") {
alert("Select Degree Code!!");
$("#fdegree").focus();
return;
}
if (trim($("#notiftile").val()) == "") {
alert("Enter Notification Title");
$("#notiftile").focus();
return;
}
if (trim($("#notifbody").val()) == "") {
alert("Enter Notification Body");
$("#notifbody").focus();
return;
}
var regNotif = [];
if ($("#send_student_data [name='regno']:checked").length == 0) {
alert("No changes Made");
return;
}
$("#send_student_data [name='regno']:checked").each(function() {
var obj = {};
let regno = $(this).attr("id");
if (
$(this)
.parents("tr")
.find("input[name='regno']")
.is(":checked")
) {
obj.fregno = $(this).val();
} else {
}
regNotif.push(obj);
});
var strNotif = JSON.stringify(regNotif);
console.log(strNotif);
$.ajax({
type: "POST",
data:
"fdegree=" +
trim($("#fdegree").val()) +
"¬iftile=" +
trim($("#notiftile").val()) +
"¬ifbody=" +
trim($("#notifbody").val()) +
"&sem=" +
trim($("#sem").val()) +
"®from=" +
trim($("#regfrom").val()) +
"®to=" +
trim($("#regto").val()) +
"&strNotif=" +
strNotif,
url: $host_url + "sendNotification",
success: function(responce) {
var responce = eval("(" + responce + ")");
if (responce.error_code == 0) {
alert(responce.data);
$("#send_student_data").html("");
return;
} else {
alert(responce.data);
$("#send_student_data").html("");
return;
}
}
});
}
|