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


Current Path : /var/www/html/pget/js/admin/
Upload File :
Current File : //var/www/html/pget/js/admin/documentverification.js

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

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

var $photo_url = "https://admission-certificates.s3.ap-south-1.amazonaws.com/";

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

function loadDocumentVerification() {
  $.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("documentverification.html", function() {
          var degers = data;
        });
      } else {
        alert("Please try after some time");
        return;
      }
    }
  });
}
function loadChangea() {
  // console.log('hi')
  var afrom = $("#afrom").val();
  if (afrom == 0) {
    $("#ato").val("ZZZZZZZZZZ");
  } else {
    // console.log(afrom)
    $("#ato").val(afrom);
  }
}

function loadChanged() {
  // console.log('hi')
  var dfrom = $("#dfrom").val();
  if (dfrom == 0) {
    $("#dto").val("ZZZZZ");
  } else {
    // console.log(afrom)
    $("#dto").val(dfrom);
  }
}

function loadAppDetails() {
  var dfrom = $("#dfrom").val();
  var dto = $("#dto").val();
  var afrom = $("#afrom").val();
  var ato = $("#ato").val();

  //   if (dfrom == "0") {
  //     alert("Fill Degree Range");
  //     return;
  //   }
  //    if (dto == "ZZZZ") {
  //     alert("Fill Degree Range");
  //     return;
  //   }
  //  if (afrom == "0") {
  //     alert("Fill Application Range");
  //     return;
  //   }
  //  if (ato == "ZZZZ") {
  //     alert("Fill Application Range");
  //     return;
  //   }
  $("#next").show();
  var datastring =
    "&dfrom=" + dfrom + "&dto=" + dto + "&afrom=" + afrom + "&ato=" + ato;
  $.blockUI({ message: "<img src='../img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    url: $host_url + "loadAppDetails",
    data: datastring,
    success: function(response) {
      $.unblockUI();
      // console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      console.log(data);
      var app = data;

      var str = `<table class="table table-bordered" >
            <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;">Applied Date</th>
                <th style = "text-align: center;">Student Name</th>                                
                <th style = "text-align: center;">Gender</th>
                <th style = "text-align: center;">Caste</th>
                <th style = "text-align: center;">HK / NHK</th>
                <th style = "text-align: center;">Amount</th>
                <th style = "text-align: center;">Action</th>
              </tr>
            </thead>
            <tbody>`;

      for (var i = 0; i < app.length; i++) {
        if (app[i].fappstatus == "T") {
          str += `<tr>
                    <td style = 'text-align: center;'>${i + 1}</td>
                    <td style = 'text-align: center;'>${app[i]["fappno"]}</td>
                    <td style = 'text-align: center;'>${app[i]["fappdate"]}</td>
                    <td style = 'text-align: left;'>${
                      app[i]["fname"]
                    }</td>                            
                    <td style = 'text-align: center;'>${app[i]["fgender"]}</td>
                    <td style = 'text-align: center;'>${
                      app[i]["fcategory"]
                    }</td>
                    <td style = 'text-align: center;'>${app[i]["fhk"]}</td>
                    <td style = 'text-align: center;'>${app[i]["ftotfee"]}</td>
                    <td style = 'text-align: center;'><button class="btn-info"
                    style="padding-right: 8px;padding-left: 8px;padding-top: 2px;padding-bottom: 2px;" 
                    onclick="loadStudentDetails('${app[i]["fappno"]}','${
            app[i]["fname"]
          }','${app[i]["fappdate"]}','${app[i]["ftotfee"]}','${
            app[i]["fgender"]
          }','${app[i]["fcategory"]}','${app[i]["fhk"]}')">View</button></td>
                  </tr>`;
        }
      }

      $("#appdet").html(str);
    }
  });
}
var fappnoo;
var statusandremarks = [];

function loadStudentDetails(
  fappno,
  fname,
  fappdate,
  ftotfee,
  fgender,
  fcategory,
  fhk
) {
  $("#next").hide();
  $("#add").hide();
  $("#perdetl").show();

  $("#fname").html(fname);
  $("#fappno").html(fappno);
  $("#fappdate").html(fappdate);
  $("#ftotfee").html(ftotfee);
  $("#fcategory").html(fcategory);
  $("#fhk").html(fhk);

  var datastring = "&fappno=" + fappno;

  $.blockUI({ message: "<img src='../img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    url: $host_url + "loadstuddocDetails",
    data: datastring,
    success: function(response) {
      $.unblockUI();
      // console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      statusandremarks = data.app;
      var app = data.app;
      var stuadm = data.stuadm;
      if (app.fstatus == null || " ") {
        var opt = `<option value = ''>>>Pending<<</option>`;
      }
      opt += `<option value='Verified'>Verified</option>
                        <option value='NotVerified'>Not Verified</option>`;

      var str = `<table class="table table-bordered">
            <thead>
              <tr class="bg-cyan">
                <th style = "text-align: center;width: 6%;">Sl. No.</th>
                <th style = "text-align: center;width: 15%;">Document Name</th>
                <th style = "text-align: center;width: 15%;">Document Status</th>
                <th style = "text-align: center;width: 200px;">Remarks</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;'><button class="btn btn-link" >
              <a href = "${$photo_url + app[i].fpath}" target = '_blank'>${
          app[i].fdoctype
        }</a>
              </button></td>              
              <td style = 'text-align: center;'><select id="${i}_doc_status" class="form-control" onchange="changeDoc(${i}, this)" >${opt}</select></td>
              <td style = 'text-align: center;'><input class="form-control form-rounded" type="text"   value="${
                app[i]["fremarks"]
              }" rounded id="${
          app[i]["fdoctype"]
        }_Remarks" onchange="changeRemarks(${i}, this)"  />
              </td>
            </tr>`;
      }

      var pen = `<option  value = ''>>>Pending<<</option>
                  <option value = 'Rejected'>Rejected</option>
                  <option value = 'Accepted'>Accepted</option>`;

      $("#studet").html(str);
      $("#studstatus").html(pen);
      // console.log(app);
      for (var j = 0; j < app.length; j++) {
        // console.log(app[j]["fstatus"]);
        $(`#${j}_doc_status`).val(app[j]["fstatus"]);
      }
      // console.log(stuadm[0]["FAPPRSTATUS"]);
      $(`#studstatus`).val(stuadm[0]["FAPPRSTATUS"]);
      $(`#textarea`).val(stuadm[0]["FAPPREMARKS"]);
    }
  });

  // console.log(statusandremarks);
}
function studentback() {
  $("#next").show();
  $("#add").show();
  $("#perdetl").hide();
}

function changeDoc(i, obj) {
  var docsts = statusandremarks.map((el, j) => {
    // console.log(el, j, i);
    if (j == i) {
      return {
        fappno: el.fappno,
        fdoctype: el.fdoctype,
        fstatus: $(obj).val(),
        fremarks: el.fremarks
      };
    } else return el;
  });
  // console.log(docsts);
  statusandremarks = docsts;
}

function changeRemarks(i, obj) {
  var docsts = statusandremarks.map((el, j) => {
    // console.log(el, j, i);
    if (j == i) {
      return {
        fappno: el.fappno,
        fdoctype: el.fdoctype,
        fstatus: el.fstatus,
        fremarks: $(obj).val()
      };
    } else return el;
  });
  // console.log(docsts);
  statusandremarks = docsts;
}

function StudentDetailsSubmit() {
  var studstatus = $("#studstatus").val();
  var textarea = $("#textarea").val();
  var fappno = $("#fappno").html();
  // console.log(studstatus,textarea,fappno);

  var datastring =
    "&fappno=" +
    fappno +
    "&studstatus=" +
    studstatus +
    "&textarea=" +
    textarea +
    "&statusandremarks=" +
    JSON.stringify(statusandremarks);

  $.ajax({
    type: "POST",
    url: $host_url + "DocStatusAndRemarks",
    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") {
        alert("Updated Successfullyy");
        studentback();
      } else {
        alert("Please try after some time");
        return;
      }
    }
  });
}