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.219.94.17
var USER, USERTYPE;
function loadMaster() {
//loaddashboard();
$.ajax({
type: "post",
url: "src/login.php",
//data:parameters,
success: function(response) {
response = JSON.parse(response);
var { status } = response;
if (status === "loggedin") {
({ USER, USERTYPE } = response);
if (USERTYPE === "usr") $("#createUserMenu").hide();
loadApplications();
} else {
alert("please login");
window.location.href = "index.html";
}
}
});
}
function loadApplications() {
$("#loadtab").load("html_modules/applications.html", function() {
$("#appdetl").hide();
var today = new Date();
var option = "<option value=''>--Select--</option>";
for (var j = today.getFullYear(); j > 1960; j--) {
option += "<option value='" + j + "'>" + j + "</option>";
}
$("#qalpassyear").append(option);
$.ajax({
type: "post",
async: true,
url: "src/getautofill.php",
success: function(response) {
response = JSON.parse(response);
var { college, degree } = response;
console.log(degree);
$("#fromdeg")
.autocomplete({ source: degree })
.focus(function() {
$(this)
.data("uiAutocomplete")
.search($(this).val());
});
$("#todeg")
.autocomplete({
source: degree
})
.focus(function() {
$(this)
.data("uiAutocomplete")
.search($(this).val());
});
$("#fromcoll")
.autocomplete({
source: college
})
.focus(function() {
$(this)
.data("uiAutocomplete")
.search($(this).val());
});
$("#tocoll")
.autocomplete({
source: college
})
.focus(function() {
$(this)
.data("uiAutocomplete")
.search($(this).val());
});
}
});
});
}
function loaddashboard() {
$("#loadtab").load("html_modules/dashboard.html", function() {
var parameters = `usertype=${USERTYPE}&user=${USER}`;
$.ajax({
type: "post",
url: "src/dashboard.php",
data: parameters,
success: function(response) {
response = JSON.parse(response);
var {
totalappcount,
approvecount,
notapprovecount,
onlinepaysuccesscount,
onlinepaycount,
challanpaycount
} = response;
$("#tot_app").attr("data-to", totalappcount);
$("#appr_app").attr("data-to", approvecount);
$("#pend_app").attr("data-to", notapprovecount);
$("#online_app").attr("data-to", onlinepaycount);
$("#sbm_app").attr("data-to", challanpaycount);
var {
freshstudcount,
secondstudcount,
trirdstudcount,
lateralstudcount
} = response;
$("#first_year").attr("data-to", freshstudcount);
$("#second_year").attr("data-to", secondstudcount);
$("#third_year").attr("data-to", trirdstudcount);
$("#lateral_entry").attr("data-to", lateralstudcount);
$(".count-to").countTo();
var {
onlinepaymentdone,
onlinepaymentpending,
sbmpaymentdone,
sbmpaymentpending,
challanpayackcount,
challanpayackpencount
} = response;
var totamt =
parseInt(onlinepaymentdone) +
parseInt(onlinepaymentpending) +
parseInt(sbmpaymentdone) +
parseInt(sbmpaymentpending);
var totpaid = parseInt(onlinepaymentdone) + parseInt(sbmpaymentdone);
var totpend =
parseInt(onlinepaymentpending) + parseInt(sbmpaymentpending);
$("#tot_amt").html(formartCurrency(totamt));
$("#tot_paid").html(formartCurrency(totpaid));
$("#tot_pend").html(formartCurrency(totpend));
//Sales count to
$(".sales-count-to").countTo({
formatter: function(value, options) {
return (
"$" +
value
.toFixed(2)
.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, " ")
.replace(".", ",")
);
}
});
initCharts();
function getChartJs(type) {
var config = null;
if (type === "barm") {
config = {
type: "bar",
data: {
labels: ["Challan Payments", "Online Payments"],
datasets: [
{
label: "Total",
data: [
parseInt(sbmpaymentdone) + parseInt(sbmpaymentpending),
parseInt(onlinepaymentdone) +
parseInt(onlinepaymentpending)
],
backgroundColor: "rgba(0, 188, 212, 0.8)"
},
{
label: "Done",
data: [sbmpaymentdone, onlinepaymentdone],
backgroundColor: "rgba(80, 244, 66, 0.8)"
},
{
label: "Pending",
data: [sbmpaymentpending, onlinepaymentpending],
backgroundColor: "rgba(233, 30, 99, 0.8)"
}
]
},
options: {
responsive: true,
legend: false
}
};
} else if (type === "bara") {
config = {
type: "bar",
data: {
labels: ["Challan Payments", "Online Payments"],
datasets: [
{
label: "Total",
data: [challanpaycount, onlinepaycount],
backgroundColor: "rgba(0, 188, 212, 0.8)"
},
{
label: "Done",
data: [challanpayackcount, onlinepaysuccesscount],
backgroundColor: "rgba(80, 244, 66, 0.8)"
},
{
label: "Pending",
data: [
challanpayackpencount,
parseInt(onlinepaycount) - parseInt(onlinepaysuccesscount)
],
backgroundColor: "rgba(233, 30, 99, 0.8)"
}
]
},
options: {
responsive: true,
legend: false
}
};
}
return config;
}
new Chart(
document.getElementById("bar_chart_app").getContext("2d"),
getChartJs("bara")
);
new Chart(
document.getElementById("bar_chart_amt").getContext("2d"),
getChartJs("barm")
);
}
});
});
}
function formartCurrency(x) {
x = x.toString();
var lastThree = x.substring(x.length - 3);
var otherNumbers = x.substring(0, x.length - 3);
if (otherNumbers != "") lastThree = "," + lastThree;
var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;
return "Rs." + res;
}
//Charts
function initCharts() {
//Chart Bar
$(".chart.chart-bar").sparkline(undefined, {
type: "bar",
barColor: "#fff",
negBarColor: "#fff",
barWidth: "4px",
height: "34px"
});
//Chart Pie
$(".chart.chart-pie").sparkline(undefined, {
type: "pie",
height: "50px",
sliceColors: [
"rgba(255,255,255,0.70)",
"rgba(255,255,255,0.85)",
"rgba(255,255,255,0.95)",
"rgba(255,255,255,1)"
]
});
//Chart Line
$(".chart.chart-line").sparkline(undefined, {
type: "line",
width: "60px",
height: "45px",
lineColor: "#fff",
lineWidth: 1.3,
fillColor: "rgba(0,0,0,0)",
spotColor: "rgba(255,255,255,0.40)",
maxSpotColor: "rgba(255,255,255,0.40)",
minSpotColor: "rgba(255,255,255,0.40)",
spotRadius: 3,
highlightSpotColor: "#fff"
});
}
function loadCreateUser() {
$("#loadtab").load("html_modules/createUser.html");
}
function createUser() {
if (!$("#createUserForm").valid()) {
return;
}
var usrname = $("#usrname").val();
var password = $("#password").val();
var parameters = `&usrname=${usrname}&password=${password}`;
$.ajax({
type: "post",
url: "src/createUser.php",
data: parameters,
success: function(response) {
response = JSON.parse(response);
var { status, msg } = response;
if (status == "success") {
alert(msg);
} else {
alert(msg);
}
}
});
}
function backapp() {
$("#appintro").show();
$("#appdetl").show();
$("#appview").hide();
$("#subject_det").hide();
$("#eligibilitydet").hide();
var gappno = "";
var gcounter = 0;
var gtotsub = 0;
}
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split("&"),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split("=");
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
var table;
var gappno = "";
var gcounter = 0;
var gtotsub = 0;
function getAppDetails() {
if (!$("#appRangeForm").valid()) {
return;
}
var parameters = "fromdeg=" + $("#fromdeg").val();
parameters += "&todeg=" + $("#todeg").val();
parameters += "&fromcoll=" + $("#fromcoll").val();
parameters += "&tocoll=" + $("#tocoll").val();
parameters += "&fromapp=" + $("#fromapp").val();
parameters += "&toapp=" + $("#toapp").val();
parameters += "&year=" + $("#year").val();
parameters += "&rtype=" + $("#rtype").val();
parameters += "&combcode=" + $("#combcode").val();
function getcodes(param) {}
$.ajax({
type: "post",
url: "src/getapps.php",
data: parameters,
success: function(response) {
response = JSON.parse(response);
var { apps: app_obj_arr } = response;
$(".js-exportable").html("");
$("#appdetl").show();
var app_arr = [];
//get array of applications
console.log(app_obj_arr);
for (var i in app_obj_arr) {
console.log("this loop");
if (app_obj_arr[i][9] == "success") {
var arr = $.map(app_obj_arr[i], function(el) {
return el;
});
app_arr.push(arr);
}
}
table = $(".js-exportable").DataTable({
dom: "Bfrtip",
destroy: true,
responsive: true,
data: app_arr,
columnDefs: [
{
targets: 0,
searchable: false,
orderable: false,
className: "dt-body-center",
render: function(data, type, full, meta) {
//console.log(data);
return (
'<center><input type="checkbox" name="id[]" class="filled-in chk-col-light-blue" id="' +
$("<div/>")
.text(data)
.html() +
'" value="' +
$("<div/>")
.text(data)
.html() +
'"> <lable for="' +
$("<div/>")
.text(data)
.html() +
'"> </label></center>'
);
}
},
{
targets: 11,
searchable: false,
orderable: false,
className: "dt-body-center",
render: function(data, type, full, meta) {
return '<center><button name="id[]" class = "btn btn-primary details">Details</button></center>';
}
},
{
targets: 12,
searchable: false,
orderable: false,
className: "dt-body-center",
render: function(data, type, full, meta) {
return '<center><button name="id[]" class = "btn btn-primary edit">Edit</button></center>';
}
}
],
order: [[1, "asc"]],
columns: [
{
title:
"<center><input type='checkbox' name='select_all' value='1' id='select-all'/></center>"
},
{ title: "App. No." },
{ title: "Name" },
{ title: "Father Name" },
{ title: "Mother Name" },
{ title: "Caste" },
{ title: "Degree" },
{ title: "Fees" },
{ title: "Pay. Type" },
{ title: "Status" },
{ title: "User" },
{ title: "Details" },
{ title: "Edit" }
],
lengthMenu: [[2, 4, 8, -1], [2, 4, 8, "All"]],
pageLength: 400,
buttons: ["copy", "csv", "excel", "pdf", "print"]
});
//check already assigned user
var rows = table.rows({ search: "applied" }).nodes();
$('input[type="checkbox"]', rows).prop("checked", this.checked);
/*var check_arr = app_arr.filter((app) => { return app[7] != '';});
for(let i in check_arr){
$(`#${check_arr[i][0]}`).prop('checked', true);
}*/
$("#select-all").on("click", function() {
// Check/uncheck all checkboxes in the table
var rows = table.rows({ search: "applied" }).nodes();
$('input[type="checkbox"]', rows).prop("checked", this.checked);
});
$(".edit").on("click", function() {
var appno = $(this)
.parents("tr")
.find('input[type="checkbox"]')
.val();
console.log(appno);
$("#appintro").hide();
$("#appdetl").hide();
$("#appview").show();
$("#subject_det").show();
var page = getUrlParameter("page");
var params = "&appno=" + appno;
$.ajax({
type: "post",
url: "src/appedit.php",
data: params,
async: false,
success: function(response) {
response = JSON.parse(response);
console.log(response);
var subopt = response.subopt;
var studsub = response.studsub;
var studdet = response.studdet;
var ftotsub = response.totsub.ftotsub;
var category = response.category;
var subcomb = response.subcomb;
gappno = response.studdet.FAPPNO;
gtotsub = ftotsub;
console.log(gappno);
var cat = `<option value = "">-Select-</option>`;
for (var i = 0; i < category.length; i++) {
cat += `<option value = "${category[i]["int_code"]}">${
category[i]["val"]
}</option>`;
}
$("#FCASTE").html(cat);
var sub = `<option value = "">-Select-</option>`;
for (var i = 0; i < subcomb.length; i++) {
sub += `<option id='${subcomb[i]["FCOMBCODE"]}' value = "${
subcomb[i]["FCOMBCODE"]
}">${subcomb[i]["FCOMBDESC"]}</option>`;
}
$("#FCOMBCODE").html(sub);
var arr = studdet.FPASSMTHYEAR.split("/");
jQuery.trim(arr[1]);
console.log(arr[1]);
console.log(arr[0]);
// $("#qalpassmonth option[value='" + arr[0] + "']").prop(
// "selected",
// "selected"
// );
$("#eligibilitydet").show(0, function() {
$("#qalpassmonth").val(jQuery.trim(arr[0]));
$("#qalpassyear").val(1990);
});
var option =
"<option value='" + arr[1] + "' selected>" + arr[1] + "</option>";
// $("#qalpassyear").append(option);
//val(jQuery.trim(arr[1]));
// console.log(ftotsub);
$("#appview input[type=text],#appview select").each(function() {
// console.log('hii');
$(this).val(studdet[$(this).attr("id")]);
});
$("#eligibilitydet input[type=text],#eligibilitydet select").each(
function() {
// console.log('hii');
$(this).val(studdet[$(this).attr("id")]);
}
);
$("#eligibilitydet input[type=text],#eligibilitydet select").each(
function() {
// console.log('hii');
$(this).val(studdet[$(this).attr("id")]);
}
);
var radio_names = ["FSEX", "FHANDICAP", "FNATIONAL"];
$("#FCOMBCODE").val(studdet["FCOMBCODE"]);
for (var i = 0; i < radio_names.length; i++) {
if (studdet[radio_names[i]] != "") {
var $radios = $("input:radio[name=" + radio_names[i] + "]");
// console.log($radios);
var value = studdet[radio_names[i]];
// console.log(value);
$radios.filter(`[value="${value}"]`).prop("checked", true);
}
}
if (studsub.length > 0) {
var str = `<center><div class=' col-md-offset-2 col-md-8'>
<table id='feeMainTable' class='table table-striped table-condensed table-bordered'>
<thead>
<tr class='bg-cyan'>
<th style = 'width:8%;'><center>Sl. No.</center></th>
<th style = 'width:70%;'><center>Subject Name</center></th>
</tr>
</thead>
<tbody>`;
var z = 1;
var option = `<option value = "">-Select Subject-</option>`;
for (var i = 0; i < studsub.length; i++) {
option += `<option value = "${studsub[i]["fsubcode"]}">${
studsub[i]["fsubname"]
}</option>`;
}
var z = 1;
for (var i = 0; i < ftotsub; i++) {
str += `<tr>
<td>
${z}
</td>
<td>
<select style = "width: 100%;height:25px" id = "subcode_${i}" onchange = "checkdata('${i}')">${option}</select>
</td>
</tr>`;
z++;
}
str += `</tbody></table></div><center>`;
$("#mediumdiv").html(str);
gcounter = 0;
for (var i = 0; i < ftotsub; i++) {
$(`#subcode_${i}`).val(studsub[i]["oldsubcode"]);
if (studsub[i]["oldsubcode"] !== null) {
gcounter++;
}
}
console.log(gcounter);
}
var arr = studdet.FPASSMTHYEAR.split("/");
jQuery.trim(arr[1]);
console.log(arr[1]);
console.log(arr[0]);
// $("#qalpassmonth option[value='" + arr[0] + "']").prop(
// "selected",
// "selected"
// );
// $('#eligibilitydet').show(0,function(){
// $('#qalpassmonth').val(jQuery.trim(arr[0]));
// $('#qalpassyear').val(1990)
// });
document.getElementById("qalpassmonth").value = arr[0];
document.getElementById("qalpassyear").value = arr[1];
}
});
});
$(".details").on("click", function() {
var appno = $(this)
.parents("tr")
.find('input[type="checkbox"]')
.val();
var parameters = "&appno=" + appno;
$.ajax({
type: "post",
url: "src/studdet.php",
data: parameters,
async: false,
success: function(response) {
response = JSON.parse(response);
var user = response.user;
var disabled = "disabled";
if (user == "admx") disabled = "";
var subjectarry = ``;
var z = 1;
var sub = response.subjdet.split("~");
jQuery.each(sub, function(i, val) {
subject = val.split("->");
subjectarry += `<tr>
<td>
${z}
</td>
<td>
${subject[1]}
</td>
<td>
${subject[0]}
</td>
</tr>`;
z++;
});
//console.log(subjectarry);
$("#idModal2").empty();
$("#idModal2").append(`<div class="body" id="body">
<table class = "table">
<th>
Personal Information
</th>
<tr>
<td >Name </td>
<td><input id = "name" class = "form-control" ${disabled} type = 'text' value = "${response.name}"></td>
<td>Father Name</td>
<td><input id = "fname" class = "form-control" ${disabled} type = 'text' value = "${response.FFATNAME}"></td>
</tr>
<tr>
<td>Occupation</td>
<td><input id = "fatocc" class = "form-control" ${disabled} type = 'text' value = "${response.FFAT_OCC}"> </td>
<td>Category</td>
<td><input id = "fcaste" class = "form-control" ${disabled} type = 'text' value = "${response.FCASTE}"> </td>
</tr>
<tr>
<td>Gender</td>
<td><input id = "fsex" class = "form-control" ${disabled} type = 'text' value = "${response.FSEX}"> </td>
<td>Handicap</td>
<td><input id = "fhandicap" class = "form-control" ${disabled} type = 'text' value = "${response.FHANDICAP}"> </td>
</tr>
<tr>
<td>Date Of Birth</td>
<td><input id = "fdob" class = "form-control" ${disabled} type = 'text' value = "${response.fdob}"> </td>
<td> Aadhar Number</td>
<td><input id = "fadar" class = "form-control" ${disabled} type = 'text' value = "${response.FAADHARNO}"> </td>
</tr>
<tr>
<td>Mobile Numbe</td>
<td><input id = "fmobile" class = "form-control" ${disabled} type = 'text' value = "${response.FCONTACT_NO}"> </td>
<td>LandLine Number</td>
<td><input id = "flandline" class = "form-control" ${disabled} type = 'text' value = "${response.FLANDLINE}"> </td>
</tr>
<tr>
<td>Email Address</td>
<td><input id = "femail" class = "form-control" ${disabled} type = 'text' value = "${response.FEMAIL}"> </td>
<td>Annual Income</td>
<td><input id = "fincome" class = "form-control" ${disabled} type = 'text' value = "${response.FINCOME}"> </td>
</tr>
<tr>
<td>Permanent Address</td>
<td><input id = "fperadd1" class = "form-control" ${disabled} type = 'text' value = "${response.FPERMADD1}"> </td>
<td>Communication Address</td>
<td><input id = "fcuradd1" class = "form-control" ${disabled} type = 'text' value = "${response.FCURRADD1}"> </td>
</tr>
<tr>
<td></td>
<td><input id = "fperadd2" class = "form-control" ${disabled} type = 'text' value = "${response.FPERMADD2}"> </td>
<td></td>
<td><input id = "fcuradd2" class = "form-control" ${disabled} type = 'text' value = "${response.FCURRADD2}"> </td>
</tr>
<tr>
<td></td>
<td><input id = "fperadd3" class = "form-control" ${disabled} type = 'text' value = "${response.FPERMADD3}"> </td>
<td></td>
<td><input id = "fcuradd3" class = "form-control" ${disabled} type = 'text' value = "${response.FCURRADD3}"> </td>
</tr>
<tr>
<td>District</td>
<td><input id = "fperdistrict" class = "form-control" ${disabled} type = 'text' value = "${response.FPERDISTRICT}"> </td>
<td>District</td>
<td><input id = "fcurdistrict" class = "form-control" ${disabled} type = 'text' value = "${response.FCURDISTRICT}"> </td>
</tr>
<tr>
<td>Pincode</td>
<td><input id = "fperpincode" class = "form-control" ${disabled} type = 'text' value = "${response.FPERPINCODE}"> </td>
<td>Pincode</td>
<td><input id = "fcurpincode" class = "form-control" ${disabled} type = 'text' value = "${response.FCURPINCODE}"> </td>
</tr>
<tr>
<td>State</td>
<td><input id = "fperstate" class = "form-control" ${disabled} type = 'text' value = "${response.FPERSTATE}"> </td>
<td>State</td>
<td><input id = "fcurstate" class = "form-control" ${disabled} type = 'text' value = "${response.FCURSTATE}"> </td>
</tr>
</table>
<table class = "table">
<th>
Opted Course Details
</th>
<tr>
<td>Course</td>
<td><input id = "fdegree" class = "form-control" ${disabled} type = 'text' value = "${response.fdegname}"> </td>
<td>Medium</td>
<td><input id = "fmoe" class = "form-control" ${disabled} type = 'text' value = "${response.FENGLISH}"> </td>
</tr>
</table>
<table class = "table">
<th>
Subject Deatils
</th>
<tr>
<td>
Sl. No.
</td>
<td>
Subject Name
</td>
<td>
Subject Short Name
</td>
</tr>
${subjectarry}
</table>
<table class = "table">
<th>
Fee Details
</th>
<tr>
<td>Payment Mode</td>
<td><input id = "fcollcode" class = "form-control" ${disabled} type = 'text' value = "${response.FPAYMENTTYPE}"> </td>
<td>Amount</td>
<td><input id = "fmoe" class = "form-control" ${disabled} type = 'text' value = "${response.FTOTFEE}"> </td>
<td>Register No</td>
<td><input id = "fmoe" class = "form-control" ${disabled} type = 'text' value = "${response.fregno}"> </td>
<td>Reference No</td>
<td><input id = "fmoe" class = "form-control" ${disabled} type = 'text' value = "${response.fappno}"> </td>
</tr>
</table>
<table class = "table">
<th>
Acknowledgement
</th>
<tr>
<td>
Remarks
</td>
<td>
<input id = "fremarks" class = "form-control" type = 'text' value = "${response.fremarks}" >
</td>
<td>
Status
</td>
<td>
<select id = "status">
<option value = "APPROVED">
Approved
</option>
<option value = "REJECT">
Reject
</option>
</select>
</td>
</tr>
</table>
<div class='p-b-20 p-t-20'>
<center>
<button type='button' class='btn btn-primary m-r-20' onclick='saveApplication("${response.fappno}")'>Save</button>
<button type='button' class='btn btn-secondary' data-dismiss='modal'>Close</button>
</center>
</div>
</div>`);
$("#status").val(response.fapprstatus);
$("#idModal1").modal();
}
});
});
}
});
}
const nonMandFields = ["FLANDLINE"];
function saveEditApp() {
console.log(gcounter, gtotsub);
jsonObj = [];
subjectCombination = [];
var errcount = 0;
var missing_fields = [];
privsub = [];
finaloptdeg = [];
privackd = [];
$("#appview input[type=text],#appview select").each(function() {
if ($(this).val() == "" && !in_array($(this).attr("id"), nonMandFields)) {
$(this)
.closest(".form-group")
.find(".fieldError")
.addClass("hasError");
if ($(this).attr("name") != "") errcount++;
missing_fields.push($(this).attr("name"));
} else {
$(this)
.closest(".form-group")
.find(".fieldError")
.removeClass("hasError");
item = {};
item["id"] = $(this).attr("id");
item["value"] = $(this).val();
jsonObj.push(item);
}
// console.log(jsonObj);
});
var radio_names = ["FSEX", "FHANDICAP", "FNATIONAL"];
for (var i = 0; i < radio_names.length; i++) {
if (!$('input[name="' + radio_names[i] + '"]').is(":checked")) {
console.log(radio_names[i] + " is not checked");
if (radio_names[i] != "fbcuetype") {
$('input[name="' + radio_names[i] + '"]')
.closest(".form-group")
.find(".fieldError")
.addClass("hasError");
errcount++;
missing_fields.push(radio_names[i]);
} else {
value = $('input[name="' + radio_names[i] + '"]').val();
item = {};
item["id"] = radio_names[i];
item["value"] = value;
jsonObj.push(item);
}
} else {
console.log(radio_names[i] + "is checked");
$('input[name="' + radio_names[i] + '"]')
.closest(".form-group")
.find(".fieldError")
.removeClass("hasError");
value = $('input[name="' + radio_names[i] + '"]:checked').val();
item = {};
item["id"] = radio_names[i];
item["value"] = value;
jsonObj.push(item);
}
}
$("#subject_det input[type=text],#subject_det select").each(function() {
if ($(this).val() == "" && !in_array($(this).attr("id"), nonMandFields)) {
$(this)
.closest(".form-group")
.find(".fieldError")
.addClass("hasError");
if ($(this).attr("name") != "") errcount++;
missing_fields.push($(this).attr("name"));
} else {
$(this)
.closest(".form-group")
.find(".fieldError")
.removeClass("hasError");
item = {};
item["id"] = $(this).attr("id");
item["value"] = $(this).val();
jsonObj.push(item);
}
});
$("#mediumdiv input[type=text],#mediumdiv select").each(function() {
if ($(this).val() == "" && !in_array($(this).attr("id"), nonMandFields)) {
$(this)
.closest(".form-group")
.find(".fieldError")
.addClass("hasError");
if ($(this).attr("name") != "") errcount++;
missing_fields.push($(this).attr("name"));
} else {
$(this)
.closest(".form-group")
.find(".fieldError")
.removeClass("hasError");
item = {};
item["id"] = $(this).attr("id");
item["value"] = $(this).val();
subjectCombination.push(item);
}
});
$("#eligibilitydet input[type=text],#eligibilitydet select").each(function() {
if ($(this).val() == "" && !in_array($(this).attr("id"), nonMandFields)) {
$(this)
.closest(".form-group")
.find(".fieldError")
.addClass("hasError");
if ($(this).attr("name") != "") errcount++;
missing_fields.push($(this).attr("name"));
} else {
$(this)
.closest(".form-group")
.find(".fieldError")
.removeClass("hasError");
item = {};
item["id"] = $(this).attr("id");
item["value"] = $(this).val();
jsonObj.push(item);
}
});
var qalpassyear = $("#qalpassyear").val();
var qalpassmonth = $("#qalpassmonth").val();
qalpassyear = qalpassmonth + "/" + qalpassyear;
console.log(qalpassyear);
if (qalpassyear !== "") {
item = {};
item["id"] = "FPASSMTHYEAR";
item["value"] = qalpassyear;
jsonObj.push(item);
}
console.log(gappno);
console.log(jsonObj);
console.log(subjectCombination);
if (subjectCombination.length < gtotsub) {
alert("Please select " + gtotsub + "subjects ");
console.log("select subjects");
return;
}
var parameters =
"&gappno=" +
gappno +
"&updatevalue=" +
JSON.stringify(jsonObj) +
"&studsub=" +
JSON.stringify(subjectCombination);
$.ajax({
type: "post",
url: "src/saveeditapp.php",
data: parameters,
success: function(response) {
response = JSON.parse(response);
var { status, msg } = response;
if (status == "success") {
alert(msg);
// $("#idModal1").modal("toggle");
$("#appintro").show();
$("#appdetl").show();
$("#appview").hide();
$("#subject_det").hide();
$("#eligibilitydet").hide();
return;
} else {
alert(msg);
// $("#idModal1").modal("toggle");
return;
}
}
});
}
function in_array(needle, haystack) {
var length = haystack.length;
for (var i = 0; i < length; i++) {
if (haystack[i] == needle) return true;
}
return false;
}
function saveApplication(appno) {
var remarks = $("#fremarks").val();
var status = $("#status").val();
var parameters =
"&appno=" + appno + "&status=" + status + "&remarks=" + remarks;
$.ajax({
type: "post",
url: "src/savestuddet.php",
data: parameters,
success: function(response) {
response = JSON.parse(response);
var { status, msg } = response;
if (status == "success") {
alert(msg);
$("#idModal1").modal("toggle");
return;
} else {
alert(msg);
$("#idModal1").modal("toggle");
return;
}
}
});
}
function saveAssignDetails() {
var selected_apps = [];
table.$('input[type="checkbox"]').each(function() {
if (this.checked) {
// Create an array of applications
selected_apps.push(this.value);
}
});
if (typeof selected_apps !== "undefined" && selected_apps.length > 0) {
// the array is defined and has at least one element
var user = $("#user").val();
var parameters = `user=${user}&apps=${selected_apps}`;
$.ajax({
type: "post",
url: "src/saveapps.php",
data: parameters,
success: function(response) {
response = JSON.parse(response);
var { status, msg } = response;
if (status == "success") {
alert(msg);
} else {
alert(msg);
}
}
});
} else {
alert("No Application selected");
}
}
function signOut() {
$.ajax({
type: "post",
url: "src/logout.php",
//data:parameters,
success: function(response) {
if (response === "logout") {
window.location.href = "index.html";
}
}
});
}
function getDate() {
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1; //January is 0!
var yyyy = today.getFullYear();
if (dd < 10) {
dd = "0" + dd;
}
if (mm < 10) {
mm = "0" + mm;
}
var today = dd + "/" + mm + "/" + yyyy;
return today;
}
function loadSeconYear() {
window.location.href =
"http://universitysolutions.in/gcg/adm/registration.html";
}
|