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.138.134.163


Current Path : /var/www/html/pgadm/js/admin/
Upload File :
Current File : /var/www/html/pgadm/js/admin/admconfirmation.js

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

// var db = window.location.pathname.split("/")[2];

// if (location.protocol != "https:") {
//   var protocol = "http://";
// } else {
//   var protocol = "https://";
// }

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

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

$(function() {
  var focusedElement;
  $(document).on("focus", "input", function() {
    if (focusedElement == this) return;
    focusedElement = this;
    setTimeout(function() {
      focusedElement.select();
    }, 100);
  });
});

function loadadmconfirmation() {
  $.ajax({
    type: "POST",
    url: $host_url + "loaddegcreateuser",
    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("admconfirmation.html", function() {
          var degers = data;
          var opt = "<option value = ''>--Select--</option>";
          for (var i = 0; i < degers.length; i++) {
            opt += `<option value = '${degers[i]["fdegree"]}'>${
              degers[i]["fdescpn"]
            }</option>`;
          }
          $("#degcreateusr").html(opt);
        });
      } else {
        alert("Please try after some time");
        return;
      }
    }
  });
}
function loadstuddetadm() {
  $("#next").show();
  var status = $("#fadmstatus").val();
  // var deg = $('#degcreateusr').val();
  console.log(status);
  $.ajax({
    type: "POST",
    url: $host_url + "loadstuddetadm",
    data:
      "&deg=" + $("#degcreateusr").val() + "&status=" + $("#fadmstatus").val(),
    async: false,
    success: function(response) {
      //  console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      console.log(data);
      if (error_code == -1) {
        $("#next").hide();
        return;
      }
      var app = data;

      var str = `<table class="table table-bordered" style="height: 200px;">
            <thead>
              <tr class="bg-cyan">
                <th style = "text-align: center;">Sl. No.</th>                
                <th style = "text-align: center;">Application No.</th>
                <th style = "text-align: center;">Student Name</th>
                <th style = "text-align: center;">Alloted No.</th>
                <th style = "text-align: center;">Alloted Date</th>
                <th style = "text-align: center;">Alloted Category</th>
                <th style = "text-align: center;">Alloted Quota</th>
                <th style = "text-align: center;">View</th>  
                <th style = "text-align: center;">Status</th>                
              </tr>
            </thead>
            <tbody>`;
      for (var i = 0; i < app.length; i++) {
        str += `<tr>
              <td style = 'text-align: center;'>${i + 1}</td>              
              <td style = 'text-align: center;'>${
                app[i]["fappno"]
              }</td>              
              <td style = 'text-align: left;'>${app[i]["fname"]}</td>
              <td style = 'text-align: center;'>${
                app[i]["fallotno"]
              }</td>                                          
              <td style = 'text-align: center;'>${app[i]["fallotdate"]}</td>
              <td style = 'text-align: center;'>${app[i]["fcatcode"]}</td>
              <td style = 'text-align: center;'>${app[i]["freserve"]}</td>
              <td style = 'text-align: center;'><button class="btn-info"
                    style="padding-right: 8px;padding-left: 8px;padding-top: 2px;padding-bottom: 2px;" 
                    onclick="loadStudentadmdetails('${app[i]["fallotdate"]}','${
          app[i]["fallotno"]
        }','${app[i]["fappno"]}','${app[i]["fcatcode"]}','${
          app[i]["fcollcode"]
        }','${app[i]["fname"]}','${app[i]["frank"]}','${app[i]["freserve"]}','${
          app[i]["fcollconf"]
        }')">View</button></td>
              <td style = 'text-align: center;' id='${i}_admitted'></td>          
            </tr>`;
      }

      $("#studdet").html(str);
      for (var i = 0; i < app.length; i++) {
        if (app[i]["fcollconf"] == "T") {
          $("#" + i + "_admitted").html("Admitted");
        } else {
          $("#" + i + "_admitted").html("Pending");
          $("#" + i + "_admitted").css("background", "lightcoral");
        }
      }
    }
  });
}

// background: bisque;

function loadStudentadmdetails(
  fallotdate,
  fallotno,
  fappno,
  fcatcode,
  fcollcode,
  fname,
  frank,
  freserve,
  fcollconf
) {
  $("#next").hide();
  $("#add").hide();
  $("#perdetl").show();

  $("#fname").html(fname);
  $("#fappno").html(fappno);
  $("#fadmno").html(fallotno);
  $("#fallotcat").html(fcatcode);
  $("#frank").html(frank);
  $("#fallotqta").html(freserve);
  $("#fallotdate").html(fallotdate);

  if (fcollconf == "T") {
    // console.log('checked');
    document.getElementById("admit").checked = true;
    document.getElementById("saveadmconf").disabled = true;
    // $("#alreadyadmitted").html('Already Admitted');
    // $("#alreadyadmitted").css('font-size','16px');
  } else {
    // console.log('not checked');
    document.getElementById("saveadmconf").disabled = false;
    document.getElementById("admit").checked = false;
    // fcollconf = '';
  }

  // var datastring =
  //   "&fappno=" +
  //   fappno;

  // $.ajax({
  //   type: "POST",
  //   url: $host_url + "loadstudconf",
  //   async: false,
  //   data: datastring,
  //   success: function (response) {
  //     //  console.log(response);
  //     var { error_code, data, status } = JSON.parse(response);
  //     console.log(data);
  //     if (error_code == "0") {
  //       if(data[0].fcollconf == 'T'){
  //         $("#admit").attr("checked", true);
  //         console.log('checked');
  //       }else{
  //         $("#admit").attr("checked", false);
  //       }
  //     } else {
  //       alert("Please try after some time");
  //       return;
  //     }
  //   },
  // });
}

var chkboxes = [];
boxes = deg => {
  console.log($(deg).is(":checked"));
  if ($(deg).is(":checked")) {
    chkboxes.push($(deg).val());
  } else {
    chkboxes = chkboxes.filter(el => el !== $(deg).val());
  }
  console.log(chkboxes);
};

function savestudadmissionconfirm() {
  var admit = $("#admit").is(":checked");

  console.log("ack", admit);
  if (admit !== true) {
    swal({
      title: `Please Confirm and Admit`,
      html: true,
      showCancelButton: false,
      confirmButtonColor: "#5495ff",
      confirmButtonText: "OK",
      closeOnConfirm: false
    });
    return;
  }

  console.log($("#fappno").html());

  var datastring =
    "&admitted=" + $("#admit").val() + "&fappno=" + $("#fappno").html();

  $.ajax({
    type: "POST",
    url: $host_url + "studconf",
    async: false,
    data: datastring,
    success: function(response) {
      //  console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      console.log(data);
      if (error_code == "0") {
        swal({
          title: `Updated successfully.`,
          html: true,
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: false
        });
        studentback();
      } else {
        alert("Please try after some time");
        return;
      }
    }
  });
}

function getreport() {
  // $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  var status = $("#fadmstatus").val();
  var degree = $("#degcreateusr").val();

  printstatusreport(status, degree);
}
function printstatusreport(status, degree) {
  console.log(status, degree);
  window.location.href =
    $host_url + "admissionstatusreport&status=" + status + "&degree=" + degree;
}