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


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

function calluvcms() {
  $("#page_main_div").load("../html_modules/updateuvcms.html", function () {
    document.getElementById("display_module_name").innerHTML =
      "Update UUCMS Reg No.";
    document.getElementById("module_name_for_save").value =
      "Update UUCMS Reg No.";
    getDefaultHeadFooterLinks("Update UUCMS Reg No.");
    loaduvcms();
  });
}

function loaduvcms() {
  document.getElementById("from").value = "0";
  document.getElementById("to").value = "z";
  $.ajax({
    type: "GET",
    url: $host_url + "loaduvcms",
    success: function (response) {
      var encode = JSON.parse(response);
      // console.log(encode);
      // return;

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

function submithandler() {
  var degree = document.getElementById("degree").value;
  var from = document.getElementById("from").value;
  var to = document.getElementById("to").value;
  var datas = "&fdegree=" + degree + "&from=" + from + "&to=" + to;

  $.ajax({
    type: "GET",
    data: datas,
    url: $host_url + "submithandler",
    success: function (response) {
      // console.log(response);
      // return;
      var slno = 1;
      var encode = JSON.parse(response);
      var table = `<table align="center" width="100%" cellspacing="0" cellpadding="1" border="1">
            <tbody>
              <tr>
              <th align="left" colspan="6" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper" 
              style="font-size:12px; padding-left:6px; height:24px;">Update UUCMS Reg No.</th>
              </tr>
        
              <tr class="ui-state-default ui-jqgrid-hdiv">
              <td align="center" style="width:25px; font-size:12px; 
               border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; 
               border-bottom:1px solid #C5DBEC;">Sl.<br>No.</td>

              <td align="center" style="width:40px; font-size:12px; 
               border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; 
               border-bottom:1px solid #C5DBEC;">Reg.<br>No.</td>
        
              <td align="center" style="width:200px; font-size:12px; 
              border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Name</td>
        
              <td align="center" style="width:200px; font-size:12px; padding:5px 5px; 
               border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Father Name</td>
        
               <td align="center" style="width:70px; font-size:12px; padding:5px 5px; 
               border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">UVCMS Reg No.</td>
        
              <td align="center" style="width:80px; font-size:12px;  
              border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Action</td>
              </tr>`;
      if (encode.error_code == 0) {
        for (var i = 0; i < encode.data.length; i++) {
          //   console.log(i);
          table += `<tr class="ui-widget-content jqgrow">
                  <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="border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
                                  encode.data[i].fregno
                                }</td>
        
                                <td class="tbl_row_new" style="text-align:initial;border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${
                                  encode.data[i].fname
                                }</td>
        
                                <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${
                                  encode.data[i].ffatname
                                }</td>
        
                                <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;"> <input type="text" id="univreg${slno}" value="${
            encode.data[i].temunivregno
          }" /></td>

                                <td><span onclick="save('${
                                  encode.data[i].fregno
                                }',${slno})" style="background-color: #008CBA; border: none; color: white; padding: 5px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;"" >Update</span></td>
                                </tr>`;
        }
        table += `</table>`;
        // console.log(table) ;
      }
      $("#tabledata").html(table);
    },
  });
}

// function edit(fregno,i){
//     $.ajax({
//         type:"GET",
//         data: "&fregno="+fregno,
//         url:$host_url+"edit",
//         success: function (response){
//         var encode=JSON.parse(response);
//         // console.log(encode);
//         // return;

//             if(encode.error_code==0){
//                    document.getElementById(`univreg${i}`).disabled=false;
// $(`#univreg${i}`).val(encode.data.temunivregno);
// document.getElementById(`univreg${i}`).focus();
//             }
//         },
//     })
// }

function save(fregno, i) {
  var univreg = document.getElementById(`univreg${i}`).value;
  $.ajax({
    type: "POST",
    data: "&fregno=" + fregno + "&temunivregno=" + univreg,
    url: $host_url + "save",
    success: function (response) {
      var encode = JSON.parse(response);
      // console.log(encode);
      // return;
      if (encode.error_code == 0) {
        document.getElementById(`univreg${i}`).focus();
        // document.getElementById(`univreg${i}`).disabled=true;
        // alert("saved");
        // submithandler();
        alert(encode.data.msg);
        submithandler();
      } else {
        alert(encode.data.msg);
      }
    },
  });
}