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/demo.sports-crowd.com/public/js/memberships.js
const validatePayment = function (transactionId) {
    $.ajax({
        url: '/memberships/validate-payment/' + transactionId,
        success: function (data) {
            swal(
                Lang.get('memberships.messages.edit_success'), {
                icon: "success",
                buttons: {
                    Ok: true,
                },
            }).then((val) => {
                if (val == "Ok") {
                    $(location).attr("href", '/memberships/dashboard');
                }
            });
        },
        error: function (a) {
            swal("Error", a.responseJSON.message ?? Lang.get('memberships.messages.generic_error'), "error");
        }
    });
}

const clickExportAll = function () {
    const table = $(`${SELECTOR_PREFIX}`).DataTable();
    var validateDownloadUrl = document.location.origin + "/memberships/downloadReport";

    info = {
        data: table.rows({
            filter: 'applied'
        }).data().toArray()
    }

    $.ajax({
        url: validateDownloadUrl,
        type: "POST",
        contentType: "application/json",
        headers: {
            "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
            "Content-Type": "application/json",
        },
        data: JSON.stringify({
            states: $('select[name="states"]').val(),
            is_renewal: $('select[name="is_renewal"]').val(),
            start_date: $('input[name="start_date"]').val(),
            end_date: $('input[name="end_date"]').val()
        }),
        success: function (response) {
            const filename = Lang.get('memberships.export.file_name') + ".xlsx";
            const rows = response.data;
            const new_rows = rows.map(
                ({
                    ...rest
                }) => ({
                    ...rest
                }));
            let headers = Object.keys(new_rows[0]);
            headers = headers.map((header) => Lang.get('memberships.export.columns.' + header));
            const worksheet = XLSX.utils.json_to_sheet(new_rows);
            XLSX.utils.sheet_add_aoa(worksheet, [headers], {
                origin: "A1"
            });
            const workbook = XLSX.utils.book_new();
            XLSX.utils.book_append_sheet(workbook, worksheet, "Report");
            XLSX.writeFile(workbook, filename, {
                compression: true
            });
            $('#loading').hide();
        },
        error: function (response) {
            $('#loading').hide();
            swal("Error", response.responseJSON ? response.responseJSON.message :
                'Hubo un error en el servidor, espere unos segundos e intente de nuevo',
                "error");
        }
    });
}