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


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

var fee = 0;
let a = 0;
let lat = "";
CMS = {
  GetHeaderDetails: function () {
    $("#T14").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",
    });
    $("#apps_dob").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#date_from").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#date_to").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#rp_dob").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#pd_from_date").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $("#pd_to_date").inputmask("d/m/y", {
      placeholder: "dd/mm/yyyy",
    });
    $.ajax({
      type: "POST",
      url: $host_url + "GetHeaderDetails",
      error: AjaxErrorMessage,
      success: function GetHeaderDetailsResponce(responce) {
        try {
          $("#tatkalid").hide();
          responce = eval("(" + responce + ")");
          document.getElementById("header_title").innerHTML =
            responce.data["FUNIVNAME"];
          document.getElementById("header_addr").innerHTML =
            responce.data["FUNIVADD1"];
          $("#header_logo").attr("src", responce.data["FLOGOPATH"]);
          CMS.GetCMSDropDownMenuValues();
        } catch (err) {
          txt = err.message;
          $.unblockUI();
        }
      },
    });
  },
  GetCMSDropDownMenuValues: function () {
    $.ajax({
      type: "POST",
      url: $host_url + "GetCMSDropDownMenuValues",
      error: AjaxErrorMessage,
      success: function GetCMSDropDownMenuValuesResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          var payment_arr = responce.data["acctype"];
          var conv_arr = responce.data["convtype"];
          var univdata = responce.data["univdata"];
          var cat_arr = responce.data["category"];
          var db = responce.data["db"];
          // if (db == "vskub") $("#disp_uploads").show();
          //console.log(univdata.length);
          CMS.FillDropdownValues(payment_arr, "T13");
          CMS.FillDropdownValues(univdata, "univ");
          CMS.FillDropdownValues(cat_arr, "T16");
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          //bootbox.alert(txt);
        }
      },
    });
  },
  FillDropdownValues: function (arr, ele_name) {
    if (ele_name == "univ" && arr.length == 1) {
      document.getElementById(ele_name).options.length = 0;
      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);
        document.getElementById(ele_name).disabled = true;
      });
    } else {
      document.getElementById(ele_name).options.length = 0;
      var op = new Option("  Select  ", "00");
      op.id = "00";
      document.getElementById(ele_name).options.add(op);

      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);
      });
    }
  },
  ValidateCertificateDetails: function () {
    list_data = "";

    var student_entry_photo = $("#student_entry_upload").val();
    var reg_no = encodeURIComponent($("#T1").val());
    var candidate_name = encodeURIComponent($("#T2").val());
    var college = encodeURIComponent($("#T3").val());
    var degree = encodeURIComponent($("#T4").val());
    var mobileno = encodeURIComponent($("#T5").val());
    var confmobileno = encodeURIComponent($("#T6").val());
    var kanname = encodeURIComponent($("#T99").val());
    var emailid = $("#T7").val();
    var univ = $("#univ").val();

    //var postaladdr2 =  encodeURIComponent($("#T10").val());
    var amount = encodeURIComponent($("#T12").val());
    var convtype = encodeURIComponent($("#T15").val());
    var category = encodeURIComponent($("#T16").val());
    var paytype = encodeURIComponent($("#T13").val());
    var dob = date_format($("#T14").val());
    var event = document.createEvent("Event");

    var rctype = encodeURIComponent($("#rctype").val());
    var nationality = encodeURIComponent($("#nationality").val());
    var aadhar = encodeURIComponent($("#aadhar").val());
    var postaladdr1 = encodeURIComponent($("#T8").val());
    var postaladdr2 = encodeURIComponent($("#T9").val());
    var city = encodeURIComponent($("#T31").val());
    var state = encodeURIComponent($("#T32").val());
    var pincode = encodeURIComponent($("#T33").val());
    var sem_mks = $("#h_sem_mks").val();
    var deg_cert = $("#h_deg_cert").val();
    console.log(sem_mks, deg_cert);
    if (univ != "018") {
      if (empty(reg_no)) {
        bootbox.alert("Enter Register no.");
        $("#T1").focus();
        return false;
      }

      if (empty(rctype)) {
        bootbox.alert("Select Receive Certificate");
        $("#rctype").focus();
        return false;
      }

      if (empty(nationality)) {
        bootbox.alert("Select Nationality");
        $("#nationality").focus();
        return false;
      }

      if (category == "00") {
        bootbox.alert("Select Category");
        $("#T16").focus();
        return false;
      } else if (empty(candidate_name)) {
        bootbox.alert("Enter candidate name");
        $("#T2").focus();
        return false;
      } else if (dob == "0000-00-00") {
        bootbox.alert("Enter Date of Birth");
        $("#T14").focus();
        return false;
      } else if (empty(aadhar)) {
        bootbox.alert("Enter aadhar number");
        $("#aadhar").focus();
        return false;
      } else if (empty(mobileno) || mobileno.length != 10) {
        bootbox.alert("Enter 10 digit mobile number");
        $("#T5").focus();
        return false;
      }
      // else if (empty(confmobileno) || confmobileno.length != 10) {
      //   bootbox.alert("Enter 10 digit mobile number");
      //   $("#T6").focus();
      //   return false;
      // } else if (mobileno != confmobileno) {
      //   bootbox.alert(
      //     "The confirmed mobile no. does not match with mobile no."
      //   );
      //   $("#T6").focus();
      //   return false;
      // }
      if (!validateemail(event, emailid)) {
        bootbox.alert(
          "The Email ID format is invalid,the valid Email Id format is name@org.com or name@org.co.in"
        );
        document.getElementById("T7").focus();
        return false;
      }
      if (rctype != "by%20Post") {
        if (empty(postaladdr1)) {
          bootbox.alert("Enter Postal Address 1");
          $("#T8").focus();
          return false;
        }
        if (empty(postaladdr2)) {
          bootbox.alert("Enter Postal Address 2");
          $("#T9").focus();
          return false;
        }
        if (empty(city)) {
          bootbox.alert("Enter City");
          $("#T31").focus();
          return false;
        }
        if (empty(state)) {
          bootbox.alert("Enter State");
          $("#T32").focus();
          return false;
        }
        if (empty(pincode)) {
          bootbox.alert("Enter Pincode");
          $("#T33").focus();
          return false;
        }
      }

      if (paytype == "00") {
        alert("Select Payment Type");
        $("#T13").focus();
        return false;
      }

      if (kanname == "") {
        alert("Enter Kannada Name");
        $("#T99").focus();
        return false;
      }

      if (
        document.getElementById("student_entry_photo").getAttribute("src") ==
        "img/default_photo.jpg"
      ) {
        alert("Upload photo");
        $("#student_entry_photo").focus();
        return false;
      }
    } else {
      if (empty(reg_no)) {
        bootbox.alert("Enter Register no.");
        $("#T1").focus();
        return false;
      }
      if (empty(rctype)) {
        bootbox.alert("Select Receive Certificate");
        $("#rctype").focus();
        return false;
      }
      if (empty(candidate_name)) {
        bootbox.alert("Enter candidate name");
        $("#T2").focus();
        return false;
      }
      if (empty(mobileno) || mobileno.length != 10) {
        bootbox.alert("Enter 10 digit mobile number");
        $("#T5").focus();
        return false;
      }
      // if (empty(confmobileno) || confmobileno.length != 10) {
      //   bootbox.alert("Enter 10 digit mobile number");
      //   $("#T6").focus();
      //   return false;
      // }
      // if (mobileno != confmobileno) {
      //   bootbox.alert(
      //     "The confirmed mobile no. does not match with mobile no."
      //   );
      //   $("#T6").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 (paytype == "00") {
        alert("Select Payment Type");
        $("#T13").focus();
        return false;
      }
      console.log(rctype, "by%20Post");
      if (rctype != "by%20Post") {
        if (empty(pincode)) {
          bootbox.alert("Enter Pincode");
          $("#T33").focus();
          return false;
        }
        if (empty(postaladdr1)) {
          bootbox.alert("Enter Postal Address 1");
          $("#T8").focus();
          return false;
        }
        if (empty(postaladdr2)) {
          bootbox.alert("Enter Postal Address 2");
          $("#T9").focus();
          return false;
        }
        if (empty(city)) {
          bootbox.alert("Enter City");
          $("#T31").focus();
          return false;
        }
        if (empty(state)) {
          bootbox.alert("Enter State");
          $("#T32").focus();
          return false;
        }
        if (!validateemail(event, emailid)) {
          bootbox.alert(
            "The Email ID format is invalid,the valid Email Id format is name@org.com or name@org.co.in"
          );
          document.getElementById("T7").focus();
          return false;
        }
      }
    }

    var lstr_query_string = window.location.href;
    lstr_query_string = lstr_query_string.split("/");
    console.log(lstr_query_string);
    lstr_query_string = lstr_query_string[4];

    if (lstr_query_string == "vskub") {
      if (sem_mks == "") {
        alert("Upload All Semester marks cards");
        return;
      }
      // if (deg_cert == "") {
      //   alert("Upload Degree Certificate");
      //   return;
      // }
    }

    /* 	else if(convtype == '00')
		{
			alert("Select Convocation");
			$("#T15").focus();
			return false;
		} */
    var flag = true;
    if (flag == true) {
      if (category == "SCST") {
        var exam_det = $("#upload_table input[id*='categoryatt']");
        jQuery.each(exam_det, function (ak, av) {
          var id = av["id"].split("_").pop();
          var cert = $("#upload_table #doc_upload_" + id).html();
          var file = $("#upload_table #categoryatt").val();

          if (
            empty(file) ||
            empty(document.getElementById("categoryattpath").value)
          ) {
            alert("Upload Category Certificate");
            flag = false;
            return false;
          }
        });
      }
    }

    if (lat != "T") {
      var x = 0;

      for (let i = 1; i <= a; i++) {
        if (document.getElementById("confirm" + i).checked != true) x = 1;
      }

      if (x > 0) {
        alert("Confirm your all Semester Marks");
        return false;
      }
    }
    if (document.getElementById("student_declr").checked != true) {
      alert("Read the Declaration and check I agree to the Terms ");
      return false;
    }

    return flag;
  },
  SaveCertificateDetails: function () {
    var applicantOrThirdOrPost = $("#rctype").val();

    console.log(applicantOrThirdOrPost, "hi");

    var freccer;
    var list_data = $host_url + "SaveCertificateDetails";
    if (applicantOrThirdOrPost == "IN ABSENTIA") {
      var valid_file_extentionsletter = new Array("jpeg", "jpg", "png", "gif");
      var extletter = $("#letter_upload").val();
      filepathletter = extletter;

      var ext1 = extletter.substring(extletter.length - 4, extletter.length);
      ext1 = ext1.toLowerCase();

      extletter = extletter.substring(extletter.length - 3, extletter.length);
      extletter = extletter.toLowerCase();

      if (
        extletter != "" &&
        !in_array(extletter, valid_file_extentionsletter)
      ) {
        console.log(ext1);
        if (ext1 != "" && !in_array(ext1, valid_file_extentionsletter)) {
          alert("Please Select the Valid Photo!");
          return false;
        }
      }
      App.blockUI({ boxed: true, message: "Please wait, We are saving Data" });
      list_data += "&filepathletter=" + filepathletter;
      var thirdpersonName = $("#thirdName").val();
      list_data += "&thirdName=" + thirdpersonName;
      var thirdPersonRelation = $("#relative").val();
      list_data += "&relative=" + thirdPersonRelation;
      if (thirdPersonRelation == "father") {
        list_data += "&father=" + thirdPersonRelation;
      } else if (thirdPersonRelation == "mother") {
        list_data += "&mother=" + thirdPersonRelation;
      } else if (thirdPersonRelation == "spouse") {
        list_data += "&spouse=" + thirdPersonRelation;
      } else if (thirdPersonRelation == "other") {
        list_data += "&other=" + thirdPersonRelation;
        var otherRelName = $("#otherralation").val();
        list_data += "&otherralation=" + otherRelName;
      }

      var thirdPersonEmail = $("#thirdPersonEmail").val();
      list_data += "&thirdPersonEmail=" + thirdPersonEmail;
      var thirdPersonMobile = $("#thirdPersonMobile").val();
      list_data += "&thirdPersonMobile=" + thirdPersonMobile;
      var thirdPersonAddress = $("#thirdPersonAddress").val();
      list_data += "&thirdPersonAddress=" + thirdPersonAddress;

      var thirdPersonidproof = $("#idproof").val();
      list_data += "&idproof=" + thirdPersonidproof;
      if (thirdPersonidproof == "aadhar") {
        list_data += "&aadhar=" + thirdPersonidproof;
        var aadharno = $("#aadharno").val();
        list_data += "&aadharno=" + aadharno;
      } else if (thirdPersonidproof == "driving") {
        list_data += "&driving=" + thirdPersonidproof;
        var drivingliecence = $("#drivingliecence").val();
        list_data += "&drivingliecence=" + drivingliecence;
      } else if (thirdPersonidproof == "voter") {
        list_data += "&voter=" + thirdPersonidproof;
        var voterproof = $("#voterproof").val();
        list_data += "&voterproof=" + voterproof;
      } else if (thirdPersonidproof == "other") {
        list_data += "&other=" + thirdPersonidproof;
        var otherproof = $("#otherproof").val();
        list_data += "&otherproof=" + otherproof;
        var otherproofnumber = $("#otherproofnumber").val();
        list_data += "&otherproofnumber=" + otherproofnumber;
      }

      var valid_file_extentionsletter = new Array("jpeg", "jpg", "png", "gif");
      var extproof = $("#letter_upload").val();
      filepathextproof = extproof;

      var filepathextproof1 = extproof.substring(
        extproof.length - 4,
        extproof.length
      );
      filepathextproof1 = filepathextproof1.toLowerCase();

      extproof = extproof.substring(extproof.length - 3, extproof.length);
      extproof = extproof.toLowerCase();

      if (extproof != "" && !in_array(extproof, valid_file_extentionsletter)) {
        console.log(filepathextproof1);
        if (
          filepathextproof1 != "" &&
          !in_array(filepathextproof1, valid_file_extentionsletter)
        ) {
          alert("Please Select the Valid Photo!");
          return false;
        }
      }

      App.blockUI({ boxed: true, message: "Please wait, We are saving Data" });
      list_data += "&filepathextproof=" + filepathextproof;
    } else if (applicantOrThirdOrPost == "by Post") {
      var houseno = $("#byposthouseno").val();
      list_data += "&byposthouseno=" + houseno;
      var streetName = $("#bypoststreetname").val();
      list_data += "&bypoststreetname=" + streetName;
      var areaname = $("#bypostarea").val();
      list_data += "&bypostarea=" + areaname;
      var landmark = $("#bypostlandmark").val();
      list_data += "&bypostlandmark=" + landmark;

      var statebypost = $("#counties").val();
      list_data += "&counties=" + statebypost;
      if (statebypost == "india") {
        statess = $("#indiasState").val();
        list_data += "&indiasState=" + statess;
      } else if (statebypost == "other") {
        var othercountrt = $("#otherthanall").val();
        list_data += "&otherthanall=" + othercountrt;
        statess = $("#otherthanstate").val();
        list_data += "&otherthanstate=" + statess;
      } else {
        statess = $("#otherthanstate").val();
        list_data += "&otherthanstate=" + statess;
      }

      var postdist = $("#postdist").val();
      list_data += "&postdist=" + postdist;
      var pincodebypost = $("#bypostpincode").val();
      list_data += "&bypostpincode=" + pincodebypost;
    }

    var reg_no = encodeURIComponent($("#T1").val());
    list_data += "&reg_no=" + reg_no;
    var course = $("#T4").val();
    list_data += "&course=" + course;
    var college = $("#T3").val();
    list_data += "&college=" + college;
    var candidate_name = encodeURIComponent($("#T2").val());
    list_data += "&candidate_name=" + candidate_name;

    var univ = encodeURIComponent($("#univ").val());
    list_data += "&univ=" + univ;

    var catcode = encodeURIComponent($("#T16").val());
    list_data += "&catcode=" + catcode;

    var paddr1 = encodeURIComponent($("#T8").val());
    list_data += "&paddr1=" + paddr1;

    var paddr2 = encodeURIComponent($("#T9").val());
    list_data += "&paddr2=" + paddr2;

    var city = encodeURIComponent($("#T31").val());
    list_data += "&city=" + city;

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

    var pincode = encodeURIComponent($("#T33").val());
    list_data += "&pincode=" + pincode;

    var mobile_no = encodeURIComponent($("#T5").val());
    list_data += "&mobile_no=" + mobile_no;
    var email_id = encodeURIComponent($("#T7").val());
    list_data += "&email_id=" + email_id;
    var amount = encodeURIComponent($("#T12").val());
    list_data += "&amount=" + amount;

    var nationality = encodeURIComponent($("#nationality").val());
    list_data += "&nationality=" + nationality;

    var rctype = encodeURIComponent($("#rctype").val());
    list_data += "&rctype=" + rctype;

    var aadhar = encodeURIComponent($("#aadhar").val());
    list_data += "&aadhar=" + aadhar;

    var paytype = encodeURIComponent($("#T13").val());
    list_data += "&paytype=" + paytype;

    var kanname = encodeURIComponent($("#T99").val());
    list_data += "&kanname=" + kanname;

    list_data += "&deg_cert=" + $("#h_deg_cert").val();
    list_data += "&sem_mks=" + $("#h_sem_mks").val();

    var feearry = [];
    $("#feetable tbody>tr").each(function () {
      var headcode = ["slno", "headcode", "fee"];
      var x = 0;
      var item = {};
      $("td", this).each(function () {
        item[headcode[x]] = $(this).text();
        feearry.push(item);
        x++;
      });
    });

    list_data += "&fee_arr=" + JSON.stringify(feearry);

    //var paytype =  encodeURIComponent($("#T30").val());list_data+="&paytype="+paytype;

    var dob = date_format($("#T14").val());
    list_data += "&dob=" + dob;

    var valid_file_extentions = new Array("jpeg", "jpg", "png", "gif");
    var ext = $("#student_entry_upload").val();
    filepath = ext;

    var ext1 = ext.substring(ext.length - 4, ext.length);
    ext1 = ext1.toLowerCase();

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

    if (ext != "" && !in_array(ext, valid_file_extentions)) {
      console.log(ext1);
      if (ext1 != "" && !in_array(ext1, valid_file_extentions)) {
        alert("Please Select the Valid Photo!");
        return false;
      }
    }

    App.blockUI({ boxed: true, message: "Please wait, We are saving Data" });
    list_data += "&filepath=" + filepath;

    document
      .getElementById("form_module_details_upload")
      .setAttribute("action", list_data);
    return AIM.submit(
      document.getElementById("form_module_details_upload"),
      "same_tab",
      { onComplete: CMS.SaveCertificateDetailsResponse }
    );
  },
  SaveCertificateDetailsResponse: function (responce) {
    try {
      $.fancybox.close();
      App.unblockUI();
      responce = eval("(" + trim(responce) + ")");
      if (responce.error_code == 0) {
        CMS.GetpaymentLinkForAppNo(responce.data["app_no"]);
      } else {
        alert(responce.data);
        return false;
      }
    } catch (err) {
      txt = err.message;
      bootbox.alert(txt + "<br>" + responce);
    }
  },
  SaveCertificateDetailsNehu: function () {
    var freccer;
    var list_data = $host_url + "SaveCertificateDetailsNehu";
    var reg_no = encodeURIComponent($("#T1").val());
    list_data += "&reg_no=" + reg_no;
    var course = $("#T4").val();
    list_data += "&course=" + course;
    var college = $("#T3").val();
    list_data += "&college=" + college;
    var candidate_name = encodeURIComponent($("#T2").val());
    list_data += "&candidate_name=" + candidate_name;

    var univ = encodeURIComponent($("#univ").val());
    list_data += "&univ=" + univ;

    var catcode = encodeURIComponent($("#T16").val());
    list_data += "&catcode=" + catcode;

    var paddr1 = encodeURIComponent($("#T8").val());
    list_data += "&paddr1=" + paddr1;

    var paddr2 = encodeURIComponent($("#T9").val());
    list_data += "&paddr2=" + paddr2;

    var city = encodeURIComponent($("#T31").val());
    list_data += "&city=" + city;

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

    var pincode = encodeURIComponent($("#T33").val());
    list_data += "&pincode=" + pincode;

    var mobile_no = encodeURIComponent($("#T5").val());
    list_data += "&mobile_no=" + mobile_no;
    var email_id = encodeURIComponent($("#T7").val());
    list_data += "&email_id=" + email_id;
    var amount = encodeURIComponent($("#T12").val());
    list_data += "&amount=" + amount;

    var nationality = encodeURIComponent($("#nationality").val());
    list_data += "&nationality=" + nationality;

    var rctype = encodeURIComponent($("#rctype").val());
    list_data += "&rctype=" + rctype;

    var aadhar = encodeURIComponent($("#aadhar").val());
    list_data += "&aadhar=" + aadhar;

    var paytype = encodeURIComponent($("#T13").val());
    list_data += "&paytype=" + paytype;

    var kanname = encodeURIComponent($("#T99").val());
    list_data += "&kanname=" + kanname;

    list_data += "&deg_cert=" + $("#h_deg_cert").val();
    list_data += "&sem_mks=" + $("#h_sem_mks").val();

    var feearry = [];
    $("#feetable tbody>tr").each(function () {
      var headcode = ["slno", "headcode", "fee"];
      var x = 0;
      var item = {};
      $("td", this).each(function () {
        item[headcode[x]] = $(this).text();
        feearry.push(item);
        x++;
      });
    });

    list_data += "&fee_arr=" + JSON.stringify(feearry);

    //var paytype =  encodeURIComponent($("#T30").val());list_data+="&paytype="+paytype;

    var dob = date_format($("#T14").val());
    list_data += "&dob=" + dob;

    var valid_file_extentions = new Array("jpeg", "jpg", "png", "gif");
    var ext = $("#student_entry_upload").val();
    filepath = ext;

    var ext1 = ext.substring(ext.length - 4, ext.length);
    ext1 = ext1.toLowerCase();

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

    if (ext != "" && !in_array(ext, valid_file_extentions)) {
      console.log(ext1);
      if (ext1 != "" && !in_array(ext1, valid_file_extentions)) {
        alert("Please Select the Valid Photo!");
        return false;
      }
    }

    App.blockUI({ boxed: true, message: "Please wait, We are saving Data" });
    list_data += "&filepath=" + filepath;

    document
      .getElementById("form_module_details_upload")
      .setAttribute("action", list_data);
    return AIM.submit(
      document.getElementById("form_module_details_upload"),
      "same_tab",
      { onComplete: CMS.SaveCertificateDetailsNehuResponse }
    );
  },
  SaveCertificateDetailsNehuResponse: function (responce) {
    try {
      $.fancybox.close();
      App.unblockUI();
      responce = eval("(" + trim(responce) + ")");
      if (responce.error_code == 0) {
        CMS.GetpaymentLinkForAppNo(responce.data["app_no"]);
      } else {
        alert(responce.data);
        return false;
      }
    } catch (err) {
      txt = err.message;
      bootbox.alert(txt + "<br>" + responce);
    }
  },
  GetpaymentLinkForAppNo: function (app_no) {
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "GetpaymentLinkForAppNo",
      error: AjaxErrorMessage,
      data: "&app_no=" + app_no,
      success: function GetpaymentLinkForAppNoResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          $("#tasks_inbox").html(responce.data);
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  ValidatePaymentApplicationData: function () {
    var p_appno = $("#p_appno").val();
    var p_dob = date_format($("#p_dob").val());
    var p_reg_no = $("#p_regno").val();
    if (empty(p_appno)) {
      bootbox.alert("Please Enter Application no.");
      return false;
    } else if (empty(p_reg_no)) {
      bootbox.alert("Please Enter Reg No");
      return false;
    } else if (p_dob == "0000-00-00") {
      bootbox.alert("Please Enter Date of Birth");
      return false;
    }
    App.blockUI({
      boxed: true,
      message: "Please wait,validating input details...",
    });
    $.ajax({
      type: "POST",
      url: $host_url + "ValidatePaymentApplicationData",
      error: AjaxErrorMessage,
      data: "&p_appno=" + p_appno + "&p_dob=" + p_dob + "&p_reg_no=" + p_reg_no,
      success: function GetpaymentLinkForAppNoResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          $.unblockUI();
          if (responce.error_code == -1) {
            bootbox.alert(responce.data);
          } else {
            CMS.MakeOnlinePayment(
              responce.data["app_no"],
              responce.data["UNIVCODE"]
            );
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  ValidatePrintCertificateApplicationData: function () {
    var appno = $("#rp_app_no").val();
    var regno = date_format($("#rp_reg_no").val());
    if (db != "sikkim" && db != "nehu") {
      var dob = date_format($("#rp_dob").val());
      if (dob == "0000-00-00") {
        bootbox.alert("Enter Date of Birth");
        return false;
      }
    }
    if (empty(appno)) {
      bootbox.alert("Enter Application no.");
      return false;
    } else if (empty(regno)) {
      bootbox.alert("Enter Reg No");
      return false;
    }
    App.blockUI({ boxed: true, message: "Please wait,generating report..." });
    $.ajax({
      type: "POST",
      url: $host_url + "ValidatePrintCertificateApplicationData",
      error: AjaxErrorMessage,
      data: "&appno=" + appno + "&dob=" + dob + "&regno=" + regno,
      success: function ValidatePrintCertificateApplicationDataResponce(
        responce
      ) {
        try {
          responce = eval("(" + responce + ")");
          $.unblockUI();
          if (responce.error_code == -1) {
            bootbox.alert(responce.data);
          } else {
            if (responce.data["paytype"] == "POSTOFFICE") {
              CMS.PrintPOSTCertifcate(responce.data["app_no"]);
            }
            if (
              (responce.data["paytype"] == "Other Banks" ||
                responce.data["paytype"] == "Paytm") &&
              responce.data["paystatus"] == "success"
            ) {
              CMS.PrintNETBANKCertifcate(responce.data["app_no"]);
            }
            if (
              (responce.data["paytype"] == "Other Banks" ||
                responce.data["paytype"] == "Paytm") &&
              responce.data["paystatus"] != "success"
            ) {
              txt = "Online Payment Pending";
              bootbox.alert(txt);

              if (db == "sikkim") {
                window.location.href =
                  "http://universitysolutions.in/sikkim/adm/hdfc/ccavRequestHandler.php?productinfo=" +
                  responce.data["app_no"] +
                  "&type=convo";
              } else if (db == "nehu") {
                window.location.href =
                  "http://universitysolutions.in/nehu/hdfc/ccavRequestHandler.php?productinfo=" +
                  responce.data["app_no"] +
                  "&type=convo";
              }
            }
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },

  viewGoldMedal: function () {
    var regno = $("#regno").val();

    if (regno == "") {
      alert("Enter Roll No.");
      $("#regno").focus();
      return;
    }

    App.blockUI({ boxed: true, message: "Please wait" });
    $.ajax({
      type: "POST",
      url: $host_url + "viewGoldMedal",
      error: AjaxErrorMessage,
      data: "&regno=" + regno,
      success: function viewGoldMedalResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          $.unblockUI();
          if (responce.error_code == -1) {
            bootbox.alert(responce.data);
            $("#medaldiv").hide();
          } else {
            $("#medaldiv").show();
            document.getElementById("regno").disabled = true;
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  saveGoldMedal: function () {
    var regno = $("#regno").val();
    var vname1 = $("#vname1").val();
    var vname2 = $("#vname2").val();

    var vrelation1 = $("#vrelation1").val();
    var vrelation2 = $("#vrelation2").val();

    var vemail1 = $("#vemail1").val();
    var vemail2 = $("#vemail2").val();

    var vmob1 = $("#vmob1").val();
    var vmob2 = $("#vmob2").val();

    if (regno == "") {
      alert("Enter Roll No.");
      $("#regno").focus();
      return;
    }

    if (vname1 == "") {
      alert("Enter Visitor 1 Name");
      $("#vname1").focus();
      return;
    }

    if (vrelation1 == "") {
      alert("Enter Relation with Candidate");
      $("#vrelation1").focus();
      return;
    }

    if (vemail1 == "") {
      alert("Enter Email id");
      $("#vemail1").focus();
      return;
    }

    if (vmob1 == "") {
      alert("Enter Phone number");
      $("#vmob1").focus();
      return;
    }

    App.blockUI({ boxed: true, message: "Please wait" });
    $.ajax({
      type: "POST",
      url: $host_url + "saveGoldMedal",
      error: AjaxErrorMessage,
      data:
        "&regno=" +
        regno +
        "&vname1=" +
        vname1 +
        "&vname2=" +
        vname2 +
        "&vrelation1=" +
        vrelation1 +
        "&vrelation2=" +
        vrelation2 +
        "&vemail1=" +
        vemail1 +
        "&vemail2=" +
        vemail2 +
        "&vmob1=" +
        vmob1 +
        "&vmob2" +
        vmob2,
      success: function saveGoldMedalResponce(responce) {
        try {
          responce = eval("(" + responce + ")");
          $.unblockUI();
          if (responce.error_code == -1) {
            bootbox.alert(responce.data);
            //$('#medaldiv').hide();
          } else {
            bootbox.alert(responce.data.msg);
            $("#medaldiv").hide();
            $("#regno").val("");
            document.getElementById("regno").disabled = false;

            window.location.href =
              $host_url +
              "PrintNetbankCertificate&db=sikkim&app_no=" +
              responce.data.appno;
            //https://universitysolutions.in/convocation/app.php?db=sikkim&a=PrintNetbankCertificate&app_no=31810000218
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  MakeOnlinePayment: function (app_no, univcode) {
    //window.location.href="payment_gateway.php?productinfo="+app_no;

    if (db == "sikkim") {
      window.location.href =
        "http://universitysolutions.in/sikkim/adm/hdfc/ccavRequestHandler.php?productinfo=" +
        app_no +
        "&type=convo";
    }
    if (db == "nehu") {
      window.location.href =
        "http://universitysolutions.in/nehu/hdfc/ccavRequestHandler.php?productinfo=" +
        app_no +
        "&type=convo";
    } else {
      $host_url = "https://universitysolutions.in/convocation/";

      window.location.href =
        $host_url +
        "Paytm/pgRedirect.php?productinfo=" +
        app_no +
        "&funivcode=" +
        univcode;
    }
  },
  PrintNETBANKCertifcate: function (app_no) {
    window.location.href =
      $host_url + "PrintNetbankCertificate&app_no=" + app_no;
  },
  PrintNETBANKCertifcatepaytm: function (app_no) {
    $host_url = "https://universitysolutions.in/cnv/rcub/app.php?&a=";
    window.location.href =
      $host_url + "PrintNetbankCertificate&app_no=" + app_no;
  },
  PrintPOSTCertifcate: function (app_no) {
    window.location.href = $host_url + "PrintPostCertificate&app_no=" + app_no;
  },
  ValidateOTPasssword: function () {
    $("#otp_error").hide();
    if (
      $("#otp_password_input").val() == document.getElementById("TH1").value
    ) {
      if (db == "sikkim") {
        CMS.SaveCertificateDetails();
      } else {
        CMS.SaveCertificateDetailsNehu();
      }
    } else {
      $("#otp_error").show();
    }
  },
  SendMailOtPToUser: function () {
    console.log("shivu");

    if (CMS.ValidateCertificateDetails()) {
      $("#otp_password_input").val("");
      $("#otp_error").hide();
      App.blockUI({
        boxed: true,
        message: "Please wait,System Sending OTP Password",
      });
      $.ajax({
        type: "POST",
        url: $host_url + "SendMailOtPToUser",
        error: AjaxErrorMessage,
        data: "s_mobile_no=" + $("#T5").val() + "&s_email_id=" + $("#T7").val(),
        success: function GetPendingCertificatesDataResponce(responce) {
          try {
            $.unblockUI();
            responce = eval("(" + responce + ")");

            if (responce.error_code == -1) {
              bootbox.alert(responce.data);
            } else {
              console.log(responce.data);
              document.getElementById("TH1").value = responce.data;
              $(".fancybox").trigger("click");
              // console.log(responce.error_code);
            }
          } catch (err) {
            txt = err.message;
            $.unblockUI();
            bootbox.alert(txt);
          }
        },
      });
    }
  },

  ShowCertficateToggle: function (id) {
    $("#cert_tr_" + id).toggle();
  },
  //  : function() {
  //   $.ajax({
  //     type: "POST",
  //     //async:false,
  //     url: $host_url + "GetCollwiseCandidateList",
  //     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);
  //       }
  //     }
  //   });
  // },
  GetCollwiseCandidateList: function () {
    var fromdate = date_format($("#date_from").val());
    var todate = date_format($("#date_to").val());
    var fromdeg = $("#deg_from").val();
    var todeg = $("#deg_to").val();
    var paystatus = $("#paystatus").val();
    var certificatetype = $("#certificatetype").val();
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "GetCollwiseCandidateList",
      error: AjaxErrorMessage,
      data:
        "from_app=" +
        $("#app_from_app").val() +
        "&to_app=" +
        $("#app_to_app").val() +
        "&fromdeg=" +
        fromdeg +
        "&todeg=" +
        todeg +
        "&fromdate=" +
        fromdate +
        "&todate=" +
        todate +
        "&paystatus=" +
        paystatus +
        "&certificatetype=" +
        certificatetype,

      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);
        }
      },
    });
  },

  viewCandidateDetails: function (appno, collcode) {
    $.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 {
            document.getElementById("cand_list").className = " ";
            document.getElementById("cand_details").className = "active";
            document.getElementById("tasks_inbox").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);
        }
      },
    });
  },
  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("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"]);
            }
          }
        } catch (err) {
          txt = err.message;
          $.unblockUI();
          bootbox.alert(txt);
        }
      },
    });
  },
  Getstudentdetails: function (event, dob) {
    var regno = document.getElementById("T1").value;
    if (regno.length > 0) {
      var univ = $("#univ").val();
      App.blockUI({ boxed: true, message: "Please wait,loading data.." });

      $.ajax({
        type: "POST",
        url: $host_url + "Getstudentdetails",
        error: AjaxErrorMessage,
        data: "regno=" + regno + "&univ=" + univ + "&birthData=" + dob,
        success: function (responce) {
          // let responce = JSON.parse(res);

          try {
            responce = eval("(" + responce + ")");

            $.unblockUI();
            var db = responce.data.db;
            if (db == "vskub") {
              $("#disp_uploads").show();
            }

            if (responce.error_code == 0) {
              if (responce.data.tdata.FRCTYPE == "by Post") {
                $("#bypostway").show();
                $("#authorizedperson").hide();
                $("#hideforPost").hide();
                document.getElementById("byposthouseno").value =
                  responce.data.tdata.FPHOUSE;
                document.getElementById("bypoststreetname").value =
                  responce.data.tdata.FPSTREET;
                document.getElementById("bypostarea").value =
                  responce.data.tdata.FPAREA;
                document.getElementById("bypostlandmark").value =
                  responce.data.tdata.FPLANDMARKS;
                document.getElementById("counties").value =
                  responce.data.tdata.FPCOUNTRY;
                if (responce.data.tdata.FPCOUNTRY == "india") {
                  document.getElementById("states").style.display = "block";
                  $("#otherCountry").hide();
                  $("#Othercountryother").hide();
                  document.getElementById("indiasState").value =
                    responce.data.tdata.FPSTATE;
                } else if (responce.data.tdata.FPCOUNTRY == "other") {
                  document.getElementById("otherCountry").style.display =
                    "block";
                  document.getElementById("Othercountryother").style.display =
                    "block";
                  $("#states").hide();
                  document.getElementById("otherthanall").value =
                    responce.data.tdata.FPOTHERCOUNTRY;
                  document.getElementById("otherthanstate").value =
                    responce.data.tdata.FPSTATE;
                } else {
                  document.getElementById("otherCountry").style.display =
                    "block";
                  $("#states").hide();
                  $("#Othercountryother").hide();
                  document.getElementById("otherthanstate").value =
                    responce.data.tdata.FPSTATE;
                }
                document.getElementById("postdist").value =
                  responce.data.tdata.FPDIST;
                document.getElementById("bypostpincode").value =
                  responce.data.tdata.FPPINCODE;
              } else if (responce.data.tdata.FRCTYPE == "IN ABSENTIA") {
                $("#authorizedperson").show();
                $("#hideforPost").show();
                $("#bypostway").hide();

                // Display the photo in the img element

                // document.getElementById("letter_upload").value =
                //   responce.data.tdata.FTUPLOADLETTER;
                // console.log(
                //   document.getElementById("letter_upload").value,
                //   "hi"
                // );
                document.getElementById("thirdName").value =
                  responce.data.tdata.FTNAME;
                if (responce.data.tdata.FTRELATION == "Father") {
                  cnd = "father";
                } else if (responce.data.tdata.FTRELATION == "Mother") {
                  cnd = "mother";
                } else if (responce.data.tdata.FTRELATION == "Spouse") {
                  cnd = "spouse";
                } else if (responce.data.tdata.FTRELATION == "Other") {
                  cnd = "other";
                }
                document.getElementById("relative").value = cnd;

                if (cnd == "other") {
                  document.getElementById("otherralation").value =
                    responce.data.tdata.FTOTHERRELATION;
                }
                document.getElementById("thirdPersonEmail").value =
                  responce.data.tdata.FTEMAIL;
                document.getElementById("thirdPersonMobile").value =
                  responce.data.tdata.FTMOBILE;
                document.getElementById("thirdPersonAddress").value =
                  responce.data.tdata.FTADDRESS;

                if (responce.data.tdata.FTIDPROOF == "Aadhar") {
                  idcnd = "aadhar";
                  document.getElementById("idproof").value = idcnd;
                  // document.getElementById("createIdrow").style.display =
                  //   "block";
                  // document.getElementById("aadharno").style.display = "block";
                  row = `<tr><td></td>
                  <td><input  type="text" class="form-control" style='min-width:150px;' value='${responce.data.tdata.FTIDNUMBER}' placeholder="Enter Aadhar No." id="aadharno"/></td>
                  </tr>`;
                  // $("#drivingliecence").hide();
                  // $("#voterproof").hide();
                  // $("#otherproof").hide();
                  // $("#otherproofnumber").hide();
                } else if (responce.data.tdata.FTIDPROOF == "Driving") {
                  idcnd = "driving";
                  document.getElementById("idproof").value = idcnd;
                  row = `<tr><td></td>
                  <td><input type="text" class="form-control" style='min-width:150px;' value='${responce.data.tdata.FTIDNUMBER}' placeholder="Enter Licence No." id="drivingliecence"/></td> 
                  </tr>`;
                } else if (responce.data.tdata.FTIDPROOF == "Voter") {
                  idcnd = "voter";
                  document.getElementById("idproof").value = idcnd;
                  row = `<tr><td></td>
                  <td><input type="text" class="form-control" style='min-width:150px;' value='${responce.data.tdata.FTIDNUMBER}' placeholder="Enter Licence No." id="voterproof"/></td> 
                  </tr>`;
                } else if (responce.data.tdata.FTIDPROOF == "Other") {
                  idcnd = "other";
                  document.getElementById("idproof").value = idcnd;
                  row = `<tr>
                  <td></td>
                  <td><input type="text" class="form-control" style='min-width:150px;' value=${responce.data.tdata.FTOTHERIDPROOF} placeholder="Enter Id Name"/ id="otherproof"></td>
                  </tr>
                  <br/>
                  <tr>
                 <td></td>
                  <td><input type="text" class="form-control" style='min-width:150px;' value='${responce.data.tdata.FTIDNUMBER}' placeholder="Enter Id no."/ id="otherproofnumber"></td>
                  </tr>`;
                }
                // if (idcnd == "aadhar") {
                //   // $("#createIdrow").show();
                //   // document.getElementById("createIdrow").style.display ="block";
                //   // $("#aadharno").hide();
                //   // document.getElementById("aadharno").style.display = "block";
                //   // if (responce.data.tdata.FTIDNUMBER != 0) {
                //   //   $("#createIdrow").show();
                //   //   document.getElementById("aadharno").style.display = "block";
                //   // }
                //   // $("#createIdrow").show();
                //   // $("#aadharno").show();
                //   // document.getElementById("aadharno").style.display = "block";
                //   // document.getElementById("aadharno").value =
                //   //   responce.data.tdata.FTIDNUMBER;
                //   // console.log(responce.data.tdata.FTIDNUMBER);
                // }
                $("#createIdrow").html(row);
                //else if (responce.data.tdata.FTIDPROOF == "Driving") {
                //   document.getElementById("drivingliecence").value =
                //     responce.data.tdata.FTIDNUMBER;
                // } else if (responce.data.tdata.FTIDPROOF == "Voter") {
                //   document.getElementById("voterproof").value =
                //     responce.data.tdata.FTIDNUMBER;
                // } else if (responce.data.tdata.FTIDPROOF == "Other") {
                //   document.getElementById("otherproof").value =
                //     responce.data.tdata.FTOTHERIDPROOF;
                //   document.getElementById("otherproofnumber").value =
                //     responce.data.tdata.FTRANID;
                // }
              } else if (responce.data.tdata.FRCTYPE == "IN PERSON") {
                $("#authorizedperson").hide();
                $("#bypostway").hide();
                $("#hideforPost").show();
              }
              $("#T5").prop("disabled", false);
              $("#T6").prop("disabled", false);
              $("#T7").prop("disabled", false);
              $("#T13").prop("disabled", false);
              $("#T8").prop("disabled", false);
              $("#T9").prop("disabled", false);
              $("#T31").prop("disabled", false);
              $("#T32").prop("disabled", false);
              $("#T33").prop("disabled", false);

              document.getElementById("hidden1").style.display = "block";
              document.getElementById("hidden2").style.display = "block";
              document.getElementById("hidden3").style.display = "block";
              document.getElementById("hidden4").style.display = "block";
              document.getElementById("hidden5").style.display = "block";
              document.getElementById("hidden6").style.display = "block";
              document.getElementById("hidden7").style.display = "block";
              document.getElementById("hidden8").style.display = "block";
              document.getElementById("dcmsg").style.display = "block";

              // var div = document.getElementById("hidden4");
              // div.style.display = "block";
              // $("#disp_scstatt_not_working").show();

              document.getElementById("T2").value =
                responce.data.mdata["FNAME"];
              document.getElementById("T3").value =
                responce.data.mdata["FCOLLNAME"];
              document.getElementById("T4").value =
                responce.data.mdata["FDESCPN"];
              document.getElementById("T15").value =
                responce.data.mdata["FCNVNAME"];
              if (univ != "018") {
                document.getElementById("T16").value =
                  responce.data.mdata["FCASTE"];
                lat = document.getElementById("T16").value =
                  responce.data.mdata["lat"];
              }
              // document.getElementById("T16").value =
              //   responce.data.mdata["FCASTE"];
              // lat = document.getElementById("T16").value =
              //   responce.data.mdata["lat"];
              lat = responce.data.mdata["lat"];
              if (responce.data.mdata["fdcmsg"] == "T") {
                $("#dcmsg").show();
              }

              let str = `<br>ಸೆಮಿಸ್ಟರ್‌ನ ಗರಿಷ್ಠ / ಪಡೆದ ಅಂಕಗಳ ವಿವರಗಳು (ಪ್ರತಿ ಸೆಮಿಸ್ಟರ್‌ನ ಅಂಕಗಳನ್ನು ದೃಢೀಕರಿಸಿ)`;
              let str1 = `<br>ಮೇಲೆ ತೋರಿಸಿರುವ ಅಂಕಗಳ ವಿವರಗಳಲ್ಲಿನ ಯಾವುದೇ ವ್ಯತ್ಯಾಸಗಳಿಗಾಗಿ, ಸಹಾಯ ಕೇಂದ್ರವನ್ನು ಸಂಪರ್ಕಿಸಿ ಮತ್ತು ಸರಿಯಾದ ದಾಖಲೆಗಳನ್ನು ರಿಜಿಸ್ಟ್ರಾರ್ (ಮೌಲ್ಯಮಾಪನ), ವಿಶ್ವವಿದ್ಯಾಲಯಕ್ಕೆ ಸಲ್ಲಿಸಿ`;
              if (db == "sikkim" || db == "nehu") {
                str = "";
                str1 = "";
              }
              let table = "";
              if (responce.data.mdata["fthesis"] != "-") {
                table += `
                  <span style = 'color:black'>Thesis Name and Registration No. Details (Confirm the Thesis Name)<br></span>
                  <table id="upload_table" class="table table-bordered table-hover" cellpadding="0" cellspacing="0">
                  <thead>
                  <tr>
                  <th><i class="icon-briefcase"></i>&nbsp;Registration No.</th>
                  <th>Thesis Name</th>
                  <th>Confirm</th>
                  </tr>
                  </thead>
                  <tbody>`;
                if (responce.data.mdata["fthesis"] != "-") {
                  table += `<tr>
                          <td>${responce.data.mdata["frollno"]}</td>
                          <td>${responce.data.mdata["fthesis"]}</td>
                          <td><input type="checkbox" id="confirm1"  ></td>
                      </tr>`;
                  a++;
                }
              } else {
                table = `
                  <span style = 'color:black'>Semester wise Maximum / Secured Marks details (Confirm the marks against each semester) ${str}<br></span>
                  <table id="upload_table" class="table table-bordered table-hover" cellpadding="0" cellspacing="0">
                  <thead>
                  <tr>
                  <th><i class="icon-briefcase"></i>&nbsp;Semester</th>
                  <th>Max. Marks</th>
                  <th>Sec. Marks</th>
                  <th>Confirm</th>
                  </tr>
                  </thead>
                  <tbody>`;
                if (responce.data.mdata["FMAXMARKSA"] != "-") {
                  table += `<tr>
                          <td>1st Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSA"]}</td>
                          <td>${responce.data.mdata["FMARKSA"]}</td>
                          <td><input type="checkbox" id="confirm1"  ></td>
                      </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSB"] != "-") {
                  table += `<tr>
                          <td>2nd Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSB"]}</td>
                          <td>${responce.data.mdata["FMARKSB"]}</td>
                          <td><input type="checkbox" id="confirm2"  ></td>
                      </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSC"] != "-") {
                  table += `<tr>
                          <td>3rd Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSC"]}</td>
                          <td>${responce.data.mdata["FMARKSC"]}</td>
                          <td><input type="checkbox" id="confirm3"  ></td>
                      </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSD"] != "-") {
                  table += `<tr>
                          <td>4th Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSD"]}</td>
                          <td>${responce.data.mdata["FMARKSD"]}</td>
                          <td><input type="checkbox" id="confirm4"  ></td>
                          </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSE"] != "-") {
                  table += `<tr>
                          <td>5th Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSE"]}</td>
                          <td>${responce.data.mdata["FMARKSE"]}</td>
                          <td><input type="checkbox" id="confirm5"  ></td>
                      </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSF"] != "-") {
                  table += `<tr>
                          <td>6th Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSF"]}</td>
                          <td>${responce.data.mdata["FMARKSF"]}</td>
                          <td><input type="checkbox" id="confirm6"  ></td>
                      </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSG"] != "-") {
                  table += `<tr>
                          <td>7th Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSG"]}</td>
                          <td>${responce.data.mdata["FMARKSG"]}</td>
                          <td><input type="checkbox" id="confirm7"  ></td>
                      </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSH"] != "-") {
                  table += `<tr>
                          <td>8th Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSH"]}</td>
                          <td>${responce.data.mdata["FMARKSH"]}</td>
                          <td><input type="checkbox" id="confirm8"  ></td>
                      </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSI"] != "-") {
                  table += `<tr>
                          <td>9th Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSI"]}</td>
                          <td>${responce.data.mdata["FMARKSI"]}</td>
                          <td><input type="checkbox" id="confirm9"  ></td>
                      </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSJ"] != "-") {
                  table += `<tr>
                          <td>10th Semester</td>
                          <td>${responce.data.mdata["FMAXMARKSJ"]}</td>
                          <td>${responce.data.mdata["FMARKSJ"]}</td>
                          <td><input type="checkbox" id="confirm10"  ></td>
                      </tr>`;
                  a++;
                }
              }

              table += `</tbody>
              </table>
              <br>
              <div class="form-group">
              	<label class="col-md-3 control-label" style="text-align:left" >Passing Month</label>
              	<div class="col-md-3">
              		<input type="text" disabled  name="registerno" id="FCEXAM" class="form-control" style="text-transform: uppercase;min-width:150px;" title='University Register no.'  value = '${responce.data.mdata["FCEXAM"]}' >
              	</div>
              </div>
              <div class="form-group">
              	<label class="col-md-3 control-label" style="text-align:left" >Class </label>
              	<div class="col-md-3">
              		<input type="text" disabled  name="registerno" id="FCLASS" class="form-control" style="text-transform: uppercase;min-width:150px;" title='University Register no.'  value = '${responce.data.mdata["FCLASS"]}' >
              	</div>
              </div>
              <span style = 'color:black'>For any differences in marks details shown above, contact Help desk and submit the proper documents to Registrar (Evaluation) ${str1}<br></br></span>
              `;
              if (a > 0) $("#privmarks").html(table);

              // $("#disp_scstatt").hide();
              if (responce.data.tdata.length != 0) {
                document.getElementById("rctype").value =
                  responce.data.tdata["FRCTYPE"];
                if (univ != "018") {
                  document.getElementById("T14").value =
                    responce.data.tdata["dob"];
                  document.getElementById("T99").value =
                    responce.data.tdata["FKANNAME"];
                  document.getElementById("nationality").value =
                    responce.data.tdata["FNATIONAL"];
                  document.getElementById("aadhar").value =
                    responce.data.tdata["FAADHAR"];
                  document.getElementById("aadhar").value =
                    responce.data.tdata["FAADHAR"];
                  document.getElementById("T16").value =
                    responce.data.tdata["FCATCODE"];
                }
                document.getElementById("T5").value =
                  responce.data.tdata["FMOBILE"];
                // document.getElementById("T6").value =
                //   responce.data.tdata["FMOBILE"];
                document.getElementById("T7").value =
                  responce.data.tdata["FEMAIL"];
                document.getElementById("T8").value =
                  responce.data.tdata["FPOSTADDR1"];
                document.getElementById("T9").value =
                  responce.data.tdata["FPOSTADDR2"];
                document.getElementById("T31").value =
                  responce.data.tdata["FCITY"];
                document.getElementById("T32").value =
                  responce.data.tdata["FSTATE"];
                document.getElementById("T33").value =
                  responce.data.tdata["FPINCODE"];

                CMS.loadConvoFee();

                var photo =
                  "https://university-cnv-student-photos.s3.ap-south-1.amazonaws.com/" +
                  responce.data.tdata["fcunivcode"] +
                  "/" +
                  responce.data.tdata["FPHOTOPATH"];

                $("#student_entry_photo").attr("src", photo);
                var s3_url =
                  "https://university-cnv-student-photos.s3.ap-south-1.amazonaws.com/";

                if (responce.data.tdata["FALLSEMCERT"] != "") {
                  var path_all = s3_url + responce.data.tdata["FALLSEMCERT"];

                  var html =
                    '<a target="_blank" href="' +
                    path_all +
                    '" style="color:#AB45F9; padding-right:5px;">' +
                    "All Semester Marks cards" +
                    "</a>";
                  $("#attach_td_sem_mks").html(html);
                }

                if (responce.data.tdata["FDEGCERTPATH"] != "") {
                  var path_deg = s3_url + responce.data.tdata["FDEGCERTPATH"];
                  var html =
                    '<a target="_blank" href="' +
                    path_deg +
                    '" style="color:#AB45F9; padding-right:5px;">' +
                    "Degree Certificate" +
                    "</a>";
                  $("#attach_td_deg_cert").html(html);
                }
              }
            } else {
              document.getElementById("T2").value = "";
              document.getElementById("T3").value = "";
              document.getElementById("T4").value = "";
              document.getElementById("T15").value = "";
              //document.getElementById("T16").value = "00";
              document.getElementById("T12").value = "0";
              bootbox.alert(responce.data);
            }
          } catch (err) {
            txt = err.message;
            $.unblockUI();
            bootbox.alert(txt);
          }
        },
      });
    }
  },
  GetstudentdetailsNehu: function (event, regno) {
    if (regno.length > 0) {
      var univ = $("#univ").val();
      App.blockUI({ boxed: true, message: "Please wait,loading data.." });
      $.ajax({
        type: "POST",
        url: $host_url + "GetstudentdetailsNehu",
        error: AjaxErrorMessage,
        data: "regno=" + regno + "&univ=" + univ,
        success: function (responce) {
          try {
            responce = eval("(" + responce + ")");
            $.unblockUI();
            var db = responce.data.db;
            if (db == "vskub") {
              // console.log("hii");
              $("#disp_uploads").show();
            }

            if (responce.error_code == 0) {
              document.getElementById("T2").value =
                responce.data.mdata["FNAME"];
              document.getElementById("T3").value =
                responce.data.mdata["FCOLLNAME"];
              document.getElementById("T4").value =
                responce.data.mdata["FDESCPN"];
              document.getElementById("T15").value =
                responce.data.mdata["FCNVNAME"];
              document.getElementById("certificateno").value =
                responce.data.mdata["fcertificateno"];
              if (univ != "018") {
                document.getElementById("T16").value =
                  responce.data.mdata["FCASTE"];
                lat = document.getElementById("T16").value =
                  responce.data.mdata["lat"];
              }
              // document.getElementById("T16").value =
              //   responce.data.mdata["FCASTE"];
              // lat = document.getElementById("T16").value =
              //   responce.data.mdata["lat"];
              lat = responce.data.mdata["lat"];
              if (responce.data.mdata["fdcmsg"] == "T") {
                $("#dcmsg").show();
              }

              let str = `<br>ಸೆಮಿಸ್ಟರ್‌ನ ಗರಿಷ್ಠ / ಪಡೆದ ಅಂಕಗಳ ವಿವರಗಳು (ಪ್ರತಿ ಸೆಮಿಸ್ಟರ್‌ನ ಅಂಕಗಳನ್ನು ದೃಢೀಕರಿಸಿ)`;
              let str1 = `<br>ಮೇಲೆ ತೋರಿಸಿರುವ ಅಂಕಗಳ ವಿವರಗಳಲ್ಲಿನ ಯಾವುದೇ ವ್ಯತ್ಯಾಸಗಳಿಗಾಗಿ, ಸಹಾಯ ಕೇಂದ್ರವನ್ನು ಸಂಪರ್ಕಿಸಿ ಮತ್ತು ಸರಿಯಾದ ದಾಖಲೆಗಳನ್ನು ರಿಜಿಸ್ಟ್ರಾರ್ (ಮೌಲ್ಯಮಾಪನ), ವಿಶ್ವವಿದ್ಯಾಲಯಕ್ಕೆ ಸಲ್ಲಿಸಿ`;
              if (db == "sikkim") {
                str = "";
                str1 = "";
              }
              let table = "";
              if (responce.data.mdata["fthesis"] != "-") {
                table += `
                <span style = 'color:black'>Thesis Name and Registration No. Details (Confirm the Thesis Name)<br></span>
                <table id="upload_table" class="table table-bordered table-hover" cellpadding="0" cellspacing="0">
                <thead>
                <tr>																												
                <th><i class="icon-briefcase"></i>&nbsp;Registration No.</th>	
                <th>Thesis Name</th>	
                <th>Confirm</th>	
                </tr>
                </thead>
                <tbody>`;
                if (responce.data.mdata["fthesis"] != "-") {
                  table += `<tr>						
                        <td>${responce.data.mdata["frollno"]}</td>
                        <td>${responce.data.mdata["fthesis"]}</td>
                        <td><input type="checkbox" id="confirm1"  ></td>
                    </tr>`;
                  a++;
                }
              } else {
                table = `
                <span style = 'color:black'>Semester wise Maximum / Secured Marks details (Confirm the marks against each semester) ${str}<br></span>
                <table id="upload_table" class="table table-bordered table-hover" cellpadding="0" cellspacing="0">
                <thead>
                <tr>																												
                <th><i class="icon-briefcase"></i>&nbsp;Semester</th>	
                <th>Max. Marks</th>	
                <th>Sec. Marks</th>
                <th>Confirm</th>	
                </tr>
                </thead>
                <tbody>`;
                if (responce.data.mdata["FMAXMARKSA"] != "-") {
                  table += `<tr>						
                        <td>1st Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSA"]}</td>
                        <td>${responce.data.mdata["FMARKSA"]}</td>
                        <td><input type="checkbox" id="confirm1"  ></td>
                    </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSB"] != "-") {
                  table += `<tr>						
                        <td>2nd Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSB"]}</td>
                        <td>${responce.data.mdata["FMARKSB"]}</td>
                        <td><input type="checkbox" id="confirm2"  ></td>
                    </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSC"] != "-") {
                  table += `<tr>						
                        <td>3rd Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSC"]}</td>
                        <td>${responce.data.mdata["FMARKSC"]}</td>
                        <td><input type="checkbox" id="confirm3"  ></td>
                    </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSD"] != "-") {
                  table += `<tr>						
                        <td>4th Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSD"]}</td>
                        <td>${responce.data.mdata["FMARKSD"]}</td>
                        <td><input type="checkbox" id="confirm4"  ></td>                     
                        </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSE"] != "-") {
                  table += `<tr>						
                        <td>5th Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSE"]}</td>
                        <td>${responce.data.mdata["FMARKSE"]}</td>
                        <td><input type="checkbox" id="confirm5"  ></td>
                    </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSF"] != "-") {
                  table += `<tr>						
                        <td>6th Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSF"]}</td>
                        <td>${responce.data.mdata["FMARKSF"]}</td>
                        <td><input type="checkbox" id="confirm6"  ></td>
                    </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSG"] != "-") {
                  table += `<tr>						
                        <td>7th Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSG"]}</td>
                        <td>${responce.data.mdata["FMARKSG"]}</td>
                        <td><input type="checkbox" id="confirm7"  ></td>
                    </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSH"] != "-") {
                  table += `<tr>						
                        <td>8th Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSH"]}</td>
                        <td>${responce.data.mdata["FMARKSH"]}</td>
                        <td><input type="checkbox" id="confirm8"  ></td>
                    </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSI"] != "-") {
                  table += `<tr>						
                        <td>9th Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSI"]}</td>
                        <td>${responce.data.mdata["FMARKSI"]}</td>
                        <td><input type="checkbox" id="confirm9"  ></td>
                    </tr>`;
                  a++;
                }
                if (responce.data.mdata["FMAXMARKSJ"] != "-") {
                  table += `<tr>						
                        <td>10th Semester</td>
                        <td>${responce.data.mdata["FMAXMARKSJ"]}</td>
                        <td>${responce.data.mdata["FMARKSJ"]}</td>
                        <td><input type="checkbox" id="confirm10"  ></td>
                    </tr>`;
                  a++;
                }
              }

              table += `</tbody>
            </table> 
            <br>
            <div class="form-group">
              <label class="col-md-3 control-label" style="text-align:left" >Passing Month</label>
              <div class="col-md-3">
                <input type="text" disabled  name="registerno" id="FCEXAM" class="form-control" style="text-transform: uppercase;min-width:150px;" title='University Register no.'  value = '${responce.data.mdata["FCEXAM"]}' >											
              </div>
            </div>	
            <div class="form-group">
              <label class="col-md-3 control-label" style="text-align:left" >Class </label>
              <div class="col-md-3">
                <input type="text" disabled  name="registerno" id="FCLASS" class="form-control" style="text-transform: uppercase;min-width:150px;" title='University Register no.'  value = '${responce.data.mdata["FCLASS"]}' >											
              </div>
            </div>	
            <span style = 'color:black'>For any differences in marks details shown above, contact Help desk and submit the proper documents to Registrar (Evaluation) ${str1}<br></br></span>
            `;
              if (a > 0) $("#privmarks").html(table);

              // $("#disp_scstatt").hide();
              if (responce.data.tdata.length != 0) {
                document.getElementById("rctype").value =
                  responce.data.tdata["FRCTYPE"];
                if (univ != "018") {
                  document.getElementById("T14").value =
                    responce.data.tdata["dob"];
                  document.getElementById("T99").value =
                    responce.data.tdata["FKANNAME"];
                  document.getElementById("nationality").value =
                    responce.data.tdata["FNATIONAL"];
                  document.getElementById("aadhar").value =
                    responce.data.tdata["FAADHAR"];
                  document.getElementById("aadhar").value =
                    responce.data.tdata["FAADHAR"];
                  document.getElementById("T16").value =
                    responce.data.tdata["FCATCODE"];
                }
                document.getElementById("T5").value =
                  responce.data.tdata["FMOBILE"];
                document.getElementById("T6").value =
                  responce.data.tdata["FMOBILE"];
                document.getElementById("T7").value =
                  responce.data.tdata["FEMAIL"];
                document.getElementById("T8").value =
                  responce.data.tdata["FPOSTADDR1"];
                document.getElementById("T9").value =
                  responce.data.tdata["FPOSTADDR2"];
                document.getElementById("T31").value =
                  responce.data.tdata["FCITY"];
                document.getElementById("T32").value =
                  responce.data.tdata["FSTATE"];
                document.getElementById("T33").value =
                  responce.data.tdata["FPINCODE"];

                CMS.loadConvoFee();

                var photo =
                  "https://university-cnv-student-photos.s3.ap-south-1.amazonaws.com/" +
                  responce.data.tdata["fcunivcode"] +
                  "/" +
                  responce.data.tdata["FPHOTOPATH"];

                $("#student_entry_photo").attr("src", photo);
                var s3_url =
                  "https://university-cnv-student-photos.s3.ap-south-1.amazonaws.com/";

                if (responce.data.tdata["FALLSEMCERT"] != "") {
                  var path_all = s3_url + responce.data.tdata["FALLSEMCERT"];

                  var html =
                    '<a target="_blank" href="' +
                    path_all +
                    '" style="color:#AB45F9; padding-right:5px;">' +
                    "All Semester Marks cards" +
                    "</a>";
                  $("#attach_td_sem_mks").html(html);
                }

                if (responce.data.tdata["FDEGCERTPATH"] != "") {
                  var path_deg = s3_url + responce.data.tdata["FDEGCERTPATH"];
                  var html =
                    '<a target="_blank" href="' +
                    path_deg +
                    '" style="color:#AB45F9; padding-right:5px;">' +
                    "Degree Certificate" +
                    "</a>";
                  $("#attach_td_deg_cert").html(html);
                }
              }
            } else {
              document.getElementById("T2").value = "";
              document.getElementById("T3").value = "";
              document.getElementById("T4").value = "";
              document.getElementById("T15").value = "";
              //document.getElementById("T16").value = "00";
              document.getElementById("T12").value = "0";
              bootbox.alert(responce.data);
            }
          } catch (err) {
            txt = err.message;
            $.unblockUI();
            bootbox.alert(txt);
          }
        },
      });
    }
  },
  loadConvoFee: function (val) {
    var regno = $("#T1").val();
    var catcode = $("#T16").val();
    var rctype = $("#rctype").val();
    var nationality = $("#nationality").val();
    var univ = $("#univ").val();

    if (rctype == "") {
      $("#authorizedperson").hide();
      return;
    } else if (rctype == "IN PERSON") {
      $("#authorizedperson").hide();
      $("#bypostway").hide();
      $("#hideforPost").show();
      return;
    } else if (rctype == "IN ABSENTIA") {
      $("#authorizedperson").hide();
    }
    $.ajax({
      type: "post",
      url:
        $host_url +
        `loadConvoFee&regno=${regno}&catcode=${catcode}&rctype=${rctype}&nationality=${nationality}&univ=${univ}`,
      success: function (response) {
        var { error_code, data, status } = JSON.parse(response);

        if (error_code == 0) {
          var feedet = data.fee;
          var table = `<table class = "table" id = "feetable">
          <thead style = "height:40px;background-color: #184F76 !important;color: #fff;">
            <th>Sl. No.</th>
            <th>Fee Head</th>
            <th>Amount</th>
          </thead>
          <tbody>`;
          var totfee = 0;
          // console.log(feedet.length);
          var j = 1;
          for (var i = 0; i < feedet.length; i++) {
            // console.log(feedet[i].fheadcode);
            table += `<tr>
                  <td>${j}</td>
                  <td>${feedet[i].fheadcode}</td>
                  <td>${feedet[i].fee}</td>
                  </tr>`;
            totfee = parseInt(feedet[i].fee) + parseInt(totfee);
            j++;
          }

          table += `<tr>
                  <td></td>
                  <td>Total Amount</td>
                  <td>${totfee}</td>
                  </tr>`;

          $("#feediv").html(table);

          // $("#T12").val(totfee);
        } else {
          alert(data.msg);
          return;
        }
      },
    });
    if (rctype == "IN ABSENTIA") {
      $("#bypostway").hide();
      document.getElementById("authorizedperson").style.display = "block";
      document.getElementById("hideforPost").style.display = "block";
      return;
    } else if (rctype == "by Post") {
      $("#authorizedperson").hide();
      $("#hideforPost").hide();
      document.getElementById("bypostway").style.display = "block";
      return;
    } else if (rctype == "IN PERSON") {
      $("#bypostway").hide();
      $("#authorizedperson").hide();
      $("#hideforPost").show();
      document.getElementById("hideforPost").style.display = "block";
      return;
    }
  },

  loadrelation: function () {
    var relation = $("#relative").val();
    if (relation == "other") {
      row = `<tr><td></td>
               <td><input type="text" name="mobile no" id="otherralation" class="form-control" style='min-width:150px;' placeholder="Enter Relation"/></td>
               </tr>`;
      $("#createrow").html(row);
      document.getElementById("createrow").style.display = "block";
    } else {
      $("#createrow").hide();
    }

    console.log(relation, "hii");
  },

  loadidproof: function () {
    var idproof = $("#idproof").val();
    if (idproof == "aadhar") {
      row = `<tr><td></td>
      <td><input  type="text" class="form-control" style='min-width:150px;' placeholder="Enter Aadhar No." id="aadharno"/></td>
      </tr>`;
    } else if (idproof == "driving") {
      row = `<tr><td></td>
      <td><input type="text" class="form-control" style='min-width:150px;' placeholder="Enter Licence No." id="drivingliecence"/></td> 
      </tr>`;
    } else if (idproof == "voter") {
      row = `<tr><td></td>
      <td><input type="text" class="form-control" style='min-width:150px;' placeholder="Enter Voter id."/ id="voterproof"></td>
      </tr>`;
    } else if (idproof == "other") {
      row = `<tr>
      <td></td>
      <td><input type="text" class="form-control" style='min-width:150px;' placeholder="Enter Id Name"/ id="otherproof"></td>
      </tr>
      <br/>
      <tr>
     <td></td>
      <td><input type="text" class="form-control" style='min-width:150px;' placeholder="Enter Id no."/ id="otherproofnumber"></td>
      </tr>`;
    }

    $("#createIdrow").html(row);
  },

  loadcountry: function () {
    var country = document.getElementById("counties").value;
    if (country == "india") {
      document.getElementById("states").style.display = "block";
      $("#otherCountry").hide();
      $("#Othercountryother").hide();
    } else if (country == "") {
      document.getElementById("otherCountry").style.display = "block";
      $("#states").hide();
      $("#Othercountryother").hide();
    } else if (country == "other") {
      document.getElementById("otherCountry").style.display = "block";
      document.getElementById("Othercountryother").style.display = "block";
      $("#states").hide();
    } else {
      document.getElementById("otherCountry").style.display = "block";
      $("#states").hide();
      $("#Othercountryother").hide();
    }
  },

  loadcnvcategoryfee: function (catcode) {
    var regno = document.getElementById("T1").value;
    var amount = 0;
    var postamount = 0;
    var scheme = document.getElementById("T30").value;
    var recive = document.getElementById("T23").value;
    var collage = document.getElementById("T3").value;

    if (scheme == "Tatkal") {
      document.getElementById("T13").value = "DEBIT/CREDIT/NET BANKING";
      document.getElementById("T13").disabled = true;
      amount = 3850;
      $("#tatkalid").show();
    } else {
      $("#tatkalid").hide();
      document.getElementById("T13").value = "00";
      document.getElementById("T13").disabled = false;
      amount = 0;
    }
    if (document.getElementById("T23").checked == true) postamount = 165;
    else postamount = 0;
    if (!empty(regno)) {
      if (catcode == "SCST") {
        $("#disp_scstatt").show();
      } else $("#disp_scstatt").hide();

      $.ajax({
        type: "POST",
        url: $host_url + "Getcnvcategoryfee",
        error: AjaxErrorMessage,
        data: "catcode=" + catcode + "&regno=" + regno,
        success: function (responce) {
          responce = eval("(" + responce + ")");
          if (responce.error_code == 0) {
            fee = responce.data["fee"];
            if (scheme == "Tatkal")
              document.getElementById("T12").value =
                parseInt(responce.data["fee"]) + parseInt(amount);
            else
              document.getElementById("T12").value =
                parseInt(responce.data["fee"]) +
                parseInt(amount) +
                parseInt(postamount);
            document.getElementById("categoryatt").value = "";
            document.getElementById("categoryattpath").value = "";
            document.getElementById("attach_td_cat").innerHTML = "";
          }
        },
      });
    }
  },
  loadscheme: function () {
    var scheme = document.getElementById("T30").value;
    var amount = document.getElementById("T12").value;
    var recive = document.getElementById("T23").value;

    if (scheme == "Tatkal") {
      $("#tatkalid").show();
      document.getElementById("T13").value = "DEBIT/CREDIT/NET BANKING";
      document.getElementById("T13").disabled = true;
      if (document.getElementById("T23").checked == true)
        document.getElementById("T12").value = parseInt(fee) + parseInt(3850);
      else
        document.getElementById("T12").value = parseInt(fee) + parseInt(3850);
    } else {
      $("#tatkalid").hide();
      document.getElementById("T13").value = "00";
      document.getElementById("T13").disabled = false;
      if (document.getElementById("T23").checked == true)
        document.getElementById("T12").value = parseInt(fee) + parseInt(165);
      else document.getElementById("T12").value = fee;
    }
    CMS.loadpostofficeamount();
  },
  loadpostofficeamount: function () {
    var recive = document.getElementById("T23").value;
    var scheme = document.getElementById("T30").value;

    if (
      document.getElementById("T23").checked == true &&
      collage != "KUVEMPU UNIVERSITY, SHIVAMOGGA"
    ) {
      if (scheme == "Tatkal") {
        document.getElementById("T12").value = parseInt(fee) + parseInt(3850);
        $("#tatkalid").show();
      } else {
        document.getElementById("T12").value = parseInt(fee) + parseInt(165);
        $("#tatkalid").hide();
      }
    } else {
      if (scheme == "Tatkal") {
        document.getElementById("T12").value = parseInt(fee) + parseInt(3850);
        $("#tatkalid").show();
      } else {
        document.getElementById("T12").value = fee;
        $("#tatkalid").hide();
      }
    }
  },
  ViewCertificateApplicationData: function () {
    var regno = document.getElementById("apps_reg_no").value;
    var appno = document.getElementById("apps_app_no").value;
    if (db != "sikkim") {
      var dob = document.getElementById("apps_dob").value;
      if (dob == "0000-00-00") {
        bootbox.alert("Enter Date of Birth");
        return false;
      }
    }
    if (empty(appno)) {
      bootbox.alert("Enter Application no.");
      return false;
    } else if (empty(regno)) {
      bootbox.alert("Enter Register no.");
      return false;
    }
    App.blockUI({ boxed: true, message: "Please wait, data loading..." });
    var datastring = "regno=" + regno + "&appno=" + appno + "&dob=" + dob;
    $.ajax({
      type: "POST",
      url: $host_url + "Getapplicationstatusdetails",
      error: AjaxErrorMessage,
      data: datastring,
      success: function (responce) {
        App.unblockUI();
        responce = eval("(" + responce + ")");
        if (responce.error_code == 0) {
          try {
            $("#status_task").html(responce.data["html"]);
          } catch (err) {
            txt = err.message;
            $.unblockUI();
            bootbox.alert(txt);
          }
        } else {
          bootbox.alert(responce.data);
        }
      },
    });
  },
  onLoad: function (evt) {
    var $i = 1;
    var charCode = evt.which ? evt.which : evt.keyCode;
    if (charCode == 32 || $i == 1) {
      var options = {
        sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
        destinationLanguage: [
          google.elements.transliteration.LanguageCode.KANNADA,
        ],
        shortcutKey: "ctrl+g",
        transliterationEnabled: true,
      };

      var control = new google.elements.transliteration.TransliterationControl(
        options
      );

      // Enable transliteration in the editable elements with id
      // 'transliterateDiv'.
      control.makeTransliteratable(["T99"]);
      //control.makeTransliteratable(['transliterateDiv2']);
      //google.setOnLoadCallback(onLoad);
      $i++;
    }
    google.setOnLoadCallback(onLoad);
  },
  UploadEmployeeDocuments: function (file_name) {
    var ext = $("#categoryatt").val();
    var filepath = ext;
    if (empty(filepath)) {
      alert("please select the file!");
      return false;
    }
    var list_data = "";
    list_data = $host_url + "UploadEmployeeDocuments";
    list_data += "&filepath=" + filepath;
    list_data += "&file_name=" + file_name;
    document
      .getElementById("form_module_details_upload")
      .setAttribute("action", list_data);
    App.blockUI({ boxed: true, message: "Please wait,Uploading" });
    return AIM.submit(
      document.getElementById("form_module_details_upload"),
      "same_tab",
      { onComplete: CMS.UploadEmployeeDocumentsResponce }
    );
  },
  UploadEmployeeDocumentsResponce: function (responce) {
    responce = eval("(" + trim(responce) + ")");
    App.unblockUI();
    var int_code = responce.data["id"];
    var path = responce.data["path"];
    var file_name = responce.data["file_name"];
    var html =
      '<a target="_blank" href="' +
      path +
      '" style="color:#AB45F9; padding-right:5px;">' +
      file_name +
      "</a>";
    document.getElementById("categoryattpath").value = path;
    $("#attach_td_cat").html(html);
  },
  UploadEmployeeDocumentsTAB: function (file_name) {
    // console.log(file_name);
    var ext = $("#" + file_name).val();
    var fregno = $("#T1").val();
    var filepath = ext;
    console.log(filepath);
    if (empty(filepath)) {
      alert("please select the file!");
      return false;
    }
    var list_data = "";
    list_data = $host_url + "UploadEmployeeDocumentsTAB";
    list_data += "&filepath=" + filepath;
    list_data += "&file_name=" + file_name;
    list_data += "&fregno=" + fregno;
    console.log(list_data);
    document
      .getElementById("form_tab_uploads")
      .setAttribute("action", list_data);
    App.blockUI({ boxed: true, message: "Please wait,Uploading" });
    return AIM.submit(document.getElementById("form_tab_uploads"), "same_tab", {
      onComplete: CMS.UploadEmployeeDocumentsTABResponce,
    });
  },
  UploadEmployeeDocumentsTABResponce: function (responce) {
    responce = eval("(" + trim(responce) + ")");
    App.unblockUI();
    console.log(responce);
    var int_code = responce.data["id"];
    var path = responce.data["path"];
    var file_name =
      responce.data["file_name_param"] == "deg_cert"
        ? "Degree Cerificate"
        : "All semester marks cards";

    var html =
      '<a target="_blank" href="' +
      path +
      '" style="color:#AB45F9; padding-right:5px;">' +
      file_name +
      "</a>";
    // console.log("hii");
    // $("#attach_td_deg_cert").html("hii");
    // attach_td_deg_cert;
    document.getElementById("categoryattpath").value = path;
    console.log("#attach_td_" + responce.data["file_name_param"]);
    $("#h_" + responce.data["file_name_param"]).val(responce.data["file_name"]);
    $("#attach_td_" + responce.data["file_name_param"]).html(html);
  },
  downloadstudentphotos: function () {
    var fromdate = date_format($("#pd_from_date").val());
    if (fromdate == "0000-00-00") {
      bootbox.alert("Enter from date");
      $("#pd_from_date").focus();
      return false;
    }
    var todate = date_format($("#pd_to_date").val());
    if (todate == "0000-00-00") {
      bootbox.alert("Enter to date");
      $("#pd_to_date").focus();
      return false;
    }
    window.location.href =
      $host_url +
      "downloadstudentphotos&fromdate=" +
      fromdate +
      "&todate=" +
      todate;
  },
  allowAlphaNumericSpace: function (e) {
    var code = "charCode" in e ? e.charCode : e.keyCode;
    if (
      !(code == 32) && // space
      !(code > 47 && code < 58) && // numeric (0-9)
      !(code > 64 && code < 91) && // upper alpha (A-Z)
      !(code > 96 && code < 123)
    ) {
      // lower alpha (a-z)
      e.preventDefault();
    }
  },

  GetCollwiseCandidateReport: function () {
    var deg_from = $("#deg_from").val();
    var deg_to = $("#deg_to").val();
    var date_from = $("#date_from").val();
    var date_to = $("#date_to").val();
    var app_from_app = $("#app_from_app").val();
    var app_to_app = $("#app_to_app").val();
    var paystatus = $("#paystatus").val();
    var certificatetype = $("#certificatetype").val();

    window.location.href =
      $host_url +
      "GetCollwiseCandidateReport" +
      "&fromdeg=" +
      deg_from +
      "&todeg=" +
      deg_to +
      "&fromdate=" +
      date_from +
      "&todate=" +
      date_to +
      "&from_app=" +
      app_from_app +
      "&to_app=" +
      app_to_app +
      "&paystatus=" +
      paystatus +
      "&certificatetype=" +
      certificatetype;
  },

  saveStudentSikkimDetails: function () {
    console.log("anitaaa");
    var regno = $("#T1").val();
    var sname = $("#T2").val();
    var colname = $("#T3").val();
    var degree = $("#T4").val();
    var seatype = $("#rctype").val();
    var mobile = $("#T5").val();
    var perm_nobile = $("#T6").val();
    var email = $("#T7").val();
    var add1 = $("#T8").val();
    var add2 = $("#T9").val();
    var city = $("#T31").val();
    var state = $("#T32").val();
    var pincode = $("#T33").val();
    var student_entry_photo = $("#student_entry_upload").val();
    var convo = $("#T15").val();
    var fee = $("#T12").val();
    var paytype = $("#T13").val();
    var applicantORThirdORPost = $("#rctype").val();

    console.log(applicantORThirdORPost, "hii anita");

    var data =
      "regno=" +
      regno +
      "&sname=" +
      sname +
      "&colname=" +
      colname +
      "&degree=" +
      degree +
      "&seatype=" +
      seatype +
      "&mobile=" +
      mobile +
      "&perm_nobile=" +
      perm_nobile +
      "&email=" +
      email +
      "&add1=" +
      add1 +
      "&add2=" +
      add2 +
      "&city=" +
      city +
      "&state=" +
      state +
      "&pincode=" +
      pincode +
      "&convo=" +
      convo +
      "&fee=" +
      fee +
      "&paytype=" +
      paytype +
      "&photo_path=" +
      student_entry_photo;
    if (document.getElementById("student_declr").checked) {
      $.ajax({
        type: "POST",
        url: $host_url + "saveStudentSikkimDetails",
        data: data,
        success: function (res) {
          var status = JSON.parse(res);
          // console.log(status);
          // return;
          if (status.error_code == 0) {
            alert(status.data.msg);
          } else {
            alert(status.data.msg);
            return;
          }
        },
      });
    }
  },
};

function getStudDetails() {
  var registerNo = document.getElementById("register_no").value;
  var data = "&regno=" + registerNo;
  $("#transtion_date").inputmask("d/m/y", {
    placeholder: "dd/mm/yyyy",
  });
  $.ajax({
    type: "GET",
    url: $host_url + "getStudDetailsSikkim",
    data: data,
    success: function (res) {
      var status = JSON.parse(res);
      $("#name").val(status.data.fname);
      $("#transtion_no").val(status.data.ftranid);
      $("#transtion_date").val(status.data.fpaydate);
    },
  });
}

function saveUpdatePayment() {
  var register_no = document.getElementById("register_no").value;
  var name = document.getElementById("name").value;
  var transtion_no = document.getElementById("transtion_no").value;
  var transtion_date = document.getElementById("transtion_date").value;

  $.ajax({
    type: "POST",
    url: $host_url + "saveTransactionDetailsSikkim",
    data:
      "&regno=" +
      register_no +
      "&sname=" +
      name +
      "&transtionno=" +
      transtion_no +
      "&transtiondate=" +
      transtion_date,
    success: function (res) {
      var data = JSON.parse(res);
      if (data.error_code == 0) {
        alert(data.data.msg);
        return;
      } else {
        alert(data.data.msg);
        return;
      }
    },
  });
}