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


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

function CalluploadStudentPhotos() {
  $("#page_main_div").load(
    "../html_modules/upload_studentphoto.html",
    function () {
      document.getElementById("display_module_name").innerHTML = "Upload Photo";
      document.getElementById("module_name_for_save").value = "Upload Photo";
      clearCalluploadStudentPhotos();
      getDefaultHeadFooterLinks("Upload Photo");
    }
  );
  // $('#module_details_div').hide();
  loadDegreePhoto();
}

function loadDegreePhoto() {
  $.ajax({
    type: "GET",
    url: $host_url + "getBatchWisePracticalDegree",
    success: function (res) {
      var response = JSON.parse(res);
      console.log(response);
      if (response.error_code == 0) {
        var degree = "";
        degree += `<option>---select---</option>`;
        for (var i = 0; i < response.data.length; i++) {
          degree += `<option value="${response.data[i].fdegree}">${response.data[i].fdegree} - ${response.data[i].fdescpn}</option>`;
        }
        $("#degree_code").html(degree);
      } else {
        alert(response.data.data);
        return;
      }
    },
  });
}

function clearCalluploadStudentPhotos() {
  $("#degree_code").val("");
  //document.getElementById('it_module').innerHTML = '';
  $("#degree_code").focus();
}

function viewUploadStudentPhoto() {
  if (trim($("#degree_code").val()) == "") {
    alert("Enter Degree Code ");
    $("#degree_code").focus();
    return;
  }
  var dataString =
    "degreeCode=" +
    $("#degree_code").val() +
    "&regStart=" +
    $("#uploadPhoto_regno_start_from").val() +
    "&regEnd=" +
    $("#uploadPhoto_regno_end_to").val()+"&stype="+$('#stype').val();
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'>Saving... <img src='images/spinner.gif' border='0'></h1>",
  });
  $.ajax({
    type: "POST",
    data: dataString,
    url: $host_url + "viewStudInfoToupload",
    success: viewStudInfoTouploadResponse,
  });
}

function viewStudInfoTouploadResponse($responce) {
  $.unblockUI();
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == -1) {
    alert($responce.data);
  } else {
    $("#uploadPh_studlist").show();
    $("#uploadPh_studlist").html($responce.data["html"]);
  }
}
var row_index = 0;
var filepath;
var regnumb;
function UserSelectedPhotoDisplay(index) {
  row_index = index;

  var valid_file_extentions = new Array("jpeg", "jpg", "png", "gif");

  var ext = $("#student_entry_upload_" + index).val();

  filepath = ext;

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

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

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

  var lstr_data = "&filepath=" + filepath + "&index=" + index;

  $upload = $host_url + "UserSelectedPhotoDisplay&" + lstr_data;

  document
    .getElementById("form_module_image_upload")
    .setAttribute("action", $upload);
  return AIM.submit(
    document.getElementById("form_module_image_upload"),
    "report_display",
    { onComplete: UserSelectedPhotoDisplayResponse }
  );
}

function UserSelectedPhotoDisplayResponse($responce) {
  $responce = eval("(" + $responce + ")");

  if ($responce.error_code == 0)
    $("#student_entry_photo_" + row_index).attr("src", $responce.data);
  else if ($responce.error_code == -1)
    $("#student_entry_photo_" + row_index).attr(
      "src",
      "images/default_photo.jpg"
    );
  else if ($responce.error_code == -2) {
    alert($responce.data);
    $("#student_entry_photo_" + row_index).attr(
      "src",
      "images/default_photo.jpg"
    );
    $("#student_entry_upload_" + row_index).val("");
  }
}

function UserSelectedPhotoUpload(index, regno) {
  var valid_file_extentions = new Array("jpeg", "jpg", "png", "gif");
  var ext = $("#student_entry_photo_" + row_index).attr("src");
  var regno = $("#hd_regno_" + index).val();
  filepath = ext;

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

  if (
    ext == "" ||
    !in_array(ext, valid_file_extentions) ||
    ext == "default_photo.jpg"
  ) {
    alert("Select the Valid Photo!");
    return false;
  }
  $lstr_data = "filepath=" + filepath + "&index=" + index + "&regno=" + regno;
  $upload = $host_url + "saveUserSelectedPhotoUpload&" + $lstr_data;
  document
    .getElementById("form_module_image_upload")
    .setAttribute("action", $upload);
  return AIM.submit(
    document.getElementById("form_module_image_upload"),
    "report_display",
    { onComplete: UserSelectedPhotoUploadResponse }
  );
}

function UserSelectedPhotoUploadResponse($responce) {
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
}