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


Current Path : /var/www/oasis/js/
Upload File :
Current File : /var/www/oasis/js/repeateriamarksentry.js

function callrepeateriamarksentry() {
  console.log("anita");
  $("#page_main_div").load(
    "../html_modules/repeateriamarksentry.html?v=1001",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Repeater IA Marks Entry";
      document.getElementById("module_name_for_save").value =
        "Repeater IA Marks Entry";
      getDefaultHeadFooterLinks("Repeater IA Marks Entry");
      getSemester();
      studentdetailreport();
    }
  );
}
function getNameDeg() {
  let regNo = document.getElementById("reg").value;
  if (regNo == "") {
    alert("Enter Reg.No.");
    return;
  }

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });
  $.ajax({
    type: "GET",
    data: "reg=" + regNo,
    url: $host_url + "getNameDegrepeiamarksentry",
    success: function (res) {
      let response = JSON.parse(res);
      console.log(response, "response");
      if (response.error_code === 0) {
        document.getElementById("name").value = response.data.fname;
        document.getElementById("degree").value = response.data.fdegree;
        document.getElementById("s_semister").value = response.data.fexamno;
        $.unblockUI();
      } else {
        alert(response.data.msg);
        $.unblockUI();
        return;
      }
    },
  });
}
function getSemester() {
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });
  $.ajax({
    type: "GET",
    url: $host_url + "getSempeiamarksentry",
    success: function (res) {
      let response = JSON.parse(res);
      console.log(response);
      if (response.error_code == 0) {
        var opt3 = "";
        opt3 += `<option>---Select---</option>`;
        for (i = 0; i < response.data.length; i++) {
          opt3 += `<option value="${response.data[i].fexamno}">  ${response.data[i].fexamname}</option>`;
        }
        document.getElementById("s_semister").innerHTML = opt3;
      }
      $.unblockUI();
    },
  });
}

var thmarksarray = [];
function Getmarksddet() {
  let regNo = document.getElementById("reg").value;
  let degree = document.getElementById("degree").value;
  let semester = document.getElementById("s_semister").value;
  if (regNo == "") {
    alert("Enter Reg. No");
    // document.getElementById("reg").va
    return;
  }

  thmarksarray = [];

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });
  $.ajax({
    type: "GET",
    data: "&degree=" + degree + "&reg=" + regNo + "&s_semister=" + semester,
    url: $host_url + "iamarksEntries",
    success: function (res) {
      let response = JSON.parse(res);
      console.log(response, "anu");
      if (response.error_code == 0) {
        var table = "";
        table += `<table style='width: 100%;' cellspacing='0'>`;
        table += `<thead style='position:sticky; top:0'><tr>
                  <th colspan='7' style='padding:5px;' align='left' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper'>Theory Marks</th></tr>
                 <tr align="center" class='ui-state-default ui-jqgrid-hdiv'>
       
              <th align="center" class='column' >Sub Short</th>
              <th align="center" class='column' >Subject Name</th>
              <th align="center" class='column'>Max Marks</th>
               <th align="center" class='column'>Marks</th>
            

              </tr>`;
        for (let i = 0; i < response.data.length; i++) {
          thmarksarray.push(response.data[i]);
          console.log(response.data[i].fmarks, "hhhhhhh");
          if (response.data[i].fmarks == undefined) {
            $con = "";
          } else {
            $con = response.data[i].fmarks;
          }
          table += `<tr align='center' id='row_${i}' >
              
                <td style=" font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC; text-align:center;"
                >
                  ${response.data[i].fcsubcode}
                </td>
                <td style=" font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC; text-align:left;"
                >
                ${response.data[i].fsubname}
                </td>
                <td style=" width:55px; font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;
                 text-align:center; id="maxmarks_${i}" 
                >
                 ${response.data[i].fvalmax}
                </td>
                <td style=" font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC; text-align:center;"
                >
                <input style="width:55px;text-align:center;" value="${$con}" id="marks_${i}" oninput="getmarksdata('${i}', '${response.data[i].fvalmax}')"></input>
                </td>
              `;
        }

        document.getElementById("datatable").innerHTML = table;
        $.unblockUI();
      } else {
        document.getElementById(
          "datatable"
        ).innerHTML = `<h3><b>Data Not Found</b></h3>`;
        $.unblockUI();
      }
    },
  });
}
function getmarksdata(i, valmax) {
  var marks = document.getElementById("marks_" + i).value;
  thmarksarray[i]["fmarks"] = marks;
  if (marks > valmax) {
    alert("Enter Valid Marks");
    document.getElementById("marks_" + i).value = "";
    document.getElementById("marks_" + i).focus();
    return;
  }
}

function saverepeateriamarksentry(i) {
  let regNo = document.getElementById("reg").value;
  let degree = document.getElementById("degree").value;
  let semester = document.getElementById("s_semister").value;

  let formdata = new FormData();
  formdata.append("reg", regNo);
  formdata.append("degree", degree);
  formdata.append("semester", semester);
  formdata.append("data", JSON.stringify(thmarksarray));
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });
  $.ajax({
    type: "POST",
    url: $host_url + "savetomarkstable",
    data: formdata,
    contentType: false,
    processData: false,
    cache: false,

    success: function (res) {
      let response = JSON.parse(res);
      console.log(response, "anita");
      if (response.error_code == 0) {
        alert(response.data.data);
        $.unblockUI();
      } else {
        alert(response.data.data);
        $.unblockUI();
        return;
      }
    },
  });
}