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


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

function callTeachOficerEntry() {
  $("#page_main_div").load(
    "../html_modules/teachOficerEntry.html",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Identify Technical Officer";
      document.getElementById("module_name_for_save").value =
        "Identify Technical Officer";
      getDefaultHeadFooterLinks("Identify Technical Officer");
      document.getElementById("screen").value = "add";
      $.ajax({
        type: "POST",
        url: $host_url + "getdeggrp",
        success: function (responce) {
          var responce = eval("(" + responce + ")");
          if (responce.error_code == 0) {
            var deggrp = responce.data;
            var options;
            options += `<option value="">--Select--</option>`;
            for (var i = 0; i < deggrp.length; i++) {
              options += `<option value="${deggrp[i].fdeggrp}">${deggrp[i].fdescpn}</options>`;
            }
            $("#deggrp").html(options);
          }
        },
      });
    }
  );
}
var tablecnt = 0;
function ViewDeatilsto() {
  document.getElementById("screen").value = "edit";
  $("#header_save").hide();
  $("#footer_save").hide();

  // console.log(document.getElementById("screen").value);
  $.ajax({
    type: "POST",
    url: $host_url + "ViewDeatilsto",
    success: function (responce) {
      var responce = eval("(" + responce + ")");
      if (responce.error_code == 0) {
        tablecnt = responce.data.rowcnt;
        $("#todeatils").html(responce.data.table);
      } else {
        $("#todeatils").html(responce.data.table);
      }
    },
  });
}

function saveto() {
  var name = $("#name").val();
  var mob = $("#mob").val();
  var deggrp = $("#deggrp").val();
  var datefrom = $("#tech_officer_date_from").val();
  var dateto = $("#tech_officer_date_to").val();
  var status = $("#status_tech_officer").val();
  var type = $("#screen").val();
  // console.log(document.getElementById("screen").value);
  if (type == "add") {
    if (name == "") {
      alert("Please Enter Technical Officer Name");
      document.getElementById("name").focus();
      return;
    }

    if (mob == "") {
      alert("Please Enter Technical Officer Mobile No.");
      document.getElementById("mob").focus();
      return;
    }

    if (deggrp == "") {
      alert("Please Select Degree Group");
      document.getElementById("deggrp").focus();
      return;
    }
    if (datefrom == "") {
      alert("Please Select From Date");
      document.getElementById("tech_officer_date_from").focus();
      return;
    }
    if (dateto == "") {
      alert("Please Select To Date");
      document.getElementById("tech_officer_date_to").focus();
      return;
    }

    if (status == "") {
      alert("Please Select status");
      document.getElementById("tech_officer_date_to").focus();
      return;
    }

    $.blockUI({
      message:
        "<h1 class='h1' style='font-size:12px'><img src='images/ajax-loader.gif' border='0'></h1>",
    });
    $.ajax({
      type: "POST",
      async: false,
      data:
        "&name=" +
        name +
        "&mob=" +
        mob +
        "&deggrp=" +
        deggrp +
        "&datefrom=" +
        datefrom +
        "&dateto=" +
        dateto +
        "&status=" +
        status +
        "&type=" +
        type,
      url: $host_url + "saveto",
      success: function (responce) {
        $.unblockUI();
        var responce = eval("(" + responce + ")");
        alert(responce.data);
        callTeachOficerEntry();
        return;
      },
    });
  } else if (type == "edit") {
    var arr_edit = [];
    var obj = {};
    obj.name = $("#name").val();
    obj.mob = $("#mob").val();
    obj.deggrp = $("#deggrp").val();
    obj.datefrom = $("#tech_officer_date_from").val();
    obj.dateto = $("#tech_officer_date_to").val();
    obj.status = $("#status_tech_officer").val();
    obj.type = $("#screen").val();
    arr_edit.push(obj);
    // console.log(arr_edit);

    $.ajax({
      type: "POST",
      async: false,
      data: "&type=" + type + "&arr_edit=" + JSON.stringify(arr_edit),
      url: $host_url + "saveto",
      success: function (responce) {
        $.unblockUI();
        var responce = eval("(" + responce + ")");
        // console.log(responce);
        alert(responce.data);
        callTeachOficerEntry();
        return;
      },
    });
  }
}

function deletetechofficer(mob) {
  console.log(mob);

  var txt;
  var r = confirm("Are you sure Do you want to delete?");
  if (r == true) {
    $.ajax({
      type: "POST",
      async: false,
      data: "&mob=" + mob,
      url: $host_url + "deletetechofficer",
      success: function (responce) {
        $.unblockUI();
        var responce = eval("(" + responce + ")");
        // console.log(responce);
        ViewDeatilsto();

        return;
      },
    });
  } else {
    return;
  }
}

function edittechofficer(mob) {
  console.log(mob);

  var fdeggrp = "";
  var fname = "";
  var fmobile = "";
  var fdatefrom = "";
  var fdateto = "";
  var fsuspend = "";

  $.ajax({
    type: "POST",
    async: false,
    data: "&mob=" + mob,
    url: $host_url + "edittechofficer",
    success: function (responce) {
      $.unblockUI();
      var responce = eval("(" + responce + ")");
      console.log(responce.data["fsuspend"]);
      fdeggrp = responce.data["fdeggrp"];
      fname = responce.data["fname"];
      fmobile = responce.data["fmobile"];
      fdatefrom = responce.data["fdatefrom"];
      fdateto = responce.data["fdateto"];
      fsuspend = responce.data["fsuspend"];
      $("#page_main_div").load(
        "../html_modules/teachOficerEntry.html",
        function () {
          document.getElementById("display_module_name").innerHTML =
            "Identify Technical Officer";
          document.getElementById("module_name_for_save").value =
            "Identify Technical Officer";
          getDefaultHeadFooterLinks("Identify Technical Officer");
          document.getElementById("screen").value = "edit";
          $.ajax({
            type: "POST",
            url: $host_url + "getdeggrp",
            success: function (responce) {
              var responce = eval("(" + responce + ")");
              if (responce.error_code == 0) {
                var deggrp = responce.data;
                var options;
                options += `<option value="">--Select--</option>`;
                for (var i = 0; i < deggrp.length; i++) {
                  options += `<option value="${deggrp[i].fdeggrp}">${deggrp[i].fdescpn}</options>`;
                }
                $("#deggrp").html(options);
                document.getElementById("deggrp").value = fdeggrp;
                document.getElementById("name").value = fname;
                document.getElementById("mob").value = fmobile;
                document.getElementById("tech_officer_date_from").value =
                  fdatefrom;
                document.getElementById("tech_officer_date_to").value = fdateto;
                $("#mob").prop("disabled", true);
                var sus = "";
                if (fsuspend == "T") {
                  sus = "S";
                } else {
                  sus = "A";
                }
                console.log(sus);
                document.getElementById("status_tech_officer").value = sus;
              }
            },
          });
        }
      );

      // return;
    },
  });
}