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


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

function CallEnableCreateAdmission() {
  $("#page_main_div").load("../html_modules/createAdmission.html", function () {
    document.getElementById("display_module_name").innerHTML =
      "Create Admission Basic Data";
    document.getElementById("module_name_for_save").value =
      "Create Admission Basic Data";
    getDefaultHeadFooterLinks("Create Admission Data");
    loadDegree();
    $("#mode").val("add");
  });
}

function ViewAdmissionData() {
  $("#page_main_div").load(
    "../html_modules/ViewAdmissionData.html",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Create Admission Basic Data";
      document.getElementById("module_name_for_save").value =
        "Create Admission Basic Data";
      getDefaultHeadFooterLinks("Create Admission Data");
      loadDegree();
      $("#adm_data").html("");
    }
  );
}

function loadDegComb() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "loadDegComb",
    data: "degcode=" + $("#fdegree").val(),
    success: function ($responceCat) {
      $responceCat = eval("(" + $responceCat + ")");
      if ($responceCat.error_code == 0) {
        var optionsAsString =
          "<option value=''>--Select Combination--</option>";
        for (var i = 0; i < $responceCat.data.length; i++) {
          optionsAsString +=
            "<option value='" +
            $responceCat.data[i].internal_code +
            "'>" +
            $responceCat.data[i].internal_code +
            "-" +
            $responceCat.data[i].value +
            "</option>";
        }

        $("#fcombcode").html(optionsAsString);
      }
    },
    error: function (data) {
      alert(data);
    },
  });
}

function loadDegree() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "loaddegree",
    success: function ($responceCat) {
      $responceCat = eval("(" + $responceCat + ")");
      if ($responceCat.error_code == 0) {
        var optionsAsString = "<option value=''>--Select Degree--</option>";
        for (var i = 0; i < $responceCat.data.length; i++) {
          optionsAsString +=
            "<option value='" +
            $responceCat.data[i].internal_code +
            "'>" +
            $responceCat.data[i].internal_code +
            "-" +
            $responceCat.data[i].value +
            "</option>";
        }

        $("#fdegree").append(optionsAsString);
      }
    },
    error: function (data) {
      alert(data);
    },
  });
}

function loaddegreeResponse($responceCat) {
  $responceCat = eval("(" + $responceCat + ")");
  if ($responceCat.error_code == 0) {
    var optionsAsString = "<option value=''>--Select Degree--</option>";
    for (var i = 0; i < $responceCat.data.length; i++) {
      optionsAsString +=
        "<option value='" +
        $responceCat.data[i].internal_code +
        "'>" +
        $responceCat.data[i].internal_code +
        "-" +
        $responceCat.data[i].value +
        "</option>";
    }

    $("#fdegree").append(optionsAsString);
  }
}

function savestudentdata() {
  var fdegree = $("#fdegree").val();
  var fname = $("#fname").val();
  var catcode = '';//$("#catcode").val();
  //var fcombcode = $("#fcombcode").val();
  var femail = $("#femail").val();
  var fmobileno = $("#fmobileno").val();
  var mode = $("#mode").val();
  var fstudidno = $("#fstudidno").val();

  var wom = "F";
  // if (document.getElementById("wom").checked == true) {
  //   wom = "T";
  //   document.getElementById("fmobileno").disabled = true;
  // }
  if (empty(fdegree)) {
    alert("Please Select Degree");
    $("#fdegree").focus();
    return false;
  }
  if (fname == "") {
    alert("Please Enter Student Name");
    $("#fname").focus();
    return false;
  }
  // if (fcombcode == "") {
  //   alert("Please Select Combination");
  //   $("#fcombcode").focus();
  //   return false;
  // }

  // if (catcode == "") {
  //   alert("Please Select Category");
  //   $("#catcode").focus();
  //   return false;
  // }

  if (wom == "F") {
    if (fmobileno.length < 10) {
      alert("Please Enter Mobile Number Correclty");
      $("#fmobileno").focus();
      return false;
    }
    if (fmobileno == "") {
      alert("Please Enter Mobile Number");
      $("#fmobileno").focus();
      return false;
    }
  }

  if ($("#LT").val() == "T") {
    var degree = $("#fdegree").val();
    if (degree[degree.length - 1] == 2) {
      alert(`For ${degree} 1st semester, the degree code is ${degree}`);
      return;
    }
  }

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });
  var parameters = `&fdegree=${$("#fdegree").val()}
						&fname=${$("#fname").val()}
						&femail=${$("#femail").val()}
						&fmobileno=${$("#fmobileno").val()}
						&LT=${$("#LT").val()}
						&wom=${wom}&catcode=${catcode}&mode=${mode}&fstudidno=${fstudidno}`;
            //&fcombcode=${fcombcode}
  $.ajax({
    type: "POST",
    data: parameters,
    url: $host_url + "savestudentdata",
    success: savestudentdataResponce,
  });
}

function savestudentdataResponce(responce) {
  responce = eval("(" + responce + ")");
  $.unblockUI();
  if (responce.error_code == "-1") {
    var msg = "Updation Failure. The Given Mobile Number Exist in \n";
    msg += `\t College Code : ${responce.data.fcollcode} \n`;
    msg += `\t Degree Code : ${responce.data.fdegree} \n`;
    msg += `\t Name : ${responce.data.fname} \n`;
    msg += `\t Email Id : ${responce.data.femail} \n`;
    msg += `\t Mobile Number : ${responce.data.fmobileno} \n`;

    alert(msg);
    $("#fname").val("");
    $("#femail").val("");
    $("#fmobileno").val("");
    $("#fname").focus();
    return;
  } else if (responce.error_code == "-2") {
    alert(responce.data);

    $("#fname").val("");
    $("#femail").val("");
    $("#fmobileno").val("");
    $("#fname").focus();
    return;
  } else if (responce.error_code == "0") {
    alert(responce.data);
    $("#fname").val("");
    $("#femail").val("");
    $("#fmobileno").val("");
    $("#fname").focus();
    return;
  }
}

function checkwob() {
  document.getElementById("fmobileno").disabled = false;
  if (document.getElementById("wom").checked == true)
    document.getElementById("fmobileno").disabled = true;
}

function viewStuddet() {
  var fdegree = $("#fdegree").val();

  if (fdegree == "") {
    alert("Please Select Degree");
    $("#fdegree").focus();
    return false;
  }

  var parameters = `&fdegree=${fdegree}`;

  $.ajax({
    type: "POST",
    async: false,
    data: parameters,
    url: $host_url + "viewStuddet",
    success: function ($responceCat) {
      $responceCat = eval("(" + $responceCat + ")");
      if ($responceCat.error_code == 0) {
        var table = `<table
        style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='reval_table_data' width='100%' border='0' cellspacing='0' cellpadding='0'>
        <tr class='ui-state-default ui-jqgrid-hdiv'>
          <td align='center' style='padding:4px;width: 50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >Sl. No.</td>
          <td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >Mobile No.</td>
          <td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >Student Name</td>
          <td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >Caste</td>
          <td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >Status</td>
          <td align='center' style=' font-size:11px; width: 50px;border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >Edit</td>
          <td align='center' style=' font-size:11px; width: 50px;border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >Delete</td>
        </tr>`;
        var $class = "";
        for (var i = 0; i < $responceCat.data.studdata.length; i++) {
          if (i % 2 == 0) $class = "tbl_row1";
          else $class = "tbl_row_alter1";

          table += `<tr>
          <td class=' tbl_row_new' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'>${
            i + 1
          }</td>
          <td class=' tbl_row_new' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >${
            $responceCat.data.studdata[i].fmobileno
          }</td>
          <td class=' tbl_row_new' style='text-align:left; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >${
            $responceCat.data.studdata[i].fname
          }</td>
          <td class=' tbl_row_new' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >${
            $responceCat.data.studdata[i].fcaste
          }</td>
          
          <td class=' tbl_row_new' style='text-align:left; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >${
            $responceCat.data.studdata[i].fstatus
          }</td>
          <td class=' tbl_row_new' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >
          <span
            style="background-color: #3c9c40; border: none; color: white; padding: 5px 10px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;"
            onclick="editadmdata('${
              $responceCat.data.studdata[i].fmobileno
            }');">Edit</span
          >
          </center>
          </td>
          <td class=' tbl_row_new' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >
          <span
            style="background-color: #e63838; border: none; color: white; padding: 5px 10px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;"
            onclick="deleteadmdata('${
              $responceCat.data.studdata[i].fmobileno
            }');">Delete</span
          >
          </center>
          </td>
          </tr>`;
        }

        $("#adm_data").html(table);
      } else {
        alert($responceCat.data);
        $("#adm_data").html("");
        return;
      }
    },
    error: function (data) {
      alert(data);
    },
  });
}

function editadmdata(mob) {
  $.ajax({
    type: "POST",
    async: false,
    data: "mob=" + mob,
    url: $host_url + "editadmdata",
    success: function ($responceCat) {
      $responceCat = eval("(" + $responceCat + ")");
      if ($responceCat.error_code == 0) {
        CallEnableCreateAdmission();

        $("#page_main_div").load(
          "../html_modules/createAdmission.html",
          function () {
            document.getElementById("display_module_name").innerHTML =
              "Create Admission Basic Data";
            document.getElementById("module_name_for_save").value =
              "Create Admission Basic Data";
            getDefaultHeadFooterLinks("Create Admission Data");
            loadDegree();
            var collstud = $responceCat.data;
            $("#fname").val(collstud.data.FNAME);
            $("#fdegree").val(collstud.data.FDEGREE);
            $("#femail").val(collstud.data.FEMAIL);
            $("#fmobileno").val(collstud.data.FMOBILENO);
            $("#fstudidno").val(collstud.data.fcstudidno);
            //$("#catcode").val(collstud.data.FCASTE);
            //loadDegComb();
            //$("#fcombcode").val(collstud.data.FCOMBCODE);
            $("#mode").val("edit");
            //document.getElementById("fcombcode").disabled = true;
            document.getElementById("fmobileno").disabled = true;
            document.getElementById("fdegree").disabled = true;
          }
        );
      } else {
        alert($responceCat.data);
        return;
      }
    },
    error: function (data) {
      alert(data);
    },
  });
}

function deleteadmdata(mob) {
  var r = confirm(
    "Do you want to delete this data? This action will delete basic admission details and admission details in admission portal"
  );
  if (r == true) {
    $.ajax({
      type: "POST",
      async: false,
      data: "mob=" + mob,
      url: $host_url + "deleteadmdata",
      success: function ($responceCat) {
        $responceCat = eval("(" + $responceCat + ")");
        if ($responceCat.error_code == 0) {
          alert($responceCat.data);
          viewStuddet();
          return;
        } else {
          alert($responceCat.data);
          return;
        }
      },
      error: function (data) {
        alert(data);
      },
    });
  } else {
    return;
  }
}