0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.141.46.108


Current Path : /proc/thread-self/root/var/www/html/univadmin/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin/js/spadmin.js

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

// var $host_url= window.location.protocol+"//"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/app.php?a=";
var funivcode, funivname;

function loadMaster() {
  // loadProfile();
  //loadExamApplication();
  $.ajax({
    type: "post",
    url: $host_url + "isloggedin",
    //data:parameters,
    success: function (response) {
      var { error_code, data, status } = response;

      if (error_code == 0) {
        ({ funivcode, funivname } = data.result);
        $("#loadmenu li").click(function () {
          // remove classes from all
          $("li").removeClass("active");
          // add class to the one we clicked
          $(this).addClass("active");

          $("body").removeClass("overlay-open");
          $(".overlay").css("display", "none");
        });

        $("#nav-header").html("University Admin");
       // loadStudent();
      } else {
        alert("Please login");
        window.location.href = "index.html";
      }
    },
  });
}

function getdeggrp() {
  univcode = document.getElementById("univname").value;
  $("#deggrp").html("");

  // console.log("univuniv",univcode);
  $.ajax({
    type: "post",
    url: $host_url + "getDegreeGroup&univcode=" + univcode,
    success: function (response) {
      var { error_code, data, status } = response;
      if (error_code == 0) {
        var deg = data.deggrp;
        var options;
        options += `<option value="">--Select--</option>`;

        for (var i = 0; i < deg.length; i++) {
          options += `<option value="${deg[i].fdeggrp}">${deg[i].fdeggrp} - ${deg[i].fdescpn}</options>`;
        }
        $("#deggrp").html(options);
      } else if (error_code == -1) {
        var status = data.msg;
        $("#reserr").html(status);
      }
    },
  });
}

function loadUnivs(id) {
  $.ajax({
    type: "post",
    url: $host_url + "getUnivs",
    //data:parameters,
    async:false,
    success: function (response) {
      var { error_code, data, status } = response;
      if (error_code == 0) {
        var univs = data.univs;
        var options;
        for (var i = 0; i < univs.length; i++) {
          options += `<option value="${univs[i].funivcode}">${univs[i].funivname}</options>`;
        }

        $("#" + id).html(options);
      }
    },
  });
}

function loadCollSMS() {
  $("#loadtab").load("html_modules/collSMS.html?v=" + version, () =>
    loadUnivs("univname")
  );
}

// loadSspData

function loadSspData() {
  $("#loadtab").load("html_modules/sspData.html?v=" + version, () =>
    loadUnivs("univname")
  );
}

var sspdata = [];

function getSspData() {
  var univcode = $("#univname").val();
  var colgrngfrom = $("#colgrngfrom").val();
  var colgrngto = $("#colgrngto").val();
  var degfrom = $("#degfrom").val();
  var degto = $("#degto").val();

  if (
    colgrngto == "" ||
    univcode == "" ||
    colgrngfrom == "" ||
    degfrom == "" ||
    degto == ""
  ) {
    alert("Please fill All the values");
  } else {
    $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });
    $.ajax({
      type: "POST",
      url:
        $host_url +
        "getSspDegColl" +
        "&univcode=" +
        univcode +
        "&colgrngto=" +
        colgrngto +
        "&colgrngfrom=" +
        colgrngfrom +
        "&degfrom=" +
        degfrom +
        "&degto=" +
        degto,
      success: function (response) {
        $.unblockUI();
        var { error_code, data, status } = response;
        if (error_code == 0) {
          console.log(data);
          sspdata = data;
          html = `<div class="text-right m-b-10">
          <button  type="button" class="m-t-3 m-b-10 btn btn-success waves-effect btn-lg" onclick = "uploadSspData()">Upload</button>
        </div>
          <table class="table table-bordered table-hover">`;
          html += `<tr class='bg-green'>
          <th width='4%'><center>Sl. No.</center></th>
          <th width='10%'><center>College Code</center></th>
          <th width='20%'><center>College Name</center></th>
          <th width='10%'><center>Degree Code</center></th>
          <th width='20%'><center>Degree Name</center></th>
          <th width='10%'><center>Student Count</center></th>
          <th width='9%'><center><input type="checkbox" class="filled-in" 
          id="chk_all" 
          value="" onChange="CheckUncheckall()"/>
          <label for="chk_all" 
          style="font-size:14px !important;">Check All</label></th>
          </tr>
          <tbody id="sspCollDeg">`;

          for (var i = 0; i < data.length; i++) {
            html += `<tr>
            <td><center>${i + 1}</center></td>
            <td><center>${data[i]["fsspcollcode"]}</center></td>
            <td>${data[i]["college_name"]}</td>
            <td><center>${data[i]["fsspdegcode"]}</center></td>
            <td>${data[i]["fdescpn"]}</td>
            <td>${data[i]["fregcount"]}</td>
            <td style='text-align:center'>`;

            html += `<input type="checkbox" class="filled-in" 
            id="${data[i]["fsspcollcode"]}_${data[i]["fsspdegcode"]}" 
            value=""/>
            <label for="${data[i]["fsspcollcode"]}_${data[i]["fsspdegcode"]}" 
            style="font-size:14px !important;" 
            id="toInactive${data[i]["fsspcollcode"]}_${data[i]["fsspdegcode"]}"></label>`;

            html += `<input type="hidden"  value="F" id="h_${data[i]["fsspcollcode"]}_${data[i]["fsspdegcode"]}"></td>
            </tr>
            `;
          }
          html += `</tbody> 
          </table>`;

          $("#showSspCollDeg").html(html);
        } else {
          console.log("status", status);
        }
      },
    });
  }
}

function CheckUncheckall() {
  if ($("#chk_all").is(":checked")) {
    for (let el of sspdata) {
      $(`#${el.fsspcollcode}_${el.fsspdegcode}`).prop("checked", true);
    }
  } else {
    for (let el of sspdata) {
      $(`#${el.fsspcollcode}_${el.fsspdegcode}`).prop("checked", false);
    }
  }
}

function uploadSspData() {
  var univcode = $("#univname").val();
  var ssppush = [];

  for (let el of sspdata) {
    if ($(`#${el.fsspcollcode}_${el.fsspdegcode}`).is(":checked")) {
      ssppush.push({ coll: el.fsspcollcode, deg: el.fsspdegcode });
    }
  }
  console.log(ssppush);
  var str_ssppush = JSON.stringify(ssppush);

  // $.post($host_url + "sspUploadbonafideData&params", function (str_ssppush) {
  //   var w = window.open("about:blank");
  //   w.document.open();
  //   w.document.write(str_ssppush);
  //   w.document.close();
  // });
  // window.open(
  //   $host_url + "sspUploadbonafideData&params" + str_ssppush,
  //   "_blank"
  // );
  $(`<form method="post" action="${$host_url}sspUploadbonafideData&univcode=${univcode}" target="TheWindow">
       <input type="hidden" name="params" value='${str_ssppush}'>
   </form>`)
    .appendTo("body")
    .submit()
    .remove();
}

function loadScriptUpload() {
  $("#loadtab").load(
    "html_modules/scriptStatusUpload.html?v=" + version,
    () => {
      loadUnivs("univname");
    }
  );
}

function examAttendance() {
  $("#loadtab").load("html_modules/examAttendance.html?v=" + version, () => {
    loadUnivs("univname");
    var $demoMaskedInput = $(".daterange");
    //Date
    $demoMaskedInput
      .find(".date")
      .inputmask("dd/mm/yyyy", { placeholder: "__/__/____" });
  });
}

function getExamAttendance() {
  var univcode = $("#univname").val();
  var doe = $("#doe").val();
  var reportType = $("#reportType").val();
  var sessionType = $("#sessionType").val();
  var qprngfrom = $("#qprngfrom").val();
  var qprngto = $("#qprngto").val();

  console.log(
    "data",
    univcode,
    doe,
    sessionType,
    qprngfrom,
    qprngto,
    reportType
  );

  if (
    univcode == "" ||
    doe == "" ||
    sessionType == "" ||
    qprngfrom == "" ||
    qprngto == "" ||
    reportType == ""
  ) {
    alert("Fill All Details to Get Reports");
  } else {
    window.location.href =
      $host_url +
      "getExamAttendance&doe=" +
      doe +
      "&sessionType=" +
      sessionType +
      "&qprngfrom=" +
      qprngfrom +
      "&qprngto=" +
      qprngto +
      "&univcode=" +
      univcode +
      "&reportType=" +
      reportType;
  }
}

function uploadTimeTable() {
  $("#loadtab").load("html_modules/timetableUpload.html?v=" + version, () => {
    var js_path = "js/form_submit.js";
    $(document.createElement("script"))
      .attr("src", js_path)
      .attr("type", "text/javascript")
      .appendTo("head");
    loadUnivs("univname");
  });
}

function uploadTT() {
  var univcode = $("#univname").val();
  var deggrp = $("#deggrp").val();
  console.log("zzzzzzz", univcode, deggrp);
  file_file = "file";
  var file_name = $("#" + file_file).val();
  var file_size = $("#" + file_file)[0].files[0].size;
  var file_extn = file_name.split(".").pop();
  var file_extn = file_extn.toLowerCase();

  if (file_extn == "zip") {
  } else {
    alert("Zip files are allowed!");
    return false;
  }

  if (file_size >= 3000000) {
    alert("Upload files with size less then 2MB!");
    return false;
  }

  var file_data = $("#" + file_file).prop("files")[0];
  var form_data = new FormData();
  form_data.append("file", file_data);

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='../images/ajax-loader.gif' border='0'></h1>",
  });
  $.ajax({
    type: "POST",
    url: "uploadTT.php",
    data: form_data,
    cache: false,
    contentType: false,
    processData: false,
    success: function (data) {
      $.unblockUI();
      // console.log(data);
      gfilename = data;
    },
    error: function (data) {
      alert(data);
    },
  });
}
function loadTimeTable() {
  console.log("ttformResponse");
  var univcode = $("#univname").val();
  var deggrp = $("#deggrp").val();
  console.log("zzzzzzz", univcode, deggrp, gfilename);
  var parameters =
    "univcode=" + univcode + "&deggrp=" + deggrp + "&gfilename=" + gfilename;
  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });

  $.ajax({
    type: "post",
    url: $host_url + "loadTimeTable",
    data: parameters,
    success: function (response) {
      $.unblockUI();
      console.log(response);
    },
  });
}

function activateTimeTable() {
  $("#loadtab").load("html_modules/activateTT.html?v=" + version, () => {
    loadUnivs("univname");
  });
}

function activateTT() {
  var univcode = $("#univname").val();
  var deggrp = $("#deggrp").val();

  if (deggrp == null || univcode == null) {
    alert("Please select Degree Group, University");
  } else {
    $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });
    $.ajax({
      type: "POST",
      url:
        $host_url + "getTTlist" + "&univcode=" + univcode + "&deggrp=" + deggrp,
      success: function (response) {
        $.unblockUI();
        var { error_code, data, status } = response;
        if (error_code == 0) {
          // console.log(data);
          html = `<table class="table table-bordered table-hover" >`;
          html += ` <tr class='bg-green'>
          <th width='4%'><center>Sl. No.</center></th>
          <th width='5%'><center>Degree</center></th>
          <th width='20%'><center>Degree Name</center></th>
          <th width='20%'><center>Time Table</center></th>
          <th width='9%'><center>Check</center></th>
          </tr>`;
          for (var i = 0; i < data.length; i++) {
            html += `<tr>
            <td><center>${i + 1}</center></td>
            <td><center>${data[i]["fdegree"]}</center></td>
            <td>${data[i]["fdescpn"]}</td>
            <td style='text-align:center'><a href="${
              data[i]["ttpath"]
            }" id="ttpath" target="_blank">${data[i]["ttpath"]}</a></td>
            <td style='text-align:center'>`;
            if (data[i]["factive"] == "T") {
              html += `<input type="checkbox" class="filled-in" id="${data[i]["fdegree"]}" checked="checked" value="" onchange="getActivates('${data[i]["fdegree"]}')"/>
            <label for="${data[i]["fdegree"]}" style="font-size:14px !important;" id="toActivate${data[i]["fdegree"]}">Active</label>
            `;
            } else {
              html += `<input type="checkbox" class="filled-in" id="${data[i]["fdegree"]}" value="" onChange="getActivates('${data[i]["fdegree"]}')"/>
            <label for="${data[i]["fdegree"]}" style="font-size:14px !important;" id="toInactive${data[i]["fdegree"]}">Inactive</label>`;
            }
            fdeg = data[i]["fdegree"];
            html += `<input type="hidden"  value="F" id="h_${data[i]["fdegree"]}"></td>
            </tr>
            `;
          }
        } else {
          console.log("status", status);
        }

        html += `</table>
        <div class="text-center m-t-3">
          <button  type="button" class="m-t-5 btn btn-success waves-effect btn-lg" onclick = "updateTTstatus()">Save</button>
        </div>`;

        $("#showTT").html(html);
      },
    });
  }
}

function getActivates(checkbox) {
  console.log("checkbox", checkbox);
  if ($("#toInactive" + checkbox).text() == "Inactive") {
    $("#toInactive" + checkbox).text("Active");
  } else {
    $("#toInactive" + checkbox).text("Inactive");
  }
  if ($("#toActivate" + checkbox).text() == "Active") {
    $("#toActivate" + checkbox).text("Inactive");
  } else {
    $("#toActivate" + checkbox).text("Active");
  }
  document.getElementById("h_" + checkbox).value = "T";
}

function updateTTstatus() {
  var univcode = $("#univname").val();
  var deggrp = $("#deggrp").val();

  var inputs = $("#showTT").find("input[type=checkbox]");
  var h_inputs = $("#showTT").find("input[type=hidden]");

  var values = Array();
  for (var i = 0; i < inputs.length; i++) {
    if ($("#" + h_inputs[i]["id"]).val() == "T") {
      if ($("#" + inputs[i]["id"]).is(":checked")) {
        values.push({
          degree: inputs[i]["id"],
          factive: $("#" + h_inputs[i]["id"]).val(),
        });
      } else {
        values.push({
          degree: inputs[i]["id"],
          factive: "F",
        });
      }
    } else {
      console.log("h_input not T", inputs[i]["id"]);
    }
  }
  // console.log("val",values);
  var final_values = JSON.stringify(values);

  $.ajax({
    type: "POST",
    data: "myData=" + final_values,
    url:
      $host_url +
      "updateTTstatus" +
      "&univcode=" +
      univcode +
      "&deggrp=" +
      deggrp,
    success: function (response) {
      var { error_code, data, status } = response;
      if (error_code == 0) {
        console.log("response", data, status);
      }
      if (error_code == -1) {
        console.log("response", status);
      }
    },
  });
}

function loadStudent() {
  $("#loadtab").load("html_modules/student.html?v=" + version, () => {
    loadUnivs("univname");
    $("#studinfo").hide();
  });
}

function getStudentInfo() {
  var univcode = $("#univname").val();
  var studid = $("#studid").val();

  var parameters = "&univcode=" + univcode + "&studid=" + studid;
  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });

  $.ajax({
    type: "GET",
    url: $host_url + "getStudentPersonalDetails" + parameters,
    success: function (response) {
      $.unblockUI();
      response = response;
      var { masuser, student } = response.data;
      $("#regno").val(masuser.fregno);
      $("#studinfo").html(`<tr>
        <td width="35%"><b>Student Name</b></td><td width="2%"> : </td>
        <td width="68%"> ${student.fname}</td>
      </tr>
      <tr>
        <td width="17%"><b>Register number</b> </td><td width="2%"> : </td>
        <td> ${masuser.fregno.toUpperCase()} </td>
        <td width="17%" rowspan="4"> <img 
        src="http://universitysolutions.in/${masuser.ffolder}/${
        student.fphotopath
      }"  
        width="100" height = "100" /></td>
      </tr>

      <tr>
        <td><b>Mobile Number</b></td><td width="2%"> : </td>
        <td>${masuser.fmobileno}</td>
      </tr>
      <tr>
          <td><b>Email Id</b> </td><td width="2%"> : </td>
          <td> ${masuser.femail} </td>
      </tr>
      <tr>
          <td><b>Father / Guardian Name</b> </td>
          <td width="2%"> : </td><td> ${student.ffatname} </td>
      </tr>
      <tr>
        <td><b>Father / Guardian Mobile</b> </td><td width="2%"> : </td>
        <td> ${masuser.fparentmob} </td>
      </tr>
      <tr>
          <td><b>College</b> </td><td width="2%"> : </td>
          <td> ${student.college} </td>
      </tr>
      <tr>
          <td><b>Degree</b> </td><td width="2%"> : </td>
          <td>[${student.fdegree}] ${student.degree} </td>
      </tr>
      <tr>
          <td><b>Exam Date</b> </td><td width="2%"> : </td>
          <td> ${student.fexamdate} </td>
      </tr>`);
      $("#studinfo").show();
      getSubject(univcode, masuser.fregno);
    },
  });
}

function getCandsum() {
  var univcode = $("#univname").val();
  var regno = $("#regno").val();

  var parameters = "&univcode=" + univcode + "&regno=" + regno;
  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });

  $.ajax({
    type: "GET",
    url: $host_url + "getStudentCandidateSummary" + parameters,
    success: function (response) {
      $.unblockUI();
      // response = response
      var { candsum } = response.data;

      var table = `<table class="m-b-20 table table-condensed table-bordered table-striped table-hover">
        <tr style = "height:40px;background-color: #184F76 !important;color: #fff;">
            <th style = "width:8%;"><center>Sl. No. </center></th>
            <th style = "width:10%;"><center>Sem / Year</center></th>
            <th style = "width:20%;"><center>Status </center></th>
            <th style = "width:10%;"><center>Exam Fee</center></th>
            <th style = "width:20%;"><center>Eligibility</center></th>
            <th style = "width:10%;"><center>Concession</center></th>
            <th style = "width:15%;"><center>Hall Ticket</center></th>
        </tr>`;

      const sems = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"];

      for (let i in sems) {
        let sem = sems[i].toLowerCase();
        let fappear = eval("candsum.fappear" + sem);
        let appear = "";
        if (fappear == "A") {
          appear = "Appear";
        } else if (fappear == "P") {
          appear = "Pass";
        } else if (fappear == "N") {
          appear = "Not Applicable";
        }

        let fexamfee = eval("candsum.fexamfee" + sem);

        let felig = candsum.felig.substring(i, i + 1);
        let elig = "";
        if (felig == sems[i]) elig = "Eligible";
        else elig = "Not Eligible";

        let fconstype = candsum.fconstype.substring(i, i + 1);
        let constype = "";
        if (fconstype == sems[i]) constype = "Yes";
        else constype = "No";

        let fhtblk = candsum.fhtblk.substring(i, i + 1);
        let htblk = "";
        if (fhtblk != sems[i]) htblk = "Blocked";
        else htblk = "Not Blocked";

        table += `<tr>
          <td><center> ${parseInt(i) + 1} </center></td>
          <td><center> ${romanize(parseInt(i) + 1)} </center></td>
          <td>${appear}</td>
          <td>${fexamfee}</td>
          <td><center>${elig}</center></td>
          <td><center>${constype}</center></td>
          <td><center>${htblk}</center></td>
        </tr>`;
      }
      table += `</table>`;
      $("#candsum_table").html(table);
    },
  });
}

function getSubject(univcode, regno) {
  var parameters = "&univcode=" + univcode + "&regno=" + regno;
  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });

  $.ajax({
    type: "GET",
    url: $host_url + "getStudentSubjectsForCurrentSem" + parameters,
    success: function (response) {
      $.unblockUI();
      response = response;
      var { subject } = response.data;
      var table = `<table class="m-b-20 table table-condensed table-bordered table-striped table-hover">
        <tr style = "height:40px;background-color: #184F76 !important;color: #fff;">
            <th style = "width:5%;"><center>Sl. No. </center></th>
            <th style = "width:8%;"><center>Sem / Year</center></th>
            <th style = "width:8%;"><center>Subject Code</center></th>
            <th style = "width:10%;"><center>Qp Code</center></th>
            <th><center>Subject Name</center></th>
            <th style = "width:5%;"><center>Pass Month</center></th>
            <th style = "width:5%;"><center>Optional Subject</center></th>
            <th style = "width:5%;"><center>Present</center></th>
            <th style = "width:8%;"><center>Hall No.</center></th>
        </tr>`;
      for (let i in subject) {
        let sub = subject[i];
        table += `<tr>
          <td><center> ${parseInt(i) + 1} </center></td>
          <td><center> ${sub.fexamname} </center></td>
          <td><center> ${sub.fsubcode} </center></td>
          <td><center> ${sub.fqpcode} </center></td>
          <td>${sub.fsubname}</td>
          <td><center>${sub.fpassmth}</center></td>
          <td><center>${sub.finserted}</center></td>
          <td><center>${sub.fpresent}</center></td>
          <td><center>${sub.fhallno}</center></td>
        </tr>`;
      }
      table += `</table>`;
      $("#table_subject").html(table);
    },
  });
}

function getExamApplication() {
  var univcode = $("#univname").val();
  var regno = $("#regno").val();

  var parameters = "&univcode=" + univcode + "&regno=" + regno;
  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });

  $.ajax({
    type: "GET",
    url: $host_url + "getStudentExamApplications" + parameters,
    success: function (response) {
      $.unblockUI();
      response = response;
      var { examApp: apps } = response.data;
      var table = `<table class="m-b-20 table table-condensed table-bordered table-striped table-hover">
        <tr style = "height:40px;background-color: #184F76 !important;color: #fff;">
            <th style = "width:8%;"><center>Sl. No. </center></th>
            <th style = "width:10%;"><center>App. No.</center></th>
            <th style = "width:10%;"><center>Applied Date</center></th>
            <th style = "width:10%;"><center>Payment Type</center></th>
            <th style = "width:10%;"><center>Total Fee</center></th>
            <th style = "width:15%;"><center>Rec. Date</center></th>
            <th style = "width:10%;"><center>Rec. By</center></th>
            <th style = "width:8%;"><center>Pay. Status</center></th>
            <th style = "width:8%;"><center>Pay. Gate Way</center></th>
            <th style = "width:8%;"><center>Order ID</center></th>
        </tr>`;
      for (let i in apps) {
        let app = apps[i];
        table += `<tr>
          <td><center> ${parseInt(i) + 1} </center></td>
          <td><center> ${app.appno} </center></td>
          <td><center> ${app.fdate} </center></td>
          <td>${app.fpaymentype}</td>
          <td><center>${app.ftotalfee}</center></td>
          <td><center>${app.fackdate}</center></td>
          <td><center>${app.fackuser}</center></td>
          <td><center>${app.fpaymentstatus}</center></td>
          <td><center>${app.fpaygateway}</center></td>
          <td><center>${app.forderid}</center></td>
        </tr>`;
      }
      table += `</table>`;
      $("#examapp_table").html(table);
    },
  });
}

function getIAMarks() {
  var univcode = $("#univname").val();
  var regno = $("#regno").val();

  var parameters = "&univcode=" + univcode + "&regno=" + regno;
  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });

  $.ajax({
    type: "GET",
    url: $host_url + "getStudentIAMarks" + parameters,
    success: function (response) {
      $.unblockUI();
      response = response;
      var { iamarks } = response.data;
      var table = `<table class="m-b-20 table table-condensed table-bordered table-striped table-hover">
        <tr style = "height:40px;background-color: #184F76 !important;color: #fff;">
            <th style = "width:5%;"><center>Sl. No. </center></th>
            <th style = "width:8%;"><center>Subject Code </center></th>
            <th><center> Subject Name <center></th>
            <th style = "width:10%;"><center>Short Name</center></th>
            <th style = "width:10%;"><center>Max. Marks</center></th>
            <th style = "width:10%;"><center>Sec. Marks</center></th>
            <th style = "width:8%;"><center>Present</center></th>
            <th style = "width:8%;"><center>Entered By</center></th>
            <th style = "width:15%;"><center>Entered Date</center></th>
        </tr>`;
      for (let i in iamarks) {
        let ia = iamarks[i];
        table += `<tr>
          <td><center> ${parseInt(i) + 1} </center></td>
          <td><center> ${ia.fsubcode} </center></td>
          <td>${ia.fsubname}</td>
          <td><center>${ia.fssubname}<center></td>
          <td><center>${ia.fsmaxmarks}</center></td>
          <td><center>${ia.fmarks}</center></td>
          <td><center>${ia.fpresent}</center></td>
          <td><center>${ia.flogname}</center></td>
          <td><center>${ia.flogdate}</center></td>
        </tr>`;
      }
      table += `</table>`;
      $("#iamarks_table").html(table);
    },
  });
}

function getExamno() {
  var univcode = $("#univname").val();
  var regno = $("#regno").val();

  var parameters = "&univcode=" + univcode + "&regno=" + regno;
  $.ajax({
    type: "GET",
    url: $host_url + "getExamno" + parameters,
    success: function (response) {
      var { error_code, data, status } = response;
      // console.log("REsresres",response)
      var examno = data;
      html = "";
      html1 = "";
      if (error_code == 0) {
        for (let i in examno) {
          var e = examno[i];
          if ($("#res").prop("id")) {
            console.log("resres");
            html += ` 
          <input type="radio" class="form-check-input" id="${e.fexamno}" name="examno" onclick="getRes('${e.fexamno}')">
          <label class="form-check-label" for="${e.fexamno}">${e.fexamno}</label>`;
          }
          if ($("#resdet").prop("id")) {
            console.log("resdetresdetresdetresdetresdet");
            html1 += `
            <input type="radio" class="form-check-input" id="resdet${e.fexamno}" name="examno1" onclick="getResDet('${e.fexamno}')">
            <label class="form-check-label" for="resdet${e.fexamno}">${e.fexamno}</label>`;
          }
        }
      }
      $("#disExNo").html(html);
      $("#disExNo1").html(html1);
    },
  });
}

function getRes(examno) {
  var univcode = $("#univname").val();
  var regno = $("#regno").val();

  var parameters =
    "&univcode=" + univcode + "&regno=" + regno + "&examno=" + examno;
  console.log("ppp", parameters);
  // $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "GET",
    url: $host_url + "getResults" + parameters,
    success: function (response) {
      // $.unblockUI();
      var { error_code, data, status } = response;

      // console.log("resres",data);
      var FMAXMARKS = (FPERCENT = FTOTMARKS = result = FSCHEME = "");
      html = `<table class="table table-bordered table-hover"><thead><tr style = "height:40px;background-color: #184F76 !important;color: #fff;">`;
      if (error_code == 0) {
        for (var i in data) {
          var d = data;
        }
        for (var a = 0; a < d.headers.length; a++) {
          // console.log("aa",d[a]);
          html += `
            <th>${d.headers[a]}</th>
          `;
        }
        html += `</tr></thead>`;
        for (var b = 0; b < d.body.length; b++) {
          FTOTMARKS = data.body[b]["FTOTMARKS"];
          FMAXMARKS = data.body[b]["FMAXMARKS"];
          FPERCENT = data.body[b]["FPERCENT"];
          FSCHEME = data.body[b]["FSCHEME"];
          RESULT = data.body[b]["result"];
          html += `<tbody>
              <tr>
              <td>${d.body[b]["sl_no"]}</td>
              <td>${d.body[b]["subject"]}</td>
              <td>${d.body[b]["mthprue"]}</td>
              <td>${d.body[b]["uni_exam"]}</td>
              <td>${d.body[b]["viva_exam"]}</td>
              <td>${d.body[b]["ia_exam"]}</td>
              <td>${d.body[b]["thtot"]}</td>
              <td>${d.body[b]["remarks"]}</td>
              </tr>`;
          if (data.body[b]["FSCHEME"] == "CR") {
            FCGPA = data.body[b]["FCGPA"];
            FSGPA = data.body[b]["FSGPA"];

            // html += `<td>${d.body[b]['FCREDITS']}</td>
            //   <td>${d.body[b]['FGP']}</td>
            //   <td>${d.body[b]['FCP']}</td>
            // `;
          }
        }
        if (FSCHEME == ".") {
          html += `<tr> <td colspan="8"><center><p class="display-4"><b>Max. Marks :</b> ${FMAXMARKS}&nbsp;&nbsp;  <b>Sec. Marks :</b> ${FTOTMARKS}&nbsp;&nbsp;
          <b>Percentage :</b> ${FPERCENT}&nbsp;&nbsp; <b>Result : </b> ${RESULT}</p></center></td>
          </tr>`;
        } else {
          html += `<tr> <td colspan="8"><center><p class="display-4"><b>S.G.P.A : </b> ${FSGPA}&nbsp;&nbsp;${FCGPA}&nbsp;&nbsp;${RESULT}
          </p></center></td>
          </tr>`;
        }

        html += `</tbody></table>`;
        $("#res_table").html(html);
      }
      if (error_code == -1) {
        console.log("Status:", status);
      }
    },
  });
}

function getResDet(examno) {
  var univcode = $("#univname").val();
  var regno = $("#regno").val();
  console.log("resdetresdet");
  var parameters =
    "&univcode=" + univcode + "&regno=" + regno + "&examno=" + examno;
  $.ajax({
    type: "POST",
    url: $host_url + "getResDet" + parameters,
    success: function (response) {
      // console.log("resresres",response);
      var { error_code, data, status } = response;
      table = ``;
      if (error_code == 0) {
        table += `<table class="table table-bordered table-hover"><thead class="text-center">
        <tr style = "height:40px;background-color: #184F76 !important;color: #fff;">
          <th>Sl_No</th>
          <th>Subject Name</th>
          <th>Subject Code</th>
          <th>Component Name</th>
          <th>Marks</th> 
        </tr>
        </thead>
        <tbody>`;
        var sl_no = 0;
        for (var i in data) {
          var d = data[i];
          sl_no++;
          var size = Object.keys(d).length;
          table += `<tr><td rowspan="${size}"><center>${sl_no}</center></td>
          <td rowspan="${size}">${i}</td>`;
          for (var j in d) {
            var det = d[j];
            table += `<td><center>${j}</center></td>
            <td><center>${det["s"]}</center></td>
            <td><center>${det["m"]}</center></td>
            </tr>`;
          }
        }
        table += `</tbody></table>`;
        $("#resdet_table").html(table);
      }
      if (error_code == -1) {
        console.log("Status", status);
      }
    },
  });
}

var gfilename;

function UploadDocument() {
  file_file = "file";
  var file_name = $("#" + file_file).val();
  var file_size = $("#" + file_file)[0].files[0].size;
  var file_extn = file_name.split(".").pop();
  var file_extn = file_extn.toLowerCase();
  if (file_extn == "xlsx") {
  } else {
    alert("XLSX files are allowed!");
    return false;
  }

  if (file_size >= 1000000) {
    alert("Upload files with size less then 1MB!");
    return false;
  }

  var file_data = $("#" + file_file).prop("files")[0];
  var form_data = new FormData();
  form_data.append("file", file_data);

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='../images/ajax-loader.gif' border='0'></h1>",
  });
  $.ajax({
    type: "POST",
    url: "upload_file.php",
    data: form_data,
    cache: false,
    contentType: false,
    processData: false,
    success: function (data) {
      $.unblockUI();
      console.log(data);
      gfilename = data;
      // $('#h_'+file_file).val(data);

      // var str = `<a href = "${$host_url1+'/upload/'+data}" target = "_blank">${file_file}</a>`;
      // document.getElementById('attach_td_'+file_file).innerHTML = str;
    },
    error: function (data) {
      alert(data);
    },
  });
}

function uploadScriptStats() {
  var univcode = $("#univname").val();
  var deggrp = $("#deggrp").val();

  var parameters =
    "univcode=" + univcode + "&deggrp=" + deggrp + "&gfilename=" + gfilename;
  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });

  $.ajax({
    type: "post",
    url: $host_url + "uploadScriptStats",
    data: parameters,
    success: function (response) {
      $.unblockUI();
      var { error_code, data, status } = response;
      alert(data);
    },
  });
}

function sendSms() {
  var univcode = $("#univname").val();
  var type = $("#type").val();
  var deggrp = $("#deggrp").val();
  var stype = "";
  var message = $("#message").val();
  message = message.replace("'", "");
  message = message.replace('"', "");

  if (type == "student") stype = $("#stype").val();

  var parameters =
    "univcode=" +
    univcode +
    "&type=" +
    type +
    "&message=" +
    message +
    "&deggrp=" +
    deggrp +
    "&stype=" +
    stype;

  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "post",
    url: $host_url + "sendsms",
    data: parameters,
    success: function (response) {
      $.unblockUI();
      var { error_code, data, status } = response;
      if (error_code == 0) {
        $("#res_table").html(data.sms);
      }
    },
  });
}

function loadoasisLinks() {
  $("#loadtab").load(
    "html_modules/oasislinks.html?v=" + version,
    function () {}
  );
}

function getCollege(coll) {
  $("#event").hide();
  if (coll == "student") {
    /*document.getElementById('collfrom').disabled=true;
    document.getElementById('collto').disabled=true;
    document.getElementById('Regfrom').disabled=true;
    document.getElementById('Regto').disabled=true;
    document.getElementById('semister').disabled=true;*/
    $("#event").show();
  } else {
    document.getElementById("collfrom").disabled = false;
    document.getElementById("collto").disabled = false;
    document.getElementById("Regfrom").disabled = false;
    document.getElementById("Regto").disabled = false;
    document.getElementById("semister").disabled = false;
  }
}

function romanize(num) {
  if (isNaN(num)) return NaN;
  var digits = String(+num).split(""),
    key = [
      "",
      "C",
      "CC",
      "CCC",
      "CD",
      "D",
      "DC",
      "DCC",
      "DCCC",
      "CM",
      "",
      "X",
      "XX",
      "XXX",
      "XL",
      "L",
      "LX",
      "LXX",
      "LXXX",
      "XC",
      "",
      "I",
      "II",
      "III",
      "IV",
      "V",
      "VI",
      "VII",
      "VIII",
      "IX",
    ],
    roman = "",
    i = 3;
  while (i--) roman = (key[+digits.pop() + i * 10] || "") + roman;
  return Array(+digits.join("") + 1).join("M") + roman;
}

function acceptNumbersOnlyForModule(evt) {
  var charCode;
  if (window.event) charCode = window.event.keyCode;
  //if IE
  else charCode = evt.which; //if firefox
  if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
  return true;
}

function charKeydown(evt) {
  var charCode;
  if (window.event) charCode = window.event.keyCode;
  //for IE
  else charCode = evt.which; //for firefox
  if (charCode == 32)
    //for &lt;space&gt; symbol
    return true;
  if (charCode > 31 && charCode < 65)
    //for characters before 'A' in ASCII Table
    return false;
  if (charCode > 90 && charCode < 97)
    //for characters between 'Z' and 'a' in ASCII Table
    return false;
  if (charCode > 122)
    //for characters beyond 'z' in ASCII Table
    return false;
  return true;
}