0xV3NOMx
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.222.108.185


Current Path : /var/www/html/univadmin/js/
Upload File :
Current File : /var/www/html/univadmin/js/upddegdet.js

var $host_url =
  "https://" +
  window.location.host +
  "/" +
  window.location.pathname.split("/")[1] +
  "/app.php?a=";

function updatedegdet() {
  $("#loadtab").load("html_modules/updatedegdet.html?v=" + version, () => {
    loadUnivs("univname");
    upddegnm();
  });
}

function upddegnm() {
  var univcode = $("#univname").val();

  var parameters = "univcode=" + univcode;

  $.ajax({
    type: "post",
    url: $host_url + "loaddegnm",
    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].fdegree +
            "'>" +
            response.data[i].fdegree +
            "-" +
            response.data[i].fdescpn +
            "</option>";
        }

        $("#upddegree").append(optionsAsString);
      }
    },
  });
}

function loaddegreetable() {
  var degree = $("#upddegree").val();
  var univcode = $("#univname").val();

  var parameters = "&degree=" + degree + "&univcode=" + univcode;

  $.ajax({
    type: "get",
    url: $host_url + "loaddegreedettab",
    data: parameters,
    success: function (response) {
      var details = response.data;

      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>Degree Code</center></th>
            <th width='40%'><center>Degree Name</center></th>
            <th width='8%'><center>SSP Code</center></th>
            <th width='8%'><center>Course Combination</center></th>
            <th width='8%'><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="fdegree_${i}">${details[i].fdegree}</td>
                <td>${details[i].fdescpn}</td>
                <td><center><input id="sspdegcode_${i}" value="${
          details[i].fsspdegcode
        }" class="form-control"type="text"style="margin: 3px"/></center></td>
                <td><center><input id="fsspcombcode_${i}" value="${
          details[i].fsspcombcode
        }" class="form-control"type="text"style="margin: 3px"/></center></td>
                <td><center><button  type="button" class="m-t-5 btn btn-success waves-effect btn-lg" onclick="savedegreedet('${
                  details[i].fdegree
                }',${i})">Save</button></center> </td>
                
                </tr>`;
      }
      table += `</table>`;

      //   console.log(table);
      $("#degdet").html(table);
    },
  });
}

function savedegreedet(fdegree, i) {
  var sspdegcode = $("#sspdegcode_" + i).val();
  var fsspcombcode = $("#fsspcombcode_" + i).val();
  var univname = $("#univname").val();
  //   console.log(fdegree, fsspcombcode, sspdegcode);
  //   return;

  var parameters =
    "&fdegree=" +
    fdegree +
    "&sspdegcode=" +
    sspdegcode +
    "&fsspcombcode=" +
    fsspcombcode+"&univcode="+univname;

  $.ajax({
    type: "post",
    url: $host_url + "savedegreetabdet",
    data: parameters,
    success: function (response) {
      if (response.error_code == 0) {
        alert(response.data);
        loaddegreetable();
      } else {
        alert(response.data);
      }
    },
  });
}