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


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

function degData() {
  let url = document.URL;
  urlParams = parseURLParams(url);
  console.log(urlParams);
  $.ajax({
    type: "GET",
    url:
      "https://college.universitysolutions.in/app.php?db=" +
      urlParams.db[0] +
      "&a=semWiseResultAnalysis" +
      "&deggrp=" +
      urlParams.deggrp[0] +
      "&degexam=" +
      urlParams.degexam[0] +
      "&yearmode=" +
      urlParams.yearmode[0] +
      "&degree=" +
      urlParams.degree[0],
    success: function (res) {
      let response = JSON.parse(res);
      console.log(response, "anita");
      if (response.error_code == -1) {
        alert(response.data.msg);
      } else {
        google.charts.load("current", { packages: ["corechart"] });
        google.charts.setOnLoadCallback(drawChart);

        let headings = document.createElement("div");
        headings.style.cssText = "line-height: 0.7; text-align: center;";
        let colldet = document.createElement("div");
        headings.appendChild(colldet);

        if (urlParams.db[0] === "jssstu") {
          let heading_1 = document.createElement("p");
          heading_1.style.cssText =
            "font-size: 16px; font-weight: bold; text-align: center;";
          var t = document.createTextNode("JSS MAHAVIDYAPEETHA");
          heading_1.appendChild(t);
          colldet.appendChild(heading_1);
        }

        // let heading_1 = document.createElement("p");
        // heading_1.style.cssText =
        //   "font-size: 14px; font-weight: bold; text-align: center;";
        // var t = document.createTextNode("JSS MAHAVIDYAPEETHA");
        // heading_1.appendChild(t);
        // colldet.appendChild(heading_1);

        let heading_2 = document.createElement("p");
        heading_2.style.cssText =
          "font-size: 18px; font-weight: bold; text-align: center;";
        var t2 = document.createTextNode(response.data.col_det.FUNIVNAME);
        heading_2.appendChild(t2);

        let heading_3 = document.createElement("p");
        heading_3.style.cssText =
          "font-size: 16px; font-weight: bold; text-align: center;";
        var t3 = document.createTextNode(response.data.col_det.state);
        heading_3.appendChild(t3);

        let heading_4 = document.createElement("p");
        heading_4.style.cssText =
          "font-size: 18px; font-weight: bold; text-align: center;";
        var t4 = document.createTextNode(
          "College:" + response.data.obj.college_name
        );
        heading_4.appendChild(t4);

        let heading_5 = document.createElement("p");
        heading_5.style.cssText =
          "font-size: 16px; font-weight: bold; text-align: center;";
        var t5 = document.createTextNode(
          response.data.data.fdeggrp +
            " " +
            "Result Analysis-" +
            response.data.obj.fresexamdate +
            " [ " +
            response.data.obj.fexamname +
            " ]"
        );
        heading_5.appendChild(t5);

        let heading_6 = document.createElement("p");
        heading_6.style.cssText =
          "font-size: 14px; font-weight: bold; text-align: center;";
        var t6 = document.createTextNode(
          "DEGREE :- ( " + urlParams.degree[0] + " )"
        );
        heading_6.appendChild(t6);
        if (urlParams.db[0] !== "sjbit") {
          colldet.appendChild(heading_2);
          colldet.appendChild(heading_3);
          colldet.appendChild(heading_4);
        }
        colldet.appendChild(heading_5);
        colldet.appendChild(heading_6);

        let logo = document.createElement("div");
        logo.style.cssText = "margin-top:25px;";
        let img = document.createElement("img");
        console.log(urlParams.db[0]);

        if (urlParams.db[0] === "sjbit") {
          img.style.cssText = "height:120px; width:800px;";
          img.setAttribute(
            "src",
            "https://college.universitysolutions.in/" +
              urlParams.db[0] +
              "/img/log.jpg"
          );
        } else {
          img.style.cssText =
            "height:70px; width:140px; position:absolute; right:10px;";
          img.setAttribute(
            "src",
            "https://college.universitysolutions.in/" +
              urlParams.db[0] +
              "/img/logo.jpg"
          );
        }

        let line = document.createElement("div");
        line.style.cssText = "border:1px solid;";

        logo.appendChild(img);
        headings.appendChild(logo);
        headings.appendChild(colldet);
        headings.appendChild(line);
        document.getElementById("piechart").appendChild(headings);

        function drawChart() {
          var data = google.visualization.arrayToDataTable([
            ["Degree Group", "Count"],

            ["PASS", parseInt(response.data.data.passed)],
            ["FAIL", parseInt(response.data.data.ffailed)],
          ]);

          var options = {
            // title: "Semester Wise Result: ",
            pieSliceText: "label",
            legend: {
              position: "labeled",
              textStyle: { color: "blue", fontSize: 10 },
            },
            width: 1200,
            height: 800,
          };

          const div = document.createElement(`div`);
          var chart = new google.visualization.PieChart(
            document.getElementById("piechart").appendChild(div)
          );

          chart.draw(data, options);
          let mainHeader = [
            "Number of Students Appeared",
            "Number of Students Passed",
            "Number of Students Failed",
            "Pass Percentage",
          ];
          let records = [
            parseInt(response.data.data.count),
            parseInt(response.data.data.passed),
            parseInt(response.data.data.ffailed),
            (
              (parseInt(response.data.data.passed) /
                parseInt(response.data.data.count)) *
              100
            ).toFixed(2) + "%",
          ];

          // let count = document.createElement("p");
          // count.style.cssText = "font-size: 20px; font-weight: bold;";
          // let c = document.createTextNode(
          //   "Total Number Of Student Appeared =" + response.data.data.count
          // );
          // count.appendChild(c);
          // document.getElementById("piechart").appendChild(count);

          let tableDiv = document.createElement("div");
          tableDiv.setAttribute("class", "table-reponsive");
          let table = document.createElement("table");

          table.setAttribute("class", "table table-bordered");

          let thead = document.createElement("thead");

          table.appendChild(thead);
          let theadRow = document.createElement("tr");
          thead.appendChild(theadRow);
          for (j = 0; j < mainHeader.length; j++) {
            let th = document.createElement("th");
            th.style.cssText =
              "font-size: 20px; font-weight: bold; text-align: center;";
            th.appendChild(document.createTextNode(mainHeader[j]));
            theadRow.appendChild(th);
          }
          let tbody = document.createElement("tbody");
          table.appendChild(tbody);

          for (i = 0; i < records.length; i++) {
            let td = document.createElement("td");
            td.style.cssText =
              "font-size: 20px; font-weight: bold; text-align: center;";
            td.appendChild(document.createTextNode(records[i]));

            tbody.appendChild(td);
          }

          tableDiv.appendChild(table);

          document.getElementById("piechart").appendChild(tableDiv);
        }
      }
    },
  });
}
function parseURLParams(url) {
  var queryStart = url.indexOf("?") + 1,
    queryEnd = url.indexOf("#") + 1 || url.length + 1,
    query = url.slice(queryStart, queryEnd - 1),
    pairs = query.replace(/\+/g, " ").split("&"),
    parms = {},
    i,
    n,
    v,
    nv;

  if (query === url || query === "") return;

  for (i = 0; i < pairs.length; i++) {
    nv = pairs[i].split("=", 2);
    n = decodeURIComponent(nv[0]);
    v = decodeURIComponent(nv[1]);

    if (!parms.hasOwnProperty(n)) parms[n] = [];
    parms[n].push(nv.length === 2 ? v : null);
  }
  return parms;
}