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 : 13.59.217.1


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

function callCIEpendingList() {
  $("#page_main_div").load("../html_modules/CIEpendingList.html", {
    function() {
      document.getElementById("display_module_name").innerHTML =
        "CIE Pending List";
      document.getElementById("module_name_for_save").value =
        "CIE Pending List";
      getDefaultHeadFooterLinks("CIE Pending List");
      getDegree();
    },
  });
}
var selectedDegreesArray = []; // Array to store selected degrees
var selectedSubjecttArray = []; // Array to store selected subjectt

function getDegree() {
  $.ajax({
    type: "GET",
    url: $host_url + "degreeReportcie",
    success: function (response) {
      var res = JSON.parse(response);
      console.log(res.data, "vikkkkkk");

      if (res.error_code == -1) {
        alert(res.data.result);
        return;
      } else {
        document.getElementById("degree").options.length = 0;
        var option = `<option value=''>---Select---</option>
          <option value='All'>All</option>`;
        for (i = 0; i < res.data.result.length; i++) {
          option += `<option value='${res.data.result[i].FDEGREE}'>${res.data.result[i].FDEGREE} - ${res.data.result[i].FDESCPN}</option>`;
        }
        document.getElementById("degree").innerHTML = option;
        $("#degree").val("All");

        // Event listener to capture selected degrees and add to the array
        $("#degree").on("change", function () {
          selectedDegreesArray = $("#degree").val() || [];
          // console.log("Selected Degrees: ", selectedDegreesArray);
        });

        document.getElementById("subjectt").options.length = 0;
        var option1 = `<option value=''>---Select---</option>
        <option value='All'>All</option>`;
        for (i = 0; i < res.data.result1.length; i++) {
          option1 += `<option value='${res.data.result1[i].fsubname}'>${res.data.result1[i].fsubname}</option>`;
        }
        document.getElementById("subjectt").innerHTML = option1;
        $("#subjectt").val("All");


        $("#subjectt").on("change", function () {
          selectedSubjecttArray = $("#subjectt").val() || [];
          console.log("Selected subjectt: ", selectedSubjecttArray);
        });


        var option = `<option value=''>---Select---</option>`;
        for (i = 0; i < res.data.result2.length; i++) {
          option += `<option value='${res.data.result2[i].fexamno}'>${res.data.result2[i].fexamno}-${res.data.result2[i].fexamname}</option>`;
        }
        document.getElementById("semesterr").innerHTML = option;
      }
    },
  });
}

// function getDegree() {
//   $.ajax({
//     type: "GET",
//     url: $host_url + "degreeReportcie",
//     success: function (response) {
//       var res = JSON.parse(response);
//       console.log(res.data, "vikkkkkk");

//       if (res.error_code == -1) {
//         alert(res.data.result);
//         return;
//       } else {
//         document.getElementById("degree").option.length = 0;
//         var option = `<option value=''>---Select---</option>
//           <option value='All'>All</option>`;
//         for (i = 0; i < res.data.result.length; i++) {
//           option += `<option value='${res.data.result[i].FDEGREE}'>${res.data.result[i].FDEGREE} - ${res.data.result[i].FDESCPN}</option>`;
//         }
//         document.getElementById("degree").innerHTML = option;

//         var option1 = `<option value=''>---Select---</option>
//         <option value='All'>All</option>`;
//         for (i = 0; i < res.data.result1.length; i++) {
//           option1 += `<option value='${res.data.result1[i].fsubname}'>${res.data.result1[i].fsubname}</option>`;
//         }
//         document.getElementById("subjectt").innerHTML = option1;
//       }
//     },
//   });
// }
function updateSelectedDegrees() {
  var selectedDegrees = [];
  var selectElement = document.getElementById("degree");

  for (var i = 0; i < selectElement.options.length; i++) {
    var option = selectElement.options[i];
    if (option.selected) {
      selectedDegrees.push(option.value);
    }
  }

  // Update the array with comma-separated values
  var commaSeparatedDegrees = selectedDegrees.join(", ");

  // Now, 'commaSeparatedDegrees' contains the selected degree values with comma separator
  console.log(commaSeparatedDegrees);
}

// function handlerSem() {
//   var degree = document.getElementById("degree").value;
//   $.ajax({
//     type: "GET",
//     data: "&degree=" + degree,
//     url: $host_url + "degreeSemReportcie",
//     success: function (res) {
//       var response = JSON.parse(res);
//       console.log(response, "shitting");
//       if (res.error_code == -1) {
//         alert(res.data);
//         return;
//       } else {
//         var option = `<option value=''>---Select---</option>`;
//         for (i = 0; i < response.data.length; i++) {
//           option += `<option value='${response.data[i].fexamno}'>${response.data[i].fexamno}-${response.data[i].fexamname}</option>`;
//         }
//         document.getElementById("semesterr").innerHTML = option;
//       }
//     },
//   });
// }

function generateCIEpendingList() {
  var semester = document.getElementById("semesterr").value;
  var selectedSubjecttArray = $("#subjectt").val() || [];
  var event = JSON.stringify(selectedSubjecttArray);

  var selectedDegreesArray = $("#degree").val() || [];
  var degree = JSON.stringify(selectedDegreesArray);

  console.log(event, "ssss");

  window.open(
    $host_url +
      "generteCIEpendListReport" +
      "&degree=" +
      degree +
      "&semesterr=" +
      semester +
      "&subjectt=" +
      event
  );
}

function clearCIEpendingList() {
  $("#degree").val("");
  $("#semesterr").val("");
  $("#subjectt").val("");
  // $("#degree").empty();

  // // Add default and "All" options
  // $("#degree").append(`<option value=''>---Select---</option>
  //                     <option value='All'>All</option>`);

  // // Reset the selectedDegreesArray
  // selectedDegreesArray = [];

  // // Optional: Trigger change event if you want to handle it elsewhere
  // $("#degree").trigger("change");
}