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


Current Path : /var/www/oasis/js/
Upload File :
Current File : /var/www/oasis/js/batchSetup.js

function callBatchSetupPreparation() {
  $g_entered_batch = "";
  $("#page_main_div").load(
    "../html_modules/batchSetupPreparation.html?v=25052016",
    function () {
      $geditinternalcode = 0;
      window.enable_proper_module = "enableLoadRevaluationt";
      document.getElementById("display_module_name").innerHTML =
        "Batch Preparation";
      document.getElementById("module_name_for_save").value = "SaveBatchSetup";
      document.getElementById("is_add_edit").value = "Edit";
      getDefaultHeadFooterLinks("Batch Setup");

      if (db == "demo") {
        $("#batch_sub_degree_code").val("BCA1");
        $("#batch_sub_degree_name").val(
          "Bachelor of Computer Application (2018 Batch Only)"
        );
        $("#batch_sub_Examno").val("E");
        $("#batch_sub_Exam_name").val("V Semseter");
        $("#batch_sub_final_subcode").val("EP220");
        $("#batch_sub_fsubname").val("Assembly Language Programming Lab");
        $("#batch_sub_maxmark").val("35");
        $("#countvalue").val("75");
      }
      loadDegree();
    }
  );
}

function loadDegree() {
  $.ajax({
    type: "GET",
    url: $host_url + "getBatchWisePRDegree",
    success: function (res) {
      var response = JSON.parse(res);
      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>`;
        }
        $("#batch_sub_degree_code").html(degree);
      } else {
        alert(response.data.data);
        return;
      }
    },
  });
}

function getBatchWiseSemesterDetails() {
  let degree = $("#batch_sub_degree_code").val();
  if (degree == "---select---" || degree == "" || degree == null) {
    alert("Please Select Degree");
    return;
  }
  $.ajax({
    type: "GET",
    url: $host_url + "getBatchWisePRSemister",
    data: "degree=" + degree,
    success: function (res) {
      let response = JSON.parse(res);
      if (response.error_code == 0) {
        var sem = "";
        sem += `<option>---select---</option>`;
        for (var i in response.data) {
          sem += `<option value="${response.data[i].fexamno}">${response.data[i].fexamno} - ${response.data[i].fexamname}</option>`;
          i++;
        }
        $("#batch_sub_Examno").html(sem);
      } else {
        alert(response.data.data);
        return;
      }
    },
  });
}

function getBatchWiseSubjectDetails() {
  let degree = $("#batch_sub_degree_code").val();
  let sem = $("#batch_sub_Examno").val();

  if (degree == "" || degree == null || degree == "---select---") {
    alert("Please Select Degree");
    return;
  }
  if (sem == "" || sem == null || sem == "---select---") {
    alert("Please Select Semester");
    return;
  }
  $.ajax({
    type: "GET",
    url: $host_url + "getBatchWisePRSubject",
    data: "degree=" + degree + "&examno=" + sem,
    success: function (res) {
      let response = JSON.parse(res);
      console.log(response);

      if (response.error_code == -2) {
        alert(response.data);
        return;
      }

      if (response.error_code == -1) {
        alert(response.data);
        return;
      }

      if (response.error_code == 0) {
        var subject = `<option>---select---</option>`;
        var i = 0;
        while (i < response.data.length) {
          subject += `<option value=${response.data[i].fcsubcode}>${response.data[i].fcsubcode} - ${response.data[i].fsubname}</option>`;
          i++;
        }
        $("#batch_sub_final_subcode").html(subject);
      }
    },
  });
}

function GetVivaSubjectDetails() {
  let degree = $("#batch_sub_degree_code").val();
  let sem = $("#batch_sub_Examno").val();
  let subject = $("#batch_sub_final_subcode").val();
  if (degree == "" || degree == null || degree == "---select---") {
    alert("Please Select Degree");
    return;
  }
  if (sem == "" || sem == null || sem == "---select---") {
    alert("Please Select Semester");
    return;
  }
  if (subject == "" || subject == null || subject == "---select---") {
    alert("Please Select Subject");
    return;
  }
  $.ajax({
    type: "GET",
    url: $host_url + "GetVivaSubjectPR",
    data: "&degcode=" + degree + "&subcode=" + subject + "&exam_no=" + sem,
    success: function (res) {
      let response = JSON.parse(res);
      console.log(response);
      if (response.error_code == 0) {
        $("#batch_sub_maxmark").val(response.data.fvalmax);
        $("#batch_viva_subject_code").val(response.data.viva.FVVCODE);
        $("#batch_viva_subject_name").val(response.data.viva.FSUBNAME);
        $("#batch_viva_subject_max_marks").val(response.data.viva.fsmaxmarks);
        gettotalstudentcount();
      }
      if (response.data.viva.length == "0") {
        $("#batch_viva_subject_code").val("");
        $("#batch_viva_subject_name").val("");
        $("#batch_viva_subject_max_marks").val("0");
      }
    },
  });
}
function CalculateBatchDetails() {
  html_objects = $("input[id*='mes_marks_']");
  total_batch_obj = new Object();
  for (i = 1; i <= 12; i++) {
    total_batch_obj[i] = new Object();
    total_batch_obj[i] = 0;
    $("#b" + i).html(0);
  }
  jQuery.each(html_objects, function (k, v) {
    var batch_no = parseFloat($("#" + v["id"]).val());
    if (!empty(batch_no) && batch_no > 0 && batch_no != "00")
      total_batch_obj[batch_no] = eval(total_batch_obj[batch_no] + 1);
  });
  jQuery.each(total_batch_obj, function (kk, vv) {
    if (vv > 0) {
      $("#b" + kk).html(vv);
    }
  });
}
var $batch;
function gettotalstudentcount() {
  var bw_condition;
  if ($("#batch_sub_range").val() == "B/W") {
    condition_name = " between ";
    condition_val =
      "'" +
      $("#batch_sub_range_from").val() +
      "'" +
      " and " +
      "'" +
      $("#batch_sub_range_to").val() +
      "'";
  } else {
    condition_name = "like ";
    condition_val = $("#batch_sub_range_bw").val();
  }

  var list_data = "Degcode=" + $("#batch_sub_degree_code").val();
  list_data += "&Subcode=" + $("#batch_sub_final_subcode").val();
  list_data += "&Examno=" + $("#batch_sub_Examno").val();
  list_data += "&batch_nos=" + $("#batch_nos").val();
  list_data += "&fssubname=" + $("#batch_sub_fssubname").val();
  list_data += "&condition_name=" + condition_name;
  list_data += "&condition_val=" + condition_val;
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'>Getting... <img src='images/spinner.gif' border='0'></h1>",
  });
  $.ajax({
    type: "POST",
    url: $host_url + "Getstudentcount",
    data: list_data,
    success: function ($responce) {
      $responce = eval("(" + $responce + ")");
      $.unblockUI();
      if ($responce.error_code == 0) {
        document.getElementById("countvalue").value = $responce.data["count"];
        $batch = $responce.data["batchno"];
        if ($responce.data["batchno"] != 0) {
          document.getElementById("batch_nos").disabled = true;
        } else {
          document.getElementById("batch_nos").disabled = false;
        }
      } else {
        alert($responce.data);
        return;
      }
    },
  });
}
function GetBatchWiseRegNos() {
  $("#mes_default_reg_div").hide();

  if ($("#batch_sub_degree_code").val() == "---select---") {
    alert("Please Select Degree");
    $("#batch_sub_degree_code").focus();
    return;
  }
  if ($("#batch_sub_final_subcode").val() == "---select---") {
    alert("Please Select Subject");
    $("#batch_sub_final_subcode").focus();
    return;
  }
  if ($("#batch_sub_Examno").val() == "---select---") {
    alert("Please Select Examno");
    $("#batch_sub_Examno").focus();
    return;
  }
  var $batchno = $("#batch_nos").val();
  var batch_stat = $("#batch_stat").val();
  var $count = $("#countvalue").val();

  if (parseInt($count) < parseInt($batchno)) {
    alert("No. of Students Per Batch is greater than students count.");
    $("#batch_nos").focus();
    return;
  }
  if ($batch == 0) {
    /* if($("#batch_nos").val()=="")
		{
			alert("Please Enter No. of Students Per Batch");
			$("#batch_nos").focus();
			return;
		}  */
  }
  var bw_condition;
  if ($("#batch_sub_range").val() == "B/W") {
    condition_name = " between ";
    condition_val =
      "'" +
      $("#batch_sub_range_from").val() +
      "'" +
      " and " +
      "'" +
      $("#batch_sub_range_to").val() +
      "'";
  } else {
    condition_name = "like ";
    condition_val = $("#batch_sub_range_bw").val();
  }

  var list_data = "Degcode=" + $("#batch_sub_degree_code").val();
  list_data += "&Subcode=" + $("#batch_sub_final_subcode").val();
  list_data += "&Examno=" + $("#batch_sub_Examno").val();
  list_data += "&batch_nos=" + $("#batch_nos").val();
  list_data += "&batch_stat=" + $("#batch_stat").val();
  list_data += "&fssubname=" + $("#batch_sub_fssubname").val();

  list_data += "&condition_name=" + condition_name;
  list_data += "&condition_val=" + condition_val;
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'>Getting... <img src='images/spinner.gif' border='0'></h1>",
  });
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "GetBatchWiseRegNos",
    data: list_data,
    success: GetBatchWiseRegNosResponse,
  });
}

function GetBatchWiseRegNosResponse($responce) {
  $responce = eval("(" + $responce + ")");
  $.unblockUI();
  $("#btc_default_reg_div").html("");
  if ($responce.error_code == 0) {
    $("#btc_default_reg_div").load($responce.data.filenme, function () {
      CalculateBatchDetails();
    });
  }
}

function SaveBatchWiseDetails() {
  var list_data = "&Degcode=" + $("#batch_sub_degree_code").val();
  list_data += "&Subcode=" + $("#batch_sub_final_subcode").val();
  list_data += "&VivaSubcode=" + $("#batch_viva_subject_code").val();
  list_data += "&Examno=" + $("#batch_sub_Examno").val();
  list_data += "&batch_nos=" + $("#batch_nos").val();
  $length_of_marks = $("input[id*='hidden_']").length;

  save_obj = new Object();
  $mes_all_reg_nos = "";
  count_marks = 0;
  html_objects = $("input[id*='mes_marks_']");
  var i = 0;
  jQuery.each(html_objects, function (k, v) {
    var batch_no = $("#" + v["id"]).val();
    var reg_no = v["id"].split("mes_marks_")[1];
    save_obj[i] = new Object();
    save_obj[i]["reg_no"] = reg_no;
    save_obj[i]["batch_no"] = batch_no;
    i++;
  });

  var myJSONText = encodeURIComponent(JSON.stringify(save_obj));
  list_data += "&output_details=" + myJSONText;

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'>Saving... <img src='images/spinner.gif' border='0'></h1>",
  });
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "SaveBatchWiseDetails",
    data: list_data,
    success: SaveBatchWiseDetailsResponce,
  });
}
function SaveBatchWiseDetailsResponce(responce) {
  responce = eval("(" + responce + ")");
  $.unblockUI();
  alert(responce.data);
  $("#btc_default_reg_div").html("");
}