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


Current Path : /var/www/html/pgadm2020/js/admin/
Upload File :
Current File : /var/www/html/pgadm2020/js/admin/change-password.js

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

function loadChangepassword() {
  var deggrp = $("#deggrp").val();

  var datastring = "&deggrp=" + deggrp;
  //alert(datastring);

  $.ajax({
    type: "POST",
    url: $host_url + "loadDegree",
    async: false,
    success: function(response) {
      var { error_code, data, status } = JSON.parse(response);
      if (error_code == "0") {
        $("#loadTab").load("change-password.html", function() {
          var degers = data;
          deglen = degers.length;
          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;">Degree Code</th>
                      <th style = "text-align: center;">Degree Name</th>
                      <th style = "text-align: center;">Check Box</th>
                    </tr>
                  </thead>
                  <tbody>`;
          for (var i = 0; i < degers.length; i++) {
            str += `<tr>
            <td style = 'text-align: center;'>${i   +   1}</td>
            <td style = 'text-align: center;'>${degers[i]["fdegree"]}</td>
            <td>${degers[i]["fdescpn"]}</td>
            <td style="text-align:center">&nbsp; &nbsp;<input onChange="box(this)" type="checkbox" id="${i}_deg" value = '${
              
              
              degers[i]["fdegree"]
            
            
            }' autocomplete="off"/>
            <label for="${i}_deg" style="font-size:10px !important;">&nbsp;</label>
            </td>
          </tr>`;
          }
          $("#degtable").html(str);
        });
      } else {
        alert("Please try after some time");
        return;
      }
    }
  });
}

var checkedValue = [];
function box(obj) {
  if ($(obj).is(":checked")) {
    checkedValue.push($(obj).val());
  } else {
    if ((index = checkedValue.indexOf($(obj).val())) !== -1) {
      checkedValue.splice(index, 1);
    }
  }
}
$(function() {
  $("input[type=checkbox]").bind("click");
});

function changepasswrd() {
  var foldpassword = $("#foldpassword").val();
  var fnewpass = $("#fnewpass").val();
  var fconfpass = $("#fconfpass").val();

  if (fnewpass !== fconfpass) {
    alert("New passord and confirm passsword are not matching");
  }
  console.log(foldpassword,fnewpass,fconfpass);

//   return;

  var datastring =
    "&foldpassword=" +
    foldpassword +  
    "&fnewpass=" +
    fnewpass +
    "&fconfpass=" +
    fconfpass ;    
  $.ajax({
    type: "POST",
    url: $host_url + "changepasswordadmin",
    data: datastring,
    success: function($responce) {
      $responce = eval("(" + $responce + ")");
      if ($responce.error_code == "0") {
        alert("Updated Successfullyy");
        loadChangepassword();
      } else {
        alert("Enter correct password");
        loadChangepassword();
      }
    }
  });
}





function logout() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "logout",
    success: function  (response) {
      res = JSON.parse(response);
      if(res.error_code == 0)
        window.location.href = "index.html";
    },
  });
}