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


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

function callupdatecopo() {
  // console.log('hi');
  $("#page_main_div").load("html_modules/updatecopo.html", function () {
    document.getElementById("display_module_name").innerHTML = "Update COPO";
    document.getElementById("module_name_for_save").value = "Update COPO";
    getDefaultHeadFooterLinks("Update COPO");
    loadtempcode();
  });
}

function loadtempcode() {
  $.ajax({
    type: "GET",
    url: $host_url + "loadtempcode",
    success: function (response) {
      var res = JSON.parse(response);
      // console.log(res.data.tempcode[0]);
      // return;
      var tempcodeopt = `<option value = "">----Select----</option>`;
      for (var i = 0; i < res.data.tempcode.length; i++) {
        tempcodeopt += `<option value = ${res.data.tempcode[i].ftempcode}>${res.data.tempcode[i].tcode}</option>`;
      }

      var degree = `<option value = "">----Select----</option>`;
      for (var i = 0; i < res.data.degree.length; i++) {
        degree += `<option value = ${res.data.degree[i].fdegree}>${res.data.degree[i].fdegree} - ${res.data.degree[i].fdescpn}</option>`;
      }
      $("#degree").html(degree);
      $("#tempcodecopo").html(tempcodeopt);
    },
  });
}

function loadexamno() {
  var deg = document.getElementById("degree").value;

  $.ajax({
    type: "GET",
    data: "degree=" + deg,
    url: $host_url + "loadexamno",
    success: function (response) {
      var res = JSON.parse(response);
      var examno = `<option value = "">----Select----</option>`;
      for (var i = 0; i < res.data.length; i++) {
        examno += `<option value = ${res.data[i].fexamno}>${res.data[i].fexamname}</option>`;
      }
      $("#examno").html(examno);
    },
  });
}

function loadqpcode() {
  var deg = document.getElementById("degree").value;
  var examno = document.getElementById("examno").value;
  var element = document.getElementById("element").value;

  if (element == "theory") {
    $.ajax({
      type: "GET",
      data: "element=" + element + "&degree=" + deg + "&examno=" + examno,
      url: $host_url + "loadqpcodetemp",
      success: function (response) {
        var res = JSON.parse(response);
        var qpcode = `<option value = "">----Select----</option>`;
        for (var i = 0; i < res.data.length; i++) {
          qpcode += `<option value = ${res.data[i].fqpcode}>${res.data[i].fqpcode}-${res.data[i].fsubname}</option>`;
        }
        $("#qpcode").html(qpcode);
      },
    });
  } else {
    $.ajax({
      type: "GET",
      data: "element=" + element + "&degree=" + deg + "&examno=" + examno,
      url: $host_url + "loadqpcodetemp",
      success: function (response) {
        var res = JSON.parse(response);
        var qpcode = `<option value = "">----Select----</option>`;
        for (var i = 0; i < res.data.length; i++) {
          qpcode += `<option value = ${res.data[i].fcsubcode}>${res.data[i].fcsubcode}-${res.data[i].fsubname}</option>`;
        }
        $("#qpcode").html(qpcode);
      },
    });
  }
}

function viewTemptab() {
  var element = document.getElementById("element").value;
  var tempcode = document.getElementById("tempcodecopo").value;
  var deg = document.getElementById("degree").value;
  var examno = document.getElementById("examno").value;
  var qpcode = document.getElementById("qpcode").value;

  $.ajax({
    type: "GET",
    data:
      "degree=" +
      deg +
      "&examno=" +
      examno +
      "&qpcode=" +
      qpcode +
      "&tempcode=" +
      tempcode +
      "&element=" +
      element,
    url: $host_url + "viewtemplatecodetab",
    success: function (response) {
      var res = JSON.parse(response);

      if (res.error_code == 0) {
        var slno = 1;
        var copo = `<table id="pocotab" class="content-tbl" width="70%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
        <tbody>
          <tr>
          <th align="left" colspan="7" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper" 
          style="font-size:15px; padding-left:6px; height:24px;">Update COPO</th>
          </tr>
          <td align="center" style="width:20px; font-size:12px; 
          border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Sl. No.</td>

          <td align="center" style="width:20px; font-size:12px; padding:5px 5px; 
           border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Qusetion No.</td>
  
          <td align="center" style="width:20px; font-size:12px; padding:5px 5px; 
           border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Max. Marks</td>
  
          <td align="center" style="width:500px; font-size:12px;  
          border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Details</td>
          </tr>`;

        for (var i = 0; i < res.data.length; i++) {
          copo += `<tr class="ui-widget-content jqgrow" id = '${slno}'>
              <td class="tbl_row_new" style="border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${slno}</td>
  
              <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${res.data[i].fqnno}</td>
              <td class="tbl_row_new" style="text-align:initial;border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">
              <input type="text" id="maxmarks_${slno}" style='width:90%;' name="maxmarks" value="${res.data[i].fmaxmarks}">
              <input type="hidden" id="partcode_${slno}" name="partcode" value="${res.data[i].fpartcode}">
              <input type="hidden" id="qncode_${slno}" name="qncode" value="${res.data[i].fqncode}">
              </td>
  
              <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; ">
              <label style = 'padding-right: 9px;' >PO1</label><input type="checkbox" id="PO1_${slno}" name="PO1" value="PO1">
              <label style = 'padding-right: 9px;' >PO2</label><input type="checkbox" id="PO2_${slno}" name="PO2" value="PO2">
              <label style = 'padding-right: 9px;' >PO3</label><input type="checkbox" id="PO3_${slno}" name="PO3" value="PO3">
              <label style = 'padding-right: 9px;' >PO4</label><input type="checkbox" id="PO4_${slno}" name="PO4" value="PO4">
              <label style = 'padding-right: 9px;' >PO5</label><input type="checkbox" id="PO5_${slno}" name="PO5" value="PO5">
              <label style = 'padding-right: 9px;' >PO6</label><input type="checkbox" id="PO6_${slno}" name="PO6" value="PO6">
              <label style = 'padding-right: 9px;' >PO7</label><input type="checkbox" id="PO7_${slno}" name="PO7" value="PO7">
              <label style = 'padding-right: 9px;' >PO8</label><input type="checkbox" id="PO8_${slno}" name="PO8" value="PO8">
              <label style = 'padding-right: 9px;' >PO9</label><input type="checkbox" id="PO9_${slno}" name="PO9" value="PO9">
              <label style = 'padding-right: 9px;' >PO10</label><input type="checkbox" id="PO10_${slno}" name="PO10" value="PO10">
              <label style = 'padding-right: 9px;' >PO11</label><input type="checkbox" id="PO11_${slno}" name="PO11" value="PO11">
              <label style = 'padding-right: 9px;' >PO12</label><input type="checkbox" id="PO12_${slno}" name="PO12" value="PO12">
              <br>
              <span></span>
              <label style = 'padding-right: 8px;' >CO1</label><input type="checkbox"  id="CO1_${slno}" name="CO1" value="CO1">
              <label style = 'padding-right: 8px;' >CO2</label><input type="checkbox"  id="CO2_${slno}" name="CO2" value="CO2">
              <label style = 'padding-right: 8px;' >CO3</label><input type="checkbox"  id="CO3_${slno}" name="CO3" value="CO3">
              <label style = 'padding-right: 8px;' >CO4</label><input type="checkbox"  id="CO4_${slno}" name="CO4" value="CO4">
              <label style = 'padding-right: 8px;' >CO5</label><input type="checkbox"  id="CO5_${slno}" name="CO5" value="CO5">
              <label style = 'padding-right: 8px;' >CO6</label><input type="checkbox"  id="CO6_${slno}" name="CO6" value="CO6">
              <br>
              <span></span>
              <label>PSO1</label><input type="checkbox"  id="PSO1_${slno}" name="PSO1" value="PSO1">
              <label>PSO2</label><input type="checkbox"  id="PSO2_${slno}" name="PSO2" value="PSO2">
              <label>PSO3</label><input type="checkbox"  id="PSO3_${slno}" name="PSO3" value="PSO3">
              <label>PSO4</label><input type="checkbox"  id="PSO4_${slno}" name="PSO4" value="PSO4">
              <label>PSO5</label><input type="checkbox"  id="PSO5_${slno}" name="PSO5" value="PSO5"><br>
              
              
              </td>

             
            </tr>`;

          slno++;
        }
        $("#copotab").html(copo);
        slno = 1;

        for (var i = 0; i < res.data.length; i++) {
          if (res.data[i].fpo.split("*").indexOf("PO1") != -1) {
            $(`#PO1_${slno}`).attr("checked", "checked");
          }

          if (res.data[i].fpo.split("*").indexOf("PO2") != -1) {
            $("#PO2_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpo.split("*").indexOf("PO3") != -1) {
            $("#PO3_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpo.split("*").indexOf("PO4") != -1) {
            $("#PO4_" + slno).attr("checked", "checked");
          }

          if (res.data[i].fpo.split("*").indexOf("PO5") != -1) {
            $("#PO5_" + slno).attr("checked", "checked");
          }

          if (res.data[i].fpo.split("*").indexOf("PO6") != -1) {
            $("#PO6_" + slno).attr("checked", "checked");
          }

          if (res.data[i].fpo.split("*").indexOf("PO7") != -1) {
            $("#P7_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpo.split("*").indexOf("PO8") != -1) {
            $("#PO8_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpo.split("*").indexOf("PO9") != -1) {
            $("#PO9_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpo.split("*").indexOf("PO10") != -1) {
            $("#PO10_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpo.split("*").indexOf("PO11") != -1) {
            $("#PO11_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpo.split("*").indexOf("PO12") != -1) {
            $("#PO12_" + slno).attr("checked", "checked");
          }

          if (res.data[i].fco.split("*").indexOf("CO1") != -1) {
            $("#CO1_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fco.split("*").indexOf("CO2") != -1) {
            $("#CO2_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fco.split("*").indexOf("CO3") != -1) {
            $("#CO3_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fco.split("*").indexOf("CO4") != -1) {
            $("#CO4_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fco.split("*").indexOf("CO5") != -1) {
            $("#CO5_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fco.split("*").indexOf("CO6") != -1) {
            $("#CO6_" + slno).attr("checked", "checked");
          }

          if (res.data[i].fpso.split("*").indexOf("PSO1") != -1) {
            $("#PSO1_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpso.split("*").indexOf("PSO2") != -1) {
            $("#PSO2_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpso.split("*").indexOf("PSO3") != -1) {
            $("#PSO3_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpso.split("*").indexOf("PSO4") != -1) {
            $("#PSO4_" + slno).attr("checked", "checked");
          }
          if (res.data[i].fpso.split("*").indexOf("PSO5") != -1) {
            $("#PSO5_" + slno).attr("checked", "checked");
          }
          slno++;
        }
      }
    },
  });
}

function loadcopo() {
  var tempcode = document.getElementById("tempcodecopo").value;
  $.ajax({
    type: "GET",
    data: "tempcode=" + tempcode,
    url: $host_url + "loadpcopotable",
    success: function (response) {
      var res = JSON.parse(response);

      //   console.log(res.data);

      // if (res.error_code == 0) {
      //   var slno = 1;
      //   var copo = `<table id="pocotab" class="content-tbl" width="70%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
      //   <tbody>
      //     <tr>
      //     <th align="left" colspan="7" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper"
      //     style="font-size:15px; padding-left:6px; height:24px;">Update COPO</th>
      //     </tr>
      //     <td align="center" style="width:40px; font-size:12px;
      //     border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Sl. No.</td>

      //     <td align="center" style="width:70px; font-size:12px; padding:5px 5px;
      //      border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Qusetion No.</td>

      //     <td align="center" style="width:70px; font-size:12px; padding:5px 5px;
      //      border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Max. Marks</td>

      //     <td align="center" style="width:200px; font-size:12px;
      //     border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Details</td>

      //     </tr>`;

      //   for (var i = 0; i < res.data.length; i++) {
      //     copo += `<tr class="ui-widget-content jqgrow" id = '${slno}'>
      //         <td class="tbl_row_new" style="border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${slno}</td>

      //         <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; text-align:center;">${res.data[i].fqnno}</td>
      //         <td class="tbl_row_new" style="text-align:initial;border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${res.data[i].fmaxmarks}
      //         <input type="hidden" id="partcode_${slno}" name="partcode" value="${res.data[i].fpartcode}">
      //         <input type="hidden" id="qncode_${slno}" name="qncode" value="${res.data[i].fqncode}">
      //         </td>

      //         <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; ">
      //         <label>PO1</label><input type="checkbox" id="PO1_${slno}" name="PO1" value="PO1">
      //         <label>PO2</label><input type="checkbox" id="PO2_${slno}" name="PO2" value="PO2">
      //         <label>PO3</label><input type="checkbox" id="PO3_${slno}" name="PO3" value="PO3">
      //         <label>PO4</label><input type="checkbox" id="PO4_${slno}" name="PO4" value="PO4">
      //         <label>PO5</label><input type="checkbox" id="PO5_${slno}" name="PO5" value="PO5"><br>
      //         <span></span>
      //         <label>CO1</label><input type="checkbox"  id="CO1_${slno}" name="CO1" value="CO1">
      //         <label>CO2</label><input type="checkbox"  id="CO2_${slno}" name="CO2" value="CO2">
      //         <label>CO3</label><input type="checkbox"  id="CO3_${slno}" name="CO3" value="CO3">
      //         <label>CO4</label><input type="checkbox"  id="CO4_${slno}" name="CO4" value="CO4">
      //         <label>CO5</label><input type="checkbox"  id="CO5_${slno}" name="CO5" value="CO5"><br>
      //         <span></span>
      //         <label>PSO1</label><input type="checkbox"  id="PSO1_${slno}" name="PSO1" value="PSO1">
      //         <label>PSO2</label><input type="checkbox"  id="PSO2_${slno}" name="PSO2" value="PSO2">
      //         <label>PSO3</label><input type="checkbox"  id="PSO3_${slno}" name="PSO3" value="PSO3">
      //         <label>PSO4</label><input type="checkbox"  id="PSO4_${slno}" name="PSO4" value="PSO4">
      //         <label>PSO5</label><input type="checkbox"  id="PSO5_${slno}" name="PSO5" value="PSO5"><br>

      //         </td>

      //       </tr>`;

      //     slno++;
      //   }
      //   $("#copotab").html(copo);
      //   slno = 1;
      //   for (var i = 0; i < res.data.length; i++) {
      //     if (res.data[i].fpo.search("PO1") != -1) {
      //       $(`#PO1_${slno}`).attr("checked", "checked");
      //     }
      //     if (res.data[i].fpo.search("PO2") != -1) {
      //       $("#PO2_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fpo.search("PO3") != -1) {
      //       $("#PO3_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fpo.search("PO4") != -1) {
      //       $("#PO4_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fpo.search("PO5") != -1) {
      //       $("#PO5_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fco.search("CO1") != -1) {
      //       $("#CO1_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fco.search("CO2") != -1) {
      //       $("#CO2_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fco.search("CO3") != -1) {
      //       $("#CO3_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fco.search("CO4") != -1) {
      //       $("#CO4_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fco.search("CO5") != -1) {
      //       $("#CO5_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fpso.search("PSO1") != -1) {
      //       $("#PSO1_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fpso.search("PSO2") != -1) {
      //       $("#PSO2_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fpso.search("PSO3") != -1) {
      //       $("#PSO3_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fpso.search("PSO4") != -1) {
      //       $("#PSO4_" + slno).attr("checked", "checked");
      //     }
      //     if (res.data[i].fpso.search("PSO5") != -1) {
      //       $("#PSO5_" + slno).attr("checked", "checked");
      //     }
      //     slno++;
      //   }
      // }
    },
  });
}

function savecopo() {
  var pocopso_arru = {};
  var arr_fin = [];
  var tempcode = document.getElementById("tempcodecopo").value;
  var deg = document.getElementById("degree").value;
  var examno = document.getElementById("examno").value;
  var qpcode = document.getElementById("qpcode").value;
  var element = document.getElementById("element").value;
  var target = document.getElementById("target").value;

  $("#pocotab tr:gt(0)").each(function () {
    var this_row = $(this.id);
    let slno = this_row["selector"];
    if (slno != "") {
      let partcode = document.getElementById("partcode_" + slno).value;
      let qncode = document.getElementById("qncode_" + slno).value;
      let maxmarks = document.getElementById("maxmarks_" + slno).value;
      let po1 = document.getElementById("PO1_" + slno).checked;
      let po2 = document.getElementById("PO2_" + slno).checked;
      let po3 = document.getElementById("PO3_" + slno).checked;
      let po4 = document.getElementById("PO4_" + slno).checked;
      let po5 = document.getElementById("PO5_" + slno).checked;
      let po6 = document.getElementById("PO6_" + slno).checked;
      let po7 = document.getElementById("PO7_" + slno).checked;
      let po8 = document.getElementById("PO8_" + slno).checked;
      let po9 = document.getElementById("PO9_" + slno).checked;
      let po10 = document.getElementById("PO10_" + slno).checked;
      let po11 = document.getElementById("PO11_" + slno).checked;
      let po12 = document.getElementById("PO12_" + slno).checked;

      let co1 = document.getElementById("CO1_" + slno).checked;
      let co2 = document.getElementById("CO2_" + slno).checked;
      let co3 = document.getElementById("CO3_" + slno).checked;
      let co4 = document.getElementById("CO4_" + slno).checked;
      let co5 = document.getElementById("CO5_" + slno).checked;
      let co6 = document.getElementById("CO6_" + slno).checked;

      let pso1 = document.getElementById("PSO1_" + slno).checked;
      let pso2 = document.getElementById("PSO2_" + slno).checked;
      let pso3 = document.getElementById("PSO3_" + slno).checked;
      let pso4 = document.getElementById("PSO4_" + slno).checked;
      let pso5 = document.getElementById("PSO5_" + slno).checked;

      postr = "";

      if (po1 == true) {
        postr += "PO1*";
      }
      if (po2 == true) {
        postr += "PO2*";
      }
      if (po3 == true) {
        postr += "PO3*";
      }
      if (po4 == true) {
        postr += "PO4*";
      }
      if (po5 == true) {
        postr += "PO5*";
      }
      if (po6 == true) {
        postr += "PO6*";
      }
      if (po7 == true) {
        postr += "PO7*";
      }
      if (po8 == true) {
        postr += "PO8*";
      }
      if (po9 == true) {
        postr += "PO9*";
      }
      if (po10 == true) {
        postr += "PO10*";
      }
      if (po11 == true) {
        postr += "PO11*";
      }
      if (po12 == true) {
        postr += "PO12*";
      }

      costr = "";

      if (co1 == true) {
        costr += "CO1*";
      }
      if (co2 == true) {
        costr += "CO2*";
      }
      if (co3 == true) {
        costr += "CO3*";
      }
      if (co4 == true) {
        costr += "CO4*";
      }
      if (co5 == true) {
        costr += "CO5*";
      }
      if (co6 == true) {
        costr += "CO6*";
      }

      psostr = "";

      if (pso1 == true) {
        psostr += "PSO1*";
      }
      if (pso2 == true) {
        psostr += "PSO2*";
      }
      if (pso3 == true) {
        psostr += "PSO3*";
      }
      if (pso4 == true) {
        psostr += "PSO4*";
      }
      if (pso5 == true) {
        psostr += "PSO5*";
      }

      pocopso_arru = new Object();
      pocopso_arru["partcode"] = partcode;
      pocopso_arru["qncode"] = qncode;
      pocopso_arru["maxmarks"] = maxmarks;
      pocopso_arru["po"] = postr;
      pocopso_arru["co"] = costr;
      pocopso_arru["pso"] = psostr;

      arr_fin.push(pocopso_arru);
    }
  });
  //   console.log(arr_fin);
  //   return;

  $.ajax({
    type: "GET",
    url: $host_url + "savecopopso",
    data:
      "element=" +
      element +
      "&fnarr=" +
      JSON.stringify(arr_fin) +
      "&tempcode=" +
      tempcode +
      "&degree=" +
      deg +
      "&examno=" +
      examno +
      "&qpcode=" +
      qpcode +
      "&target=" +
      target,
    success: function (response) {
      var res = JSON.parse(response);
      if (res.error_code == 0) {
        alert(res.data.msg);
        return;
      } else {
        alert(res.data.msg);
        return;
      }
    },
  });
}

function clearcopo() {
  callupdatecopo();
}

function loadElement() {
  document.getElementById("examno").value = "";
  document.getElementById("degree").value = "";
  document.getElementById("qpcode").value = "";
}