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


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

function teachattend() {
  $("#page_main_div").load(
    "../html_modules/uploadteachattend.html?",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Upload Teacher Attendance";
      document.getElementById("module_name_for_save").value =
        "Upload Teacher Attendance";
      getDefaultHeadFooterLinks("Upload Teacher Attendance");
      loadteachattendance();
    }
  );
}

function loadteachattendance() {
  $.ajax({
    type: "POST",
    url: $host_url + "loadteachattendance",
    success: function (response) {
      var encode = JSON.parse(response);
      var teachlist = "";
      var teachattend = "";

      teachlist =
        "https://teachattendance.s3.ap-south-1.amazonaws.com/" +
        encode.data.fteachlist;

      teachattend =
        "https://teachattendance.s3.ap-south-1.amazonaws.com/" +
        encode.data.fteachattend;
      var tabteach = `<table
        class='table table-bordered table-striped table-upd'
        style='border-spacing: 0px !important; width: 835px'
        cellpading='2'
      >
        <thead>
          <tr class='ui-state-default ui-jqgrid-hdiv'>
            <th
              style='
                padding: 2px;
                width: 50px;
                border-top: 1px solid #c5dbec;
                border-left: 1px solid #c5dbec;
                border-right: 1px solid #c5dbec;
                border-bottom: 1px solid #c5dbec;
              '
            >
              Sl. No.
            </th>
  
            <th
              style='
                padding: 2px;
                width: 200px;
                border-top: 1px solid #c5dbec;
                border-right: 1px solid #c5dbec;
                border-bottom: 1px solid #c5dbec;
              '
            >
              Description
            </th>
  
            <th
              style='
                padding: 2px;
                width: 380px;
                border-right: 1px solid #c5dbec;
                border-top: 1px solid #c5dbec;
                border-bottom: 1px solid #c5dbec;
              '
            >
              Upload
            </th>
  
            <th
              style='
                padding: 2px;
                width: 150px;
                border-right: 1px solid #c5dbec;
                border-top: 1px solid #c5dbec;
                border-bottom: 1px solid #c5dbec;
              '
            >
              View
            </th>
            <th
              style='
                padding: 2px;
                width: 150px;
                border-right: 1px solid #c5dbec;
                border-top: 1px solid #c5dbec;
                border-bottom: 1px solid #c5dbec;
              '
            >
              Uploaded Date
            </th>
          </tr>
  
          <tr></tr>
        </thead>
        
        <tr class="ui-widget-content jqgrow">
        <td
          class="tbl_row_new"
          align="center"
          style="
            border-left: 1px solid #c5dbec;
            border-right: 1px solid #c5dbec;
            padding: 2px;
          "
        >
          1
        </td>
        <td
          class="tbl_row_new"
          align="center"
          style="
            border-right: 1px solid #c5dbec;
            padding: 5px;
            text-align: left;
          "
        >
          Upload Teacher List
        </td>
        <td
          class="tbl_row_new"
          align="center"
          style="border-right: 1px solid #c5dbec; padding: 5px"
        >
          <input type="file" name="doclist" id="doclist" />
          <span
            style="
              background-color: seagreen;
              border: none;
              color: white;
              padding: 5px 20px;
              text-align: center;
              text-decoration: none;
              display: inline-block;
              font-size: 12px;
              cursor: pointer;
            "
            onclick="uplteachlist()"
            >Upload</span
          >
        </td>
        <td
          class="tbl_row_new"
          align="center"
          style="border-right: 1px solid #c5dbec; padding: 5px"
        >
          <a href="${teachlist}" id="teachlist" target="_blank">View</a>
        </td>
        <td
          class="tbl_row_new"
          align="center"
          style="border-right: 1px solid #c5dbec; padding: 5px"
          id="list"
        >${encode.data.flistdate}</td>
      </tr>

      <tr class="ui-widget-content jqgrow">
        <td
          class="tbl_row_new"
          align="center"
          style="
            border-left: 1px solid #c5dbec;
            border-right: 1px solid #c5dbec;
            padding: 2px;
          "
        >
          2
        </td>
        <td
          class="tbl_row_new"
          align="center"
          style="
            border-right: 1px solid #c5dbec;
            padding: 5px;
            text-align: left;
          "
        >
          Upload Teacher Attendance
        </td>
        <td
          class="tbl_row_new"
          align="center"
          style="border-right: 1px solid #c5dbec; padding: 5px"
        >
          <input type="file" name="docattend" id="docattend" />
          <span
            style="
              background-color: seagreen;
              border: none;
              color: white;
              padding: 5px 20px;
              text-align: center;
              text-decoration: none;
              display: inline-block;
              font-size: 12px;
              cursor: pointer;
            "
            onclick="uplteachattend()"
            >Upload</span
          >
        </td>
        <td
          class="tbl_row_new"
          align="center"
          style="border-right: 1px solid #c5dbec; padding: 5px"
        >
          <a href="${teachattend}" id="teachattend" target="_blank">View</a>
        </td>
        <td
          class="tbl_row_new"
          align="center"
          style="border-right: 1px solid #c5dbec; padding: 5px"
        >
          ${encode.data.fattenddate}
        </td>
      </tr>
    </table>`;

      $("#tabtechdet").html(tabteach);
      if (encode.data.fteachlist == "") {
        $("#teachlist").hide();
      } else {
        $("#teachlist").show();
      }
      if (encode.data.fteachattend == "") {
        $("#teachattend").hide();
      } else {
        $("#teachattend").show();
      }
    },
  });
}

function uplteachlist() {
  var file_data = $("#doclist").prop("files")[0];
  var form_data = new FormData();
  form_data.append("file", file_data);

  if ($("#doclist")[0].files.length === 0) {
    alert("No files selected");
    return;
  }

  $.ajax({
    url: "uploadteachlist.php",
    dataType: "text",
    cache: false,
    contentType: false,
    processData: false,
    data: form_data,
    type: "post",
    success: function (response) {
      var response = JSON.parse(response);
      console.log(response);
      if (response.err_code == -2) {
        alert(response.msg);
        loadteachattendance();
        return;
      }

      if (response.err_code == 0) {
        $.ajax({
          type: "POST",
          data: "&file=" + response.teachlistdoc,
          url: $host_url + "teachlist_AWS",
          success: function (response) {
            var encode = JSON.parse(response);
            if (encode.error_code == 0) {
              alert(encode.data.msg);
              loadteachattendance();
            } else {
              alert(encode.data.msg);
              return;
            }
          },
        });
      }
    },
  });
}

function uplteachattend() {
  var file_data = $("#docattend").prop("files")[0];
  var form_data = new FormData();
  form_data.append("file", file_data);

  if ($("#docattend")[0].files.length === 0) {
    alert("No files selected");
    return;
  }

  $.ajax({
    url: "uploadteachattend.php",
    dataType: "text",
    cache: false,
    contentType: false,
    processData: false,
    data: form_data,
    type: "post",
    success: function (response) {
      var response = JSON.parse(response);
      console.log(response);
      if (response.err_code == -2) {
        alert(response.msg);
        loadteachattendance();
        return;
      }

      if (response.err_code == 0) {
        $.ajax({
          type: "POST",
          data: "&file=" + response.teachattenddoc,
          url: $host_url + "teachattend_AWS",
          success: function (response) {
            var encode = JSON.parse(response);
            if (encode.error_code == 0) {
              alert(encode.data.msg);
              loadteachattendance();
            } else {
              alert(encode.data.msg);
              return;
            }
          },
        });
      }
    },
  });
}