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 : 18.222.110.231


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

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

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

function uploadSSPdata() {
  var univcode = $("#univname").val();
  //var gfilename = $("#file").val();
  console.log("gfilename", gfilename);
  var parameters = "univcode=" + univcode + "&gfilename=" + gfilename;
  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });

  $.ajax({
    type: "post",
    url: $host_url + "uploadSSPData",
    data: parameters,
    success: function (response) {
      $.unblockUI();
      alert(response.data);
      loadsspadmpush();
    },
  });
}

function uploadSSPData() {
  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("Only 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;
      
    },
    error: function (data) {
      alert(data);
    },
  });
}

function loadsspadmpush()
{
  var univcode = $("#univname").val();
  //var gfilename = $("#file").val();
  console.log("univcode", univcode);
  var parameters = "univcode=" + univcode;
  $.blockUI({ message: "<img src='images/Loading_icon.gif' border='0'>" });

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

     let html =`<table style = '100%' class="table table-bordered table-hover">
     <tr class='bg-green'>
      <th width='4%'><center>University Code</center></th>
      <th width='20%'><center>Univerity Name</center></th>
      <th width='5%'><center>Tot. stud.</center></th>
      <th width='5%'><center>Push. Stud</center></th>
      <th width='5%'><center>Pending Stud.</center></th>
      <th width='5%'><center>Push</center></th>
      <th width='5%'><center>Error Log</center></th>
      </tr>
      <tbody>
      <tr>
        <td><center>${response.data['University_SSP_Code']}</center></td>
        <td>${response.data['University_Name']}</td>
        <td><center>${response.data['tot']}</center></td>
        <td><center>${response.data['pushed']}</center></td>
        <td><center>${response.data['not_pushed']}</center></td>
        <td><center><button  type="button" class="m-t-5 btn btn-success waves-effect btn-lg" onclick="pushsspadmdata()">Push</button></center> </td>
        <td><center><button  type="button" class="m-t-5 btn btn-warning waves-effect btn-lg" onclick="errorsspadmdata()">Error File</button></center> </td>
        
      </tr>
      </tbody>
      </table>`;
      $('#sspadmpush').html(html);
    }
  });
}


function pushsspadmdata()
{
  var univcode = $("#univname").val();
  if(univcode == '')
  {
    alert("Please Select University");
    return;
  }

  window.open(`https://universitysolutions.in/univadmin/app.php?a=sspadmdata&univcode=${univcode}`,"_blank");
}

function errorsspadmdata()
{
  alert('Hi Error');
}

function signOut()
{
  
  $.ajax({
    type: "post",
    url: $host_url + "logout",
    success: function (response) {
      alert(response.data);
    },
  });

  window.location.href = "index.html";
}