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


Current Path : /proc/thread-self/root/var/www/html/college/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/college/js/SubjectType.js

function callSubjectType() {
  $("#page_main_div").load("../html_modules/SubjectType.html", function () {
    // window.enable_proper_module = "SubjectType";
    document.getElementById("display_module_name").innerHTML =
      "Add Subject Type";
    document.getElementById("module_name_for_save").value = "Add Subject Type";
    getDefaultHeadFooterLinks("Add Subject Type");
    getDegreesubtype();
  });
}

function ViewSubjType() {
  $("#page_main_div").load("../html_modules/viewsubtype.html", function () {
    // window.enable_proper_module = "SubjectType";
    document.getElementById("display_module_name").innerHTML =
      "Add Subject Type";
    document.getElementById("module_name_for_save").value = "Add Subject Type";
    getDefaultHeadFooterLinks("Add Subject Type");
    getDegreesubtypedet();
  });
}

function SubjTypeMainPage() {
  $("#page_main_div").load("../html_modules/SubjectType.html", function () {
    // window.enable_proper_module = "SubjectType";
    document.getElementById("display_module_name").innerHTML =
      "Add Subject Type";
    document.getElementById("module_name_for_save").value = "Add Subject Type";
    getDefaultHeadFooterLinks("Add Subject Type");
    getDegreesubtype();
  });
}
var selectedDegreesArray = [];
var selectedSubjecttArray = [];

function getDegreesubtypedet() {
  $.ajax({
    type: "GET",
    url: $host_url + "getDegreesubtypedet",
    success: function (response) {
      var res = JSON.parse(response);
      if (res.error_code == -1) {
        alert(res.data);
        return;
      } else {
        var option = `<option value='All'>All</option>`;
        for (i = 0; i < res.data.length; i++) {
          option += `<option value='${res.data[i].fdegree}'>${res.data[i].fdegree} - ${res.data[i].fdescpn}</option>`;
        }
        document.getElementById("degree").innerHTML = option;
        ViewSubjTypeDet();
      }
    },
  });
}

function Addsubjtype() {
  var degree = document.getElementById("degree").value;
  var type = document.getElementById("type").value;
  var designation = document.getElementById("designation").value;
  var subcount = document.getElementById("subcount").value;
  var order = document.getElementById("order").value;
  if (degree == "") {
    alert("Please select Degree");
    return;
  }
  if (type == "") {
    alert("Please select Type");
    return;
  }
  if (designation == "") {
    alert("Please select Designation");
    return;
  }
  if (subcount == "") {
    alert("Please select Subject Count");
    return;
  }
  if (order == "") {
    alert("Please select Order");
    return;
  }

  $.ajax({
    type: "POST",
    data:
      "&degree=" +
      degree +
      "&type=" +
      type +
      "&designation=" +
      designation +
      "&subcount=" +
      subcount +
      "&order=" +
      order,
    url: $host_url + "Addsubjtype",
    success: function (response) {
      let res = JSON.parse(response);

      if (res.error_code == -1) {
        alert(res.data);
        return;
      } else {
        alert("Subject Type Added successfully.");
        callSubjectType();
      }
    },
    error: function (error) {
      console.error("AJAX request failed:", error);
    },
  });
}

function getDegreesubtype() {
  $.ajax({
    type: "GET",

    url: $host_url + "getDegreesubtype",
    success: function (response) {
      var res = JSON.parse(response);
      if (res.error_code == -1) {
        alert(res.data);
        return;
      } else {
        var option = `<option value=''>---Select---</option>`;
        for (i = 0; i < res.data.length; i++) {
          option += `<option value='${res.data[i].fdegree}'>${res.data[i].fdegree} - ${res.data[i].fdescpn}</option>`;
        }
        document.getElementById("degree").innerHTML = option;
      }
    },
  });
}

function ViewSubjTypeDet() {
  var degree = document.getElementById("degree").value;
  $.ajax({
    type: "GET",
    data: "&degree=" + degree,
    url: $host_url + "ViewSubjTypeDet",
    success: function (response) {
      var res = JSON.parse(response);
      console.log(response),"hijkl;";

      if (res.error_code == -1) {
        alert(res.data.msg);
        document.getElementById("data-table").innerHTML = tableHTML;
        return;
      } else {
        var tableHTML = `
            <table width='98%' cellspacing='0' class='tr_ventor_row' cellpadding='0' border='0' style="
            padding-left: 20px;
        ">
              <th align="left" colspan="8" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper" style="font-size: 12px; padding-left: 10px; height: 24px"></th>
              <tr class="ui-state-default ui-jqgrid-hdiv">
                <td style="padding: 2px; width: 20px; border-left: 1px solid #c5dbec; border-right: 1px solid #c5dbec; border-bottom: 1px solid #c5dbec;">
                  <center>Sl.NO</center>
                </td>
                <td style="padding: 2px; width: 40px; border-left: 1px solid #c5dbec; border-right: 1px solid #c5dbec; border-bottom: 1px solid #c5dbec;">
                  <center>Degree</center>
                </td>
                <td style="padding: 2px; width: 80px; border-left: 1px solid #c5dbec; border-right: 1px solid #c5dbec; border-bottom: 1px solid #c5dbec;">
                  <center>Degree Description</center>
                </td>
                <td style="padding: 2px; width: 150px; border-left: 0px solid #c5dbec; border-right: 1px solid #c5dbec; border-bottom: 1px solid #c5dbec;">
                  <center>subject Description Name</center>
                </td>
                <td style="padding: 2px; width: 25px; border-left: 0px solid #c5dbec; border-right: 1px solid #c5dbec; border-bottom: 1px solid #c5dbec;">
                  <center>Type</center>
                </td>
                <td style="padding: 2px; width: 20px; border-left: 0px solid #c5dbec; border-right: 1px solid #c5dbec; border-bottom: 1px solid #c5dbec;">
                  <center>Count</center>
                </td>
                <td style="padding: 2px; width: 20px; border-left: 0px solid #c5dbec; border-right: 1px solid #c5dbec; border-bottom: 1px solid #c5dbec;">
                  <center>Action</center>
                </td>
              </tr>`;

        for (var i = 0; i < res.data.length; i++) {
          tableHTML += `
              <tr>
                <td align='center' style="border-bottom:1px solid #C5DBEC;border-left: 1px solid #c5dbec; border-right:1px solid #C5DBEC;  padding:2px;">${
                  i + 1
                }</td>
                <td align='center' style="border-bottom:1px solid #C5DBEC;border-left: 1px solid #c5dbec; border-right:1px solid #C5DBEC;  padding:2px;">${
                  res.data[i].fdegree
                }</td>
                <td align='left' style="border-bottom:1px solid #C5DBEC;border-left: 1px solid #c5dbec; border-right:1px solid #C5DBEC;  padding:2px;">${
                  res.data[i].fdescpn
                }</td>
                <td align=';left' style="border-bottom:1px solid #C5DBEC; border-left: 1px solid #c5dbec;border-right:1px solid #C5DBEC;  padding:2px;">${
                  res.data[i].discpn
                }</td>
                <td align='center' style="border-bottom:1px solid #C5DBEC; border-left: 1px solid #c5dbec;border-right:1px solid #C5DBEC;  padding:2px;">${
                  res.data[i].fsubtype
                }</td>
                <td align='center' style="border-bottom:1px solid #C5DBEC; border-left: 1px solid #c5dbec;border-right:1px solid #C5DBEC;  padding:2px;">${
                  res.data[i].ftotsub
                }</td>
                <td align='center' style="border-bottom:1px solid #C5DBEC; border-left: 1px solid #c5dbec;border-right:1px solid #C5DBEC;  padding:2px;"><span
                style="
                  background-color: #008cba;
                  border: none;
                  color: white;
                  padding: 6px 10px;
                  text-align: center;
                  text-decoration: none;
                  display: inline-block;
                  font-size: 13px;
                  cursor: pointer;
                  border-radius: 3px;
                "
                onclick="EditSubTypeRow('${res.data[i].fdegree}', '${
            res.data[i].discpn
          }', '${res.data[i].fsubtype}', '${res.data[i].ftotsub}','${
            res.data[i].ftorder
          }', '${res.data[i].fdescpn}')"

                >Edit</span
              ></td>
              </tr>`;
        }

        tableHTML += `</table>`;

        document.getElementById("data-table").innerHTML = tableHTML;
      }
    },
  });
}

function EditSubTypeRow(
  fdegree,
  discpn,
  fsubtype,
  ftotsub,
  ftorder,
  degdescpn
) {
  // Now, load the HTML page into the main_div
  //BVAH1 third oscar and ciemanotgraphy 99 69 desssss
  $("#page_main_div").load("../html_modules/SubjectType.html", function () {
    // let opt = `<option value='${fdegree}'>${
    //   fdegree + " - " + degdescpn
    // }</option>`;
    let opt = `<option value='${fdegree}'>${fdegree} - ${degdescpn}</option>`;

    $("#degree").html(opt);
    $("#type").val(fsubtype);
    $("#designation").val(discpn);
    $("#subcount").val(ftotsub);
    $("#order").val(ftorder);

    $("#degree").prop("disabled", true);
    $("#type").prop("disabled", true);
  });
}

//   $.ajax({
//     type: "GET",
//     data:
//       "&fdegree=" +
//       fdegree +
//       "&fsubtype=" +
//       fsubtype ,
//     url: $host_url + "EditSubTypeRow",
//     success: function (response) {
//       let res = JSON.parse(response);
//     },
//   });

// function handlerSem() {
//   var degree = document.getElementById("degree").value;

//   console.log(response, "shitting");
//   return;

//   $.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);

  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");
}

function ClearSubjType() {
  callSubjectType();
}
v;