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


Current Path : /proc/thread-self/root/var/www/html/convocation/custom_js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/convocation/custom_js/cms_nehu.js

//import console = require("console");

var $g_subject_appearing = "";
var $g_remaining_counter_inc = "";
var str = "";

CMS = {
  getcollname: function () {
    $("#dob").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#passport_expiry_date").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#visa_expiry_date").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#p_dob").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#c_dob").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#draftdate").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#std_dob").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    //var lstr_query_string = $("#college").val();//
    var lstr_query_string = "";
    //alert($host_url);
    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];

    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "getcollname",
      error: AjaxErrorMessage,
      data: "&lstr_query_string=" + lstr_query_string,
      success: function GetCMSDropDownMenuValuesResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          console.log(responce, "responce");
          var category_arr = responce.data["category"];
          var statename_arr = responce.data["statename"];
          var college_arr = responce.data["college"];
          //alert(responce.data['college']);
          var lastinst_arr = responce.data["lastinst"];
          CMS.FillDropdownValues(statename_arr, "perstate");
          CMS.FillDropdownValues(college_arr, "fcollcode");
          CMS.FillDropdownValues(lastinst_arr, "lastinst");
          CMS.FillDropdownValues(category_arr, "category");
          if (lstr_query_string == "ug") {
            $("#feedetails").show();
            document.getElementById("rf").value = 200;
            document.getElementById("msf").value = 200;
            document.getElementById("dcf").value = 300;
            document.getElementById("amount").value = 700;
          }
          //CMS.HideShowPassportDetails();
          $("#lastexampas").hide();
          $("#lastinstname").hide();
          $("#lastinstname").hide();
          $("#nationalname").hide();
          $("#state").hide();
          $("#board").hide();
          $("#edite").hide();
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  getcollnamee: function () {
    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "getcollname",
      error: AjaxErrorMessage,
      success: function GetCMSUpdateDropDownMenuValuesResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          console.log(responce, "responce");
          var category_arr = responce.data["category"];
          var statename_arr1 = responce.data["statename"];
          var college_arr = responce.data["college"];
          var lastinst_arr = responce.data["lastinst"];

          CMS.FillDropdownValues(statename_arr1, "uperstate");
          CMS.FillDropdownValues(college_arr, "ufcollcode");
          CMS.FillDropdownValues(lastinst_arr, "ulastinst");
          CMS.FillDropdownValues(category_arr, "ucategory");
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  getdegname: function () {
    var fcollcode = $("#fcollcode").val();

    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "getdegname",
      error: AjaxErrorMessage,
      data: "&fcollcode=" + fcollcode + "&deggrp=" + lstr_query_string,
      success: function GetCMSDropDownMenuValuesResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          var degree_arr = responce.data["degree"];

          if (lstr_query_string == "pg" || lstr_query_string == "supg") {
            var collcode = $("#fcollcode").val();

            if (collcode.charAt(0) == "E") {
              document.getElementById("rf").value = 0;
              document.getElementById("msf").value = 0;
              document.getElementById("dcf").value = 0;
              document.getElementById("amount").value = 0;
            } else {
              if (univname == "others") {
                $("#board").show();
                document.getElementById("regnno").value = "NOT APPLICABLE";
                document.getElementById("regnno").disabled = true;
                document.getElementById("board").focus();
                document.getElementById("rf").value = 200;
                document.getElementById("msf").value = 200;
                document.getElementById("dcf").value = 300;
                document.getElementById("amount").value = 700;
                return;
              } else {
                if (univname == "Sikkim University") {
                  document.getElementById("rf").value = 0;
                  document.getElementById("msf").value = 200;
                  document.getElementById("dcf").value = 300;
                  document.getElementById("amount").value = 500;
                } else {
                  document.getElementById("rf").value = 200;
                  document.getElementById("msf").value = 200;
                  document.getElementById("dcf").value = 300;
                  document.getElementById("amount").value = 700;
                }
              }
            }
          }

          CMS.FillDropdownValues(degree_arr, "fdegree");
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },

  getdegnamee: function () {
    var fcollcode = $("#ufcollcode").val();

    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "getdegname",
      error: AjaxErrorMessage,
      data: "&fcollcode=" + fcollcode + "&deggrp=" + lstr_query_string,
      success: function GetCMSDropDownMenuValuesResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          var degree_arr = responce.data["degree"];

          if (lstr_query_string == "pg" || lstr_query_string == "supg") {
            var collcode = $("#ufcollcode").val();

            if (collcode.charAt(0) == "E") {
              document.getElementById("rf").value = 0;
              document.getElementById("msf").value = 0;
              document.getElementById("dcf").value = 0;
              document.getElementById("amount").value = 0;
            } else {
              if (univname == "others") {
                $("#board").show();
                document.getElementById("regnno").value = "NOT APPLICABLE";
                document.getElementById("regnno").disabled = true;
                document.getElementById("board").focus();
                document.getElementById("rf").value = 200;
                document.getElementById("msf").value = 200;
                document.getElementById("dcf").value = 300;
                document.getElementById("amount").value = 700;
                return;
              } else {
                if (univname == "Sikkim University") {
                  document.getElementById("rf").value = 0;
                  document.getElementById("msf").value = 200;
                  document.getElementById("dcf").value = 300;
                  document.getElementById("amount").value = 500;
                } else {
                  document.getElementById("rf").value = 200;
                  document.getElementById("msf").value = 200;
                  document.getElementById("dcf").value = 300;
                  document.getElementById("amount").value = 700;
                }
              }
            }
          }

          CMS.FillDropdownValues(degree_arr, "ufdegree");
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },

  getprefix: function () {
    console.log("hii");
    if ($("#fcollcode").val() == "None") {
      $("#roll_number_1").val("");
      $("#roll_number_2").val("");
      $("#roll_number_3").val("");
      $("#roll_number_4").val("");
      $("#roll_number_5").val("");
      $("#roll_number_6").val("");
      $("#roll_number_7").val("");
      $("#roll_number_8").val("");
      return;
    }

    $("#roll_number_1").val("");
    $("#roll_number_2").val("");
    $("#roll_number_3").val("");
    $("#roll_number_4").val("");
    $("#roll_number_5").val("");
    $("#roll_number_6").val("");
    $("#roll_number_7").val("");
    $("#roll_number_8").val("");

    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];

    if ($("#fcollcode").val() != "None" && $("#fdegree").val() != "None") {
      $.ajax({
        type: "POST",
        //async:false,
        url: $host_url + "getprefix",
        error: AjaxErrorMessage,
        data:
          "&fcollcode=" +
          $("#fcollcode").val() +
          "&fdegree=" +
          $("#fdegree").val() +
          "&deggrp=" +
          lstr_query_string,
        success: function checkregnoResponce(responce) {
          responce = JSON.parse(responce);
          //   console.log(responce.data);
          var split = responce.data.split("");
          let x = 0;

          document.getElementById("roll_number_1").disabled = false;
          document.getElementById("roll_number_2").disabled = false;
          document.getElementById("roll_number_3").disabled = false;
          document.getElementById("roll_number_4").disabled = false;
          document.getElementById("roll_number_5").disabled = false;
          document.getElementById("roll_number_6").disabled = false;
          document.getElementById("roll_number_7").disabled = false;
          document.getElementById("roll_number_8").disabled = false;

          //   console.log(split);
          split.forEach((item, i) => {
            $("#roll_number_" + (i + 1)).val(item);
            document.getElementById("roll_number_" + (i + 1)).disabled = true;
            x = i;
          });
          $("#roll_number_" + (x + 1)).focus();
        },
      });
    }
  },
  checkregno: function () {
    var roll_number =
      $("#roll_number_1").val() +
      $("#roll_number_2").val() +
      $("#roll_number_3").val() +
      $("#roll_number_4").val() +
      $("#roll_number_5").val() +
      $("#roll_number_6").val() +
      $("#roll_number_7").val() +
      $("#roll_number_8").val();
    var fcollcode = $("#fcollcode").val();

    if (roll_number != "") {
      if (roll_number.length != "8") {
        alert("Roll Number Shoud be 8 character.");
        document.getElementById("roll_number").value = "";
        document.getElementById("roll_number").focus();
        return false;
      }

      $.ajax({
        type: "POST",
        //async:false,
        url: $host_url + "checkregno",
        error: AjaxErrorMessage,
        data: "&roll_number=" + roll_number + "&fcollcode=" + fcollcode,
        success: function checkregnoResponce(responce) {
          try {
            responce = eval("(" + responce + ")");
            if (responce.data != "") {
              //alert(responce.data['fname']);
              alert(
                "The Roll number " +
                  responce.data["frollno"] +
                  " has already been entered by\r\nstudent name : " +
                  responce.data["fname"] +
                  "\r\ncollege code : " +
                  responce.data["fcollcode"] +
                  "\r\ndegree : " +
                  responce.data["fdegree"] +
                  "\rDOB : " +
                  responce.data["fdob"] +
                  "\rPlease enter the correct roll number.\r\n"
              );
              //alert('your roll no. already given to another stydent plz contact to the college');
              document.getElementById("roll_number").value = "";
              document.getElementById("roll_number").focus();
              return false;
            }
            //var degree_arr=responce.data['degree'];
            //CMS.FillDropdownValues(degree_arr,'fdegree');
          } catch (err) {
            txt = err.message;
            $.unblockUI();
            bootbox.alert(txt);
          }
        },
      });
    }
  },
  nationality: function () {
    $("#nationalname").hide();
    var nationality = $("#nationality").val();
    if (nationality == "others") {
      $("#nationalname").show();
      $("#passportid").show();
      $("#aadhaarid").hide();
      document.getElementById("nationalname").focus();
      return;
    } else if (nationality == "INDIAN") {
      $("#nationalname").hide();
      $("#passportid").hide();
      $("#aadhaarid").show();
    }
  },
  lastexampassed: function () {
    $("#lastexampas").hide();

    if ($("#level").val() == "Higher Secondary") {
      $("#univname").val("others");
      document.getElementById("univname").disabled = true;
      $("#board").show();
      $("#lastinst").val("others");
      document.getElementById("lastinst").disabled = true;
      $("#lastinstname").show();
    } else {
      document.getElementById("univname").disabled = false;
      document.getElementById("lastinst").disabled = false;
    }

    var level = $("#level").val();
    if (level == "others") {
      $("#lastexampas").show();
      document.getElementById("lastexampas").focus();
      return;
    }
    document.getElementById("regnno").value = "NOT APPLICABLE";
    document.getElementById("regnno").disabled = true;
    CMS.getadmfee();
  },

  getadmfee: function () {
    var fdegree = $("#fdegree").val();
    var fcollcode = $("#fcollcode").val();
    var univname = $("#univname").val();
    // console.log("getadmfee");

    $.ajax({
      type: "POST",
      // async: false,
      url: $host_url + "checkadmfee",
      error: AjaxErrorMessage,
      data: "&fdegree=" + fdegree + "&fcollcode=" + fcollcode,
      success: function checkregnoResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          console.log(responce, "Ssdsd");

          if (responce.data != "") {
            if (responce.data.fadmfee == "T") {
              if (univname == "others" || univname == "None") {
                console.log("uni");
                $("#board").show();
                $("#lastinst").val("others");
                document.getElementById("lastinst").disabled = true;
                $("#lastinstname").show();
                document.getElementById("regnno").value = "NOT APPLICABLE";
                document.getElementById("regnno").disabled = true;
                // document.getElementById("board").focus();

                if (fcollcode == "1017") {
                  document.getElementById("rf").value = responce.data.fregfee;
                  document.getElementById("msf").value = responce.data.fmcfee;
                  document.getElementById("dcf").value = responce.data.fdcfee;
                  document.getElementById("exf").value = responce.data.fexamfee;
                  document.getElementById("amount").value = responce.data.total;
                } else {
                  if ($("#univname").val() == "Sikkim University") {
                    document.getElementById("rf").value = responce.data.fregfee;
                    document.getElementById("msf").value = responce.data.fmcfee;
                    document.getElementById("dcf").value = responce.data.fdcfee;
                    document.getElementById("exf").value =
                      responce.data.fexamfee;
                    document.getElementById("amount").value =
                      responce.data.total;
                  } else {
                    document.getElementById("rf").value = responce.data.fregfee;
                    document.getElementById("msf").value = responce.data.fmcfee;
                    document.getElementById("dcf").value = responce.data.fdcfee;
                    document.getElementById("exf").value =
                      responce.data.fexamfee;
                    document.getElementById("amount").value =
                      responce.data.total;
                  }
                }

                return;
              } else {
                document.getElementById("lastinst").disabled = false;

                document.getElementById("rf").value = responce.data.fregfee;
                if (fcollcode == "1017") {
                  document.getElementById("msf").value = responce.data.fmcfee;
                  document.getElementById("dcf").value = responce.data.fdcfee;
                  document.getElementById("exf").value = responce.data.fexamfee;
                  document.getElementById("amount").value = responce.data.total;
                } else {
                  if ($("#univname").val() == "Sikkim University") {
                    document.getElementById("msf").value = responce.data.fmcfee;
                    document.getElementById("dcf").value = responce.data.fdcfee;
                    document.getElementById("exf").value =
                      responce.data.fexamfee;
                    document.getElementById("amount").value =
                      responce.data.total;
                  } else {
                    document.getElementById("rf").value = responce.data.fregfee;
                    document.getElementById("msf").value = responce.data.fmcfee;
                    document.getElementById("dcf").value = responce.data.fdcfee;
                    document.getElementById("exf").value =
                      responce.data.fexamfee;
                    document.getElementById("amount").value =
                      responce.data.total;
                  }
                }
              }
            } else {
              document.getElementById("rf").value = responce.data.fregfee;
              document.getElementById("msf").value = responce.data.fmcfee;
              document.getElementById("dcf").value = responce.data.fdcfee;
              document.getElementById("exf").value = responce.data.fexamfee;
              document.getElementById("amount").value = responce.data.total;
            }
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  Universityname: function () {
    $("#board").hide();
    var univname = $("#univname").val();
    document.getElementById("regnno").value = "";
    document.getElementById("regnno").disabled = false;
    if (univname == "others") $("#board").show();
    CMS.getadmfee();

    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];
    if (lstr_query_string == "ug") {
      if (univname == "others") {
        $("#board").show();
        $("#lastinst").val("others");
        document.getElementById("lastinst").disabled = true;
        $("#lastinstname").show();
        document.getElementById("regnno").value = "NOT APPLICABLE";
        document.getElementById("regnno").disabled = true;
        document.getElementById("board").focus();
        // document.getElementById("rf").value = 200;
        // document.getElementById("msf").value = 200;
        // document.getElementById("dcf").value = 300;
        // document.getElementById("amount").value = 700;
        return;
      } else {
        document.getElementById("lastinst").disabled = false;
        // document.getElementById("rf").value = 0;
        // document.getElementById("msf").value = 200;
        // document.getElementById("dcf").value = 300;
        // document.getElementById("amount").value = 500;
      }
    } else if (lstr_query_string == "pg") {
      var collcode = $("#fcollcode").val();
      console.log(collcode);
      console.log(collcode.charAt(0));
      if (collcode.charAt(0) == "E") {
        // document.getElementById("rf").value = 0;
        // document.getElementById("msf").value = 0;
        // document.getElementById("dcf").value = 0;
        // document.getElementById("amount").value = 0;
      } else {
        if (univname == "others") {
          $("#board").show();
          $("#lastinst").val("others");
          $("#lastinstname").show();
          document.getElementById("lastinst").disabled = true;
          document.getElementById("regnno").value = "NOT APPLICABLE";
          document.getElementById("regnno").disabled = true;
          document.getElementById("board").focus();
          // document.getElementById("rf").value = 200;
          // document.getElementById("msf").value = 200;
          // document.getElementById("dcf").value = 300;
          // document.getElementById("amount").value = 700;
          return;
        } else {
          document.getElementById("lastinst").disabled = false;
          // document.getElementById("rf").value = 0;
          // document.getElementById("msf").value = 200;
          // document.getElementById("dcf").value = 300;
          // document.getElementById("amount").value = 500;
        }
      }
    } else {
      var univname = $("#univname").val();
      document.getElementById("regnno").value = "";
      document.getElementById("regnno").disabled = false;
      if (univname == "others") {
        $("#board").show();
        document.getElementById("regnno").value = "NOT APPLICABLE";
        document.getElementById("regnno").disabled = true;
        document.getElementById("board").focus();
      }
      // document.getElementById("rf").value = 0;
      // document.getElementById("msf").value = 0;
      // document.getElementById("dcf").value = 0;
      // document.getElementById("amount").value = 0;
    }
  },
  institutionname: function () {
    $("#lastinstname").hide();
    $("#regnnoform").show();
    var lastinst = $("#lastinst").val();
    //document.getElementById('regnno').value ='';
    //document.getElementById('regnno').disabled =false;
    if (lastinst == "others") {
      $("#lastinstname").show();
      //$("#regnnoform").hide();
      //document.getElementById('regnno').value ='NOT APPLICABLE';
      //document.getElementById('regnno').disabled =true;
      document.getElementById("lastinstname").focus();
      return;
    }
  },
  statevalue: function () {
    $("#state").hide();
    var perstate = $("#perstate").val();
    if (perstate == "others") {
      $("#state").show();
      document.getElementById("state").focus();
      return;
    }
  },
  disp_sub: function () {
    var fdegree = $("#fdegree").val();
    var fcollcode = $("#fcollcode").val();

    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];
    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "disp_sub",
      error: AjaxErrorMessage,
      data:
        "&fdegree=" +
        fdegree +
        "&fcollcode=" +
        fcollcode +
        "&fdeggrp=" +
        lstr_query_string,
      success: function dis_subResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          var degree_arr = responce.data["html"];
          $g_subject_appearing = responce.data.total_count;
          $g_remaining_counter_inc = responce.data.remaining_count;
          var remaining_count = responce.data["remaining_count"];
          document.getElementById("tabledtetails").innerHTML = degree_arr; //tabledtetails
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  disp_sub_upd: function (fdegree,fcollcode,fappno) {
    
    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];
    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "disp_sub_upd",
      error: AjaxErrorMessage,
      data:
        "&fdegree=" +
        fdegree +
        "&fcollcode=" +
        fcollcode +
        "&fdeggrp=" +
        lstr_query_string+"&fappno="+fappno,
      success: function dis_updatesubResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          var degree_arr = responce.data["html"];
          var optsubarry = responce.data["optsub"];
          document.getElementById("utabledtetails").innerHTML = degree_arr; //tabledtetails
          for(let i =0;i<optsubarry.length;i++)
          {
            console.log(optsubarry[i]['fsubcode']);
            $(`#fsubname_${i}`).val(optsubarry[i]['fsubcode']);
            
            if(optsubarry[i]['fsubcode'] == optsubarry[i]['fhonour'])
              document.getElementById("honours_" + i).checked = true;
            console.log(`#honours_${i}`);
            
            $(`#fsubcode_${i}`).val(optsubarry[i]['fsubcode']);
            $(`#fsubshort_${i}`).val(optsubarry[i]['fsubshort']);
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  getsubcode: function (e, id) {
    var fsubname = id;
    var key = e.substring(9);
    var fscode = "fsubcode_" + key;
    var fsshort = "fsubshort_" + key;
    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];
    $check_dup_flag = 0;
    for ($m = 0; $m < $g_subject_appearing; $m++) {
      if (
        $m != key &&
        (fsubname == $("#fsubname_" + $m).val() ||
          fsubname == $("#se_sub_code_" + $m).html())
      )
        $check_dup_flag = 1;
    }
    if ($check_dup_flag == 1) {
      alert("Sub Code " + fsubname + " already Selected");
      $("#fsubname_" + key).focus();
      $("#fsubname_" + key).val("");
      $("#fsubcode_" + key).val("");
      $("#fsubshort_" + key).val("");
      return;
    } else {
      var fdegree = $("#fdegree").val();
      $.ajax({
        type: "POST",
        //async:false,
        url: $host_url + "getsubcode",
        error: AjaxErrorMessage,
        data:
          "&fsubname=" +
          fsubname +
          "&fdegree=" +
          fdegree +
          "&fdeggrp=" +
          lstr_query_string,
        success: function getsubcodeResponce(responce) {
          try {
            responce = eval("(" + responce + ")");
            var fsubcode = responce.data["FSUBCODE"];
            var fsubshort = responce.data["FSUBSHORT"];
            document.getElementById(fscode).value = fsubcode;
            document.getElementById(fsshort).value = fsubshort;
          } catch (err) {
            txt = err.message;
            $.unblockUI();
            bootbox.alert(txt);
          }
        },
      });
    }
  },
  getappno: function () {
    var approllno = $("#approllno").val();
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "getappno",
      error: AjaxErrorMessage,
      data: "&approllno=" + approllno,
      success: function getappnoResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          //var fsubcode =responce.data['FSUBCODE'];
          document.getElementById("app_no").value = responce.data;
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  checkhonours: function (id) {
    var checkboxes = document.getElementsByTagName("input");

    for (var i = 0; i < checkboxes.length; i++) {
      if (checkboxes[i].type == "checkbox" && id != checkboxes[i].id) {
        checkboxes[i].checked = false;
      }
    }
  },
  FillDropdownValues: function (arr, ele_name) {
    /* document.getElementById(ele_name).options.length=1;
		jQuery.each(arr, function(k, v) {	 
		var op = new Option(v['val'], v['int_code']);
		op.id=v['int_code'];
		document.getElementById(ele_name).options.add(op);
		}); */
    console.log(arr, ele_name, "arr, ele_name");
    if (ele_name == "lastinst") {
      document.getElementById(ele_name).options.length = 2;
      jQuery.each(arr, function (k, v) {
        var op = new Option(v["val"], v["int_code"]);
        op.id = v["int_code"];
        document.getElementById(ele_name).options.add(op);
      });
    } else {
      document.getElementById(ele_name).options.length = 1;
      jQuery.each(arr, function (k, v) {
        var op = new Option(v["val"], v["int_code"]);
        op.id = v["int_code"];
        document.getElementById(ele_name).options.add(op);
      });
    }
  },
  HideShowPassportDetails: function () {
    var nationality = $("#nationality").val();
    if (nationality == "INDIAN") {
      $("#passport_div").hide();
    } else $("#passport_div").show();
  },
  StudentDetails: function () {
    var list_data = $host_url + "SavestudentDetails";
    var fdegree = $("#fdegree").val();
    list_data += "&fdegree=" + fdegree;
    var fcollcode = $("#fcollcode").val();
    list_data += "&fcollcode=" + fcollcode;
    var candidate_name = encodeURIComponent($("#candidate_name").val());
    list_data += "&candidate_name=" + candidate_name;
    var dob = date_format($("#dob").val());
    list_data += "&dob=" + date_format($("#dob").val());
    var gender = $("#gender").val();
    list_data += "&gender=" + gender;
    var nationality = $("#nationality").val();
    list_data += "&nationality=" + nationality;
    var father_name = $("#father_name").val();
    list_data += "&father_name=" + father_name;
    var father_Occupation = $("#father_Occupation").val();
    list_data += "&father_Occupation=" + father_Occupation;
    var mother_name = $("#mother_name").val();
    list_data += "&mother_name=" + mother_name;
    var mother_Occupation = $("#mother_Occupation").val();
    list_data += "&mother_Occupation=" + mother_Occupation;
    var email_id = encodeURIComponent($("#email_id").val());
    list_data += "&email_id=" + email_id;
    //var moi =  encodeURIComponent($("#moi").val());list_data+="&moi="+moi;

    var roll_number = encodeURIComponent($("#roll_number").val());
    list_data += "&roll_number=" + roll_number;
    var Religion = encodeURIComponent($("#Religion").val());
    list_data += "&Religion=" + Religion;
    var category = $("#category").val();
    list_data += "&category=" + category;
    var comm_addr1 = encodeURIComponent($("#comm_addr1").val());
    list_data += "&comm_addr1=" + comm_addr1;
    var comm_addr2 = encodeURIComponent($("#comm_addr2").val());
    list_data += "&comm_addr2=" + comm_addr2;
    var comm_addr3 = encodeURIComponent($("#comm_addr3").val());
    list_data += "&comm_addr3=" + comm_addr3;
    var comm_addr4 = encodeURIComponent($("#comm_addr4").val());
    list_data += "&comm_addr4=" + comm_addr4;
    var per_addr1 = encodeURIComponent($("#per_addr1").val());
    list_data += "&per_addr1=" + per_addr1;
    var per_addr2 = encodeURIComponent($("#per_addr2").val());
    list_data += "&per_addr2=" + per_addr2;
    var per_addr3 = encodeURIComponent($("#per_addr3").val());
    list_data += "&per_addr3=" + per_addr3;
    var per_addr4 = encodeURIComponent($("#per_addr4").val());
    list_data += "&per_addr4=" + per_addr4;
    var contact_no = encodeURIComponent($("#contact_no").val());
    list_data += "&contact_no=" + contact_no;
    var Blood_Groop = encodeURIComponent($("#Blood_Groop").val());
    list_data += "&Blood_Groop=" + Blood_Groop;
    //var draftno =  encodeURIComponent($("#draftno").val());list_data+="&draftno="+draftno;
    var univname = encodeURIComponent($("#univname").val());
    list_data += "&univname=" + univname;
    var level = encodeURIComponent($("#level").val());
    list_data += "&level=" + level;
    var year = encodeURIComponent($("#year").val());
    list_data += "&year=" + year;
    var rollno = encodeURIComponent($("#rollno").val());
    list_data += "&rollno=" + rollno;
    var percentage = encodeURIComponent($("#percentage").val());
    list_data += "&percentage=" + percentage;
    var Division = encodeURIComponent($("#Division").val());
    list_data += "&Division=" + Division;
    var regnno = encodeURIComponent($("#regnno").val());
    list_data += "&regnno=" + regnno;
    var draftno = encodeURIComponent($("#draftno").val());
    list_data += "&draftno=" + draftno;
    var draftamount = encodeURIComponent($("#draftamount").val());
    list_data += "&draftamount=" + draftamount;
    //var draftdate =  encodeURIComponent($("#draftdate").val());list_data+="&draftdate="+draftdate;
    var draftdate = date_format($("#draftdate").val());
    list_data += "&draftdate=" + date_format($("#draftdate").val());
    var issbank = encodeURIComponent($("#issbank").val());
    list_data += "&issbank=" + issbank;
    var issbranch = encodeURIComponent($("#issbranch").val());
    list_data += "&issbranch=" + issbranch;
    var lastinst = encodeURIComponent($("#lastinst").val());
    list_data += "&lastinst=" + lastinst;
    var lastexampas = encodeURIComponent($("#lastexampas").val());
    list_data += "&lastexampas=" + lastexampas;
    var board = encodeURIComponent($("#board").val());
    list_data += "&board=" + board;

    var payment_type = encodeURIComponent($("#payment_type").val());
    list_data += "&payment_type=" + payment_type;
    var amount = encodeURIComponent($("#amount").val());
    list_data += "&amount=" + amount;
    var mcfee = encodeURIComponent($("#msf").val());
    list_data += "&mcfee=" + mcfee;
    var dcfee = encodeURIComponent($("#dcf").val());
    list_data += "&dcfee=" + dcfee;
    var admfee = encodeURIComponent($("#rf").val());
    list_data += "&admfee=" + admfee;

    var lastinstname = encodeURIComponent($("#lastinstname").val());
    list_data += "&lastinstname=" + lastinstname;
    var nationalname = encodeURIComponent($("#nationalname").val());
    list_data += "&nationalname=" + nationalname;
    var perstate = encodeURIComponent($("#perstate").val());
    if (perstate !== "others") {
      list_data += "&perstate=" + perstate;
    } else {
      list_data += "&perstate=" + $("#state").val();
    }

    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];

    list_data += "&fdeggrp=" + lstr_query_string;

    var aadhaarNumber =
      $("#aadhaar_number_1").val() +
      $("#aadhaar_number_2").val() +
      $("#aadhaar_number_3").val() +
      $("#aadhaar_number_4").val() +
      $("#aadhaar_number_5").val() +
      $("#aadhaar_number_6").val() +
      $("#aadhaar_number_7").val() +
      $("#aadhaar_number_8").val() +
      $("#aadhaar_number_9").val() +
      $("#aadhaar_number_10").val() +
      $("#aadhaar_number_11").val() +
      $("#aadhaar_number_12").val();
    list_data += "&aadhaar=" + aadhaarNumber;
    var passportNumber = $("#passportno").val();
    list_data += "&passport=" + passportNumber;

    var ffilepath = $("#filepath").val();
    list_data += "&ffilepath=" + ffilepath;

    if (fcollcode == "None") {
      alert("select College");
      $("#college").focus();
      return false;
    }

    if (empty(roll_number)) {
      alert("Enter Roll Number");
      $("#roll_number").focus();
      return false;
    }

    if (empty(candidate_name)) {
      alert("Enter candidate name");
      $("#candidate_name").focus();
      return false;
    }
    if (dob == "0000-00-00") {
      alert("Enter valid date");
      $("#dob").focus();
      return false;
    }
    /* if(Blood_Groop == 'None')
		{
			alert("Select Blood_Groop");
			$("#Blood_Groop").focus();
			return false;
		} */
    if (empty(mother_name)) {
      alert("Enter mother name");
      $("#mother_name").focus();
      return false;
    }

    if (empty(father_name)) {
      alert("Enter father name");
      $("#father_name").focus();
      return false;
    }

    if (empty(email_id)) {
      alert("Enter Email Id");
      $("#email_id").focus();
      return false;
    }

    if (nationality == "others") {
      if (nationalname == "") {
        alert("Please Enter Nationality");
        document.getElementById("nationalname").focus();
        return false;
      }
      if (passportNumber == "") {
        alert("Please Enter Passport / Unique Citizenship no.");
        document.getElementById("passportno").focus();
        return false;
      }

      if (empty(ffilepath)) {
        alert("Upload Passport / Unique Citizenship document");
        return false;
      }

      aadhaarNumber = "";
    }

    if (nationality === "INDIAN") {
      if (aadhaarNumber.length !== 12) {
        alert("Aadhaar Number should be 12 digits");
        if ($("#aadhaar_number_1").val() == "") {
          $("#aadhaar_number_1").focus();
        }
        if ($("#aadhaar_number_2").val() == "") {
          $("#aadhaar_number_2").focus();
        }
        if ($("#aadhaar_number_3").val() == "") {
          $("#aadhaar_number_3").focus();
        }
        if ($("#aadhaar_number_4").val() == "") {
          $("#aadhaar_number_4").focus();
        }
        if ($("#aadhaar_number_5").val() == "") {
          $("#aadhaar_number_5").focus();
        }
        if ($("#aadhaar_number_6").val() == "") {
          $("#aadhaar_number_6").focus();
        }
        if ($("#aadhaar_number_7").val() == "") {
          $("#aadhaar_number_7").focus();
        }
        if ($("#aadhaar_number_8").val() == "") {
          $("#aadhaar_number_8").focus();
        }
        if ($("#aadhaar_number_9").val() == "") {
          $("#aadhaar_number_9").focus();
        }
        if ($("#aadhaar_number_10").val() == "") {
          $("#aadhaar_number_10").focus();
        }
        if ($("#aadhaar_number_11").val() == "") {
          $("#aadhaar_number_11").focus();
        }
        if ($("#aadhaar_number_12").val() == "") {
          $("#aadhaar_number_12").focus();
        }
        return false;
      }

      if (empty(ffilepath)) {
        alert("Upload aadhaar");
        return false;
      }

      passportNumber = "";
    }

    if (perstate == "None") {
      alert("please select the state");
      $("#perstate").focus();
      return false;
    }

    if (perstate == "others") {
      if ($("#state").val() == "") {
        alert("please enter the state name");
        $("#state").focus();
        return false;
      }
    }

    if (category == "None") {
      alert("Enter category");
      $("#category").focus();
      return false;
    }
    if (empty(contact_no)) {
      alert("Enter contact number");
      $("#contact_no").focus();
      return false;
    }
    if (empty(comm_addr1)) {
      alert("Enter postal address");
      $("#comm_addr1").focus();
      return false;
    }
    if (empty(per_addr1)) {
      alert("Enter parmanent address");
      $("#per_addr1").focus();
      return false;
    }
    if (fdegree == "None") {
      alert("select Degree");
      $("#course").focus();
      return false;
    }
    if (lastinst == "others") {
      if (lastinstname == "") {
        alert("Please Enter Institution of Last Examination Name");
        document.getElementById("lastinstname").focus();
        return false;
      }
    }
    if (lastinst == "None") {
      alert("Please Enter Institution of Last Examination Name");
      document.getElementById("lastinst").focus();
      return false;
    }

    var start_indx = $g_subject_appearing - $g_remaining_counter_inc;
    var subject_alert_flag = false;
    var alert_cnt = 0;
    var honours = "";
    for ($m = start_indx; $m < $g_subject_appearing; $m++) {
      var subcode = document.getElementById("fsubcode_" + $m).value;
      if (trim(subcode) == "") {
        alert("Please Enter the All Subjects");
        document.getElementById("fsubname_" + $m).focus();
        return false;
      }
    }

    if (fdegree == "BA18" || fdegree == "BSC18") {
      for ($m = start_indx; $m < $g_subject_appearing; $m++) {
        if (document.getElementById("honours_" + $m).checked == true)
          honours = trim($("#fsubcode_" + $m).val());
      }
      if (honours == "") {
        alert("Please Select honours Subject");
        return false;
      }
    }
    /* 	for($m =start_indx;$m<$g_subject_appearing;$m++)
		{
			
			if(document.getElementById("honours_"+$m).checked==true)
				honours = trim($("#fsubcode_"+$m).val());
		} 
		if(draftno == '')
		{
			alert('Please Enter Draft Number');
			document.getElementById("draftno").focus();
			return false;
		} */

    if (univname == "None") {
      alert("Please Enter Board/University Name");
      document.getElementById("univname").focus();
      return false;
    }

    if (univname == "others") {
      if (board == "") {
        alert("Please Enter Board Name");
        document.getElementById("board").focus();
        return false;
      }
    }
    if (univname == "Sikkim%20University") {
      if (regnno == "") {
        alert("Please Enter Registration number");
        document.getElementById("regnno").focus();
        return false;
      }
    }
    if (level == "None") {
      alert("Please Enter Last Examination Passed");
      document.getElementById("level").focus();
      return false;
    }

    if (level == "others") {
      if (lastexampas == "") {
        alert("Please Enter Last Examination Passed");
        document.getElementById("lastexampas").focus();
        return false;
      }
    }

    if (rollno == "") {
      alert("Enter Roll No. of Last Examination ");
      document.getElementById("rollno").focus();
      return false;
    }
    if (year == "") {
      alert("Please Enter year");
      document.getElementById("year").focus();
      return false;
    }
    // if (percentage == "") {
    //   alert("Please Enter percentage");
    //   document.getElementById("percentage").focus();
    //   return false;
    // }
    if (Division == "") {
      alert("Please Enter Division");
      document.getElementById("Division").focus();
      return false;
    }

    if (payment_type == "") {
      alert("Select Payment Type");
      document.getElementById("payment_type").focus();
      return false;
    }

    if (amount == "") {
      alert("Amount cant be Zero.");
      document.getElementById("amount").focus();
      return false;
    }

    /* if(draftamount == '')
		{
			alert('Please Enter Draft Amount');
			document.getElementById("draftamount").focus();
			return false;
		}
		if(draftdate=="0000-00-00")
		{
			alert("Enter valid date");
			$("#draftdate").focus();
			return false;
		}
		if(issbank == '')
		{
			alert('Please Enter Bank Name');
			document.getElementById("issbank").focus();
			return false;
		}
		if(issbranch == '')
		{
			alert('Please Enter Bank Branch');
			document.getElementById("issbranch").focus();
			return false;
		} */

    if ($("#roll_number_6").val() == "") {
      alert("Please Enter Roll No.");
      document.getElementById("roll_number_6").focus();
      return;
    }

    if ($("#roll_number_5").val() == "") {
      alert("Please Enter Roll No.");
      document.getElementById("roll_number_5").focus();
      return;
    }

    if ($("#roll_number_7").val() == "") {
      alert("Please Enter Roll No.");
      document.getElementById("roll_number_7").focus();
      return;
    }

    if ($("#roll_number_8").val() == "") {
      alert("Please Enter Roll No.");
      document.getElementById("roll_number_8").focus();
      return;
    }

    if (
      document.getElementById("student_entry_photo").getAttribute("src") ==
      "img/default_photo.jpg"
    ) {
      alert("Upload photo");
      $("#student_entry_photo").focus();
      return false;
    }
    CMS.EnableDisableStudentFields("Disable");
    $("#edite").show();
    $("#submith").hide();
    bootbox.alert(
      "Please check the details entered carefully before submitting the form. After clicking on Submit no changes are possible. For any changes click on Edit"
    );
  },
  EditestudentDetails: function () {
    CMS.EnableDisableStudentFields("Enable");
  },
  SavestudentDetails: function () {
    CMS.EnableDisableStudentFields("Enable");
    //var list_data="";
    //$("#edite").show();
    //$("#submith").hide();
    var list_data = $host_url + "SavestudentDetails";
    var fdegree = $("#fdegree").val();
    list_data += "&fdegree=" + fdegree;
    var fcollcode = $("#fcollcode").val();
    list_data += "&fcollcode=" + fcollcode;
    var candidate_name = encodeURIComponent($("#candidate_name").val());
    list_data += "&candidate_name=" + candidate_name;
    var dob = date_format($("#dob").val());
    list_data += "&dob=" + date_format($("#dob").val());
    var gender = $("#gender").val();
    list_data += "&gender=" + gender;
    var nationality = $("#nationality").val();
    list_data += "&nationality=" + nationality;
    var father_name = $("#father_name").val();
    list_data += "&father_name=" + father_name;
    var roll_number =
      $("#roll_number_1").val() +
      $("#roll_number_2").val() +
      $("#roll_number_3").val() +
      $("#roll_number_4").val() +
      $("#roll_number_5").val() +
      $("#roll_number_6").val() +
      $("#roll_number_7").val() +
      $("#roll_number_8").val();

    console.log(roll_number);

    list_data += "&roll_number=" + roll_number;
    //encodeURIComponent($("#roll_number").val());
    //var father_Occupation =  ($("#father_Occupation").val());list_data+="&father_Occupation="+father_Occupation;
    var mother_name = $("#mother_name").val();
    list_data += "&mother_name=" + mother_name;
    //var mother_Occupation =  ($("#mother_Occupation").val());list_data+="&mother_Occupation="+mother_Occupation;
    var email_id = encodeURIComponent($("#email_id").val());
    list_data += "&email_id=" + email_id;
    var moi = encodeURIComponent($("#moi").val());
    list_data += "&moi=" + moi;
    var Religion = encodeURIComponent($("#Religion").val());
    list_data += "&Religion=" + Religion;
    var category = $("#category").val();
    list_data += "&category=" + category;
    var comm_addr1 = encodeURIComponent($("#comm_addr1").val());
    list_data += "&comm_addr1=" + comm_addr1;
    var comm_addr2 = encodeURIComponent($("#comm_addr2").val());
    list_data += "&comm_addr2=" + comm_addr2;
    var comm_addr3 = encodeURIComponent($("#comm_addr3").val());
    list_data += "&comm_addr3=" + comm_addr3;
    var comm_addr4 = encodeURIComponent($("#comm_addr4").val());
    list_data += "&comm_addr4=" + comm_addr4;
    var per_addr1 = encodeURIComponent($("#per_addr1").val());
    list_data += "&per_addr1=" + per_addr1;
    var per_addr2 = encodeURIComponent($("#per_addr2").val());
    list_data += "&per_addr2=" + per_addr2;
    var per_addr3 = encodeURIComponent($("#per_addr3").val());
    list_data += "&per_addr3=" + per_addr3;
    var per_addr4 = encodeURIComponent($("#per_addr4").val());
    list_data += "&per_addr4=" + per_addr4;
    var contact_no = encodeURIComponent($("#contact_no").val());
    list_data += "&contact_no=" + contact_no;
    var Blood_Groop = encodeURIComponent($("#Blood_Groop").val());
    list_data += "&Blood_Groop=" + Blood_Groop;
    var perstate = encodeURIComponent($("#perstate").val());
    list_data += "&perstate=" + perstate;
    var regnno = encodeURIComponent($("#regnno").val());
    list_data += "&regnno=" + regnno;
    //var draftno =  encodeURIComponent($("#draftno").val());list_data+="&draftno="+draftno;
    var univname = encodeURIComponent($("#univname").val());
    list_data += "&univname=" + univname;
    var level = encodeURIComponent($("#level").val());
    list_data += "&level=" + level;
    var year = encodeURIComponent($("#year").val());
    list_data += "&year=" + year;
    var rollno = encodeURIComponent($("#rollno").val());
    list_data += "&rollno=" + rollno;
    var percentage = encodeURIComponent($("#percentage").val());
    list_data += "&percentage=" + percentage;
    var Division = encodeURIComponent($("#Division").val());
    list_data += "&Division=" + Division;

    var payment_type = encodeURIComponent($("#payment_type").val());
    list_data += "&payment_type=" + payment_type;
    var amount = encodeURIComponent($("#amount").val());
    list_data += "&amount=" + amount;
    var mcfee = encodeURIComponent($("#msf").val());
    list_data += "&mcfee=" + mcfee;
    var dcfee = encodeURIComponent($("#dcf").val());
    list_data += "&dcfee=" + dcfee;
    var admfee = encodeURIComponent($("#rf").val());
    list_data += "&admfee=" + admfee;
    var examfee = encodeURIComponent($("#exf").val());
    list_data += "&examfee=" + examfee;
    //var draftno =  encodeURIComponent($("#draftno").val());list_data+="&draftno="+draftno;
    //var draftamount =  encodeURIComponent($("#draftamount").val());list_data+="&draftamount="+draftamount;

    //var issbank =  encodeURIComponent($("#issbank").val());list_data+="&issbank="+issbank;
    //var issbranch =  encodeURIComponent($("#issbranch").val());list_data+="&issbranch="+issbranch;
    var nationalname = encodeURIComponent($("#nationalname").val());
    list_data += "&nationalname=" + nationalname;
    var lastinst = encodeURIComponent($("#lastinst").val());
    list_data += "&lastinst=" + lastinst;
    var lastinstname = encodeURIComponent($("#lastinstname").val());
    list_data += "&lastinstname=" + lastinstname;
    //var draftdate =  date_format($("#draftdate").val());list_data+="&draftdate="+draftdate;

    var lastexampas = encodeURIComponent($("#lastexampas").val());
    list_data += "&lastexampas=" + lastexampas;
    var board = encodeURIComponent($("#board").val());
    list_data += "&board=" + board;
    var state = encodeURIComponent($("#state").val());
    list_data += "&state=" + state;

    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("=");
    lstr_query_string = lstr_query_string[1];

    list_data += "&fdeggrp=" + lstr_query_string;

    var aadhaarNumber =
      $("#aadhaar_number_1").val() +
      $("#aadhaar_number_2").val() +
      $("#aadhaar_number_3").val() +
      $("#aadhaar_number_4").val() +
      $("#aadhaar_number_5").val() +
      $("#aadhaar_number_6").val() +
      $("#aadhaar_number_7").val() +
      $("#aadhaar_number_8").val() +
      $("#aadhaar_number_9").val() +
      $("#aadhaar_number_10").val() +
      $("#aadhaar_number_11").val() +
      $("#aadhaar_number_12").val();
    list_data += "&aadhaar=" + aadhaarNumber;
    var passportNumber = $("#passportno").val();
    list_data += "&passport=" + passportNumber;

    var ffilepath = $("#filepath").val();
    list_data += "&ffilepath=" + ffilepath;

    if (fcollcode == "None") {
      alert("select College");
      $("#college").focus();
      return false;
    }

    if (empty(roll_number)) {
      alert("Enter Roll Number");
      $("#roll_number").focus();
      return false;
    }

    if (fdegree == "None") {
      alert("select Degree");
      $("#course").focus();
      return false;
    }

    if (empty(candidate_name)) {
      alert("Enter candidate name");
      $("#candidate_name").focus();
      return false;
    }
    if (dob == "0000-00-00") {
      alert("Enter valid date");
      $("#dob").focus();
      return false;
    }
    /* if(lastinst != 'others')
		{
			if(regnno == '')
			alert("Enter Registration number");
			$("#regnno").focus();
			return false;
		} */

    if (empty(father_name)) {
      alert("Enter father name");
      $("#father_name").focus();
      return false;
    }

    if (empty(mother_name)) {
      alert("Enter mother name");
      $("#mother_name").focus();
      return false;
    }
    if (empty(email_id)) {
      alert("Enter Email Id");
      $("#email_id").focus();
      return false;
    }

    if (empty(ffilepath)) {
      alert("Upload aadhaar / passport");
      return false;
    }
    if (category == "None") {
      /* 	if(empty(Religion))
		{
			alert("Enter Religion");
			$("#Religion").focus();
			return false;
		} */
      alert("Enter category");
      $("#category").focus();
      return false;
    }
    if (contact_no == "") {
      alert("Enter contact number");
      $("#contact_no").focus();
      return false;
    }
    if (empty(comm_addr1)) {
      alert("Enter postal address");
      $("#comm_addr1").focus();
      return false;
    }

    if (empty(per_addr1)) {
      alert("Enter parmanent address");
      $("#per_addr1").focus();
      return false;
    }

    if (perstate == "None") {
      alert("please select the state");
      $("#perstate").focus();
      return false;
    }

    /*if(draftno == '')
		{
			alert('Please Enter Draft Number');
			document.getElementById("draftno").focus();
			return false;
		}
		 if(univname == '')
		{
			alert('Please Enter Board/University Name');
			document.getElementById("univname").focus();
			return false;
		} */
    /* if(level == '')
		{
			alert('Please Enter level');
			document.getElementById("level").focus();
			return false;
		} */
    if (univname == "None") {
      alert("Please Enter Board/University Name");
      document.getElementById("univname").focus();
      return false;
    }

    if (univname == "others") {
      if (board == "") {
        alert("Please Enter Board Name");
        document.getElementById("board").focus();
        return false;
      }
    }
    if (univname == "Sikkim%20University") {
      if (regnno == "") {
        alert("Please Enter Registration number");
        document.getElementById("regnno").focus();
        return false;
      }
    }
    if (level == "None") {
      alert("Please Enter Last Examination Passed");
      document.getElementById("level").focus();
      return false;
    }

    if (level == "others") {
      if (lastexampas == "") {
        alert("Please Enter Last Examination Passed");
        document.getElementById("lastexampas").focus();
        return false;
      }
    }

    if (rollno == "") {
      alert("Please Enter Roll No. of Last Examination");
      document.getElementById("rollno").focus();
      return false;
    }
    if (year == "") {
      alert("Please Enter year");
      document.getElementById("year").focus();
      return false;
    }
    // if (percentage == "") {
    //   alert("Please Enter percentage");
    //   document.getElementById("percentage").focus();
    //   return false;
    // }
    if (Division == "") {
      alert("Please Enter Division");
      document.getElementById("Division").focus();
      return false;
    }
    if (nationality == "others") {
      if (nationalname == "") {
        alert("Please Enter Nationality");
        document.getElementById("nationalname").focus();
        return false;
      }
    }

    if (lastinst == "others") {
      if (lastinstname == "") {
        alert("Please Enter Institution of Last Examination Name");
        document.getElementById("lastinstname").focus();
        return false;
      }
    }

    if (lastinst == "None") {
      alert("Please Enter Institution of Last Examination Name");
      document.getElementById("lastinst").focus();
      return false;
    }

    if (
      document.getElementById("student_entry_photo").getAttribute("src") ==
      "img/default_photo.jpg"
    ) {
      alert("Upload photo");
      $("#student_entry_photo").focus();
      return false;
    }

    if (payment_type == "") {
      alert("Select Payment Type");
      document.getElementById("payment_type").focus();
      return false;
    }

    if (amount == "") {
      alert("Amount cant be Zero.");
      document.getElementById("amount").focus();
      return false;
    }

    var start_indx = $g_subject_appearing - $g_remaining_counter_inc;

    var subject_alert_flag = false;
    var alert_cnt = 0;
    //var inputFileds = document.getElementsByTagName('input');
    /* 	var chck = '0';
		for (var counter=0; counter < inputFileds.length; counter++) 
		{       
			if ( inputFileds[counter].type.toUpperCase()=='checkbox'  && inputFileds[counter].name == "honour"  )
			{   
				chck++;
			}
		} */

    for ($m = 0; $m < $g_subject_appearing; $m++) {
      var subcode = document.getElementById("fsubcode_" + $m).value;
      if (trim(subcode) == "") {
        alert("Please Enter the All Subjects");
        document.getElementById("fsubname_" + $m).focus();
        //if(document.getElementById("honours_"+$m).checked==true)
        //honours = trim($("#fsubcode_"+$m).val());
        return false;
      }
    }
    var honours;
    /* for($m=0;$m<$g_subject_appearing;$m++)
		{
				if(document.getElementById("honours_"+$m).checked==true)
					honours = trim($("#fsubcode_"+$m).val());
		} */

    if (fdegree == "BA18" || fdegree == "BSC18") {
      for ($m = start_indx; $m < $g_subject_appearing; $m++) {
        if (document.getElementById("honours_" + $m).checked == true)
          honours = trim($("#fsubcode_" + $m).val());
      }
      if (honours == "") {
        alert("Please Select honours Subject");
        return false;
      }
    }
    $sub_arr = new Object();
    $n = 0;
    for ($m = 0; $m < $g_subject_appearing; $m++) {
      $sub_arr[$n] = new Object();
      $sub_arr[$n]["sub_code"] = trim($("#fsubcode_" + $m).val());

      $n++;
    }
    var myJSONText = encodeURIComponent(JSON.stringify($sub_arr));
    CMS.EnableDisableStudentFields("Enable");
    var valid_file_extentions = new Array("jpeg", "jpg");
    var ext = $("#student_entry_upload").val();
    filepath = ext;

    ext = ext.substring(ext.length - 3, ext.length);
    ext = ext.toLowerCase();
    if (ext != "" && !in_array(ext, valid_file_extentions)) {
      alert("Please Select the Valid Photo!");
      return false;
    }
    list_data += "&filepath=" + filepath;

    list_data += "&honours=" + honours;

    /* if(honours == '')
		{
			alert("Please Select Honour Subject");
			return false;
		} */
    list_data += "&sub_arr=" + myJSONText;
    App.blockUI({ boxed: true, message: "Please wait, We are saving Data" });
    document
      .getElementById("form_module_details_upload")
      .setAttribute("action", list_data);
    return AIM.submit(
      document.getElementById("form_module_details_upload"),
      "same_tab",
      { onComplete: CMS.SaveCertificateDetailsResponse }
    );
  },
  subjectEdie: function (fdegree, fcollcode, id) {
    for ($m = 0; $m < id; $m++) {
      document.getElementById("fsubname_" + $m).disabled = false;
    }
  },
  SaveCertificateDetailsResponse: function (responce) {
    try {
      $.fancybox.close();
      App.unblockUI();
      responce = eval("(" + trim(responce) + ")");
      if (responce.error_code == 0) {
        CMS.GetpaymentLinkForAppNo(
          responce.data["app_no"],
          responce.data["fslno"]
        );
      } else {
        alert(responce.data);
        return false;
      }
    } catch (err) {
      txt = err.message;
      bootbox.alert(txt + "<br>" + responce);
    }
  },
  EnableDisableStudentFields: function (s_type) {
    var input_obj = $("#main_page input");
    jQuery.each(input_obj, function (k, v) {
      var id = v["id"];
      var name = v["name"];
      var type = v["type"].toLowerCase();
      if (type == "radio") {
        if (s_type == "Disable")
          $('input:radio[name="' + name + '"]').attr("disabled", "disabled");
        else
          $('input:radio[name="' + name + '"]').removeAttr(
            "disabled",
            "disabled"
          );
      } else {
        if (s_type == "Disable") {
          $("#" + id).attr("disabled", "disabled");
        } else {
          $("#" + id).removeAttr("disabled", "disabled");
        }
      }
    });
    if (s_type == "Disable") {
      $("#gender").attr("disabled", "disabled");
      $("#nationality").attr("disabled", "disabled");
      $("#Blood_Groop").attr("disabled", "disabled");
      $("#perstate").attr("disabled", "disabled");
      $("#fcollcode").attr("disabled", "disabled");
      $("#fdegree").attr("disabled", "disabled");
      $(".subname").attr("disabled", "disabled");
      $("#level").attr("disabled", "disabled");
      $("#univname").attr("disabled", "disabled");
      $("#lastinst").attr("disabled", "disabled");
      $("#student_entry_upload").attr("disabled", "disabled");
      $("#payment_type").attr("disabled", "disabled");
    } else {
      $("#gender").removeAttr("disabled", "disabled");
      $("#nationality").removeAttr("disabled", "disabled");
      $("#Blood_Groop").removeAttr("disabled", "disabled");
      $("#perstate").removeAttr("disabled", "disabled");
      $("#fcollcode").removeAttr("disabled", "disabled");
      $("#fdegree").removeAttr("disabled", "disabled");
      $("#level").removeAttr("disabled", "disabled");
      $("#univname").removeAttr("disabled", "disabled");
      $("#lastinst").removeAttr("disabled", "disabled");
      $(".subname").removeAttr("disabled", "disabled");
      $("#student_entry_upload").removeAttr("disabled", "disabled");
      $("#payment_type").removeAttr("disabled", "disabled");
    }
  },

  GetpaymentLinkForAppNo: function (app_no, fslno) {
    var fcollcode = $("#fcollcode").val();
    var fdegree = $("#fdegree").val();
    var fpaymenttype = $("#payment_type").val();
    var famount = $("#amount").val();

    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "GetpaymentLinkForAppNo",
      error: AjaxErrorMessage,
      data:
        "&app_no=" +
        app_no +
        "&fcollcode=" +
        fcollcode +
        "&fdegree=" +
        fdegree +
        "&fslno=" +
        fslno +
        "&fpaymenttype=" +
        fpaymenttype +
        "&famount=" +
        famount,
      success: function GetpaymentLinkForAppNoResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          $("#tasks_inbox").html(responce.data);
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  applicationForm: function (app_no, fcollcode, fdegree, fslno) {
    window.location.href =
      $host_url +
      "GenerateApplicationFormPdfReport&app_no=" +
      app_no +
      "&fcollcode=" +
      fcollcode +
      "&fdegree=" +
      fdegree +
      "&fslno=" +
      fslno;
  },
  makepaymentapplicationForm: function (app_no) {
    window.location.href =
      $host_url + "GenerateApplicationFormPdfReport&app_no=" + app_no;
  },
  MakeOnlinePayment: function (app_no) {
    //window.location.href = "payment_gateway.php?productinfo=" + app_no;
    window.location.href =
      "hdfc/ccavRequestHandler.php?productinfo=" +
      app_no +
      "&funivcode=" +
      "018";
  },
  ValidatePrintCertificateApplicationData: function () {
    var candidate_name = $("#a_candidate_name").val();
    var dob = date_format($("#c_dob").val());
    var app_no = $("#app_no").val();
    var approllno = $("#approllno").val();
    if (approllno == "") {
      bootbox.alert("Please Enter Roll Number");
      return false;
    }
    if (empty(candidate_name)) {
      bootbox.alert("Please Enter Candidate Name");
      return false;
    } else if (dob == "0000-00-00") {
      bootbox.alert("Please Enter Date of Birth");
      return false;
    } else if (empty(app_no)) {
      bootbox.alert("Please Enter application Numbser");
      return false;
    }
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "ValidatePrintCertificateApplicationData",
      error: AjaxErrorMessage,
      data:
        "&candidate_name=" +
        candidate_name +
        "&dob=" +
        dob +
        "&app_no=" +
        app_no,
      success: function ValidatePrintCertificateApplicationDataResponce(
        responce
      ) {
        try {
          responce = eval("(" + responce + ")");
          if (responce.error_code == -1) {
            bootbox.alert("Invalid Inputs Entered");
          } else {
            if (
              responce.data["FPAYMENTSTATUS"] == "success" ||
              responce.data["famount"] == "0"
            )
              CMS.applicationreport(responce.data["app_no"]);
            else {
              CMS.MakeOnlinePayment(responce.data["app_no"]);
            }
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },

  // <div class="form-group">
  //                                 <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Date of
  //                                     Birth (as per Higher Secondary Certificate)<span style="color:red;">*</span></label>
  //                                 <div class="col-md-5">
  //                                     <input type="text" id="std_dob" class="form-control" value="${stddata.fdob}"
  //                                         placeholder="Date of Birth (as per Higher Secondary Certificate)" maxlength=10>
  //                                     <span class="help-block">(dd/mm/yyyy)</span>
  //                                 </div>
  //                             </div>
  GetEditDatax: function () {
    var roll_no = $("#roll_no").val();
    var candidate_name = $("#cand_name").val();
    var std_dob = date_format($("#std_dob").val(), "d-m-Y");

    if (roll_no == "") {
      bootbox.alert("Please Enter Roll No.");
      return false;
    }
    if (candidate_name == "") {
      bootbox.alert("Please Enter Candidate Name");
      return false;
    }
    if (std_dob == "") {
      bootbox.alert("Please Enter Date Of Birth");
      return false;
    }

    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "getEditDet",
      error: AjaxErrorMessage,
      data:
        "&candidate_name=" +
        candidate_name +
        "&roll_no=" +
        roll_no +
        "&std_dob=" +
        std_dob,
      success: function (responce) {
        try {
          responce = eval("(" + responce + ")");
          if (responce.error_code == 0) {
            var stddata = responce.data.stddata;
            // var stringno = stddata.FAADHAARNO.toString();
            // var addharno = stringno.split();
            // console.log(addharno[0], stddata.FAADHAARNO);
            // return;
            var state = responce.data.state;
            var cate = responce.data.cate;
            document.getElementById("roll_no").disabled = true;
            // document.getElementById("std_dob").disabled = false;<label  id="app_no" class="col-md-5 form-control">${stddata.FAPPNO}</label>
            document.getElementById("cand_name").disabled = true;

            $("#std_edt").hide();
            $("#edit_Save").show();
            var perdet = `
              <div class="portlet-body">
                          <div class="table-responsive">
                              <div class="form-group">
                                  <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Application No.
                                  </label>
                                  <div class="col-md-4">
                                  <label class="col-md-5 control-label" id="app_no" style="text-align:left;">${stddata.FAPPNO}
                                  </label>
                                  </div>
                              </div>
                              
                              <div class="form-group">
                                  <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Aadhaar Number<span style="color:red;">*</span>
                                  </label>
                                  <div class="col-md-4">
                                    <input type="text" name="aadhaar_no" id="aadhaar_no" value="${stddata.FAADHAARNO}"
                                    class="form-control"
                                    placeholder="Aadhaar No." maxlength=12 minlength="12" />
                                  </div>
                                </div>

                              <div class="form-group">
                                  <label class="col-md-5 control-label"
                                      style="text-align:left;margin-left:10px">Gender<span
                                          style="color:red;">*</span></label>
                                  <div class="col-md-4">
                                      <select type="select" name="gender" id="gender_val" class="form-control">
                                          <option value='M'>Male</option>
                                          <option value='F'>Female</option>
                                      </select>
                                  </div>
                              </div>
                              <div class="form-group">
                                  <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Blood
                                      Group</label>
                                  <div class="col-md-4">
                                      <select type="select" name="Blood_Groop" id="Blood_Groop_val" class="form-control">
                                          <option value='None'>None</option>
                                          <option value='O+ve'>O+ve</option>
                                          <option value='O-ve'>O-ve</option>
                                          <option value='A+ve'>A+ve</option>
                                          <option value='A-ve'>A-ve</option>
                                          <option value='B+ve'>B+ve</option>
                                          <option value='B-ve'>B-ve</option>
                                          <option value='AB+ve'>AB+ve</option>
                                          <option value='AB-ve'>AB-ve</option>
                                      </select>
                                  </div>
                              </div>
                              <div class="form-group">
                                  <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Mother's
                                      Name
                                      <span style="color:red;">*</span>
                                  </label>
                                  <div class="col-md-4">
                                      <input type="text" name="mother_name" id="mothername" value="${stddata.FMOTNAME}"
                                          class="form-control"
                                          placeholder="Mother Name" maxlength=100 />
                                  </div>
                              </div>

                              <div class="form-group">
                                  <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Father's
                                      Name
                                      <span style="color:red;">*</span>
                                  </label>
                                  <div class="col-md-4" style="float:left;">
                                      <input type="text" name="father_name" id="fathername"
                                           class="form-control" value="${stddata.FFATNAME}"
                                          placeholder="Father Name" maxlength=100 />
                                  </div>
                              </div>

                              <div class="form-group">
                                  <label class="col-md-5 control-label"
                                      style="text-align:left;margin-left:50px">Nationality<span
                                          style="color:red;">*</span>
                                  </label>
                                  <div class="col-md-4">
                                      <select type="select" name="nationality" id="nationality_std" class="form-control"
                                      onchange='CMS.nationChange()'>
                                          <option value='INDIAN'>INDIAN</option>
                                          <option value='others'>OTHERS</option>
                                      </select>
                                      <input type="text" id="national_names" class="form-control"
                                          placeholder="Enter Country of Nationality" maxlength=50> 
                                  </div>
                              </div>

                              <div id="aadhaarid">

                                  <div class="form-group">
                                      <label class="col-md-5 control-label"
                                          style="text-align:left;margin-left:50px">Upload
                                          Aadhaar
                                      </label>
                                      <div class="col-md-4">
                                          <input type="file" id="aadhaarfile" class="form-control"
                                              onchange="CMS.uploadDocuments('aadhaar',${stddata.FCOLLCODE});">
                                      </div>
                                  </div>
                              </div>

                              <div id="passportid">
                                  <div class="form-group">
                                      <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">
                                          Passport No. / Unique Citizenship No.
                                      </label>
                                      <div class="col-md-4">
                                          <input type="text" name="passportno" id="passport_nos" class="form-control"
                                              placeholder="passport / Unique Citizenship No" value="${stddata.FPASSPORTNO}">
                                      </div>
                                  </div>

                                  <div class="form-group" id="passport_id">
                                      <label class="col-md-5 control-label"
                                          style="text-align:left;margin-left:50px">Upload
                                          Passport / Other Proof of Citizenship
                                      </label>
                                      <div class="col-md-4">
                                          <input type="file" id="passportfile" class="form-control"
                                              onchange="CMS.uploadDocuments('passport',${stddata.FCOLLCODE});">
                                      </div>
                                  </div>
                              </div>

                              <div class="form-group">
                                  <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">State of
                                      Residence
                                      <span style="color:red;">*</span>
                                  </label>
                                  <div class="col-md-4">
                                      <select type="select" name="perstate" id="perstates" onchange='CMS.stateChange()'
                                          class="form-control">
                                      </select>
                                      <input type="text" name="state" id="oth_state" class="form-control"
                                          placeholder="State of Residence" value="">
                                  </div>
                              </div>
                          </div>
                      </div>
                      <div class="form-group">
                          <input type="text" id="aadhafilepath" value="" disabled hidden>
                      </div>
                      <div class="form-group">
                          <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Category
                              <span style="color:red;">*</span>
                          </label>
                          <div class="col-md-4">
                              <select type="select" name="category" id="categorys" class="form-control">
                              </select>
                          </div>
                      </div>

                      <div class="form-group">
                          <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Address of
                              Correspondence<span style="color:red;">*</span>
                          </label>
                          <div class="col-md-4">
                              <input type="text" name="Address(For Communication)" id="com_addr1"
                                  onkeypress="CMS.singlequtes(this.id)" class="form-control" maxlength=100
                                  placeholder="Address(For Communication)" value="${stddata.FCURRADD1}">
                              <input type="text" name="Address(For Communication)" onkeypress="CMS.singlequtes(this.id)"
                                  id="com_addr2" class="form-control" maxlength=100 value="${stddata.FCURRADD2}">
                              <input type="text" name="Address(For Communication)" onkeypress="CMS.singlequtes(this.id)"
                                  id="com_addr3" class="form-control" maxlength=100 value="${stddata.FCURRADD3}">
                              <input type="text" name="Address(For Communication)" onkeypress="CMS.singlequtes(this.id)"
                                  id="com_addr4" class="form-control" maxlength=100 value="${stddata.FCURRADD4}">
                          </div>
                      </div>
                      <div class="form-group">
                          <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Permanent Address
                              <span style="color:red;">*</span>

                          </label>
                          <div class="col-md-4">
                              <input type="text" name="Address(Permanent)" onkeypress="CMS.singlequtes(this.id)"
                                  id="pere_addr1" class="form-control" maxlength=100 placeholder="Address(Permanent)" value="${stddata.FPERMADD1}">
                              <input type="text" name="Address(Permanent)" onkeypress="CMS.singlequtes(this.id)"
                                  id="pere_addr2" class="form-control" maxlength=100 value="${stddata.FPERMADD2}">
                              <input type="text" name="Address(Permanent)" onkeypress="CMS.singlequtes(this.id)"
                                  id="pere_addr3" class="form-control" maxlength=100 value="${stddata.FPERMADD3}">
                              <input type="text" name="Address(Permanent)" onkeypress="CMS.singlequtes(this.id)"
                                  id="pere_addr4" class="form-control" maxlength=100 value="${stddata.FPERMADD4}">
                          </div>
                      </div>
                      <div class="form-group">
                          <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Contact No.
                              <span style="color:red;">*</span>
                          </label>
                          <div class="col-md-4">
                              <input type="text" name="Contact_No" id="contact_nos" class="form-control" maxlength=10
                                  placeholder="Contact_No" onkeypress="return CMS.acceptNumbersOnlyForModule(event);" value="${stddata.FCONTACT_NO}">
                          </div>
                      </div>
                      <div class="form-group">
                          <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Email Id<span
                                  style="color:red;">*</span></label>
                          <div class="col-md-4">
                              <input type="text" name="email_id" id="email_ids" class="form-control" maxlength=100
                                  placeholder="Email_Id" value="${stddata.FEMAIL}">
                          </div>
                      </div>

                      <h3 class="form-section" style="color:green;">Details of Qualifying Examination Passed</h3>
                      <div class="form-group">
                          <label class="col-md-5 control-label" style="text-align:left;margin-left:50px;clear:both;">Last
                              Examination Passed
                              <span style="color:red;">*</span>
                          </label>
                          <div class="col-md-4">
                              <select type="select" name="level" style="width:350px;" id="levels"
                                  onchange="CMS.lastexam()" class="form-control">
                                  <option value='None'>Last Examination Passed</option>
                                  <option value='Higher Secondary'>Higher Secondary</option>
                                  <option value='Bachelor of Arts'>Bachelor of Arts</option>
                                  <option value='Bachelor of Commerce'>Bachelor of Commerce</option>
                                  <option value='Bachelor of Science'>Bachelor of Science</option>
                                  <option value='Bachelor of Education'>Bachelor of Education</option>
                                  <option value='Bachelor of Pharmacy'>Bachelor of Pharmacy</option>
                                  <option value='others'>OTHERS</option>
                              </select>
                              <input type="text" name="lastexampas" id="lastexampass" value='' class="form-control"
                                  maxlength=100 placeholder="Last Examination Passed">
                          </div>

                          <label class="col-md-5 control-label"
                              style="text-align:left;margin-left:50px;clear:both;">Board/University under which
                              Examination was held
                              <span style="color:red;">*</span>
                          </label>

                          <div class="col-md-4">
                              <select type="select" name="univname" style="width:350px;" id="univnames"
                                  onchange="CMS.UniversityChange()" class="form-control">
                                  <option value='None'> Select Board / University</option>
                                  <option value='Sikkim University'>Sikkim University</option>
                                  <option value='others'>Enter University / Board</option>
                              </select>
                              <input type="text" name="board" id="boards" value=''"
                                  class="form-control" maxlength=100 placeholder="Board/University">
                          </div>

                          <label class="col-md-5 control-label"
                              style="text-align:left;margin-left:50px;clear:both">Institution of
                              Last Examination
                              <span style="color:red;">*</span>
                          </label>
                          <div class="col-md-4">
                              <select type="select" name="lastinst" style="width:350px;" id="lastinsts"
                                  onchange="CMS.institname()" class="form-control">
                                  <option value='None'>Institution of Last Examination</option>
                                  <option value='others'>Enter Institution of Last Examination</option>
                              </select>
                              <input type="text" name="lastinstname" id="lastinstnames"
                                   value='' class="form-control" maxlength=100
                                  placeholder="Institution of Last Examination Name">
                          </div>

                          <label class="col-md-5 control-label" style="text-align:left;margin-left:50px;clear:both;">Year
                              of Last Examination
                              <span style="color:red;">*</span>
                          </label>
                          <div class="col-md-4">
                              <input type="text" name="year" id="years" class="form-control" maxlength=100
                                  placeholder="Year" value="${stddata.FQUALYEAR}">
                          </div>
                          <label class="col-md-5 control-label" style="text-align:left;margin-left:50px">Roll No. of Last
                              Examination
                              <span style="color:red;">*</span>
                          </label>
                          <div class="col-md-4">
                              <input type="text" name="rollno" id="rollnos" class="form-control" maxlength=20
                                  placeholder="Roll No" value="${stddata.FQUALREG}">
                          </div>
                          <label class="col-md-5 control-label" style="text-align:left;margin-left:50px;">Aggregate
                              Percentage obtained (Aggregate of all semesters upto 2 decimal places. If Qualifying Exam is
                              Class 12 School certificate, take aggregate marks of ALL subjects appeared. Leave the field
                              blank if qualifying University/Board does not provide percentage)

                          </label>
                          <div class="col-md-4">
                              <input type="text" name="percentage" id="percentages" style="margin-top:20px;"
                                  class="form-control" maxlength=20 placeholder="Percentage"
                                  onkeypress="return CMS.acceptNumbersOnlyForModuleanddot(event);"
                                  value="${stddata.FQUALPR}">
                          </div>
                          <label class="col-md-5 control-label"
                              style="text-align:left;margin-left:50px;clear:both">Division /
                              Class / Grade / CGPA obtained
                              <span style="color:red;">*</span>
                          </label>
                          <div class="col-md-4">
                              <input type="text" name="Division" id="Divisions" class="form-control" maxlength=50
                                  placeholder="Division" value="${stddata.FQUALCLASS}">
                          </div>
                      </div>
                      <div class="col-md-5">
                      <div class="form-group">
                          <img id='student_entry_photo'
                              style="width:148px;z-index:1;margin-left:180px;height:187px; width:148px"
                              onchange="" src="img/default_photo.jpg" class="img-responsive">
                      </div>
                      <div class="form-group" style="margin-left:180px;padding:0;">
                          <label class="control-label" style="margin:0;padding:0;">
                              Choose a file to upload
                          </label>
                          <input type="file" name="student_entry_upload" id="student_entry_uploads"
                              onchange='StudentSelectedPhoto(${stddata.FAPPNO},${stddata.FCOLLCODE});' style="padding:0;margin:0;width:250px;"
                              class="form-control">
      
                          <p>The photo uploaded will be used for printing on all important documents such as Marks Sheets,
                              Degree, Registration Certificate etc. </p>
                          <p>Photo must be in colour, and only in <b>.JPEG format</b> (any other format will not be accepted
                              by the form).</p>
                          <p>The photo print must be clear with light background of single tone (preferably white) and face
                              must be easily identifiable.</p>
                          <p>Applications with photo not meeting the above criteria shall not be processed. </p>
                      </div>
                  </div>
            `;
            $("#persenal_data").html(perdet);

            $("#national_names").hide();
            $("#oth_state").hide();
            $("#lastexampass").hide();
            $("#boards").hide();
            $("#lastinstnames").hide();

            let url =
              "https://university-student-photos.s3.ap-south-1.amazonaws.com/018/" +
              stddata.FPHOTOPATH;

            console.log(url, "stddata");

            var stateOpt = ` <option valustddata.e='None'>Select State</option>`;
            for (var i = 0; i < state.length; i++) {
              stateOpt += `<option value='${state[i].val}'>${state[i].int_code}</option>`;
            }
            $("#perstates").html(stateOpt);
            var cateOpt = ` <option value='None'>Select Category</option>`;
            for (var i = 0; i < cate.length; i++) {
              cateOpt += `<option value='${cate[i].FCATEGORY}'>${cate[i].FDESCPN} - ${cate[i].FCATEGORY}</option>`;
            }
            $("#categorys").html(cateOpt);
            $("#categorys").val(stddata.FCASTE);
            $("#perstates").val(stddata.FSTATE);
            $("#levels").val(stddata.FQUALDEG);

            $("#Blood_Groop_val").val(stddata.FBLOOD_GROUP);
            if (stddata.FNATIONAL == "INDIAN") {
              $("#nationality_std").val(stddata.FNATIONAL);
              $("#passport_id").hide();
            } else {
              $("#nationality_std").val("others");
              $("#national_names").show();
              $("#national_names").val(stddata.FNATIONAL);
            }

            if (
              stddata.FQUALUNIV == "Sikkim University" ||
              stddata.FQUALUNIV == "None"
            ) {
              $("#univnames").val(stddata.FQUALUNIV);
            } else {
              $("#univnames").val("others");
              $("#boards").show();
              $("#boards").val(stddata.FQUALUNIV);
            }
            if (stddata.FQUALINS != "None") {
              $("#lastinsts").val("others");
              $("#lastinstnames").show();
              $("#lastinstnames").val(stddata.FQUALINS);
            }
            $("#student_entry_photo").prop("src", url);
          } else if (responce.data.error_code == -1) {
            txt = responce.data.msg;
            $.unblockUI();
            bootbox.alert(txt);
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  GetEditData: function () {
    var roll_no = $("#roll_no").val();
    var candidate_name = $("#cand_name").val();
    var std_dob = date_format($("#std_dob").val(), "d-m-Y");

    if (roll_no == "") {
      bootbox.alert("Please Enter Roll No.");
      return false;
    }
    if (candidate_name == "") {
      bootbox.alert("Please Enter Candidate Name");
      return false;
    }
    if (std_dob == "") {
      bootbox.alert("Please Enter Date Of Birth");
      return false;
    }

    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "getEditDet",
      error: AjaxErrorMessage,
      data:
        "&candidate_name=" +
        candidate_name +
        "&roll_no=" +
        roll_no +
        "&std_dob=" +
        std_dob,
      success: function (responce) {
        try {
          responce = eval("(" + responce + ")");
          if (responce.error_code == 0) {
            var stddata = responce.data.stddata;
            console.log("aaa", stddata);

            $("#studedit").load(
              "html_modules/update_system_general_master_setup.php?v=26082017",
              function () {
                //CMS.getcollnamee();
                //$("#ufdegree").val(stddata.FDEGREE);
                $('#ucollname').html(stddata.collname);
                $('#udegree').html(stddata.fdescpn);
                $('#urollno').html(stddata.FROLLNO);
                $('#appno').val(stddata.FAPPNO);
                $("#ugender").val(stddata.FGENDER);
                $("#umother_name").val(stddata.FMOTNAME);
                $("#ufather_name").val(stddata.FFATNAME);
                $("#uBlood_Groop").val(stddata.FBLOOD_GROUP);
                $("#unationality").val(stddata.FNATIONAL);
                CMS.disp_sub_upd(stddata.FDEGREE,stddata.FCOLLCODE,stddata.FAPPNO);
                
              }
              
            );
            console.log(stddata.FMOTNAME);
            

          } else if (responce.data.error_code == -1) {
            txt = responce.data.msg;
            $.unblockUI();
            bootbox.alert(txt);
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  nationChange: function () {
    var nation = $("#nationality_std").val();
    if (nation == "others") {
      $("#national_names").show();
      $("#passport_id").show();
    } else {
      $("#national_names").hide();
      $("#passport_id").hide();
    }
  },
  stateChange: function () {
    var perstate = $("#perstates").val();
    if (perstate == "others") {
      $("#oth_state").show();
    } else {
      $("#oth_state").hide();
    }
  },
  lastexam: function () {
    var perstate = $("#levels").val();
    if (perstate == "others") {
      $("#lastexampass").show();
    } else {
      $("#lastexampass").hide();
    }
  },
  UniversityChange: function () {
    var univnames = $("#univnames").val();
    if (univnames == "others") {
      $("#boards").show();
    } else {
      $("#boards").hide();
    }
  },
  institname: function () {
    var lastinsts = $("#lastinsts").val();
    if (lastinsts == "others") {
      $("#lastinstnames").show();
    } else {
      $("#lastinstnames").hide();
    }
  },
  pulsars(obj, evt) {
    var idnum = obj.id.charAt(obj.id.length - 1);
    idnum = parseInt(idnum);
    if (evt.which == 8) {
      idnum = idnum - 1;
      if ($("#roll_numbers_" + idnum).prop("disabled")) return;
      $("#roll_numbers_" + idnum).val("");
      $("#roll_numbers_" + idnum).focus();
      return;
    } else {
      idnum = idnum + 1;
      obj.value = obj.value.toUpperCase();
      $("#roll_numbers_" + idnum).focus();
    }
  },
  Edit_Save: function () {
    var app_no = $("#app_no").val();
    var aadharNo = $("#aadhaar_no").val();
    var cand_name = $("#cand_name").val();
    var roll_no = $("#roll_no").val();
    var std_dob = date_format($("#std_dob").val(), "d-m-Y");
    var gender_val = $("#gender_val").val();
    var Blood_Groop_val = encodeURIComponent($("#Blood_Groop_val").val());
    var mother_name = $("#mothername").val();
    var fathername = $("#fathername").val();
    var nationality_std = $("#nationality_std").val();
    var national_name = $("#national_name").val();
    var passportno = $("#passport_nos").val();
    var perstate = $("#perstates").val();
    var state = $("#oth_state").val();
    var category = $("#categorys").val();
    var comm_addr1 = $("#com_addr1").val();
    var comm_addr2 = $("#com_addr2").val();
    var comm_addr3 = $("#com_addr3").val();
    var comm_addr4 = $("#com_addr4").val();
    var per_addr1 = $("#pere_addr1").val();
    var per_addr2 = $("#pere_addr2").val();
    var per_addr3 = $("#pere_addr3").val();
    var per_addr4 = $("#pere_addr4").val();
    var contact_no = $("#contact_nos").val();
    var email_id = $("#email_ids").val();
    var level = $("#levels").val();
    var lastexampas = $("#lastexampass").val();
    var univname = $("#univnames").val();
    var board = $("#boards").val();
    var lastinst = $("#lastinsts").val();
    var lastinstname = $("#lastinstnames").val();
    var year = $("#years").val();
    var percentage = $("#percentages").val();
    var Division = $("#Divisions").val();
    var rollnos = $("#rollnos").val();
    var aadhafilepath = $("#aadhafilepath").val();

    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "updateEditDet",
      error: AjaxErrorMessage,
      data:
        "aadharNo=" +
        aadharNo +
        "&cand_name=" +
        cand_name +
        "&roll_no=" +
        roll_no +
        "&std_dob=" +
        std_dob +
        "&gender_val=" +
        gender_val +
        "&Blood_Groop_val=" +
        Blood_Groop_val +
        "&mother_name=" +
        mother_name +
        "&fathername=" +
        fathername +
        "&nationality_std=" +
        nationality_std +
        "&passportno=" +
        passportno +
        "&perstate=" +
        perstate +
        "&state=" +
        state +
        "&category=" +
        category +
        "&comm_addr1=" +
        comm_addr1 +
        "&comm_addr2=" +
        comm_addr2 +
        "&comm_addr3=" +
        comm_addr3 +
        "&comm_addr4=" +
        comm_addr4 +
        "&per_addr1=" +
        per_addr1 +
        "&per_addr2=" +
        per_addr2 +
        "&per_addr3=" +
        per_addr3 +
        "&per_addr4=" +
        per_addr4 +
        "&contact_no=" +
        contact_no +
        "&email_id=" +
        email_id +
        "&level=" +
        level +
        "&lastexampas=" +
        lastexampas +
        "&univname=" +
        univname +
        "&board=" +
        board +
        "&lastinst=" +
        lastinst +
        "&lastinstname=" +
        lastinstname +
        "&year=" +
        year +
        "&percentage=" +
        percentage +
        "&Division=" +
        Division +
        "&rollnos=" +
        rollnos +
        "&national_name=" +
        national_name +
        "&aadhafilepath=" +
        aadhafilepath +
        "&app_no=" +
        app_no,
      success: function (responce) {
        try {
          responce = eval("(" + responce + ")");
          console.log(responce);
          if (responce.error_code == 0) {
            txt = responce.data.status;
            $.unblockUI();
            bootbox.alert(txt);
            $("#persenal_data").hide();
            document.getElementById("roll_no").disabled = false;
            document.getElementById("std_dob").disabled = false;
            document.getElementById("cand_name").disabled = false;
            $("#roll_no").val("");
            $("#std_dob").val("");
            $("#cand_name").val("");
            $("#std_edt").show();
            $("#edit_Save").hide();
          } else if (responce.error_code == -1) {
            txt = responce.status;
            $.unblockUI();
            bootbox.alert(txt);
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  applicationreport: function (app_no) {
    window.location.href =
      $host_url + "Generateapplicationreport&app_no=" + app_no;
    //window.location.href=$host_url+"GenerateApplicationFormPdfReport&app_no="+app_no;
  },
  acceptNumbersOnlyForModule: function (evt) {
    var event = "";
    var charCode = evt.which ? evt.which : event.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;

    return true;
  },
  acceptNumbersOnlyForModuleanddot: function (evt) {
    var event = "";
    console.log(evt.which);
    var charCode = evt.which ? evt.which : event.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46)
      return false;

    return true;
  },
  acceptNumbersOnlyForModuleandalert: function (evt, possion) {
    var event = "";

    if (possion == "6") {
      let collcode = $("#fcollcode").val();
      let fdegree = $("#fdegree").val();
      if (
        (collcode == "1009" || collcode == "1015") &&
        (fdegree.toUpperCase() == "MPH17" || fdegree.toUpperCase() == "PHD17")
      )
        return true;
    } else if (possion == "5") {
      let collcode = $("#fcollcode").val();
      let fdegree = $("#fdegree").val();
      if (collcode == "1009" && fdegree.toUpperCase() == "PHD17") return true;
    }

    var charCode = evt.which ? evt.which : event.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
      alert("Only Numbers allowed..!");
      return false;
    } else {
      console.log("2");
      return true;
    }
  },
  GetPendingCertificates: function () {
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "GetPendingCertificates",
      error: AjaxErrorMessage,
      data:
        "from_app=" +
        $("#app_from_app").val() +
        "&to_app=" +
        $("#app_to_app").val(),
      success: function GetPendingCertificatesDataResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          if (responce.error_code == -1) {
          } else {
            $("#tasks_inbox_trial").html(responce.data["html"]);
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  GetVerifiedCertificates: function () {
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "GetVerifiedCertificates",
      error: AjaxErrorMessage,
      data:
        "from_app=" +
        $("#ver_from_app").val() +
        "&to_app=" +
        $("#ver_to_app").val(),
      success: function GetVerifiedCertificatesResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          if (responce.error_code == -1) {
          } else {
            $("#verified_trial").html(responce.data["html"]);
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  viewCollCandidateDetails: function (appno, collcode, type) {
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "GetCandidateDetails",
      error: AjaxErrorMessage,
      data: "appno=" + appno + "&collcode=" + collcode,
      success: function (responce) {
        try {
          responce = eval("(" + responce + ")");
          if (responce.error_code == -1) {
          } else {
            if (type == "pending") {
              document.getElementById("cand_list").className = " ";
              document.getElementById("cand_details").className = "active";
              document.getElementById("tasks_inbox").className = "tab-pane";
              document.getElementById("edit_html").className = "tab-pane";
              document.getElementById("candidate_details").className +=
                " active";
              document.getElementById("cand_details").focus();
              $("#candidate_details").html(responce.data["html"]);
            }

            if (type == "verified") {
              document.getElementById("cand_verified").className = " ";
              document.getElementById("cand_details").className = "active";
              document.getElementById("verified_div").className = "tab-pane";
              document.getElementById("candidate_details").className +=
                " active";
              document.getElementById("cand_details").focus();
              $("#candidate_details").html(responce.data["html"]);
            }
            if (type == "verifiedbarcode") {
              document.getElementById("cand_listbarcode").className = " ";
              document.getElementById("cand_details").className = "active";
              document.getElementById("tasks_inboxbarcode").className =
                "tab-pane";
              document.getElementById("candidate_details").className +=
                " active";
              document.getElementById("cand_details").focus();
              $("#candidate_details").html(responce.data["html"]);
            }
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  ApproveRejectCertificate: function (FAPPNO, status) {
    remarks = "";
    if (status == "Rejected") {
      bootbox.confirm(
        "Are you sure ? <br><br><form id='infos' action=''>Reason : <br><textarea rows='3' cols='50' id='remarks' width='200px' height='100px'/><br/>",
        function (result) {
          if (result) {
            remarks = document.getElementById("remarks").value;
            if (remarks != "") {
              $.ajax({
                type: "POST",
                //async:false,
                url: $host_url + "ApproveRejectCertificate",
                error: AjaxErrorMessage,
                data:
                  "FAPPNO=" +
                  FAPPNO +
                  "&status=" +
                  status +
                  "&remarks=" +
                  remarks,
                success: function ApproveRejectCertificateResponce(responce) {
                  try {
                    responce = eval("(" + responce + ")");
                    if (responce.error_code == -1) {
                    } else {
                      bootbox.alert("Updated Successfully");
                      CMS.GetPendingCertificates();
                    }
                  } catch (err) {
                    txt = err.message;
                    $.unblockUI();
                    bootbox.alert(txt);
                  }
                },
              });
            }
          }
        }
      );
    } else {
      bootbox.confirm("Are you sure?", function (result) {
        if (result) {
          $.ajax({
            type: "POST",
            //async:false,
            url: $host_url + "ApproveRejectCertificate",
            error: AjaxErrorMessage,
            data:
              "FAPPNO=" + FAPPNO + "&status=" + status + "&remarks=" + remarks,
            success: function ApproveRejectCertificateResponce(responce) {
              try {
                responce = eval("(" + responce + ")");
                if (responce.error_code == -1) {
                } else {
                  bootbox.alert("Updated Successfully");
                  CMS.GetPendingCertificates();
                }
              } catch (err) {
                txt = err.message;
                $.unblockUI();
                bootbox.alert(txt);
              }
            },
          });
        }
      });
    }
  },
  DisplayAllAckExamApplications: function (evt) {
    /* var event = '';
		alert(evt.keyCode);alert(evt.which);
		var charCode = (evt.which) ? evt.which : evt.keyCode;
		alert(evt.keyCode); */
    //if(charCode == 'undefined')
    //{
    app_no = $("#app_from_appbarcode").val();
    str += "'" + app_no + "',";
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "DisplayAllAckExamApplications",
      error: AjaxErrorMessage,
      data: "&app_from_app=" + encodeURIComponent(str),
      success: function DisplayAllAckExamApplicationsResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          if (responce.error_code == -1) {
          } else {
            $("#tasks_inbox_trialbarcode").html(responce.data["html"]);
            document.getElementById("app_from_appbarcode").value = "";
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });

    //	}
  },
  AcknowledgeSelectedExamApplications: function () {
    checked_app_nos = new Array();
    var obj = $("input[id*='ack_check_box_']");

    jQuery.each(obj, function (k, v) {
      row_id = v["id"].split("_")[3];
      if ($(this).is(":checked")) checked_app_nos.push(row_id);
    });

    if (empty(checked_app_nos)) {
      alert("Please select minumum one application to acknowledge.");
      return false;
    }
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "AcknowledgeSelectedExamApplications",
      error: AjaxErrorMessage,
      data: "checked_app_nos=" + checked_app_nos,
      success: function AcknowledgeSelectedExamApplicationsResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          if (responce.error_code == -1) {
            bootbox.alert("Update Failed");
          } else {
            bootbox.alert("Updated Successfully");
            $("#tasks_inbox_trialbarcode").html("");
            document.getElementById("app_from_appbarcode").value = "";
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  to_upperx: function (id) {
    var x = document.getElementById(id).value;
    document.getElementById(id).value = x.toUpperCase();
  },
  singlequtes: function (id) {
    var x = document.getElementById(id).value;
    addvaue = x.replace("'", "`");
    document.getElementById(id).value = addvaue;
  },
  uploadDoc: function (doc) {
    var roll_number =
      $("#roll_number_1").val() +
      $("#roll_number_2").val() +
      $("#roll_number_3").val() +
      $("#roll_number_4").val() +
      $("#roll_number_5").val() +
      $("#roll_number_6").val() +
      $("#roll_number_7").val() +
      $("#roll_number_8").val();
    let collcode = $("#fcollcode").val();

    let aadhaar_file = $("#aadhaar_file").prop("files")[0];
    let passport_file = $("#passport_file").prop("files")[0];

    const maxFileSize = 1024 * 1024;

    if (roll_number.length !== 8) {
      alert("Roll Number Shoud be 8 character.");
      if ($("#roll_number_1").val() == "") {
        document.getElementById("roll_number_1").focus();
      }
      if ($("#roll_number_2").val() == "") {
        document.getElementById("roll_number_2").focus();
      }
      if ($("#roll_number_3").val() == "") {
        document.getElementById("roll_number_3").focus();
      }
      if ($("#roll_number_4").val() == "") {
        document.getElementById("roll_number_4").focus();
      }
      if ($("#roll_number_5").val() == "") {
        document.getElementById("roll_number_5").focus();
      }
      if ($("#roll_number_6").val() == "") {
        document.getElementById("roll_number_6").focus();
      }
      if ($("#roll_number_7").val() == "") {
        document.getElementById("roll_number_7").focus();
      }
      if ($("#roll_number_8").val() == "") {
        document.getElementById("roll_number_8").focus();
      }
      return;
    }

    if (collcode === "None") {
      alert("select College");
      $("#college").focus();
      return false;
    }

    const form_data = new FormData();
    form_data.append("univcode", "018");
    form_data.append("regno", roll_number);
    form_data.append("collcode", collcode);
    form_data.append("doc", doc);

    if (doc === "aadhaar") {
      if (aadhaar_file === undefined || aadhaar_file === null) {
        alert("please select the aadhaar file");
        return;
      }
      if (aadhaar_file.size > maxFileSize) {
        alert("File size exceeds the maximum allowed size (1 MB)");
        return;
      }
      form_data.append("file", aadhaar_file);
    }
    if (doc === "passport") {
      if (passport_file === undefined || passport_file === null) {
        alert("please select the passport / unique civilization document");
        return;
      }
      if (passport_file.size > maxFileSize) {
        alert("File size exceeds the maximum allowed size (1 MB)");
        return;
      }
      form_data.append("file", passport_file);
    }

    $.ajax({
      url: $host_url + "uploadNationalityDoc",
      dataType: "text",
      cache: false,
      contentType: false,
      processData: false,
      data: form_data,
      type: "post",
      success: function (response) {
        let res = JSON.parse(response);
        console.log(res);
        if (res.error_code === 0) {
          alert(res.data.msg);
          $("#filepath").val(res.data.filepath);
        } else {
          alert(res.data.msg);
          return;
        }
      },
    });
  },
  uploadDocuments: function (doc, fcollcode) {
    var roll_number = $("#roll_no").val();
    let collcode = fcollcode;

    let aadhaar_file = $("#aadhaarfile").prop("files")[0];

    const maxFileSize = 1024 * 1024;

    if (roll_number.length !== 8) {
      alert("Roll Number Shoud be 8 character.");
      if ($("#roll_numbers_1").val() == "") {
        document.getElementById("roll_no").focus();
      }
      return;
    }

    const form_data = new FormData();
    form_data.append("univcode", "018");
    form_data.append("regno", roll_number);
    form_data.append("collcode", collcode);
    form_data.append("doc", doc);

    if (doc === "aadhaar") {
      if (aadhaar_file === undefined || aadhaar_file === null) {
        alert("please select the aadhaar file");
        return;
      }
      if (aadhaar_file.size > maxFileSize) {
        alert("File size exceeds the maximum allowed size (1 MB)");
        return;
      }
      form_data.append("file", aadhaar_file);
    }
    if (doc === "passport") {
      if (passport_file === undefined || passport_file === null) {
        alert("please select the passport / unique civilization document");
        return;
      }
      if (passport_file.size > maxFileSize) {
        alert("File size exceeds the maximum allowed size (1 MB)");
        return;
      }
      form_data.append("file", passport_file);
    }

    $.ajax({
      url: $host_url + "uploadNationalDoc",
      dataType: "text",
      cache: false,
      contentType: false,
      processData: false,
      data: form_data,
      type: "post",
      success: function (response) {
        let res = JSON.parse(response);
        console.log(res);
        if (res.error_code === 0) {
          alert(res.data.msg);
          $("#aadhafilepath").val(res.data.filepath);
        } else {
          alert(res.data.msg);
          return;
        }
      },
    });
  },
};

function StudentSelectedPhoto(FAPPNO, FCOLLCODE) {
  var roll_number = $("#roll_no").val();
  let collcode = FCOLLCODE;
  let FAPPNOS = FAPPNO;

  let student_photo = $("#student_entry_uploads").prop("files")[0];

  const maxFileSize = 1024 * 1024;

  if (roll_number.length !== 8) {
    alert("Roll Number Shoud be 8 character.");
    if ($("#roll_number_1").val() == "") {
      document.getElementById("roll_no").focus();
    }
    return;
  }

  const form_data = new FormData();
  form_data.append("univcode", "018");
  form_data.append("regno", roll_number);
  form_data.append("collcode", collcode);
  form_data.append("doc", doc);

  if (student_photo === undefined || student_photo === null) {
    alert("Please Select the Photo file");
    return;
  }
  if (student_photo.size > maxFileSize) {
    alert("File size exceeds the maximum allowed size (1 MB)");
    return;
  }
  form_data.append("file", student_photo);

  $.ajax({
    url: $host_url + "",
    dataType: "text",
    cache: false,
    contentType: false,
    processData: false,
    data: form_data,
    type: "post",
    success: function (response) {
      let res = JSON.parse(response);
      console.log(res);
      if (res.error_code === 0) {
        alert(res.data.msg);
      } else {
        alert(res.data.msg);
        return;
      }
    },
  });
}
// // StudentDisplayPhoto;
// function StudentSelectedPhotoResponse($responce) {
//   $responce = eval("(" + $responce + ")");
//   App.unblockUI();
//   if ($responce.error_code == 0)
//     $("#student_entry_photo").attr("src", $responce.data);
//   else if ($responce.error_code == -1) {
//     $("#student_entry_photo").attr("src", "images/default_photo.jpg");
//     $("#student_entry_upload").val("");
//   } else if ($responce.error_code == -2) {
//     alert($responce.data);
//     $("#student_entry_photo").attr("src", "images/default_photo.jpg");
//     $("#student_entry_upload").val("");
//   }
// }

// function pulsarAadhaar(obj, evt, id) {
//   idnum = parseInt(id) + 1;
//   $("#aadhaar_number_" + idnum).focus();
// }