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


Current Path : /proc/thread-self/root/var/www/html/college/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/college/js/colltransfer.js

function callcollegetransfer() {
  $("#page_main_div").load("../html_modules/colltransfer.html", function () {
    document.getElementById("display_module_name").innerHTML =
      "Initiate College Transfer";
    document.getElementById("module_name_for_save").value =
      "Initiate College Transfer";
    getDefaultHeadFooterLinks("Initiate College Transfer");
    // loadtable();
  });
  loadcoltrans();
}

function getDetails() {
  var teachcode = document.getElementById("teachcode").value;
  //   console.log(teachcode);
  //   return;

  $.ajax({
    type: "GET",
    data: "&teachcode=" + teachcode,
    url: $host_url + "getDetails",
    success: function (response) {
      var encode = JSON.parse(response);
      console.log(response);
      if (encode.error_code == 0) {
        $("#techname").val(encode.data.fteachname);
        $("#techname").attr("disabled", "disabled");
        $("#dob").val(encode.data.fdob);
        $("#dob").attr("disabled", "disabled");
      } else {
        alert(encode.data.msg);
      }
    },
  });
}

function loadcoltrans() {
  $.ajax({
    type: "GET",
    url: $host_url + "loadcoltrans",
    success: function (response) {
      var encode = JSON.parse(response);
      var colloption = `<option value="">--select--</option>`;
      for (var i = 0; i < encode.data.college.length; i++) {
        // teachoption+=`<option value="${encode.data.teach[i].fteachcode}">${encode.data.teach[i].fteachname}</option>`;
        colloption += `<option value="${encode.data.college[i].fcollcode}">${encode.data.college[i].fcollname}</option>`;
      }
      $("#colname").html(colloption);
    },
  });
}

function savetranscoll() {
  var teachname = document.getElementById("techname").value;
  var collname = document.getElementById("colname").value;
  var remarks = document.getElementById("remarks").value;
  var fid = document.getElementById("fid").value;
  var dob = document.getElementById("dob").value;
  var teachcode = document.getElementById("teachcode").value;
  // console.log(teachname);
  // return;
  // var split = teachname.split("-");
  // var teachname = split[1];
  // var teachcode = split[0];
  // console.log(teachcode);
  // return;

  if (teachcode == "") {
    alert("please enter teacher code..");
    return false;
  } else if (collname == "") {
    alert("Please Select College...");
    return false;
  }

  $.ajax({
    type: "POST",
    data:
      "&fid=" +
      fid +
      "&ftocolcode=" +
      collname +
      "&remarks=" +
      remarks +
      "&teachname=" +
      teachname +
      "&teachcode=" +
      teachcode +
      "&dob=" +
      dob,
    url: $host_url + "savetranscoll",
    success: function (response) {
      var encode = JSON.parse(response);
      if (encode.error_code == 0) {
        alert(encode.data.msg);
        // callcollegetransfer();
      } else {
        alert(encode.data.msg);
        return;
      }
    },
  });
}

function loadtable() {
  $("#page_main_div").load("../html_modules/viewcoltrans.html");
  $.ajax({
    type: "GET",
    url: $host_url + "loadtable",
    success: function (response) {
      var encode = JSON.parse(response);
      // console.log(encode.data[0].fid);
      // return;
      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;">Teacher Transfer Details</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:200px; font-size:12px; 
              border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Teacher Name</td>

              <td align="center" style="width:85px; font-size:12px; 
              border-right:1px solid #C5DBEC;align-items:center; border-bottom:1px solid #C5DBEC;">Teacher Code</td>
      
              <td align="center" style="width:85px; font-size:12px; padding:5px 5px; 
               border-right:1px solid #C5DBEC;align-items:center; border-bottom:1px solid #C5DBEC;">College Code(To)</td>
      
               <td align="center" style="width:300px; font-size:12px; padding:5px 5px; 
               border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Remarks</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: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++) {
          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;">${
                      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].fteachcode
                    }</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
                    }</td>

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

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

          if (encode.data[i].fstatus != "reported") {
            table += `<td><span onclick="edittable('${encode.data[i].fid}')" 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>`;
          }
          table += `</tr>`;
        }
        table += `</table>`;
        $("#viewtable").html(table);
      } else {
        alert(encode.data.msg);
        return;
      }
    },
  });
}

function edittable(fid) {
  callcollegetransfer();
  $.ajax({
    type: "GET",
    data: "&fid=" + fid,
    url: $host_url + "edittable",
    success: function (response) {
      var encode = JSON.parse(response);
      console.log(encode.data.fremarks);
      document.getElementById("techname").disabled = true;
      $("#techname").val(encode.data.fteachname);
      $("#techname").attr("disabled", "disabled");
      $("#colname").val(encode.data.ftocolcode);
      $("#teachcode").val(encode.data.fteachcode);
      $("#teachcode").attr("disabled", "disabled");
      $("#dob").val(encode.data.fdob);
      $("#dob").attr("disabled", "disabled");
      $("#remarks").val(encode.data.fremarks);
      $("#fid").val(fid);
    },
  });
}

function addcoltransfer() {
  callcollegetransfer();
}