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


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

function callupdatedeggree() {
  $("#page_main_div").load(
    "../html_modules/updatedegreegroup.html",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Update Degree Group";
      document.getElementById("module_name_for_save").value =
        "Update Degree Group";
      getDefaultHeadFooterLinks("Update Degree Group");
      loadupdeggrp();
    }
  );
}

function loadupdeggrp() {
  $.ajax({
    type: "GET",
    url: $host_url + "loadudg",
    success: function (response) {
      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 Degree Group</th>
        </tr>

        <tr class="ui-state-default ui-jqgrid-hdiv">
        <td align="center" style="width:30px; 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:85px; font-size:12px; 
        border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Degree Group</td>

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

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

        <td align="center" style="width:70px; 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;">${
                          i + 1
                        }</td>

                        <td class="tbl_row_new" style="text-align:initial;border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;">${
                          encode.data[i].dg
                        }</td>

                        <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${
                          encode.data[i].ddesc
                        }</td>

                        <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${
                          encode.data[i].ed
                        }</td>

                        <td><span onclick="editdeg('${
                          encode.data[i].dg
                        }')" 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;"">Edit</span></td>
                        </tr>`;
        }
        table += `</table>`;
        $("#tabledata").html(table);
      }
    },
  });
}

function editdeg(dg) {
  $("#tabledata").hide();
  // var desn=document.getElementById("descpn").value;
  $("#adddeggrp").hide();
  $.ajax({
    type: "GET",
    data: "&dg=" + dg,
    url: $host_url + "editdeg",
    success: function (response) {
      var encode = JSON.parse(response);

      var table = `<table style="float:left">
        <tr>
        <td>Degree Group</td>
        <td>
        <input style="height:18px" type="text" id="deg_grp" value="${encode.data[0].dg}"/>
        </td>
        </tr>

        <tr>
        <td>Description</td>
        <td>
        <input style="height:18px" type="text" id="descpn" value="${encode.data[0].desn}"/>
        </td>
        </tr>

        <tr>
        <td>Year</td>
        <td>
        <input style="height:18px" type="text" id="year" value="${encode.data[0].yr}"/>
        </td>
        </tr>

        <tr>
        <td>Exam Type</td>
        <td>
        <input style="height:18px" type="text" id="examtype" value="${encode.data[0].et}"/>
        </td>
        </tr>

        <tr>
        <td>Exam Date</td>
        <td>
        <input style="height:18px" type="text" id="examdate" value="${encode.data[0].ed}"/>
        </td>
        </tr>
        </table>`;

      $("#fetch").html(table);
      // console.log(table);
    },
  });
}

function addDdegree() {
  $("#tabledata").hide();
  $("#fetch").hide();
  $("#adddeggrp").show();
  var table = `<table style="float:left">
  <tr><td>Degree Group</td><td><input style="height:18px" type="text" id="deg_grp"/></td></tr>
  <tr><td>Description</td><td><input style="height:18px" type="text" id="descpn" /></td></tr>
  <tr><td>Year</td><td><input style="height:18px" type="text" id="year" /></td><br></tr>
  <tr><td>Exam Type</td><td><input style="height:18px" type="text" id="examtype" /></td><br></tr>
  <tr><td>Exam Date</td><td><input style="height:18px" type="text" id="examdate" /></td></tr></table>`;
  $("#adddeggrp").html(table);
}

function saveUpdatedDegree() {
  var deg_grp = document.getElementById("deg_grp").value;
  var descpn = document.getElementById("descpn").value;
  var year = document.getElementById("year").value;
  var examtype = document.getElementById("examtype").value;
  var examdate = document.getElementById("examdate").value;

  var merge =
    "&deg_grp=" +
    deg_grp +
    "&descpn=" +
    descpn +
    "&year=" +
    year +
    "&examtype=" +
    examtype +
    "&examdate=" +
    examdate;
  $.ajax({
    type: "POST",
    data: merge,
    url: $host_url + "saveUpdatedDegree",
    success: function (response) {
      var encode = JSON.parse(response);
      // console.log(encode.error_code);
      // return;
      if (encode.error_code == 0) {
        alert(encode.data.msg);
        callupdatedeggree();
      } else {
        alert(encode.data.msg);
      }
    },
  });
}

function viewDegree() {
  callupdatedeggree();
}

// function update(){
//   var deg_grp = document.getElementById("deg_grp").value;
//   var descpn = document.getElementById("descpn").value;
//   var year = document.getElementById("year").value;
//   var examtype = document.getElementById("examtype").value;
//   var examdate = document.getElementById("examdate").value;
//   var update="&deg_grp="+deg_grp+"&descpn="+descpn+"&year="+year+"&examtype="+examtype+"&examdate="+examdate;

//   $.ajax({
//     type:"POST",
//     data:update,
//     url:$host_url+"update",
//     success:function (response) {
//       var encode=JSON.parse(response);
//       if(encode.error_code==0){
//         alert(encode.data.msg);
//         callupdatedeggree();
//       }
//       else{
//         alert(encode.data.msg);
//       }
//       },
//   });
// }