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


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

//10561 10655
function CallEnableRoomAllotment() {
  $("#page_main_div").load("../html_modules/room_allotment.html", function () {
    document.getElementById("display_module_name").innerHTML = "Room Allotment";
    document.getElementById("module_name_for_save").value = "Room Allotment";
    getDefaultHeadFooterLinks("Room Allotment");
    getRoomdetails();
  });
}

function getRoomdetails() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "getRoomdetails",
    success: function (responce) {
      $responce = eval("(" + responce + ")");
      document.getElementById("ra_from").options.length = 0;
      console.log($responce, "anittaaaaa");

      for ($i = 0; $i < $responce.data.room.length; $i++) {
        $op = new Option(
          $responce.data.room[$i]["value"],
          $responce.data.room[$i]["id"]
        );
        $op.id = $responce.data.room[$i]["id"]; //specifying the id  for options
        document.getElementById("ra_from").options.add($op);
      }
      document.getElementById("ra_to").options.length = 0;
      for ($i = 0; $i < $responce.data.room.length; $i++) {
        $op = new Option(
          $responce.data.room[$i]["value"],
          $responce.data.room[$i]["id"]
        );
        $op.id = $responce.data.room[$i]["id"]; //specifying the id  for options
        document.getElementById("ra_to").options.add($op);
      }
    },
  });
}
function DisplayRoomAllotmentDetatils() {
  var qp_code = $("#abs_entry_qp_code").val();
  var ra_stu_cnt = $("#ra_stu_cnt").val();
  var ra_from = $("#ra_from").val();
  var ra_to = $("#ra_to").val();
  //var total_rooms=$("#total_rooms").val();
  if (empty(qp_code)) {
    alert("Please enter the QP Code");
    return false;
  } else if (empty(ra_stu_cnt)) {
    alert("Student Count is zero in CandDetails");
    return false;
  }

  $.ajax({
    type: "POST",
    async: false,
    data:
      "qp_code=" +
      qp_code +
      "&ra_stu_cnt=" +
      ra_stu_cnt +
      "&ra_from=" +
      ra_from +
      "&ra_to=" +
      ra_to,
    url: $host_url + "DisplayRoomAllotmentDetatils",
    success: DisplayRoomAllotmentDetatilsResponse,
  });
}
function DisplayRoomAllotmentDetatilsResponse(responce) {
  responce = eval("(" + responce + ")");
  $("#room_allotment").html("");
  $("#room_allotment").html(responce.data["html"]);
}
function CaclulateRaGrandTotal() {
  var grand_total = 0;
  var table_obj = $("input[id*='ra_input_']");
  jQuery.each(table_obj, function (k, v) {
    i_total = $(this).val();
    grand_total = eval(grand_total + parseFloat(i_total));
  });
  $("#ra_total").val(grand_total);
}
function SaveRoomAllotment() {
  var qp_code = $("#abs_entry_qp_code").val();
  var ra_stu_cnt = $("#ra_stu_cnt").val();
  var total_rooms = $("#total_rooms").val();
  var FSESSION = $("#ra_time").val();
  var FDOE = date_format($("#ra_date").val());
  var ra_total = $("#ra_total").val();
  if (empty(qp_code)) {
    alert("Please enter the QP Code");
    return false;
  } else if (empty(ra_stu_cnt)) {
    alert("Student Count is zero in CandDetails");
    return false;
  }

  if (ra_total != ra_stu_cnt) {
    alert("Alloted Student count should be equal to Total Student Count");
    return false;
  }

  var hall_obj = new Object();
  var table_obj = $("input[id*='ra_input_']");
  jQuery.each(table_obj, function (k, v) {
    hall_no = $(this).attr("id").split("_").pop();
    i_total = $(this).val();
    hall_obj[hall_no] = i_total;
  });
  $.ajax({
    type: "POST",
    async: false,
    data:
      "FSESSION=" +
      FSESSION +
      "&FDOE=" +
      FDOE +
      "&qp_code=" +
      qp_code +
      "&ra_stu_cnt=" +
      ra_stu_cnt +
      "&total_rooms=" +
      total_rooms +
      "&hall_obj=" +
      encodeURIComponent(JSON.stringify(hall_obj)),
    url: $host_url + "SaveRoomAllotment",
    success: SaveRoomAllotmentResponse,
  });
}
function SaveRoomAllotmentResponse(responce) {
  responce = eval("(" + responce + ")");
  if (responce.error_code == 0) {
    alert(responce.data);
  } else {
    alert(responce.data);
  }
}