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


Current Path : /var/www/html/pgadm/js/admin/
Upload File :
Current File : /var/www/html/pgadm/js/admin/applicationview.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 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 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 fdept = $("#fdept").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 = "&fdept=" + fdept + "&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;
      if (error_code == -1) {
        alert(data.msg);
      }

      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"]}')">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) {
  $("#application").show();
  var db = window.location.pathname.split("/")[2];
console.log(db);
if (db == "vku-admin") db = "vskub";
if (db == "bnu-admin") db = "bnu";
if (db == "ru-admin") db = "ru";
if (db == "bcupg-admin") db = "bcu";

$("#application").load(`../${db}/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;
    
    if(db != 'ru')
    {
      $("#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);
      });

      $("#optdeg input[type=checkbox]").prop("disabled", "disabled");
    }
    // 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;
          fappno = data.fappno;
          ffappno = data.fappno;
          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 (data.fappno != "") loadSavedData(data.fappno);
          loadotdeg(data.fappno);
          // console.log(fappno);
          $("#optdeg input[type=checkbox]").prop("disabled", "disabled");
          $("#uploaddetdet input,#uploaddetdet button").each(function() {
            $(this).attr("disabled", "true");
          });
          fappno = "";
          fappno = data.fappno;

          $("#optdeg input[type=checkbox]").prop("disabled", "disabled");
          
          // 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(degcode);
  var combcode = $("#fcombcode").val();
  var regno = $("#qulregno").val();
  fappno = fappno;
  $.ajax({
    type: "POST",
    url: $host_url + "loadotdeg",
    data: "fappno=" + fappno + "&degcode=" + degcode + "&combcode=" + combcode+"&regno="+regno,
    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);
        console.log("aaaaaaa");
        $("#optdeg input[type=checkbox]").prop("disabled", "disabled");
      }
    }
  });
}

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 = ffappno;
  $.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) +
      "&totsemmarks=" +
      JSON.stringify(totsemmarks) +
      "&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
        });
      }
    }
  });
};