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 : 13.58.110.182
Current Path : /var/www/oasis/js_old/ |
| Current File : /var/www/oasis/js_old/cntrDeclaration.js |
function CallEnableCntrDeclaration() {
$("#page_main_div").load("../html_modules/cntrDeclaration.html", function() {
document.getElementById("display_module_name").innerHTML =
"Examination Center Declaration";
document.getElementById("module_name_for_save").value =
"Examination Center Declaration";
getDefaultHeadFooterLinks("Examination Center Declaration");
$(".ui-tabs .ui-tabs-panel").css("padding", "0px");
$(".ui-tabs .ui-tabs-panel").css("padding-top", "21px");
var datastring = "";
$.ajax({
type: "POST",
data: datastring,
url: $host_url + "getCntrDetl",
success: function(responce) {
responce = eval("(" + responce + ")");
$("#centerEntry input[type=text], #centerEntry textarea").each(function(
l
) {
$(this).val(responce.data[$(this).attr("id")]);
});
var radio_names = [
"fprincitype",
"fcentre",
"fsafe",
"fugctwof",
"fugctwob",
"fnaacrep",
"faffiliated",
"fclasscctv",
"fwifi",
"fcomplab",
"fofficecctv"
];
for (var i = 0; i < radio_names.length; i++) {
if (radio_names[i] != "") {
var $radios = $("input:radio[name=" + radio_names[i] + "]");
var value = responce.data[radio_names[i]];
$radios.filter("[value=" + value + "]").attr("checked", true);
}
}
}
});
});
}
function reportexamcntrdet() {
window.location.href = $host_url + "reportexamcntrdet";
}
function SaveCentreDetails() {
var jsonObj = [];
var cntrdetlobj = "";
var missing_fields = [];
$(
"#centerEntry input[type=text],#centerEntry select,#centerEntry textarea"
).each(function() {
item = {};
item["id"] = $(this).attr("id");
item["value"] = $(this).val();
item["value"] = item["value"].replace("&", "and");
item["value"] = item["value"].replace('"', "`");
item["value"] = item["value"].replace("'", "`");
jsonObj.push(item);
if ($(this).val() == "" && $(this).attr("id") != "student_entry_admno") {
missing_fields.push($(this).attr("name"));
}
});
var radio_names = [
"fprincitype",
"fcentre",
"fsafe",
"fugctwof",
"fugctwob",
"fnaacrep",
"faffiliated",
"fclasscctv",
"fwifi",
"fcomplab",
"fofficecctv"
];
for (var i = 0; i < radio_names.length; i++) {
if ($('input[name="' + radio_names[i] + '"]').is(":checked")) {
value = $('input[name="' + radio_names[i] + '"]:checked').val();
item = {};
item["id"] = radio_names[i];
item["value"] = encodeURI(value);
jsonObj.push(item);
} else {
missing_fields.push(radio_names[i]);
}
}
var html_string = "";
var i = 1;
for (let field of missing_fields) {
html_string += `\t ${i} ${field} \n`;
i++;
}
var msg = "The Following fields are missing \n";
if (missing_fields.length > 0) {
msg += ` ${html_string}`;
alert(msg);
//return;
}
cntrdetlobj = JSON.stringify(jsonObj);
var datastring = "cntrdetlobj=" + cntrdetlobj;
$.ajax({
type: "POST",
data: datastring,
url: $host_url + "saveCentreDetails",
success: function(responce) {
responce = eval("(" + responce + ")");
if (responce.error_code === -1) {
alert("Updation Failed");
return;
} else {
alert("Updated successfuly.");
CallEnableCntrDeclaration();
}
}
});
}
|