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


Current Path : /var/www/html/pgadm2020/js/admin/
Upload File :
Current File : /var/www/html/pgadm2020/js/admin/documentverification.js

// var $host_url =
//   "http://" +
//   window.location.host +
//   "/" +
//   window.location.pathname.split("/")[1] +
//   "/app.php?a=";

// var $photo_url =
//   "http://" +
//   window.location.host +
//   "/" +
//   window.location.pathname.split("/")[1];

var $photo_url = "https://admission-certificates.s3.ap-south-1.amazonaws.com/";

$(function() {
  var focusedElement;
  $(document).on("focus", "input", function() {
    if (focusedElement == this) return;
    focusedElement = this;
    setTimeout(function() {
      focusedElement.select();
    }, 100);
  });
});

function loadDocumentVerification() {
  $.ajax({
    type: "POST",
    url: $host_url + "loadRange",
    async: false,
    success: function(response) {
      //  console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      if (error_code == "0") {
        $("#loadTab").load("documentverification.html", function() {
          var degrees = data;
          var dept_opt = "";
          for (let deg of degrees) {
            dept_opt += `<option value="${deg.fdegree}">${deg.fdescpn}</option>`;
          }
          $("#fdept").html(dept_opt);
        });
      } else {
        alert("Please try after some time");
        return;
      }
    }
  });
}
function loadChangea() {
  // console.log('hi')
  var afrom = $("#afrom").val();
  if (afrom == 0) {
    $("#ato").val("ZZZZZZZZZZ");
  } else {
    // console.log(afrom)
    $("#ato").val(afrom);
  }
}

function loadChanged() {
  // console.log('hi')
  var dfrom = $("#dfrom").val();
  if (dfrom == 0) {
    $("#dto").val("ZZZZZ");
  } else {
    // console.log(afrom)
    $("#dto").val(dfrom);
  }
}

function loadAppDetails() {
  var fdept = $("#fdept").val();
  var afrom = $("#afrom").val();
  var ato = $("#ato").val();

  //   if (dfrom == "0") {
  //     alert("Fill Degree Range");
  //     return;
  //   }
  //    if (dto == "ZZZZ") {
  //     alert("Fill Degree Range");
  //     return;
  //   }
  //  if (afrom == "0") {
  //     alert("Fill Application Range");
  //     return;
  //   }
  //  if (ato == "ZZZZ") {
  //     alert("Fill Application Range");
  //     return;
  //   }
  $("#next").show();
  var datastring = "&fdept=" + fdept + "&afrom=" + afrom + "&ato=" + ato;
  $.blockUI({ message: "<img src='../img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    url: $host_url + "loadAppDetails",
    data: datastring,
    success: function (response) {
      $.unblockUI();
      // console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      console.log(data);
      var app = data;

      var str = `<table class="table table-bordered" >
            <thead>
              <tr class="bg-cyan">
                <th style = "text-align: center;">Sl. No.</th>
                <th style = "text-align: center;">Application No.</th>
                <th style = "text-align: center;">Applied Date</th>
                <th style = "text-align: center;">Candidate Name</th>                                
                <th style = "text-align: center;">Gender</th>
                <th style = "text-align: center;">Caste</th>
                <th style = "text-align: center;">HK / NHK</th>
                <th style = "text-align: center;">Status</th>
                <th style = "text-align: center;">Action</th>
                <th style = "text-align: center;">Print</th>
              </tr>
            </thead>
            <tbody>`;

      for (var i = 0; i < app.length; i++) {        
          str += `<tr>
              <td style = 'text-align: center;'>${i + 1}</td>
              <td style = 'text-align: center;'>${app[i]["fappno"]}</td>
              <td style = 'text-align: center;'>${app[i]["fappdate"]}</td>
              <td style = 'text-align: left;'>${
                app[i]["fname"]
              }</td>                            
              <td style = 'text-align: center;'>${app[i]["fgender"]}</td>
              <td style = 'text-align: center;'>${
                app[i]["fcategory"]
              }</td>
              <td style = 'text-align: center;'>${app[i]["fhk"]}</td>
              <td style = 'text-align: center;'>${app[i]["fapprstatus"]}</td>`;

              if(app[i]["fapprstatus"] !== "pending") {
                str += `<td style = 'text-align: center;'> </td>
                  <td style = 'text-align: center;'> <div id="printdocvrf_${i}" ><button class="btn btn-outline-primary" 
                          style="padding-right: 8px;padding-left: 8px;padding-top: 2px;padding-bottom: 2px;" 
                          onclick="Printdocvrfdet('${app[i]["fappno"]}')" >Print</button> </div> </td>
                        </tr>`;
              }
              else {
                str += ` <td style = 'text-align: center;'><div id="viewdocvrf_${i}" ><button class="btn-info"
                style="padding-right: 8px;padding-left: 8px;padding-top: 2px;padding-bottom: 2px;" 
                onclick="loadStudentDetails('${app[i]["fappno"]}',
                '${app[i]["fname"]}','${app[i]["fappdate"]}','${
                app[i]["ftotfee"]
              }',
                          '${app[i]["fgender"]}','${app[i]["fcategory"]}','${
                app[i]["fhk"]
              }',
                          '${app[i]["fdescpn"]}','${app[i]["fincome"]}','${
                app[i]["fhandicap"]
              }',
                          '${app[i]["fsports"]}','${app[i]["fncc"]}','${
                app[i]["fdefence"]
              }',
                          '${app[i]["fpdp"]}','${app[i]["fgah"]}','${
                app[i]["fcof"]
              }')">View</button> </div> </td>
              <td style = 'text-align: center;'></td>`;
            }          
          }


      $("#appdet").html(str);

      // for(var i =0;i< app.length;i++){
      //   // console.log('printdocvrf_' + i);
      //   if(app[i]["fapprstatus"] == 'Verified'){
      //       console.log('printdocvrf_' + i);
      //       $('#printdocvrf_' + i).show();            
      //       $('#viewdocvrf_' + i).hide();

      //       //  document.getElementById('printdocvrf_' + i).style.visibility = 'visible' ;
      //     }
      // }
    },
  });
}
var fappnoo;
var statusandremarks = [];

function loadStudentDetails(
  fappno,
  fname,
  fappdate,
  ftotfee,
  fgender,
  fcategory,
  fhk,
  fdescpn,
  fincome,
  fhandicap,
  fsports,
  fncc,
  fdefence,
  fpdp,
  fgah,
  fcof
) {
  $("#next").hide();
  $("#add").hide();
  $("#perdetl").show();
  $("#marksdet").show();
  $("#marksdetmain").show();  

  $("#fname").html(fname);
  $("#fappno").html(fappno);
  $("#fappdate").html(fappdate);
  $("#ftotfee").html(ftotfee);
  $("#fcategory").val(fcategory);
  $("#fdescpn").html(fdescpn);
  $("#fincome").val(fincome);
  console.log(fincome);
  $('#fnccmarks').val('');
  $('#fnssmarks').val('');
  $('#frarmarks').val('');

  if(fncc == 'Yes'){    
    document.getElementById("fnss_1").checked = true;
    document.getElementById("rar_1").checked = true;  
    $('#nccmks').show();
    $('#nssmks').show();
    $('#frarmks').show();  
  }else{    
    document.getElementById("fnss_2").checked = true;
    document.getElementById("rar_2").checked = true; 
    $('#nccmks').hide();
    $('#nssmks').hide();
    $('#frarmks').hide();       
  }


  

  
  if(fhk == 'Yes'){        
    document.getElementById("fhk_1").checked = true;
  }else if(fhk == 'No'){
    document.getElementById("fhk_2").checked = true;
  }
  // console.log(fhandicap);
  if(fhandicap == 'Yes'){            
    document.getElementById("hdcp_1").checked = true;
  }else if(fhandicap == 'No'){  
    document.getElementById("hdcp_2").checked = true;
  }

  if(fsports == 'Yes'){        
    document.getElementById("fspts_1").checked = true;
  }else if(fsports == 'No'){
    document.getElementById("fspts_2").checked = true;
  }

  if(fncc == 'Yes'){        
    document.getElementById("ncc_1").checked = true;
  }else if(fncc == 'No'){
    document.getElementById("ncc_2").checked = true;
  }

   if(fdefence == 'Yes'){        
    document.getElementById("defence_1").checked = true;
  }else if(fdefence == 'No'){
    document.getElementById("defence_2").checked = true;
  }

   if(fpdp == 'Yes'){        
    document.getElementById("pdp_1").checked = true;
  }else if(fpdp == 'No'){
    document.getElementById("pdp_2").checked = true;
  }

   if(fgah == 'Yes'){        
    document.getElementById("gadinadu_1").checked = true;
  }else if(fgah == 'No'){
    document.getElementById("gadinadu_2").checked = true;
  }

   if(fcof == 'Yes'){        
    document.getElementById("cof_1").checked = true;
  }else if(fcof == 'No'){
    document.getElementById("cof_2").checked = true;
  }  
  console.log($('#fhkdoc').val());

  fappnoo =fappno;

  var datastring = "&fappno=" + fappno;

  $.blockUI({ message: "<img src='../img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    url: $host_url + "loadstuddocDetails",
    data: datastring,
    success: function(response) {
      $.unblockUI();
      // console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      console.log(data);
      statusandremarks = data.app;
      var app = data.app;
      var stuadm = data.stuadm;
      // console.log(stuadm[0].fincome);      
      // if (app.fstatus == null || " ") {
      //   var opt = `<option value = ''>>>SELECT<<</option>`;
      // }
      


      var str = `<table class="table table-bordered">
            <thead>
              <tr class="bg-cyan">
                <th style = "text-align: center;width: 6%;">Sl. No.</th>
                <th style = "text-align: center;width: 15%;">Document Name</th>
                <th style = "text-align: center;width: 15%;">Document Status</th>
                <th style = "text-align: center;width: 200px;">Remarks</th>
              </tr>
            </thead>
            <tbody>`;
      for (var i = 0; i < app.length; i++) {
        
        opt='';
          var opt = `<option value = ''>>>SELECT<<</option>`;
          if(app[i].fpath !== null){
            if(app[i].fdoctype == "1_AADHAR"){
              console.log(opt);
              opt += `<option value='Verified'>Verified</option>
                      <option value='NotProduced'>Not Produced</option>`;
            }else if(app[i].fdoctype == "2_SSLC"){
              opt += `<option value='Verified'>Verified</option>
                      <option value='NotProduced'>Not Produced</option>`;
            }else if(app[i].fdoctype == "3_UG"){
              opt += `<option value='Verified'>Verified</option>
                      <option value='NotProduced'>Not Produced</option>`;
            }else{
                opt += `<option value='NA'>NA</option>
                        <option value='Verified'>Verified</option>
                                <option value='NotProduced'>Not Produced</option>`;
            }            
            str += `<tr>
                  <td style = 'text-align: center;'>${i +
                    1}</td>                                         
                  <td style = 'text-align: left;'><button class="btn btn-link"  >
                  <a href = "${$photo_url + app[i].fpath}" target = '_blank'style="font-size: 15px;">
                    ${app[i].fdocname}
                  </a>
                  </button></td>              
                  <td style = 'text-align: center;'><select id="${i}_doc_status" class="form-control" name="${app[i].fdoctype}" onchange="changeDoc(${i}, this,${stuadm[0].fincome})" >${opt}</select></td>
                  <td style = 'text-align: center;'><input class="form-control form-rounded" type="text"   value="${
                    app[i]["fremarks"]
                  }" rounded id="${
              app[i]["fdoctype"]
            }_Remarks" onchange="changeRemarks(${i}, this)"  />
                  </td>
                </tr>`;
            }
      }

      var pen = `<option  value = ''>>>Pending<<</option>                  
                  <option value = 'Accepted'>Accepted</option>
                  <option value = 'Rejected'>Rejected</option>`;

      $("#studet").html(str);
      $("#studstatus").html(pen);
      // console.log(app);
      for (var j = 0; j < app.length; j++) {
        // console.log(app[j]["fstatus"]);
        $(`#${j}_doc_status`).val(app[j]["fstatus"]);
      }
      // console.log(stuadm[0]["FAPPRSTATUS"]);
      $(`#studstatus`).val(stuadm[0]["FAPPRSTATUS"]);
      $(`#textarea`).val(stuadm[0]["FAPPREMARKS"]);
    
    
      var table = ` <thead>
      <tr class='bg-cyan'>
        <th class="qaltablefisrtrd qaltabletd" rowspan="2">
          Sl.No
        </th>
        <th class="qaltabletd" style="width: 200px;" rowspan="2">
          Subject
        </th>
        <th class="qaltabletd" colspan="2">
          Sem / Year I
        </th>
        <th class="qaltabletd" colspan="2">
          Sem / Year II
        </th>
        <th class="qaltabletd" colspan="2">
          Sem / Year III
        </th>
        <th class="qaltabletd" colspan="2">
          Sem / Year IV
        </th>
        <th class="qaltabletd" colspan="2">
          Sem / Year V
        </th>
        <th class="qaltabletd" colspan="2">
          Sem / Year VI
        </th>
        <th class="qaltabletd" colspan="2">
          Total Marks
        </th>
        <th class="qaltabletd" rowspan="2">
          % of Marks
        </th>
      </tr>
      <tr class='bg-cyan'>
        <th class="qaltabletd">
          Max
        </th>
        <th class="qaltabletd" ot1>
          Obt
        </th>
        <th class="qaltabletd" mx1>
          Max
        </th>
        <th class="qaltabletd" ot2>
          Obt
        </th>
        <th class="qaltabletd" mx2>
          Max
        </th>
        <th class="qaltabletd" ot3>
          Obt
        </th>
        <th class="qaltabletd" mx3>
          Max
        </th>
        <th class="qaltabletd" ot4>
          Obt
        </th>
        <th class="qaltabletd" mx4>
          Max
        </th>
        <th class="qaltabletd" ot5>
          Obt
        </th>
        <th class="qaltabletd" mx5>
          Max
        </th>
        <th class="qaltabletd" ot6>
          Obt
        </th>
        <th class="qaltabletd" mx6>
          Max
        </th>
        <th class="qaltabletd">
          Obt
        </th>

      </tr>
    </thead>
    <tbody>`;

      var subdet = data.optsub;
      var i = 1;
      subdet.forEach((element) => {
        var subname = element.subname;
        var value = subname.split("-");
        table += `<tr id='${i}' class="ui-widget-content jqgrow">
        <td class='tbl_row_new tdfirst'>
          <center>${i}</center>
        </td>
        <td class='tbl_row_new' style=" text-align: left;">
          <input type="text" name="subsem1_${i}" id="subsem1_${i}"
            style="max-width: 200px !important;text-align: left;" disabled value = '${value[1]}'>
          <input type="hidden" name="subcode_${i}" id="subcode_${i}" value="${value[0]}">
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subsem1mm_${i}" maxlength="4"
          value = '${element.famm}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem1mm_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subsem1mo_${i}" maxlength="4"
            value = '${element.famo}'
            onkeypress="return acceptNumbersOnlyForModule(event);" onchange="gettoal('${i}')"
            id="subsem1mo_${i}" disabled>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subsem2mm_${i}" maxlength="4"
            value = '${element.fbmm}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem2mm_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        
        <td class='tbl_row_new'>
          <input type="text" name="subsem2mo_${i}" maxlength="4"
            value = '${element.fbmo}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem2mo_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subsem3mm_1" maxlength="4"
            value = '${element.fcmm}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem3mm_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        
        <td class='tbl_row_new'>
          <input type="text" name="subsem3mo_${i}" maxlength="4"
            value = '${element.fcmo}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem3mo_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subsem4mm_${i}" maxlength="4"
            value = '${element.fdmm}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem4mm_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        
        <td class='tbl_row_new'>
          <input type="text" name="subsem4mo_${i}" maxlength="4"
            value = '${element.fdmo}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem4mo_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subsem5mm_${i}" maxlength="4"
            value = '${element.femm}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem5mm_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        
        <td class='tbl_row_new'>
          <input type="text" name="subsem5mo_${i}" maxlength="4"
            value = '${element.femo}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem5mo_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subsem6mm_${i}" maxlength="4"
            value = '${element.ffmm}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem6mm_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        
        <td class='tbl_row_new'>
          <input type="text" name="subsem6mo_${i}" maxlength="4"
            value = '${element.ffmo}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subsem6mo_${i}"
            onchange="gettoal('${i}')" disabled>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subtotalmm_${i}" maxlength="4" readonly
            value = '${element.fmaxmarks}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subtotalmm_${i}" disabled>
        </td>
        
        <td class='tbl_row_new'>
          <input type="text" name="subtotalmo_${i}" maxlength="4" readonly
            value = '${element.fsecmarks}'
            onkeypress="return acceptNumbersOnlyForModule(event);" id="subtotalmo_${i}" disabled>
        </td>
        
        <td class='tbl_row_new'>
          <input type="text" name="subpercentagemm_${i}" maxlength="5" readonly
            value = '${element.fpercent}'
            style="max-width: 70px" onkeypress="return acceptNumbersOnlyForModule(event);"
            id="subpercentagemm_${i}" disabled >
        </td>
      </tr>`;
        i++;
      });
      table += `</tbody> `;
      $("#qalsemdet").html(table);



      var reslan = data.reslan;
      console.log(reslan[0]["famm"]);
      var table = ` <thead>
        <tr class='bg-cyan'>
          <td class="qaltablefisrtrd">
            Sl.
          </td>
          <td class="qaltabletd" style="width: 200px;" rowspan="2">
            Subject
          </td>
          <td class="qaltabletd" colspan="2">
            Sem / Year I
          </td>
          <td class="qaltabletd" colspan="2">
            Sem / Year II
          </td>
          <td class="qaltabletd" colspan="2">
            Sem / Year III
          </td>
          <td class="qaltabletd" colspan="2">
            Sem / Year IV
          </td>
          <th class="qaltabletd" colspan="2">
            Sem / Year V
          </th>
          <th class="qaltabletd" colspan="2">
            Sem / Year VI
          </th>
          <td class="qaltabletd" colspan="2">
            Total Marks
          </td>
          <td class="qaltabletd" rowspan="2">
            % of Marks
          </td>
        </tr>
        <tr class='bg-cyan'>
          <td class="qaltablefisrtrd">
            No.
          </td>
          
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
        </tr>
      </thead>
      <tbody>`;


      var i = 1;
      for (var z = 0; z < 2; z++) {
        var subname = reslan[z]["subname"];
        var value = subname.split("-");
        table += `<tr id='${i}' class="ui-widget-content jqgrow">
        <td class='tbl_row_new tdfirst'>
          <center>${i} </center>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subsem1_${i}" id="subsem1_${i}"
            style="max-width: 200px !important;text-align: left;" disabled value = '${value[1]}'>
          <input type="hidden" name="subcode_${i}" id="subcode_${i}" value="${value[0]}">
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem1mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem1mm_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["famm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem1mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" onchange="getlantoal('${i}')" disabled
            id="lansem1mo_${i}"
            value = '${reslan[z]["famo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem2mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem2mm_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["fbmm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem2mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem2mo_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["fbmo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem3mm_1" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem3mm_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["fcmm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem3mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem3mo_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["fcmo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem4mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem4mm_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["fdmm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem4mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem4mo_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["fdmo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem5mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem5mm_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["femm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem5mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem5mo_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["femo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem6mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem6mm_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["ffmm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lansem6mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lansem6mo_${i}"
            onchange="getlantoal('${i}')" disabled
            value = '${reslan[z]["ffmo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lantotalmm_${i}" maxlength="4" readonly
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lantotalmm_${i}"
            value = '${reslan[z]["fmaxmarks"]}' disabled >
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lantotalmo_${i}" maxlength="4" readonly
            onkeypress="return acceptNumbersOnlyForModule(event);" id="lantotalmo_${i}"
            value = '${reslan[z]["fsecmarks"]}' disabled >
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="lanpercentagemm_${i}" maxlength="5" readonly
            style="max-width: 70px" onkeypress="return acceptNumbersOnlyForModule(event);"
            id="lanpercentagemm_${i}"
            value = '${reslan[z]["fpercent"]}' disabled >
        </td>
      </tr>`;
        i++;
      }
      table += `</tbody>`;
      $("#lansemdet").html(table);


      var restotsem = data.restotsem;
      console.log(restotsem[0]["famm"]);
      var table = ` <thead>
        <tr class='bg-cyan'>
          <td class="qaltablefisrtrd">
            Sl.
          </td>
          <td class="qaltabletd" style="width: 200px;" rowspan="2">
            Subject
          </td>
          <td class="qaltabletd" colspan="2">
            Sem / Year I
          </td>
          <td class="qaltabletd" colspan="2">
            Sem / Year II
          </td>
          <td class="qaltabletd" colspan="2">
            Sem / Year III
          </td>
          <td class="qaltabletd" colspan="2">
            Sem / Year IV
          </td>
          <th class="qaltabletd" colspan="2">
            Sem / Year V
          </th>
          <th class="qaltabletd" colspan="2">
            Sem / Year VI
          </th>
          <td class="qaltabletd" colspan="2">
            Total Marks
          </td>
          <td class="qaltabletd" rowspan="2">
            % of Marks
          </td>
        </tr>
        <tr class='bg-cyan'>
          <td class="qaltablefisrtrd">
            No.
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
          <td class="qaltabletd">
            Max
          </td>
          <td class="qaltabletd">
            Obt
          </td>
        </tr>
      </thead>
      <tbody>`;

      var i = 1;
      var z = 0;
      var subname = restotsem[z]["subname"];
        var value = subname.split("-");
      table += `<tr id='${i}' class="ui-widget-content jqgrow">
        <td class='tbl_row_new tdfirst'>
          <center> ${i} </center>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="subsem1_${i}" id="subsem1_${i}"
            style="max-width: 200px !important;text-align: left;" disabled value = '${value[1]}'>
          <input type="hidden" name="subcode_${i}" id="subcode_${i}" value="${value[0]}">
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem1mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem1mm_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["famm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem1mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" onchange="gettottoal('${i}')" disabled
            id="totsem1mo_${i}"
            value = '${restotsem[z]["famo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem2mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem2mm_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["fbmm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem2mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem2mo_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["fbmo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem3mm_1" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem3mm_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["fcmm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem3mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem3mo_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["fcmo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem4mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem4mm_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["fdmm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem4mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem4mo_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["fdmo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem5mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem5mm_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["femm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem5mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem5mo_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["femo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem6mm_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem6mm_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["ffmm"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totsem6mo_${i}" maxlength="4"
            onkeypress="return acceptNumbersOnlyForModule(event);" id="totsem6mo_${i}"
            onchange="gettottoal('${i}')" disabled
            value = '${restotsem[z]["ffmo"]}'>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="tottotalmm_${i}" maxlength="4" readonly
            onkeypress="return acceptNumbersOnlyForModule(event);" id="tottotalmm_${i}"
            value = '${restotsem[z]["fmaxmarks"]}' disabled>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="tottotalmo_${i}" maxlength="4" readonly
            onkeypress="return acceptNumbersOnlyForModule(event);" id="tottotalmo_${i}"
            value = '${restotsem[z]["fsecmarks"]}' disabled>
        </td>
        <td class='tbl_row_new'>
          <input type="text" name="totpercentagemm_${i}" maxlength="5" readonly
            style="max-width: 70px" onkeypress="return acceptNumbersOnlyForModule(event);"
            id="totpercentagemm_${i}"
            value = '${restotsem[z]["fpercent"]}' disabled>
        </td>
      </tr>`;
      i++;

      table += `</tbody>`;
      $("#qaltotsem").html(table);

      var prevmarksdet = data.resultmks;
      for(var i=0; i< prevmarksdet.length;i++){
      if(prevmarksdet[i].fcombcode == 'lan'){
        $('#lanmks').val(prevmarksdet[i].fstatus);
      }else if(prevmarksdet[i].fcombcode == 'TOT'){
        $('#semtotmks').val(prevmarksdet[i].fstatus);
      }else if(prevmarksdet[i].fcombcode != 'lan' && prevmarksdet[i].fcombcode !== 'TOT'){
        $('#optmks').val(prevmarksdet[i].fstatus);
      }            
      }
    
    
    
    
    
    }
  });

  // console.log(statusandremarks);
}
function studentdocback() {
  $("#next").show();
  $("#add").show();
  $("#perdetl").hide();  
  $("#marksdet").hide();
  $("#marksdetmain").hide(); 
  loadAppDetails();
  // $("#mmkkdd").hide();

 // alert("1231321");
}

function Printdocvrfdet(fappnoo){
  // var fappno = $("#fappno").html(fappno);
  console.log(fappnoo);
  window.open($host_url + "PrintDocumentVerification"+ "&fappno=" + fappnoo, "_blank");
}

function changeDoc(i, obj,fincome) {  
  // console.log($('#'+i+'_doc_status').attr("name"));   
  // console.log($('#'+i+'_doc_status').val());

  if($('#'+i+'_doc_status').attr("name") == '5_INCOME' && $('#'+i+'_doc_status').val() == 'NotProduced' ){    
    $('#fincome').val('NA');
  }else if($('#'+i+'_doc_status').attr("name") == '5_INCOME' && $('#'+i+'_doc_status').val() == 'NA'){
     $('#fincome').val('NA');
  }else{
    $('#fincome').val(fincome);
  }




  var docsts = statusandremarks.map((el, j) => {
    // console.log(el, j, i);
    if (j == i) {
      return {
        fappno: el.fappno,
        fdoctype: el.fdoctype,
        fstatus: $(obj).val(),
        fremarks: el.fremarks
      };
    } else return el;
  });
  // console.log(docsts);
  statusandremarks = docsts;
}

function changeRemarks(i, obj) {
  var docsts = statusandremarks.map((el, j) => {
    // console.log(el, j, i);
    if (j == i) {
      return {
        fappno: el.fappno,
        fdoctype: el.fdoctype,
        fstatus: el.fstatus,
        fremarks: $(obj).val()
      };
    } else return el;
  });
  // console.log(docsts);
  statusandremarks = docsts;
}

function StudentDetailsSubmit() {
  var studstatus = $("#studstatus").val();
  var textarea = $("#textarea").val();
  var fappno = $("#fappno").html();
  var semtotmks = $("#semtotmks").val();
  var lanmks = $("#lanmks").val();
  var optmks = $("#optmks").val();
  // console.log(studstatus,textarea,fappno);

  var radio_names = [
      "fhkdoc",
      "fhandicap",
      "fsports",
      "fncc",
      "fdefence",
      "fpdp",
      "fgah",
      "fcof",
      "fnss",
      "frar"
    ];
    var radio_obj = [];
    var item;

  
  for (var i = 0; i < radio_names.length; i++) {
    if (!$('input[name="' + radio_names[i] + '"]').is(":checked")) {
      console.log(radio_names[i] + " is not checked");
      if (radio_names[i] != "fbcuetype") {
        $('input[name="' + radio_names[i] + '"]')
          .closest(".form-group")
          .find(".fieldError")
          .addClass("hasError");
        errcount++;
        missing_fields.push(radio_names[i]);
      } else {
        value = $('input[name="' + radio_names[i] + '"]').val();
        item = {};
        item["id"] = radio_names[i];
        item["value"] = value;
        radio_obj.push(item);
      }
    } else {
      console.log(radio_names[i] + "is checked");
      $('input[name="' + radio_names[i] + '"]')
        .closest(".form-group")
        .find(".fieldError")
        .removeClass("hasError");
      value = $('input[name="' + radio_names[i] + '"]:checked').val();
      item = {};
      item["id"] = radio_names[i];
      item["value"] = value;
      radio_obj.push(item);
    }
  }
  console.log(radio_obj);
  // console.log($('#fincome').val());
  // for(var i=0;i<radio_obj.length;i++){
  //   if(radio_obj[i]){

  //   }
  // }
  if($('#ncc_1').is(':checked') && $('#fnccmarks').val() == ''){    
    alert('Enter NCC marks');
    $( "#fnccmarks" ).focus();
    return;
  }
  if($('#fnss_1').is(':checked') && $('#fnssmarks').val() == ''){    
    alert('Enter NSS marks');
    $( "#fnssmarks" ).focus();
    return;
  }
  if($('#rar_1').is(':checked') && $('#frarmarks').val() == ''){    
    alert('Enter Rovers and Rangers marks');
    $( "#frarmarks" ).focus();
    return;
  }
 

  console.log(statusandremarks);
  if(semtotmks == ''){
    alert('Verify Semester Total marks');
    $( "#semtotmks" ).focus();
    return;
  }
  if(lanmks == ''){
    alert('Verify Languages');
    $( "#lanmks" ).focus();
    return;
  }
  if(optmks == ''){
    alert('Verify Optionals');
    $( "#optmks" ).focus();
    return;
  }
  for(var i=0;i<statusandremarks.length; i++){
    console.log('inside');
    if(statusandremarks[i].fstatus == ''){
      console.log('inside if');
      alert('Select Document Status');
      return;
    }
  }

  if(studstatus == ''){
    alert('Final Status cannot be Pending');
    $( "#studstatus" ).focus();
    return;
  }

  var datastring =
    "&fappno=" +
    fappno +
    "&studstatus=" +
    studstatus +
    "&textarea=" +
    textarea +
    "&semtotmks=" +
    semtotmks +
    "&optmks=" +
    optmks +
    "&lanmks=" +
    lanmks +
    "&fcategory=" +
    $('#fcategory').val() +
    "&fincome=" +
    $('#fincome').val() +
    "&fnccmarks=" +
    $('#fnccmarks').val() +
    "&fnssmarks=" +
    $('#fnssmarks').val() +
    "&frarmarks=" +
    $('#frarmarks').val() +
    "&statusandremarks=" +
    JSON.stringify(statusandremarks) +
    "&radio_obj=" +
    JSON.stringify(radio_obj);

  $.ajax({
    type: "POST",
    url: $host_url + "DocStatusAndRemarks",
    async: false,
    data: datastring,
    success: function(response) {
      //  console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      if (error_code == "0") {
        alert("Updated Successfullyy");
        studentdocback();
      } else {
        alert("Please try after some time");
        return;
      }
    }
  });  
}