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


Current Path : /proc/thread-self/root/proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/var/www/oasis/src/receive_teach_transfer.js

function enableTeachTransfer() {
  //   console.log("hi");
  $("#page_main_div").load(
    "../html_modules/receive_teach_trans.html",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Complete College Transfer";
      document.getElementById("module_name_for_save").value =
        "Complete College Transfer";
      getDefaultHeadFooterLinks("Complete College Transfer");
      // loadPage();
      loadTable();
    }
  );
}

function loadTable() {
  $.ajax({
    type: "GET",
    url: $host_url + "loadteachtable",
    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="7" class="ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper" 
        style="font-size:12px; padding-left:6px; height:24px;">Receive Teacher Transfer</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;">App.<br>No.</td>

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

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

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

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

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

        <td align="center" style="width:40px; 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(encode.data[i].fstatus);
          // return;

          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;">${
                  encode.data[i].fid
                }</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].fteachcode
                }</td>
    
                <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">${
                  encode.data[i].fteachname
                }</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].ffromcolcode +
                  " - " +
                  encode.data[i].ffromcollname
                }</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].ftocolcode + " - " + encode.data[i].ftocollname
                }</td>
    
                <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:15px;text-align:center;">
            
                <select id="status">
                <option value="">--select--</option>
                <option value="reported">Reported</option>
                <option value="not_reported">Not reported</option>
                </select></td>`;

          table += `<td><span id="btnupdate" onclick="updateHandler('${encode.data[i].fteachcode}')" style="background-color: #008CBA; border: none; color: white; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer;"">Update</span></td></tr>`;
        }
        table += `</table>`;
        $("#tdata").html(table);
      } else {
        alert(encode.data.msg);
      }
    },
  });
}

function updateHandler(teachcode) {
  var status = document.getElementById("status").value;
  if (document.getElementById("status").value == "") {
    alert("please selec status..");
    return false;
  }
  $.ajax({
    type: "POST",
    data: "&fstatus=" + status + "&fteachcode=" + teachcode,
    url: $host_url + "updateHandler",
    success: function (response) {
      var encode = JSON.parse(response);
      if (encode.error_code == 0) {
        alert(encode.data.msg);
      } else {
        alert(encode.data.msg);
      }
    },
  });
}