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


Current Path : /var/www/website/bkmh/js/
Upload File :
Current File : /var/www/website/bkmh/js/index.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();

// var phone_number = window.intlTelInput(document.querySelector("#FMOBILE"), {
//   separateDialCode: true,
//   preferredCountries: ["in"],
//   hiddenInput: "full",
//   utilsScript:
//     "//cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.3/js/utils.js",
// });
getReferData();
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 == "") {
    alert("Enter pervous row");
    return;
  }
  if (email == "") {
    alert("Enter pervous row");
    return;
  }
  if (mobile == "") {
    alert("Enter pervous row");
    return;
  }

  let obj = {
    mobile: mobile,
    email: email,
    name: name,
  };
  if (index === "") {
    tableArray.push(obj);
  } else {
    tableArray[index] = obj;
  }

  $("#mobile").val("");
  $("#email").val("");
  $("#name").val("");
  getReferData();
}

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 = $("#FMOBILE").val();
  var eml_otps = $("#eml_otps").val();
  var FBATCH = $("#FBATCH").val();
  var FCNTCODE = $("#FCNTCODE").val();

  if (mob_otps == "") {
    alert("Enter Mobile OTP");
    return;
  }
  if (eml_otps == "") {
    alert("Enter Email OTP");
    return;
  }
  var params =
    "FMOBILE=" +
    FMOBILE +
    "&FEMAIL=" +
    FEMAIL +
    "&FBATCH=" +
    FBATCH +
    "&FCNTCODE=" +
    FCNTCODE +
    "&mob_otps=" +
    mob_otps +
    "&eml_otps=" +
    eml_otps;

  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/bkmhconfirm.php",
    data: params,
    success: function (res) {
      let response = JSON.parse(res);
      if (response.status == "success") {
        window.location.href = "./loginForm.html";
      } else {
        alert(response.msg);
      }
    },
  });
}

function saveOldStdDet() {
  var FMEMNAME = $("#FMEMNAME").val();
  var FBATCH = $("#FBATCH").val();
  var FMOBILE = $("#FMOBILE").val();
  var FCNTCODE = $("#FCNTCODE").val();
  var FEMAIL = $("#FEMAIL").val();
  var mailformat = document.getElementById("FEMAIL").validity.valid;
  // var full_number = phone_number.getNumber(intlTelInputUtils.numberFormat.E164);
  // $("input[name='phone_number[full]'").val(full_number);
  // if (full_number.length == 13) {
  //   var code = full_number.slice(4, 13);
  //   var split = full_number.slice(-10);
  // }

  // console.log(split, code, full_number);
  // return;
  if (FMEMNAME == "") {
    $("#FMEMNAME").focus();
    alert("Enter Alumni Name");
    return;
  }
  if (FCNTCODE == "") {
    $("#FCNTCODE").focus();
    alert("Enter Country Code");
    return;
  }
  if (FMOBILE == "") {
    $("#FMOBILE").focus();
    alert("Enter Mobile");
    return;
  }

  if (FEMAIL == "") {
    $("#FEMAIL").focus();
    alert("Enter Email I'D");
    return;
  }
  if (mailformat == false) {
    $("#FEMAIL").focus();
    alert("Enter Valid Email I'D");
    return;
  }
  if (FBATCH == "" || FBATCH == "Select") {
    $("#FBATCH").focus();
    alert("Select Batch");
    return;
  }

  var params =
    "FMEMNAME=" +
    FMEMNAME +
    "&FBATCH=" +
    FBATCH +
    "&FMOBILE=" +
    FMOBILE +
    // "&FDEGREE=" +
    // FDEGREE +
    "&FCNTCODE=" +
    FCNTCODE +
    "&FEMAIL=" +
    FEMAIL;

  $.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") {
        alert(response.msg);

        if (FCNTCODE == "91") {
          $("#mob_otp").show();
          $("#eml_otp").show();
          $("#verfy_check").show();
          $("#opt_check").hide();
        } else {
          $("#eml_otp").show();
          $("#verfy_check").show();
          $("#opt_check").hide();
        }
      } else {
        alert(response.msg);
        $("#mob_otp").hide();
        $("#eml_otp").hide();
        $("#verfy_check").hide();
        $("#opt_check").show();
      }
    },
  });
}

function getData(mob) {
  $.ajax({
    type: "GET",
    url:
      "https://universitysolutions.in/univadmin/bkhm/loginDetails.php?mob=" +
      mob,
    success: function (res) {
      let response = JSON.parse(res);
      let data = response.data;
      if (response.error_code == "success") {
        window.location.href = "./loginpage.html";
        $("#FMEMNAME").val(data.FMEMNAME);
        $("#FCNTCODE").val(data.FCNTCODE);
        $("#FMOBILE").val(data.FMOBILE);
        $("#FEMAIL").val(data.FEMAIL);
      } else {
        alert(response.error_code);
        return;
      }
    },
  });
}

function loginOldStd() {
  var username = $("#fusername").val();
  var pswrd = $("#fpassword").val();
  if (username == "") {
    alert("Please enter your Mobile No./Email");
    $("#fusername").focus();
    return;
  }

  if (pswrd == "") {
    alert("Please enter your Password");
    $("#fpassword").focus();
    return;
  }

  $.ajax({
    type: "POST",
    url: "https://universitysolutions.in/univadmin/bkhm/loginDet.php",
    data: "userid=" + username + "&paswrd=" + pswrd,
    success: function (res) {
      let response = JSON.parse(res);
      if (response === 1) {
        getData(username);
      } else {
        console.log("something went wrong");
        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 = $("#FMOBILES").val();
  var FCNTCODE = $("#FCNTCODE").val();
  var FEMAIL = $("#FEMAIL").val();
  var FALTMOBILE = $("#FALTMOBILE").val();
  var FALTCNTCODE = $("#FALTCNTCODE").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();

  if (FBATCH == "" || FBATCH == "Select") {
    $("#FBATCH").focus();
    alert("Select Batch");
    return;
  }

  var params =
    "FMEMNAME=" +
    FMEMNAME +
    "&FBATCH=" +
    FBATCH +
    "&FMOBILE=" +
    FMOBILE +
    "&FDEGREE=" +
    FDEGREE +
    "&FCNTCODE=" +
    FCNTCODE +
    "&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);
      if (response.status == "success") {
        alert(response.msg);
        if (FCNTCODE == "91") {
          $("#mob_otp").show();
          $("#eml_otp").show();
          $("#verfy_check").show();
          $("#opt_check").hide();
        } else {
          $("#eml_otp").show();
          $("#verfy_check").show();
          $("#opt_check").hide();
        }
      } else {
        alert(response.msg);
        $("#mob_otp").hide();
        $("#eml_otp").hide();
        $("#verfy_check").hide();
        $("#opt_check").show();
      }
    },
  });
}

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

function getOldStudDetails() {
  console.log("HII");
  window.location.href = "./loginpage.html";
}