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


Current Path : /var/www/oasis/js_old/
Upload File :
Current File : /var/www/oasis/js_old/feeupdation_bulk.js

var totallength = "";

function CallEnablefeeInfoBulk() {
  $("#page_main_div").load("../html_modules/feeupdation_bulk.html", function() {
    document.getElementById("display_module_name").innerHTML =
      "Update Fee Information";
    document.getElementById("module_name_for_save").value =
      "Update Fee Information";
    getDefaultHeadFooterLinks("Upadte Fee Information");
    $("#fee_details").hide();
  });
}

function getpopupblk() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "getfeeInformationBulk",
    success: getfeeInformationBulkResponce
  });
}

function getfeeInformationBulkResponce(responce) {
  responce = eval("(" + responce + ")");

  var category = responce.data["category"];
  var FCONSTYPE = responce.data["FCONSTYPE"];
  var FEXAMNO = responce.data["FEXAMNO"];
  var FDEGREE = responce.data["FDEGREE"];
  validCat = category.cat.split("*");
  validExamNo = FEXAMNO.exam.split("*");

  document.getElementById("candidate_list_category").value = category.cat;
  document.getElementById("FCONSTYPE").options.length = 0;
  document.getElementById("candidate_list_examno").value = FEXAMNO.exam;
  document.getElementById("candidate_list_degree").options.length = 0;

  $op = new Option();
  $op.id = 0; //specifying the id  for options
  //document.getElementById("candidate_list_category").options.add($op);

  for ($i = 0; $i < FCONSTYPE.length; $i++) {
    $op = new Option(FCONSTYPE[$i]["value"], FCONSTYPE[$i]["internal_code"]);
    $op.id = FCONSTYPE[$i]["internal_code"]; //specifying the id  for options
    document.getElementById("FCONSTYPE").options.add($op);
  }

  for ($i = 0; $i < FDEGREE.length; $i++) {
    $op = new Option(FDEGREE[$i]["value"], FDEGREE[$i]["internal_code"]);
    $op.id = FDEGREE[$i]["internal_code"]; //specifying the id  for options
    document.getElementById("candidate_list_degree").options.add($op);
  }
}

var validExamNo = [];
var validCat = [];

function displayfeeDetailsblk() {
  var feetype = document.getElementById("FCONSTYPE").value;
  var examno = document.getElementById("candidate_list_examno").value;
  var degree = document.getElementById("candidate_list_degree").value;
  var category = document.getElementById("candidate_list_category").value;

  if (category == "") {
    alert("Please Enter category");
    return;
  } else {
    var rgUsrCategory = category.toUpperCase().split("*");
    var rgUsrValidCategory = [];
    var flag = true;

    for (let i = 0; i < rgUsrCategory.length; i++) {
      if (in_array(rgUsrCategory[i], validCat)) {
        if (!in_array(rgUsrCategory[i], rgUsrValidCategory))
          rgUsrValidCategory.push(rgUsrCategory[i]);
      } else {
        flag = false;
      }
    }

    if (!flag) {
      alert("Enter valid category");
      return;
    }
  }

  if (examno == "") {
    alert("Please Enter Exam No.");
    return;
  } else {
    var rgUsrExamno = examno.toUpperCase().split("*");
    var rgUsrValidExamno = [];
    var flag = true;
    for (let i = 0; i < rgUsrExamno.length; i++) {
      if (in_array(rgUsrExamno[i], validExamNo)) {
        if (!in_array(rgUsrExamno[i], rgUsrValidExamno))
          rgUsrValidExamno.push(rgUsrExamno[i]);
      } else {
        flag = false;
      }
    }
    if (!flag) {
      alert("Enter valid Exam No.");
      return;
    }
  }

  var datastring =
    "&feetype=" +
    feetype +
    "&examno=" +
    JSON.stringify(rgUsrValidExamno) +
    "&degreegrp=" +
    degree +
    "&category=" +
    JSON.stringify(rgUsrValidCategory);

  $("#fee_details").html("");
  //$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>" });

  $.ajax({
    type: "POST",
    url: $host_url + "displayfeeDetailsBulk",
    data: datastring,
    success: displayfeeDetailsBulkSuccess
  });
}

function displayfeeDetailsBulkSuccess(responce) {
  $("#fee_details").show();
  responce = eval("(" + responce + ")");
  //$.unblockUI();
  if (responce.data.diff == "T") {
    if (
      !confirm(
        "Diffrence in fee structure for given range do you want to continue"
      )
    )
      return;
  }
  $("#fee_details").load("../html_modules/feedetail.html", function() {
    totallength = responce.data.totallength;
    $("#fee_indet_table").append(responce.data.details);
  });
}

function savefeeInformation() {
  var feetype = document.getElementById("FCONSTYPE").value;
  var degree = document.getElementById("candidate_list_degree").value;
  var examno = document.getElementById("candidate_list_examno").value;
  var category = document.getElementById("candidate_list_category").value;
  var fmodule = document.getElementById("fmodule").value;

  if (category == "") {
    alert("Please Enter category");
    return;
  } else {
    var rgUsrCategory = category.toUpperCase().split("*");
    var rgUsrValidCategory = [];
    var flag = true;

    for (let i = 0; i < rgUsrCategory.length; i++) {
      if (in_array(rgUsrCategory[i], validCat)) {
        if (!in_array(rgUsrCategory[i], rgUsrValidCategory))
          rgUsrValidCategory.push(rgUsrCategory[i]);
      } else {
        flag = false;
      }
    }

    if (!flag) {
      alert("Enter valid category");
      return;
    }
  }

  if (examno == "") {
    alert("Please Enter Exam No.");
    return;
  } else {
    var rgUsrExamno = examno.toUpperCase().split("*");
    var rgUsrValidExamno = [];
    var flag = true;
    for (let i = 0; i < rgUsrExamno.length; i++) {
      if (in_array(rgUsrExamno[i], validExamNo)) {
        if (!in_array(rgUsrExamno[i], rgUsrValidExamno))
          rgUsrValidExamno.push(rgUsrExamno[i]);
      } else {
        flag = false;
      }
    }
    if (!flag) {
      alert("Enter valid Exam No.");
      return;
    }
  }

  var chkCnt = 0;
  var j = 0;
  var feeArray = [];
  $("#fee_indet_table tr.content").each((i, el) => {
    var row = $(el).find("td input");
    var rowObj = {};
    $.each(row, (j, val) => {
      rowObj[val.name] = val.value;
    });
    feeArray.push(rowObj);
  });

  var validFeeArray = feeArray.filter(obj => {
    return obj.maxfee != 0;
  });
  //$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>" });

  var datastring =
    "&feetype=" +
    feetype +
    "&examno=" +
    JSON.stringify(rgUsrValidExamno) +
    "&degreegrp=" +
    degree +
    "&category=" +
    JSON.stringify(rgUsrValidCategory) +
    "&feedetail=" +
    JSON.stringify(validFeeArray);
  $.ajax({
    type: "POST",
    url: $host_url + "savefeeInformationBulk",
    data: datastring,
    success: savefeeInformationBlkresponse
  });
}

function savefeeInformationBlkresponse(responce) {
  responce = eval("(" + responce + ")");
  alert(responce.data.msg);
  displayfeeDetailsblk();
}

function to_upperx(id) {
  var x = document.getElementById(id).value;
  document.getElementById(id).value = x.toUpperCase();
}