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.116.85.96
var $host_url =
"https://" +
window.location.host +
"/" +
window.location.pathname.split("/")[1] +
"/app.php?a=";
function updateclgdet() {
$("#loadtab").load("html_modules/updclgdet.html?v=" + version, () => {
loadUnivs("univname");
updclgnm();
});
}
function updclgnm() {
var univcode = $("#univname").val();
var parameters = "univcode=" + univcode;
$.ajax({
type: "post",
url: $host_url + "loadclgnm",
data: parameters,
success: function (response) {
if (response.error_code == 0) {
var optionsAsString =
"<option value=''>---Select College---</option>" +
"<option value='all'>All</option>";
for (var i = 0; i < response.data.length; i++) {
optionsAsString +=
"<option value='" +
response.data[i].fcollcode +
"'>" +
response.data[i].fcollcode +
"-" +
response.data[i].fcollname +
"-" +
response.data[i].ftown +
"</option>";
}
$("#updcollege").append(optionsAsString);
}
},
});
}
function loadclgtable() {
var college = $("#updcollege").val();
var univcode = $("#univname").val();
var parameters = "&college=" + college + "&univcode=" + univcode;
$.ajax({
type: "get",
url: $host_url + "loadclgdettab",
data: parameters,
success: function (response) {
// var responce = eval("(" + response + ")");
// console.log(responce);
var colltype =
"<option value=''>-College Type-</option>" +
"<option value='Government'>Government</option>" +
"<option value='Private Aided'>Private Aided</option>" +
"<option value='Private Un-Aided'>Private Un-Aided</option>" +
"<option value='Government Autonomous'>Government Autonomous</option>" +
"<option value='Private Autonomous'>Private Autonomous</option>" +
"<option value='Government Constituent'>Government Constituent</option>" +
"<option value='Private Constituent'>Private Constituent</option>" +
"<option value='Institute of National Importance'>Institute of National Importance</option>" +
"<option value='Private Aided Autonomous'>Private Aided Autonomous</option>";
var details = response.data;
// console.log(details);
var slno = 1;
var table = `<table class="table" style = '100%' class="table table-bordered table-hover">
<tr class='bg-green'>
<th width='3%'><center>Sl No</center></th>
<th width='5%'><center>College Code</center></th>
<th width='40%'><center>College Name</center></th>
<th width='8%'><center>College SSP Code</center></th>
<th width='8%'><center>District SSP Code</center></th>
<th width='8%'><center>Taluk SSP Code</center></th>
<th width='20%'><center>College Type</center></th>
<th width='5%'><center>Action</center></th>
</tr>
</th>`;
for (let i = 0; i < details.length; i++) {
table += `<tr>
<td id="slno"><center>${i + 1}</center></td>
<td id="collcode_${i}">${details[i].fcollcode}</td>
<td>${details[i].fcollname}</td>
<td><center><input id="collsspcode_${i}" value="${
details[i].sspcode
}" class="form-control"type="text"style="margin: 3px"/></center></td>
<td><center><input id="distsspcode_${i}" value="${
details[i].fsspdistcode
}" class="form-control"type="text"style="margin: 3px"/></center></td>
<td><center><input id="talsspcode_${i}" value="${
details[i].fssptalukcode
}" class="form-control"type="text"style="margin: 3px"/></center></td>
<td><center> <select
id="colltype_${i}"
class="form-control"
name="colltype"
value="${details[i].colltype}"
>
${colltype}
</select></center></td>
<td><center><button type="button" class="m-t-5 btn btn-success waves-effect btn-lg" onclick="saveclgdet(${
details[i].fcollcode
},${i})">Save</button></center> </td>
</tr>`;
}
table += `</table>`;
// console.log(table);
$("#clgdet").html(table);
for (let i = 0; i < details.length; i++) {
console.log(details[i]["fcolltype"], "#colltype_" + i);
$("#colltype_" + i).val(details[i]["fcolltype"]);
}
},
});
}
function saveclgdet(collcode, i) {
console.log($("#collsspcode_" + i).val(), "#collsspcode_" + i);
var collsspcode = $("#collsspcode_" + i).val();
var distsspcode = $("#distsspcode_" + i).val();
var talsspcode = $("#talsspcode_" + i).val();
var colltype = $("#colltype_" + i).val();
var univcode = $("#univname").val();
var parameters =
"&collsspcode=" +
collsspcode +
"&distsspcode=" +
distsspcode +
"&talsspcode=" +
talsspcode +
"&colltype=" +
colltype +
"&collcode=" +
collcode +
"&univcode=" +
univcode;
// console.log(parameters);
// return;
$.ajax({
type: "post",
url: $host_url + "saveclgtabdet",
data: parameters,
success: function (response) {
if (response.error_code == 0) {
alert(response.data);
loadclgtable();
} else {
alert(response.data);
}
},
});
}
|