HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/sigedo-dev.allup.com.co/resources/js/views/documents.js
$(document).ready(function() {
  function getData() {
    var document_user = document.getElementById("document_user").value;
    var filestatus_id = document.getElementById("filestatus_id").value;
    var institution_id = document.getElementById("institution_id").value;
    var program_id = document.getElementById("program_id").value;

    if (document_user == "" && filestatus_id == 0 && institution_id == 0 && program_id == 0) {
      Swal.fire({
        type: "error",
        title: "Oops...",
        text: Lang.get("fronjs.filter_required"),
      });
      return;
    }

    var data = {
      document_user: document_user != "" ? document_user : 0,
      filestatus_id: filestatus_id != 0 ? filestatus_id : 0,
      institution_id: institution_id != 0 ? institution_id : 0,
      program_id: program_id != 0 ? program_id : 0,
    };

    return data;
  }

  $("#button_search").on("click", function(e) {
    e.preventDefault();
    if ((info = getData())) {
      var language = $("#button_search").attr("language");
      var url_lang = "";
      if (language == "es") {
        url_lang = "https://cdn.datatables.net/plug-ins/1.10.19/i18n/Spanish.json";
      }

      $("#table-list")
        .dataTable()
        .fnDestroy();
      _table = $("#table-list").DataTable({
        responsive: true,
        processing: true,
        serverSide: true,
        order: [],
        pageLength: 100,
        language: {
          url: url_lang,
        },

        ajax: (url = "/documents/list/" + info.filestatus_id + "/" + info.document_user + "/" + info.institution_id + "/" + info.program_id),
        columns: [
          {
            data: "u_document",
            name: "u_document",
            render: function(data, type, info) {
              return info["u_document"] != null ? info["u_document"] : "";
            },
          },
          {
            data: "u_name",
            name: "u_name",
            render: function(data, type, info) {
              return info["u_name"] != null ? info["u_name"] + " " + info["u_last_name"] : "";
            },
          },
          {
            data: "it_name",
            name: "it_name",
            render: function(data, type, info) {
              return info["it_name"] != null ? info["it_name"] : "";
            },
          },
          {
            data: "pr_name",
            name: "pr_name",
            render: function(data, type, info) {
              return info["pr_name"] != null ? info["pr_name"] : "";
            },
          },
          {
            data: "ft_name",
            name: "ft_name",
            render: function(data, type, info) {
              return info["ft_name"] != null ? info["ft_name"] : info["name"];
            },
          },
          {
            data: "fs_name",
            name: "fs_name",
            render: function(data, type, info) {
              return info["fs_name"] != null ? info["fs_name"] : "Sin Cargar";
            },
          },
          { data: "expedition_date", name: "expedition_date" },
          { data: "expiration_date", name: "expiration_date" },
          { data: "actions", name: "actions" },
        ],
      });
    }
  });
});

window.approvedDocument = function(userdocument_id) {
  Swal.fire({
    title: Lang.get("fronjs.title_approved_document"),
    type: "warning",
    showCancelButton: true,
    confirmButtonColor: "#3085d6",
    cancelButtonColor: "#d33",
    confirmButtonText: Lang.get("fronjs.yes"),
    cancelButtonText: Lang.get("fronjs.not"),
    showLoaderOnConfirm: true,
    allowOutsideClick: false,
    allowEscapeKey: false,
    preConfirm: (login) => {
      return new Promise((resolve, reject) => {
        $.ajax({
          url: "/userdocuments/changeStatus/" + userdocument_id,
          type: "GET",
          dataType: "json",
          contentType: "application/json",
          data: null,
          success: function(response) {
            if (response.status) {
              Swal.fire({
                type: response.type,
                title: response.title,
                text: response.message,
                showConfirmButton: true,
              });
            } else {
              Swal.fire({
                type: response.type,
                title: response.title,
                text: response.message,
              });
            }
          },
        });
      });
    },
  }).then((result) => {
    console.log(result);
  });
};