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


Current Path : /proc/thread-self/root/var/www/html/univadmin/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin/js/bkhmindex.js

var year = [];
const tableArray = [];

var currentYear = new Date().getFullYear();
for (var i = currentYear; i >= 1904; i--) {
  year.push(i);
}
var yearopt = `<option value='Select'>Select</option>`;
for (var i = 0; i < year.length; i++) {
  yearopt += `<option value='${year[i]}'>${year[i]}</option>`;
}

$("#FBATCH").html(yearopt);
$("#FYOA").html(yearopt);
$("#verfy_check").hide();
$("#mob_otp").hide();
$("#eml_otp").hide();
$("#clear_det").show();
$("#otp_det").hide();
$("#new_pass").hide();
$("#chg_psd").hide();
$("#conf_pass").hide();

function getReferData() {
  var refers = `<div class="col-lg-12">
  <div class="card mb-12" id="com_det">
    <div class="card-header">
      Friends Details
      
    </div>
    <div class="card-body">
    <input id='hidden_value' value='' hidden/>
    <table id="referTab">
    <thead>
        <tr>
            <th>Name</th>
            <th>Email</th>
            <th>Mobile</th>
            <th>Add</th>
        </tr>
        </thead>
        <tbody id="tbody">
        <tr>
              <td><input type="text" id='name' value=''></input></td>
              <td><input type="text" id='email' value=''></input></td>
              <td><input type="text" id='mobile' value='' onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength='10'></input></td>
              <td> <button
              type="button"
              class="btn btn-outline-success btn-sm"
              onclick="addItem()"
            >
            <i class="bi bi-plus"></i>Add
            </button></td>
          </tr>`;
  for (var i = 0; i < tableArray.length; i++) {
    refers += `<tr>
              <td id='name' value='${tableArray[i].name}'>${tableArray[i].name}</td>
              <td id='email' value='${tableArray[i].email}'>${tableArray[i].email}</td>
              <td id='mobile' value='${tableArray[i].mobile}'>${tableArray[i].mobile}</td>
              <td> <button
              type="button"
              class="btn btn-outline-success btn-sm"
              onclick="editItem(
              '${i}', 
              '${tableArray[i].mobile}', 
              '${tableArray[i].email}', 
              '${tableArray[i].name}')"
            >
              Edit
            </button></td>
          </tr>`;
  }
  refers += ` </tbody>
    </table>
    </div>
  </div></div>
  </div>`;

  $("#referTemp").html(refers);
}

function getMovedOut() {
  let FYOA = $("#FYOA").val();

  var movedyear = [];
  const movedarry = [];

  var currentYear = new Date().getFullYear();
  for (var i = currentYear; i >= FYOA; i--) {
    movedyear.push(i);
  }

  var yearmove = `<option value='Select'>Select</option>`;
  for (var i = 0; i < movedyear.length; i++) {
    yearmove += `<option value='${year[i]}'>${year[i]}</option>`;
  }
  $("#FYOM").html(yearmove);
}

function addItem() {
  let mobile = $("#mobile").val();
  let email = $("#email").val();
  let name = $("#name").val();
  let index = $("#hidden_value").val();

  if (name == "") {
    Swal.fire({
      title: "Error!",
      text: "Enter Refer Name",
      icon: "error",
      confirmButtonText: "Ok",
    });
    $("#name").focus();
    return;
  }
  // if (email == "") {
  //   Swal.fire({
  //     title: "Error!",
  //     text: "Enter Refer Email Id",
  //     icon: "error",
  //     confirmButtonText: "Ok",
  //   });
  //   $("#email").focus();
  //   return;
  // }
  if (mobile == "") {
    Swal.fire({
      title: "Error!",
      text: "Enter Refer Mobile Number",
      icon: "error",
      confirmButtonText: "Ok",
    });
    $("#mobile").focus();
    return;
  }

  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/bkmhreferno.php",
    data: "fmob=" + mobile,
    success: function (res) {
      let response = JSON.parse(res);
      if (response.status == "success") {
        let obj = {
          mobile: mobile,
          email: email,
          name: name,
        };
        if (index === "") {
          tableArray.push(obj);
        } else {
          tableArray[index] = obj;
        }
        $("#mobile").val("");
        $("#email").val("");
        $("#name").val("");
        getReferData();
        $("#name").focus();
      } else {
        Swal.fire({
          title: "Error!",
          text: response.msg,
          icon: "error",
          confirmButtonText: "Ok",
        });
        $("#mobile").focus();
      }
    },
  });
}

function editItem(i, mobile, email, name) {
  $("#hidden_value").val(i);
  $("#mobile").val(mobile);
  $("#email").val(email);
  $("#name").val(name);
}

function copyComPer() {
  var fcopyadd = document.getElementById("fcopyadd").checked;
  var comadres1 = $("#FADDC1").val();
  var comadres2 = $("#FADDC2").val();
  var pincodecom = $("#FPINCODEC").val();
  var statec = $("#FSTATEC").val();
  var ccountry = $("#FCONTC").val();
  if (fcopyadd == true) {
    $("#FADDP1").val(comadres1);
    $("#FADDP2").val(comadres2);
    $("#FPINCODEP").val(pincodecom);
    $("#FSTATEP").val(statec);
    $("#FCONTP").val(ccountry);
  } else {
    $("#FADDP1").val("");
    $("#FADDP2").val("");
    $("#FPINCODEP").val("");
    $("#FSTATEP").val("");
    $("#FCONTP").val("");
  }
}

function finOldStdDet() {
  var FEMAIL = $("#FEMAIL").val();
  var mob_otps = $("#mob_otps").val();
  var FMOBILE = $("#fmob").val();
  // var eml_otps = $("#eml_otps").val();
  var FBATCH = $("#FBATCH").val();
  var FCNTCODE = $("#fccode").text();
  if (FCNTCODE == "+91") {
    if (mob_otps == "") {
      Swal.fire({
        title: "Error!",
        text: "Enter Mobile OTP",
        icon: "error",
        confirmButtonText: "Ok",
      });
      return;
    }
  }

  var params =
    "FMOBILE=" +
    FMOBILE +
    "&FEMAIL=" +
    FEMAIL +
    "&FBATCH=" +
    FBATCH +
    "&FCNTCODE=" +
    FCNTCODE +
    "&mob_otps=" +
    mob_otps;
  $("#overlay").fadeIn();
  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/bkmhconfirm.php",
    data: params,
    success: function (res) {
      $("#overlay").fadeOut();
      let response = JSON.parse(res);
      if (response.status == "success") {
        $("#overlay").fadeOut();
        window.location.href = "./loginForm.html?mob=" + FMOBILE;
      } else {
        $("#overlay").fadeOut();
        Swal.fire({
          title: "Error!",
          text: response.msg,
          icon: "error",
          confirmButtonText: "Ok",
        });
      }
    },
  });
}

function saveOldStdDet() {
  var FMEMNAME = $("#FMEMNAME").val();
  var FBATCH = $("#FBATCH").val();
  var FMOBILE = $("#fmob").val();
  var FCNTCODE = $("#fccode").text();
  var FEMAIL = $("#FEMAIL").val();
  var mailformat = document.getElementById("FEMAIL").validity.valid;

  if (FMEMNAME == "") {
    $("#FMEMNAME").focus();
    Swal.fire({
      title: "Error!",
      text: "Enter Alumni Name",
      icon: "error",
      confirmButtonText: "Ok",
    });
    return;
  }
  if (FCNTCODE == "") {
    $("#FCNTCODE").focus();
    Swal.fire({
      title: "Error!",
      text: "Enter Country Code",
      icon: "error",
      confirmButtonText: "Ok",
    });

    return;
  }
  if (FMOBILE == "") {
    $("#FMOBILE").focus();
    Swal.fire({
      title: "Error!",
      text: "Enter Country Code",
      icon: "error",
      confirmButtonText: "Ok",
    });

    return;
  }

  // if (FEMAIL == "") {
  //   $("#FEMAIL").focus();
  //   Swal.fire({
  //     title: "Error!",
  //     text: "Enter Email I'D",
  //     icon: "error",
  //     confirmButtonText: "Ok",
  //   });

  //   return;
  // }
  // if (mailformat == false) {
  //   $("#FEMAIL").focus();
  //   Swal.fire({
  //     title: "Error!",
  //     text: "Enter Valid Email I'D",
  //     icon: "error",
  //     confirmButtonText: "Ok",
  //   });
  //   return;
  // }
  if (FBATCH == "" || FBATCH == "Select") {
    $("#FBATCH").focus();
    Swal.fire({
      title: "Error!",
      text: "Select Batch",
      icon: "error",
      confirmButtonText: "Ok",
    });
    return;
  }

  var params =
    "FMEMNAME=" +
    FMEMNAME +
    "&FBATCH=" +
    FBATCH +
    "&FMOBILE=" +
    FMOBILE +
    "&FCNTCODE=" +
    FCNTCODE +
    "&FEMAIL=" +
    FEMAIL;
  $("#overlay").fadeIn();
  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/bkmh.php",
    data: params,
    success: function (res) {
      let response = JSON.parse(res);

      if (response.status == "success") {
        $("#overlay").fadeOut();
        Swal.fire({
          text: response.msg,
          confirmButtonText: "Ok",
        });
        if (FCNTCODE == "+91") {
          $("#mob_otp").focus();
          $("#mob_otp").show();
          // $("#eml_otp").show();
          $("#verfy_check").show();
          $("#opt_check").hide();
        } else {
          $("#overlay").fadeOut();
          window.location.href = "./loginForm.html?mob=" + FMOBILE;
        }
        // else {
        //   $("#FEMAIL").focus();
        // $("#eml_otp").show();
        //   $("#verfy_check").show();
        //   $("#opt_check").hide();
        // }
      } else {
        $("#overlay").fadeOut();
        Swal.fire({
          // title: "Error!",
          text: response.msg,
          icon: "error",
          confirmButtonText: "Ok",
        });
        $("#mob_otp").hide();
        $("#eml_otp").hide();
        $("#verfy_check").hide();
        $("#opt_check").show();
      }
    },
  });
}

function loadPerDet() {
  const queryString = window.location.search;
  const urlParams = new URLSearchParams(queryString);
  let mob = urlParams.get("mob");

  $("#overlay").fadeIn();
  $.ajax({
    type: "GET",
    url:
      "https://universitysolutions.in/univadmin/bkhm/loginDetails.php?mob=" +
      mob,
    async: false,
    success: function (res) {
      let response = JSON.parse(res);
      let data = response.data;
      let refer = response.refer;
      $("#overlay").fadeOut();
      if (response.error_code == "success") {
        let faltno = data.FALTCNTCODE + data.FALTMOBILE;
        $("#FMEMNAME").val(data.FMEMNAME);
        $("#FCNTCODE").val(data.FCNTCODE);
        $("#FMOB").val(data.FCNTCODE + "-" + data.FMOBILE);
        $("#FEMAIL").val(data.FEMAIL);
        if (data.FALTCNTCODE !== "") {
          $("#fccode").text(data.FALTCNTCODE);
        }
        $("#faltrmob").val(data.FALTMOBILE);
        $("#FBATCH").val(data.FBATCH);
        $("#FYOA").val(data.FYOA);
        getMovedOut();
        $("#FDEGREE").val(data.FDEGREE);
        $("#FJOBDESC").val(data.FJOBDESC);
        $("#FADDC1").val(data.FADDC1);
        $("#FADDC2").val(data.FADDC2);
        $("#FPINCODEC").val(data.FPINCODEC);
        $("#FSTATEC").val(data.FSTATEC);
        $("#FCONTC").val(data.FCONTC);
        $("#FADDP1").val(data.FADDP1);
        $("#FADDP2").val(data.FADDP2);
        $("#FPINCODEP").val(data.FPINCODEP);
        $("#FSTATEP").val(data.FSTATEP);
        $("#FCONTP").val(data.FCONTP);
        $("#FYOM").val(data.FYOM);
        if (refer.length !== 0) {
          for (var i = 0; i < refer.length; i++) {
            let object = {
              mobile: refer[i].FMOBILE,
              email: refer[i].FEMAIL,
              name: refer[i].FMEMNAME,
            };
            tableArray.push(object);
          }
        }
        getReferData();
      } else {
        Swal.fire({
          // title: "Error!",
          text: response.error_code,
          icon: "error",
          confirmButtonText: "Ok",
        });
        return;
      }
    },
  });
}

function loginOldStd() {
  var username = $("#fusername").val();
  var pswrd = $("#fpassword").val();
  // console.log(username, pswrd);

  if (username == "") {
    Swal.fire({
      title: "Error!",
      text: "Please enter your Mobile No./Email",
      icon: "error",
      confirmButtonText: "Ok",
    });
    $("#fusername").focus();
    return;
  }
  if (pswrd == "") {
    Swal.fire({
      title: "Error!",
      text: "Please enter your Password",
      icon: "error",
      confirmButtonText: "Ok",
    });
    $("#fpassword").focus();
    return;
  }
  $("#overlay").fadeIn();
  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/loginDet.php",
    data: "userid=" + username + "&paswrd=" + pswrd,
    success: function (res) {
      let response = JSON.parse(res);
      console.log(response, "response");
      if (response.data === 1) {
        $("#overlay").fadeOut();
        if (response.row.FTYPE == "A") {
          window.location.href = "dashboard.html";
        } else {
          window.location.href = "loginpage.html?mob=" + username;
        }

        //getData(username);
      } else {
        $("#overlay").fadeOut();
        Swal.fire({
          title: "Error!",
          text: "Invalid User Name or Password",
          icon: "error",
          confirmButtonText: "Ok",
        });
        return;
      }
    },
  });
}

function sendOTP() {
  var fmob = $("#fmob").val();
  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/sendOTP.php",
    data: "fmob=" + fmob,
    success: function (res) {
      let response = JSON.parse(res);
      if (response.status == "success") {
        alert(response.msgs);
      } else {
        alert("Something went wrong");
      }
    },
  });
}

function saveFinOldStdDet() {
  var FMEMNAME = $("#FMEMNAME").val();
  var FBATCH = $("#FBATCH").val();
  var FMOBILE = $("#FMOB").val();
  var FEMAIL = $("#FEMAIL").val();
  var FALTCNTCODE = $("#fccode").text();
  var FALTMOBILE = $("#faltrmob").val();
  var FYOA = $("#FYOA").val();
  var FDEGREE = $("#FDEGREE").val();
  var FYOM = $("#FYOM").val();
  var comadres1 = $("#FADDC1").val();
  var comadres2 = $("#FADDC2").val();
  var FJOBDESC = $("#FJOBDESC").val();
  var pincodecom = $("#FPINCODEC").val();
  var statec = $("#FSTATEC").val();
  var ccountry = $("#FCONTC").val();
  var peradres1 = $("#FADDP1").val();
  var peradres2 = $("#FADDP2").val();
  var pincodeper = $("#FPINCODEP").val();
  var statep = $("#FSTATEP").val();
  var pcountry = $("#FCONTP").val();
  $("#overlay").fadeIn();
  if (FBATCH == "" || FBATCH == "Select") {
    $("#FBATCH").focus();
    Swal.fire({
      title: "Error!",
      text: "Select Batch",
      icon: "error",
      confirmButtonText: "Ok",
    });
    return;
  }

  if (comadres1 == "") {
    $("#FBATCH").focus();
    Swal.fire({
      title: "Error!",
      text: "Enter Address details",
      icon: "error",
      confirmButtonText: "Ok",
    });
    return;
  }
  if (FYOA == "" || FYOA == "Select") {
    $("#FYOA").focus();
    Swal.fire({
      title: "Error!",
      text: "Select Year of Admission",
      icon: "error",
      confirmButtonText: "Ok",
    });
    return;
  }
  if (FYOM == "") {
    $("#FYOA").focus();
    Swal.fire({
      title: "Error!",
      text: "Select Year of Moved out",
      icon: "error",
      confirmButtonText: "Ok",
    });
    return;
  }
  var params =
    "FMEMNAME=" +
    FMEMNAME +
    "&FBATCH=" +
    FBATCH +
    "&FMOBILE=" +
    FMOBILE +
    "&FDEGREE=" +
    FDEGREE +
    "&FEMAIL=" +
    FEMAIL +
    "&FALTMOBILE=" +
    FALTMOBILE +
    "&FALTCNTCODE=" +
    FALTCNTCODE +
    "&FYOA=" +
    FYOA +
    "&FYOM=" +
    FYOM +
    "&comadres1=" +
    comadres1 +
    "&comadres2=" +
    comadres2 +
    "&pincodecom=" +
    pincodecom +
    "&statec=" +
    statec +
    "&ccountry=" +
    ccountry +
    "&peradres1=" +
    peradres1 +
    "&peradres2=" +
    peradres2 +
    "&pincodeper=" +
    pincodeper +
    "&statep=" +
    statep +
    "&pcountry=" +
    pcountry +
    "&FJOBDESC=" +
    FJOBDESC +
    "&data=" +
    JSON.stringify(tableArray);

  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/saveFinbkmh.php",
    data: params,
    success: function (res) {
      let response = JSON.parse(res);
      $("#overlay").fadeOut();
      if (response.error_code == "success") {
        Swal.fire({
          title: "Success!",
          text: response.msg,
          icon: "success",
          confirmButtonText: "Ok",
        });
      } else {
        Swal.fire({
          title: "Error!",
          text: response.msg,
          icon: "error",
          confirmButtonText: "Ok",
        });
      }
    },
  });
}

function cleardDet() {
  $("#overlay").fadeIn();
  $("#FMEMNAME").val("");
  $("#FBATCH").val("");
  $("#fmob").val("");
  $("#FCNTCODE").val("");
  $("#FEMAIL").val("");
  $("#opt_check").show();
  $("#verfy_check").hide();
  $("#mob_otp").hide();
  $("#eml_otp").hide();
  $("#overlay").fadeOut();
}

function getOldStudDetails() {
  const queryString = window.location.search;
  const urlParams = new URLSearchParams(queryString);
  let mob = urlParams.get("mob");
  window.location.href = "loginpage.html?mob=" + mob;
  getReferData();
}

function logOut() {
  Swal.fire({
    title: "Are you sure?",
    text: "Do you want to logout",
    icon: "warning",
    showCancelButton: true,
    confirmButtonColor: "#3085d6",
    cancelButtonColor: "#d33",
    confirmButtonText: "Yes",
  }).then((result) => {
    if (result.isConfirmed) {
      window.location.href = "logBKMC.html";
    }
  });
}

function otpSend() {
  let fmob = $("#for_fmob").val();
  $("#overlay").fadeIn();
  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/forgetOtpSend.php",
    data: "fmob=" + fmob,
    success: function (response) {
      let res = JSON.parse(response);
      if (res.status == "success") {
        $("#overlay").fadeOut();
        Swal.fire({
          title: "Success!",
          text: res.msg,
          icon: "sucess",
          confirmButtonText: "Ok",
        });
        $("#otp_det").show();
        $("#new_pass").show();
        $("#conf_pass").show();
        $("#verf_otp_for").hide();
        $("#chg_psd").show();
      } else {
        $("#overlay").fadeOut();
        Swal.fire({
          title: "Error!",
          text: res.msg,
          icon: "error",
          confirmButtonText: "Ok",
        });
      }
    },
  });
}

function changePassword() {
  let fmob = $("#for_fmob").val();
  let fotp = $("#fnew_otp").val();
  let fnewpswd = $("#fnewpswd").val();
  let fconfpass = $("#fconfpswd").val();
  if (fmob == "") {
    Swal.fire({
      title: "Error!",
      text: "Enter Mobile No.",
      icon: "error",
      confirmButtonText: "Ok",
    });
    $("#for_fmob").focus();
    return;
  }
  if (fotp == "") {
    Swal.fire({
      title: "Error!",
      text: "Enter OTP",
      icon: "error",
      confirmButtonText: "Ok",
    });
    $("#fnew_otp").focus();
    return;
  }
  if (fnewpswd == "") {
    Swal.fire({
      title: "Error!",
      text: "Enter New Password",
      icon: "error",
      confirmButtonText: "Ok",
    });
    $("#fnewpswd").focus();
    return;
  }
  if (fconfpass == "") {
    Swal.fire({
      title: "Error!",
      text: "Enter Confirm Password.",
      icon: "error",
      confirmButtonText: "Ok",
    });
    $("#fconfpswd").focus();
    return;
  }
  if (fnewpswd !== fconfpass) {
    Swal.fire({
      title: "Error!",
      text: "New password and Confirm password should be same",
      icon: "error",
      confirmButtonText: "Ok",
    });
    $("#fconfpswd").focus();
    return;
  }
  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/updatePassword.php",
    data: "fmob=" + fmob + "&fotpass=" + fotp + "&fnewpass=" + fnewpswd,
    success: function (response) {
      let res = JSON.parse(response);
      if (res.status == "success") {
        Swal.fire({
          title: "Success!",
          text: res.msg,
          icon: "success",
          confirmButtonText: "Ok",
        });
        window.location.href = "logBKMC.html";
      } else {
        Swal.fire({
          title: "Error!",
          text: res.msg,
          icon: "error",
          confirmButtonText: "Ok",
        });
      }
    },
  });
}

function getOldStdData() {
  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/getOldStd.php",
    success: function (res) {
      let response = JSON.parse(res);
      let data = response.row;
      for (var i = 0; i < data.length; i++) {
        // console.log(data[i]);
      }

      return;
      if (response.status == "success") {
        alert(response.msgs);
      } else {
        alert("Something went wrong");
      }
    },
  });
}