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/comfama.sports-crowd.com/public/js/academy_reports.js
$(document).ready(function () {
    Dropzone.options.saveReports = {
        success: function (file, response) {
            //Here you can get your response.
            if (response.r == 200) {
                const get = document.getElementById('button');
                get.addEventListener('click', e => { });
                get.dispatchEvent(new Event('click'));
            }
        }
    }
});

function viewReport(academy_user_id) {
    validateUserAcademy(academy_user_id);
}

function validateUserAcademy(academy_user_id) {
    $.ajax({
        url: "/academy_user/performance_reports/" + academy_user_id,
        type: "GET",
        contentType: "application/json",
        headers: {
            "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
            "Content-Type": "application/json",
        },
        success: function (r) {
            if (r.r == false) {
                swal("Error", r.m, "error");
            } else {
                $(location).attr("href", "/academy_user/performance_reports/" + academy_user_id);
            }
        },
        error: function (e) {
            swal("Error", Lang.get("messagesClient.academy_states.error_modifying"), "error");
        },
    });

}

function clickEvent() {
    createToast();
}

const button = document.getElementById('button')
const toast = document.getElementById('toasts')

const messages = [
    'El informe se ha guardado con éxito',
]

const types = [
    'success',
]

function createToast(message = null, type = null) {
    let properties

    const notif = document.createElement('div')
    const notifIcon = document.createElement('span')
    notifIcon.style = "margin: 0 20px 0 0;";
    const notificationType = type ? type : getRandomType()

    properties = setProperties(notificationType)

    notif.classList.add('toast')
    notif.classList.add(notificationType)

    notifIcon.classList.add(properties[0])
    notifIcon.classList.add(properties[1])
    notif.innerText = messages[properties[2]]

    toast.appendChild(notif)
    notif.append(notifIcon)

    setTimeout(() => {
        notif.remove()
    }, 5000)
}

function setProperties(notificationType) {
    let propertyList

    switch (notificationType) {
        case 'success':
            propertyList = ['fa', 'fa-file-pdf-o', 0]
            break
    }

    return propertyList;
}

function getRandomType() {
    return types[Math.floor(Math.random() * types.length)]
}