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


Current Path : /proc/thread-self/root/var/www/oasis/js/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/js/updatesspdetails.js

function updatesspdetails(x, deg) {
  $("#page_main_div").load(
    "../html_modules/viewupdatesspdetails.html",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Update SSP Details";
      document.getElementById("module_name_for_save").value =
        "Update SSP Details";
      getDefaultHeadFooterLinks("Update SSP Details");
      loadallsspdeg();

      console.log(x, deg, "hii", document.getElementById("sspdeg").value);
      document.getElementById("sspdeg").value = deg;
      $("#sspdeg").val(deg);
      getsspdetails();
      // if (x !== "Add") {
      //   document.getElementById("sspdeg").value = deg;
      //   // getsspdetails();
      // } else {
      // }
    }
  );
}

function loaddegree() {
  var regno = document.getElementById("regno").value;

  $.ajax({
    type: "POST",
    url: $host_url + "loaddegreessp",
    data: "&regno=" + regno,
    success: function (response) {
      response = eval("(" + response + ")");
      var degree = response.data.fdegree + "-" + response.data.fdescpn;
      // console.log(response.data.fdegree);
      if (response.error_code == -1) {
        alert("Enter valid Reg No.");
        document.getElementById("regno").value = "";
        return;
      } else {
        $("#Degree").val(degree);
        // $("#Degree").val(response.data.fdegree);
      }
    },
  });
}

function sslcboard() {
  var sslcboard = document.getElementById("sslc_board").value;
  if (sslcboard === "othsslbrd") {
    $("#othersslcboard").show();
  } else {
    $("#othersslcboard").hide();
  }
}

function pucboard() {
  var pucboard = document.getElementById("puc_board").value;
  if (pucboard === "othpucbrd") {
    $("#otherpucboard").show();
  } else {
    $("#otherpucboard").hide();
  }
}

function savesspdetails() {
  var save;
  if (document.getElementById("screen").value == "edit") {
    save = "edit";
  } else {
    save = "Add";
  }
  var db = window.location.pathname.split("/")[urlarr.length - 2];
  // console.log(fdegree);
  // return;
  var regno = document.getElementById("regno").value;
  var degree = document.getElementById("Degree").value;
  var aadharno = document.getElementById("aadharno").value;
  var studname = document.getElementById("studname").value;
  var gender = document.getElementById("gender").value;
  var sslcregno = document.getElementById("sslcregno").value;
  var sslcboard = document.getElementById("sslc_board").value;
  var sslcotherboard = document.getElementById("othersslcboard").value;
  var sslcpass = document.getElementById("sslcpass").value;
  var pucregno = document.getElementById("pucregno").value;
  var pucboard = document.getElementById("puc_board").value;
  var pucotherboard = document.getElementById("otherpucboard").value;
  var pucpass = document.getElementById("pucpass").value;
  var fatheraadharno = document.getElementById("fatheraadharno").value;
  var fathername = document.getElementById("fathername").value;
  var motheraadharno = document.getElementById("motheraadharno").value;
  var mothername = document.getElementById("mothername").value;
  var income = document.getElementById("income").value;
  var caste = document.getElementById("caste").value;
  var satsid = document.getElementById("satsid").value;
  var sspstudid = document.getElementById("sspstudid").value;

  var fdegree1 = degree.split("-");
  var fdegree = fdegree1[0];
  var fdescpn = fdegree1[1];

  // console.log(fdegree[0]);
  // return;

  if (aadharno === "") {
    alert("enter aadhar no.");
    document.getElementById("aadharno").focus();
    return;
  } else if (studname === "") {
    alert("enter student name.");
    document.getElementById("studname").focus();
    return;
  }
  console.log(db);

  // if (db == "gug") {
  // } else if (db == "kus") {
  // } else if (db == "dud") {
  // } else {
  //   if (sslcregno === "") {
  //     alert("enter sslc regno.");
  //     document.getElementById("sslcregno").focus();
  //     return;
  //   } else if (sslcboard === "") {
  //     alert("Select sslc board name.");
  //     document.getElementById("sslc_board").focus();
  //     return;
  //   } else if (pucregno === "") {
  //     alert("enter puc reg no.");
  //     document.getElementById("pucregno").focus();
  //     return;
  //   } else if (pucboard === "") {
  //     alert("Select puc board name.");
  //     document.getElementById("puc_board").focus();
  //     return;
  //   } else if (pucpass === "") {
  //     alert("enter puc pass year");
  //     document.getElementById("pucpass").focus();
  //     return;
  //   } else if (sslcpass === "") {
  //     alert("enter sslc pass year");
  //     document.getElementById("sslcpass").focus();
  //     return;
  //   } else if (gender === "") {
  //     alert("Select Gender");
  //     document.getElementById("gender").focus();
  //     return;
  //   } else if (regno === "") {
  //     alert("Enter Reg No.");
  //     document.getElementById("regno").focus();
  //     return;
  //   } else if (degree === "") {
  //     alert("Enter Degree");
  //     document.getElementById("Degree").focus();
  //     return;
  //   } else if (sspstudid === "") {
  //     alert("Enter SSP Student ID");
  //     document.getElementById("sspstudid").focus();
  //     return;
  //   }
  // }

  var parameters =
    "&aadharno=" +
    aadharno +
    "&studname=" +
    studname +
    "&gender=" +
    gender +
    "&sslcregno=" +
    sslcregno +
    "&sslcboard=" +
    sslcboard +
    "&pucregno=" +
    pucregno +
    "&pucboard=" +
    pucboard +
    "&fatheraadharno=" +
    fatheraadharno +
    "&fathername=" +
    fathername +
    "&motheraadharno=" +
    motheraadharno +
    "&mothername=" +
    mothername +
    "&income=" +
    income +
    "&caste=" +
    caste +
    "&pucpass=" +
    pucpass +
    "&sslcpass=" +
    sslcpass +
    "&sslcotherboard=" +
    sslcotherboard +
    "&pucotherboard=" +
    pucotherboard +
    "&regno=" +
    regno +
    "&degree=" +
    degree +
    "&satsid=" +
    satsid +
    "&sspstudid=" +
    sspstudid +
    "&save=" +
    save +
    "&fdegree=" +
    fdegree +
    "&fdescpn=" +
    fdescpn;

  $.ajax({
    type: "POST",
    url: $host_url + "savesspdetails",
    data: parameters,
    success: function (response) {
      response = eval("(" + response + ")");
      alert(response.data.msg);
      // viewsspdetails();
      console.log(response.data.deg);
      updatesspdetails("edit", response.data.deg);
    },
  });
}

function viewsspdetails() {
  $("#page_main_div").load(
    "../html_modules/updatesspdetails.html",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Update SSP Details";
      document.getElementById("module_name_for_save").value =
        "Update SSP Details";
      getDefaultHeadFooterLinks("Update SSP Details");
    }
  );
}

function loadallsspdeg() {
  $.ajax({
    type: "GET",
    url: $host_url + "loadallsspdeg",
    async: false,
    success: function (response) {
      response = eval("(" + response + ")");
      if (response.error_code == 0) {
        var optionsAsString = "<option value=''>--Select Degree--</option>";
        for (var i = 0; i < response.data.length; i++) {
          //   alldeg[i] = response.data[i].FDEGREE;
          optionsAsString +=
            "<option value='" +
            response.data[i].fdegree +
            "'>" +
            response.data[i].fdescpn +
            "</option>";
        }

        $("#sspdeg").append(optionsAsString);
      } else {
        alert(response.data.msg);
        // updatesspdetails("Add");
      }
    },
  });
}

function getsspdetails() {
  var sspdegree = document.getElementById("sspdeg").value;
  var regfrom = document.getElementById("regfrom").value;
  var regto = document.getElementById("regto").value;
  var db = window.location.pathname.split("/")[urlarr.length - 2];
  if (sspdegree == "") {
    return;
  }

  if (db == "gug") {
    alert(
      "For updating the remaining adhar numbers, colleges may contact Dr. Darley S. Pattathil, Head of Computer Centre, GUK"
    );
    return;
  }

  if (regfrom === "") {
    alert("enter Reg No. From");
    document.getElementById("regfrom").focus();
    return;
  } else if (regto === "") {
    alert("enter Reg No. To");
    document.getElementById("regto").focus();
    return;
  }

  $.ajax({
    type: "GET",
    url: $host_url + "getsspdetails",
    data: "&sspdegree=" + sspdegree + "&regto=" + regto + "&regfrom=" + regfrom,
    success: function (response) {
      response = eval("(" + response + ")");
      //   console.log(response);
      var details = response.data;
      var html = "";
      if (response.error_code == 0) {
        html = `<table class='table table-bordered table-striped table-upd' style="border-spacing: 0px !important" cellpading="2">
      <thead>
      <tr class='ui-state-default ui-jqgrid-hdiv'>
          <th style='padding:2px; width:50px; 
          border-top:1px solid #C5DBEC; 
          border-left:1px solid #C5DBEC; 
          border-right:1px solid #C5DBEC; 
          border-bottom:1px solid #C5DBEC;'>Sl No.</th>

          <th style='padding:2px; width:150px;
          border-top:1px solid #C5DBEC;  
          border-right:1px solid #C5DBEC; 
          border-bottom:1px solid #C5DBEC;'>Reg No</th>

          <th style='padding:2px; width:200px; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; 
          border-bottom:1px solid #C5DBEC;'>Student Name</th>
          
          <th style='padding:2px; width:150px; 
          border-right:1px solid #C5DBEC;
          border-top:1px solid #C5DBEC;  
          border-bottom:1px solid #C5DBEC; '>Aadhar No</th>	

          <th style='padding:2px; width:180px;
          border-top:1px solid #C5DBEC;  
          border-right:1px solid #C5DBEC; 
          border-bottom:1px solid #C5DBEC;'>Father Name</th>

          

          <th style='padding:2px; width:120px; 
          border-right:1px solid #C5DBEC;
          border-top:1px solid #C5DBEC;  
          border-bottom:1px solid #C5DBEC;'>Action</th>
      <tr>
      </thead>`;
        var slno = 1;
        for (let i in details) {
          // console.log("asaasasa",result['i']);

          html += `
          <tr class='ui-widget-content jqgrow'>
              <td class='tbl_row_new' align='center' 
              style='border-left:1px solid #C5DBEC; 
              border-right:1px solid #C5DBEC; padding:2px;'>${slno++}</td>
              <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'>${
                details[i].FREGNO
              }</td>
              <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'>${
                details[i].FSTUDNAME
              }</td>
              <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'>${
                details[i].FSTUDAADHARNO
              }</td>	
              <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'>${
                details[i].FFATHERNAME
              }</td>
              <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'>  <span
              style="
                background-color: seagreen;
                border: none;
                color: white;
                padding: 5px 20px;
                text-align: center;
                text-decoration: none;
                display: inline-block;
                font-size: 12px;
                cursor: pointer;
              "
              onclick="editsspdetails('${details[i].FREGNO}')"
              >Edit</span
            > </td>
          </tr>`;
        }
        html += `</table>`;

        $("#sspviewdet").html(html);
      } else {
        alert(response.data.msg);
        document.getElementById("sspdeg").value = "";
        document.getElementById("regfrom").value = "";
        document.getElementById("regto").value = "";
      }
    },
  });
}

function editsspdetails(regno) {
  var parameters = "&regno=" + regno;
  $.ajax({
    type: "GET",
    data: parameters,
    url: $host_url + "editsspdetails",
    success: function (response) {
      response = eval("(" + response + ")");

      //   console.log(response);
      //   return;
      if (response.error_code == -1) {
        alert(response.data.msg);
        document.getElementById("regno").value = "";
        document.getElementById("Degree").value = "";
        return;
      } else {
        $("#page_main_div").load(
          "../html_modules/updatesspdetails.html",
          function () {
            document.getElementById("display_module_name").innerHTML =
              "Update SSP Details";
            document.getElementById("module_name_for_save").value =
              "Update SSP Details";
            getDefaultHeadFooterLinks("Update SSP Details");

            if (response.data.FSSLCBOARDNAME !== "") {
              $("#othersslcboard").show();
            } else if (response.data.FPUCBOARDNAME !== "") {
              $("#otherpucboard").show();
            }
            var db = window.location.pathname.split("/")[urlarr.length - 2];
            console.log(db);
            if (db == "gug") {
              $(".gughide").hide();
            }

            $("#regno").val(response.data.FREGNO);
            $("#Degree").val(
              response.data.FDEGREE + "-" + response.data.FDESCPN
            );
            $("#aadharno").val(response.data.FSTUDAADHARNO);
            $("#studname").val(response.data.FSTUDNAME);
            $("#gender").val(response.data.FGENDER);
            $("#sslcregno").val(response.data.FSSLCREGNO);
            $("#sslc_board").val(response.data.FSSLCBOARDCODE);
            $("#othersslcboard").val(response.data.FSSLCBOARDNAME);
            $("#sslcpass").val(response.data.FSSLCPASSYEAR);
            $("#pucregno").val(response.data.FPUCREGNO);
            $("#puc_board").val(response.data.FPUCBOARDCODE);
            $("#otherpucboard").val(response.data.FPUCBOARDNAME);
            $("#pucpass").val(response.data.FPUCPASSYEAR);
            $("#satsid").val(response.data.FSATSID);
            $("#sspstudid").val(response.data.FSSPSTUDID);
            $("#fatheraadharno").val(response.data.FFATHERAADHAR);
            $("#fathername").val(response.data.FFATHERNAME);
            $("#motheraadharno").val(response.data.FMOTHERAADHAR);
            $("#mothername").val(response.data.FMOTHERNAME);
            $("#income").val(response.data.FINCOMERDNO);
            $("#caste").val(response.data.FCASTERDNO);
          }
        );
      }
    },
  });
}