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


Current Path : /proc/thread-self/root/var/www/oasis/js/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/js/iaroomdeclaration.js

function calliaroomdeclaration() {
  $("#page_main_div").load("../html_modules/iaroomdeclaration.html", function() {
    document.getElementById("display_module_name").innerHTML =
      "IA Room Declaration and Capacity";
    document.getElementById("module_name_for_save").value =
      "IA Room Declaration and Capacity";
    getDefaultHeadFooterLinks("IA Room Declaration and Capacity");
    getIARoomDegreeName();
  });
}

function getIARoomDegreeName()
{
  $.ajax({
    type: "POST",
    url: $host_url + "getIaDegName",
    success: getIARoomDegreeNameSuccess,
  });
}

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

  document.getElementById("degree").options.length = 0;
  var deg = $responce.data["degree"];

  $op = new Option("--Select--", "");
  document.getElementById("degree").options.add($op);
  for ($i = 0; $i < deg.length; $i++) {
    $op = new Option(deg[$i]["VALUE"], deg[$i]["internal_code"]);
    $op.id = deg[$i]["internal_code"];
    document.getElementById("degree").options.add($op);
  }
}



function getIARoomDegreeExamName() {
  var degree = $("#degree").val();

  $.ajax({
    type: "POST",
    url: $host_url + "getIADegreeExamName",
    data: "&degree=" + degree,
    success: getIARoomDegreeExamNameSuccess,
  });
}

function getIARoomDegreeExamNameSuccess($responce) {
  $responce = eval("(" + $responce + ")");
  document.getElementById("degexam").options.length = 0;
  var deg = $responce.data["degexam"];
  //console.log(deg);
  $op = new Option("--Select--", "");
  document.getElementById("degexam").options.add($op);
  for ($i = 0; $i < deg.length; $i++) {
    $op = new Option(deg[$i]["VALUE"], deg[$i]["internal_code"]);
    //console.log(deg[$i]['value']);
    $op.id = deg[$i]["internal_code"];
    document.getElementById("degexam").options.add($op);
    //console.log(degree);
  }
}


function DisplayIARoomDeclarationDetatils() {

  var roomcnt = trim(document.getElementById("totalrooms").value);
  var degexam = trim(document.getElementById("degexam").value);
  var degree = trim(document.getElementById("degree").value);

  document.getElementById("roomdeclaration").innerHTML = "";
  if (roomcnt == "") {
    alert("Enter Total Rooms");
    document.getElementById("totalrooms").focus();
    return false;
  }
  $.ajax({
    type: "POST",
    url: $host_url + "displayiaroomdeclarationdetails",
    data:"degexam="+degexam+"&degree="+degree,
    success: function(responce) {
      responce = eval("(" + responce + ")");
      var roomdecl = responce.data;

      var rtable =
        "<table style='padding:3px 4px 3px 3px;margin-left:200px;' class='tr_ventor_row' id='reval_table_data' width='400px' border='0' cellspacing='0' cellpadding='0'>";
      rtable += "<tr class='tr_bg1'>";
      rtable +=
        "<td align='center' style='width:100px;font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Room No</td>";
      rtable +=
        "<td align='center' style='width:200px;font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Room Name</td>";
      rtable +=
        "<td align='center' style='width:100px;font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Capacity</td>";
      rtable +=
        "<td align='center' style='width:100px;font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Order</td>";
      rtable +=
        "<td align='center' style='width:100px;font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>No. of Qpcodes</td>";
      rtable += "</tr>";
      var hval = "";
      for (var i = 1, j = 0, k = roomdecl.length; i <= roomcnt; i++, j++, k--) {
        var roomtitle = "";
        var roomcap = "";
        var order = "";
        var roomno = "000" + i;
        var qpcnt = "";
        roomno = roomno.substring(roomno.length - 3);
        if (k > 0) {
          if (roomdecl[j].roomname != undefined)
            roomtitle = roomdecl[j].roomname;
          if (roomdecl[j].capacity != undefined) roomcap = roomdecl[j].capacity;
          if (roomdecl[j].forder != undefined) order = roomdecl[j].forder;
          if (roomdecl[j].fmaxqpcnt != undefined) qpcnt = roomdecl[j].fmaxqpcnt;
          hval = "";
        } else {
          hval = "i";
        }
        rtable += "<tr class='tbl_row1'>";
        rtable +=
          "<td align='center' style='width:80px;font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><input style='width:80px;text-align:center;' name='roomdecl' type='text' disabled id='1GT" +
          i +
          "' value=" +
          roomno +
          "></td>";
        rtable +=
          "<td align='center' style='width:220px; font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><input style ='width:150px;' type='text'  onchange='updatehval(" +
          i +
          ")' id='2GT" +
          i +
          "'maxlength ='11'  value='" +
          roomtitle +
          "' /></td>";
        rtable +=
          "<td align='center' style='width:100px; font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><input style ='width:50px;text-align:center;' type='text' onchange='updatehval(" +
          i +
          ")' id='3GT" +
          i +
          "' value='" +
          roomcap +
          "' maxlength ='3'  onkeypress='return AcceptNumbersOnly(event);' /></td>";
        rtable +=
          "<td align='center' style='width:100px; font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><input style ='width:50px;text-align:center;' type='text' onchange='updatehval(" +
          i +
          ")' id='4GT" +
          i +
          "' value='" +
          order +
          "' maxlength ='3'  onkeypress='return AcceptNumbersOnly(event);' /> <input type='hidden' id='HGT" +
          i +
          "' value=" +
          hval +
          "></td>";
        rtable +=
          "<td align='center' style='width:100px; font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><input style ='width:50px;text-align:center;' type='text' onchange='updatehval(" +
          i +
          ")' id='5GT" +
          i +
          "' value='" +
          qpcnt +
          "' maxlength ='3'  onkeypress='return AcceptNumbersOnly(event);' /></td>";
        rtable += "</tr>";
      }
      rtable += "</table>";
      document.getElementById("roomdeclaration").innerHTML = rtable;
    }
  });
}

function updatehval(i) {
  if (document.getElementById("HGT" + i).value != "i")
    document.getElementById("HGT" + i).value = "u";
}

function saveiaroomdeclaration() {
  var inputFileds = document.getElementsByTagName("input");

  var degexam = trim(document.getElementById("degexam").value);
  var degree = trim(document.getElementById("degree").value);

  var chkCnt = 0;
  var rowCnt = 0;
  var room_arru = {};
  var room_arri = {};
  for (var counter = 0; counter < inputFileds.length; counter++) {
    if (
      inputFileds[counter].type.toUpperCase() == "TEXT" &&
      inputFileds[counter].name == "roomdecl"
    ) {
      ++chkCnt;
      if (trim(document.getElementById("2GT" + chkCnt).value) == "") {
        alert(
          "Enter Title for the Room No :" +
            document.getElementById("1GT" + chkCnt).value
        );
        document.getElementById("2GT" + chkCnt).focus();
        return false;
      }

      if (trim(document.getElementById("3GT" + chkCnt).value) == "") {
        alert(
          "Enter Capacity for the Room No :" +
            document.getElementById("1GT" + chkCnt).value
        );
        document.getElementById("3GT" + chkCnt).focus();
        return false;
      }

      if (trim(document.getElementById("5GT" + chkCnt).value) == "") {
        alert(
          "Enter No. of qpcodes for the Room No :" +
            document.getElementById("1GT" + chkCnt).value
        );
        document.getElementById("5GT" + chkCnt).focus();
        return false;
      }

      if (trim(document.getElementById("HGT" + chkCnt).value) == "u") {
        room_arru[chkCnt] = new Object();
        room_arru[chkCnt]["roomno"] = document.getElementById(
          "1GT" + chkCnt
        ).value;
        room_arru[chkCnt]["roomname"] = document.getElementById(
          "2GT" + chkCnt
        ).value;
        room_arru[chkCnt]["capacity"] = document.getElementById(
          "3GT" + chkCnt
        ).value;
        room_arru[chkCnt]["order"] = document.getElementById(
          "4GT" + chkCnt
        ).value;
        room_arru[chkCnt]["qpcnt"] = document.getElementById(
          "5GT" + chkCnt
        ).value;
      }
      if (trim(document.getElementById("HGT" + chkCnt).value) == "i") {
        room_arri[chkCnt] = new Object();
        room_arri[chkCnt]["roomno"] = document.getElementById(
          "1GT" + chkCnt
        ).value;
        room_arri[chkCnt]["roomname"] = document.getElementById(
          "2GT" + chkCnt
        ).value;
        room_arri[chkCnt]["capacity"] = document.getElementById(
          "3GT" + chkCnt
        ).value;
        room_arri[chkCnt]["order"] = document.getElementById(
          "4GT" + chkCnt
        ).value;
        room_arri[chkCnt]["qpcnt"] = document.getElementById(
          "5GT" + chkCnt
        ).value;
      }
    }
  }
  var parameters =
    "&room_arri=" +
    encodeURIComponent(JSON.stringify(room_arri)) +
    "&room_arru=" +
    encodeURIComponent(JSON.stringify(room_arru))+"&degexam="+degexam+"&degree="+degree;
  $.ajax({
    type: "POST",
    url: $host_url + "saveiaroomdeclarationdetails",
    data: parameters,
    success: function(responce) {
      responce = eval("(" + responce + ")");
      alert(responce.data);

      document.getElementById("roomdeclaration").innerHTML = "";
    }
  });
}