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


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

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

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 {
  }
}

// function login1() {
//   $.ajax({
//     type: "POST",
//     async: true,
//     url: "../pgetadm/login.php",
//     success: isLoggedInResponce
//   });
//   function isLoggedInResponce($responce) {
//     $responce = eval("(" + $responce + ")");
//     if ($responce.error_code == 1) {
//       alert("User not logged in");
//       window.location.href = "pgindex.html";
//     }
//   }
// }
var combcode = [];
var combsubject = [];
var optdegarry = [];

function loadApplicationView() {
  $.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("applicationview.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 loadAppDetailsView() {
  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 + "loadAppDetailsView",
    data: datastring,
    success: function(response) {
      $.unblockUI();
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      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;">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++) {
        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="loadPersonalDetails('${app[i]["fappno"]}','${
          app[i]["fname"]
        }','${app[i]["usertype"]}','${app[i]["fenttype"]}')">View</button></td>
            </tr>`;
      }

      $("#appdet").html(str);
    }
  });
}
function studentback() {
  $("#next").show();
  $("#add").show();
  $("#perdetl").hide();
  $("#application").hide();
  $("#apphead").hide();
  $("#basicDet").hide();
  $("#prevAcadDetCard").hide();
  $("#submitButton").hide();
  $("#optdeg_det").hide();
  $("#upload_doc_det").hide();
  $("#FeeDet").hide();
  $("#perdetl").hide();
}

function loadPersonalDetails(fappno, fname, usrtype, studtype) {
  $("#application").show();

  $("#application").load("../dud/ent-application.html", function() {
    // login1();
    $("#next").hide();
    $("#add").hide();
    $("#apphead").show();
    $("#submitButton").show();
    $("#success_card").hide();
    $("#basicDet").show();
    $("#prevAcadDetCard").show();
    $("#optdeg_det").show();
    $("#upload_doc_det").show();
    $("#FeeDet").hide();
    $("#perdetl").show();
    $("#fbcuetype").hide();
    $("#idChangePhoto").hide();

    $("#vfd").attr("checked", false);
    var cnd = true;
    if (usrtype == "adm") cnd = false;

    $("#idPerDet input[type=text],#idPerDet select").each(function() {
      $(this).attr("disabled", cnd);
    });

    $("#hprevAcadDet input[type=text],#hprevAcadDet select").each(function() {
      $(this).attr("disabled", cnd);
    });

    $(
      "#basicDet input[type=radio], #basicDet input[type=checkbox], #fgender input[type=radio]"
    ).each(function() {
      $(this).attr("disabled", cnd);
    });

    // console.log(fappno,fname);

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

    $.blockUI({ message: "<img src='../img/Loading_icon.gif' border='0'>" });
    $.ajax({
      type: "POST",
      data: datastring,
      url: $host_url + "getFacultyDegreeView",
      success: response => {
        $.unblockUI();
        var { error_code, data, status } = JSON.parse(response);
        // console.log(data);
        if (error_code == 0) {
          var fmobileno = data.fmobileno;
          combcode = data.combcode;
          combsubject = data.combsubs;

          // console.log(combcode,combsubject);
          $("#fmobileno").val(fmobileno);
          $("#fmobileno").prop("disabled", "disabled");
          var options;

          deg = data.degree;
          options += `<option value="">--Select--</option>`;
          deg.map((el, i) => {
            options += `<option value="${deg[i]["int_code"]}">${
              deg[i]["int_code"]
            } - ${deg[i]["val"]}</options>`;
          });
          $("#fdegree").html(options);
          // var options = "";
          // lanres = data.lanres;
          // options += `<option value="">--Select--</option>`;
          // lanres.map((el, i) => {
          //   options += `<option value="${lanres[i]["int_code"]}">${
          //     lanres[i]["val"]
          //   }</options>`;
          // });
          // $("#flang1").html(options);
          // $("#flang2").html(options);

          lanres = data.lanres;
          lansub = data.lanres;
          // options += `<option value="">--Select--</option>`;
          // lanres.map((el, i) => {
          //   options += `<option value="${lanres[i]["int_code"]}">${
          //     lanres[i]["val"]
          //   }</options>`;
          // });
          // $("#flang1").html(options);
          // $("#flang2").html(options);

          loadlansubjects();
          // loadsemtotmarks();

          var options = "";
          // prefdocvrfloc = data.prefdocvrfloc;
          // options += `<option value="">--Select--</option>`;
          // prefdocvrfloc.map((el, i) => {
          //   options += `<option value="${prefdocvrfloc[i]["fcollcode"]}">${
          //     prefdocvrfloc[i]["fcollname"]
          //   }</options>`;
          // });
          // $("#fdocloc").html(options);

          var year = "";
          var d = new Date();
          var n = d.getFullYear();
          for (var j = n; j > 1980; j--) {
            year += "<option value='" + j + "'>" + j + "</option>";
          }
          $("#fqyear").append(year);
          $("#fpgyear").append(year);

          var monthNames = [
            "January",
            "February",
            "March",
            "April",
            "May",
            "June",
            "July",
            "August",
            "September",
            "October",
            "November",
            "December"
          ];
          var months = monthNames
            .map(month => {
              return "<option>" + month + "</option>";
            })
            .join("");
          $("#fqmonth").html(months);
          $("#fpgmonth").html(months);
          $.ajax({
            type: "GET",
            async: false,
            url: $host_url + "getCategory",
            success: response => {
              var { error_code, data, status } = JSON.parse(response);
              // console.log(data);
              var options;

              if (error_code == 0) {
                cat = data.category;
                options += `<option value="">--Select--</option>`;
                cat.map((el, i) => {
                  options += `<option value="${cat[i]["fcategory"]}">${
                    cat[i]["fcategory"]
                  }</options>`;
                });
              }

              if (error_code == -1) {
                options += `<option>---Select---</option>
              <option value="">No Category Found</option>`;
              }
              $("#fcategory").html(options);
            }
          });
          // console.log(fappno);
          if (fappno != "") loadSavedData(fappno);
          loadotdeg(fappno);
          console.log(fappno);
          $("#uploaddetdet input,#uploaddetdet button").each(function() {
            $(this).attr("disabled", "true");
          });
          // fappno = fappno;
          // console.log(fappno);
        }
        if (error_code == -1) {
          alert("Something went wrong, Please Try after sometime.");
        }
      }
    });
  });
  // console.log(statusandremarks);
}

function loadotdeg(fappno) {
  var degcode = $("#fdegree").val();
  console.log(fappno);
  var combcode = $("#fcombcode").val();
  $.ajax({
    type: "POST",
    url: $host_url + "loadotdeg",
    data: "fappno=" + fappno + "&degcode=" + degcode + "&combcode=" + combcode,
    success: response => {
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      var { msg } = data;
      if (error_code === -1) {
        swal({
          title: data.msg,
          html: true,
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: false
        });
      } else {
        var optdeg = data.optdeg;
        optdegarry = data.optdeg;
        var optdegtable = `<table class='table table-bordered table-upd' id="optdet" style="margin: 20px;">
            <thead>
            <tr class="bg-cyan">
            <th style="width :8%">Sl. No.</th>
            <th style="width : 40%;">Degree Name</th>
            <th style="width : 5%;">Select</th>
            </tr>
            </thead>
            <tbody>`;

        var i = 1;

        optdeg.forEach(element => {
          optdegtable += `<tr>
            <td style="text-align: center;">${i}</td>
            <td style="text-align: left;" id="doc_upload_1" >${element.fdescpn}
             <input type = 'hidden' value = '${element.fdegree}' id = 'h_optdeg_${i}' >
            </td>
            <td><input type = 'checkbox' ${element.sddeg} value = '${element.fdegree}' id = 'deg_${i}' name = 'deg_${i}' disabled />
            <label for="deg_${i}" style="font-size:10px !important;"></label>
            </td>`;
          // if(element.sddeg == '0')
          // {
          //   optdegtable += `<td><input type = 'checkbox' ${element.sddeg} value = '${element.fdegree}' id = 'deg_${i}'>
          //   <label for="deg_${i}" style="font-size:10px !important;"></label>
          //   </td>`;
          // }else
          // {
          //   optdegtable += `<td><input type = 'checkbox' value = '${element.fdegree}' checked id = 'deg_${i}'>
          //   <label for="deg_${i}" style="font-size:10px !important;"></label></td>`;
          // }
          optdegtable += `</tr>`;
          i++;
        });
        optdegtable += `</tbody></table>`;
        $("#optdeg").html(optdegtable);
      }
    }
  });
}

const adminSavePGAdmDet = finsub => {
  var errorcount = savepgApplication();
  var ackvfd = $("#vfd").is(":checked");

  if (finsub == "T" && errorcount > 0) {
    swal({
      title: `Fill All the missing fields. Missing fields are highlighted in red color.`,
      html: true,
      showCancelButton: false,
      confirmButtonColor: "#5495ff",
      confirmButtonText: "OK",
      closeOnConfirm: false
    });
    return;
  }
  ackvfd = "T";
  // console.log(ffappno);
  fappno = fappno;
  $.blockUI({ message: "<img src='../img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    url: $host_url + "admpgsaveApplication",
    data:
      "fappno=" +
      fappno +
      "&final=" +
      finsub +
      "&feestr=" +
      JSON.stringify(feestr) +
      "&data=" +
      JSON.stringify(jsonObj) +
      "&privackd=" +
      JSON.stringify(privackd) +
      "&lansub=" +
      JSON.stringify(lansub) +
      "&privsub=" +
      JSON.stringify(privsub) +
      "&finaloptdeg=" +
      JSON.stringify(finaloptdeg),
    success: response => {
      $.unblockUI();
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data)
      var { message } = data;
      if (error_code === -1) {
        swal({
          title: data.message,
          html: true,
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: false
        });
      } else {
        var { app_no } = data;
        gAppNo = app_no;

        $("#next").show();
        $("#add").show();
        $("#perdetl").hide();
        $("#application").hide();
        $("#apphead").hide();
        $("#basicDet").hide();
        $("#prevAcadDetCard").hide();
        $("#submitButton").hide();
        $("#optdeg_det").hide();
        $("#upload_doc_det").hide();
        $("#FeeDet").hide();
        $("#perdetl").hide();

        swal({
          title: `Updated successfully.`,
          html: true,
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: false
        });
      }
    }
  });
};

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

  $("#next").show();
  var datastring =
    "&dfrom=" +
    dfrom +
    "&dto=" +
    dto +
    "&afrom=" +
    afrom +
    "&ato=" +
    ato +
    "&status=" +
    status;
  $.blockUI({ message: "<img src='../img/Loading_icon.gif' border='0'>" });

  $.ajax({
    type: "POST",
    url: $host_url + "loadRcubAppView",
    data: datastring,
    success: function(response) {
      $.unblockUI();
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      var app = data;
      if (error_code != "-1") {
        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;">Degree</th>
                <th style = "text-align: center;">Student <br>Name</th>   
                <th style = "text-align: center;">Tot. Max <br>Marks</th>                             
                <th style = "text-align: center;">Tot. Sec. <br>Marks</th>
                <th style = "text-align: center;">Tot. Perc.</th>
                <th style = "text-align: center;">Opt. Max. <br>Marks</th>
                <th style = "text-align: center;">Opt. Sec. <br>Marks</th>
                <th style = "text-align: center;">Opt. Perc.</th>
                <th style = "text-align: center;">Status</th>
                <th style = "text-align: center;">Action</th>
              </tr>
            </thead>
            <tbody>`;
        for (var i = 0; i < app.length; i++) {
          var cnd = "";
          var cnd1 = "";
          var cnd2 = "";
          if (app[i]["fstatus"] == "Approved") {
            cnd = "";
            cnd1 = "selected";
            cnd2 = "";
          } else if (app[i]["fstatus"] == "Rejected") {
            cnd = "";
            cnd1 = "";
            cnd2 = "selected";
          } else {
            cnd = "selected";
            cnd1 = "";
            cnd2 = "";
          }
          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]["fdegree"]}</td>
              <td style = 'text-align: left;'>${app[i]["fname"]}<br>
              Cat.:${app[i]["fcategory"]}<br>
              MOB:${app[i]["fmobileno"]}
              </td>                            
              <td style = 'text-align: center;'><input type = 'text' style = 'width: 50px;' onchange = "getappercent('${i}')" value = '${
            app[i]["ftotmax"]
          }' id = 'totmax_${i}'></td>
              <td style = 'text-align: center;'><input type = 'text' style = 'width: 50px;' onchange = "getappercent('${i}')" value = '${
            app[i]["ftotsec"]
          }' id = 'totsec_${i}'></td>
              <td style = 'text-align: center;'><input type = 'text' style = 'width: 50px;' disabled value = '${
                app[i]["ftotper"]
              }' id = 'totper_${i}'></td>
              <td style = 'text-align: center;'><input type = 'text' style = 'width: 50px;' onchange = "getappercent('${i}')" value = '${
            app[i]["foptmax"]
          }' id = 'optmax_${i}'></td>
              <td style = 'text-align: center;'><input type = 'text' style = 'width: 50px;' onchange = "getappercent('${i}')" value = '${
            app[i]["foptsec"]
          }' id = 'optsec_${i}'></td>
              <td style = 'text-align: center;'><input type = 'text' style = 'width: 50px;' disabled value = '${
                app[i]["foptper"]
              }' id = 'optper_${i}'></td>
              <td style = 'text-align: center;'>
                <select class="form-control" id="status_${i}">
                <option ${cnd}  value="">-Select-</option>
                <option ${cnd1} value="Approved" >Approved</option>
                <option ${cnd2} value="Rejected">Rejected</option>
                </select>
              </td>
              <td style = 'text-align: center;'><button class="btn-info"
              style="padding-right: 8px;padding-left: 8px;padding-top: 2px;padding-bottom: 2px;" 
              onclick="saveappprevdet('${app[i]["fappno"]}','${
            app[i]["fdegree"]
          }','${i}')">Save</button></td>
            </tr>`;
        }

        $("#appdet").html(str);
      } else {
        alert(data);
        $("#appdet").html("");
        return;
      }
    }
  });
}

function loadrcubApplicationView() {
  $("#loadTab").load("applicationview.html", function() {});
}

function saveappprevdet(appno, degree, row) {
  var totmax = $("#totmax_" + row).val();
  var totsec = $("#totsec_" + row).val();
  var optmax = $("#optmax_" + row).val();
  var optsec = $("#optsec_" + row).val();
  var totper = $("#totper_" + row).val();
  var optper = $("#optper_" + row).val();
  var status = $("#status_" + row).val();

  if (status == "") {
    alert("Please Select Status");
    $("#status_" + row).focus();
    return;
  }

  $.blockUI({ message: "<img src='../img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    url: $host_url + "saveappprevdet",
    data:
      "fappno=" +
      appno +
      "&degree=" +
      degree +
      "&totmax=" +
      totmax +
      "&totsec=" +
      totsec +
      "&optmax=" +
      optmax +
      "&optsec=" +
      optsec +
      "&totper=" +
      totper +
      "&optper=" +
      optper +
      "&status=" +
      status,
    success: response => {
      $.unblockUI();
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data)
      var { message } = data;
      if (error_code === -1) {
        swal({
          title: data.message,
          html: true,
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: false
        });
      } else {
        swal({
          title: `Updated successfully.`,
          html: true,
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: false
        });
      }
    }
  });
}

function getappercent(row) {
  var totmax = $("#totmax_" + row).val();
  var totsec = $("#totsec_" + row).val();
  var optmax = $("#optmax_" + row).val();
  var optsec = $("#optsec_" + row).val();
  var totper = 0;
  var optper = 0;
  if (totmax != "" && totsec != "") {
    totper = (totsec / totmax) * 100;
    $("#totper_" + row).val(totper);
  }

  if (optmax != "" && optsec != "") {
    optper = (optsec / optmax) * 100;
    $("#optper_" + row).val(optper);
  }
}