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 : 3.145.70.108


Current Path : /var/www/html/pgadm2020/js/admin/
Upload File :
Current File : /var/www/html/pgadm2020/js/admin/editapp.js

var $host_url1 =
  "http://" +
  window.location.host +
  "/" +
  window.location.pathname.split("/")[1] +
  "/";

var deg;

var gAppNo;

var fappno = "";
var ffappno = "";

var photo_path = "";

var months = "";
function homeLink() {
  var r = confirm("Do You Want To Logout!");
  if (r == true) {
    window.location.href = "index.html";
  } else {
  }
}

var combcode = [];
var combsubject = [];
var optdegarry = [];

function editapp() {
  $.ajax({
    type: "POST",
    url: $host_url + "loadRange",
    async: false,
    success: function (response) {
      //  console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      if (error_code == "0") {
        $("#loadTab").load("editapp.html", function () {
          var degrees = data;
          var dept_opt = "";
          for (let deg of degrees) {
            dept_opt += `<option value="${deg.fdegree}">${deg.fdescpn}</option>`;
          }
          $("#fdept").html(dept_opt);
        });
      } else {
        alert("Please try after some time");
        return;
      }
    },
  });
}

function studreg() {
  var appno = document.getElementById("regno").value;

  //   console.log(appno);
  //   return;

  $.ajax({
    type: "POST",
    url: $host_url + "loadregno",
    data: "&appno=" + appno,
    async: false,
    success: function (response) {
      var response = JSON.parse(response);
      console.log(response);
      if (response.error_code === 0) {
        var table = `<table class="table table-bordered" style="height: 50px;">
      <thead>
        <tr class="bg-cyan">
          <th style = "text-align: center;">Student Name</th>
          <th style = "text-align: center;">Mobile Number</th>
          <th style = "text-align: center;">Checkbox</th>
          <th style = "text-align: center;">Action</th>
                  </tr>
      </thead>`;
        var check = "";
        if (response.data.feditapp === "T") {
          check = "checked";
        } else {
          check = "";
        }
        table += `<tr>
      <td style = 'text-align: center;'>${response.data.fname}</td>
      <td style = 'text-align: center;'>${response.data.fmobileno}</td>
      <td style = 'text-align: center;'>&nbsp; &nbsp;<input onChange="box(this)"  type="checkbox" id="deg_${response.data.fappno}" ${check} />
        <label for="deg_${response.data.fappno}" style="font-size:10px !important;">&nbsp;</label></td>
        <td style = 'text-align: center;'><button class="btn btn-primary waves-effect m-l-40" onclick="saveeditapp(${response.data.fappno})";>Save</button></td>
    </tr>`;

        $("#edittab").html(table);
      } else {
        alert("Invalid Application Number");
        return;
      }
    },
  });
}

function saveeditapp(fappno) {
  //   console.log(fappno, document.getElementById("deg_" + fappno).checked);

  var checked = document.getElementById("deg_" + fappno).checked;

  $.ajax({
    type: "POST",
    url: $host_url + "updateeditapp",
    data: "&fappno=" + fappno + "&checked=" + checked,
    async: false,
    success: function (response) {
      var response = JSON.parse(response);

      if (response.error_code === 0) {
        alert("Updated Successfully...!");
        editapp();
      } else {
        alert("Failed to Update...!");
        return;
      }
    },
  });
}