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/publication_dashboard.js
var table;
$(document).ready(function() {
    //---------------------------------------------table----------------------------------------------------
    table = $('#example2').DataTable({
        "orderCellsTop": true,
        "responsive": true,
        "processing": true,
        "scrollX": true,
        "scrollCollapse": true,
        "paging": true,
        "language": {
            url: window.DATATABLES_LANGUAGE_URL,
        }
    });

    $('#example2 thead tr')
        .clone(true)
        .find('th')
        .removeClass('sorting_asc sorting_asc sorting')
        .off('click')
        .end()
        .appendTo('#example2 thead');

    $('#example2 thead tr:eq(1) th').each(function(i) {
        $(this).html(
            '<div class="inner-addon left-addon"><i class="glyphicon ace-icon fa fa-filter"></i><input type="text" style="width: 100%; padding-right: 5px" class="form-control"/></div>'
        );

        $('input', this).on('keyup change', function() {
            if (table.column(i).search() !== this.value) {
                table
                    .column(i)
                    .search(this.value)
                    .draw();
            }
        });
    });
    //--------------------------------------------\table----------------------------------------------------

    //------------------------------------------date_filer--------------------------------------------------
    $.fn.datepicker.dates['en'] = {
        days: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
        daysShort: ['Dom', 'Lun', 'Mar', 'Mié', 'Juv', 'Vie', 'Sáb'],
        daysMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sá'],
        months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre',
            'Octubre', 'Noviembre', 'Diciembre'
        ],
        monthsShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov',
            'Dic'
        ],
        today: "Hoy",
        clear: "Clear",
        format: "yyyy-mm-dd",
        titleFormat: "MM yyyy",
        weekStart: 0
    };

    $("input[name='min_date']").datepicker({
        dateFormat: 'yyyy-mm-dd'
    });
    $("input[name='max_date']").datepicker({
        dateFormat: 'yyyy-mm-dd'
    });

    $("input[name='min_date']").on('change', function(event) {
        minDate = this.value;
        table.draw()
    });

    $("input[name='max_date']").on('change', function(event) {
        maxDate = this.value;
        table.draw()
    });

    DataTable.ext.search.push(function(settings, data, dataIndex) {
        let min = $("#min_date").val();
        let max = $("#max_date").val();
        let types = $("select[name='type']").val();
        
        let date = new Date(data[4]);
        if (min && date <= new Date(min)) {
            return false;
        }

        if (max && date >= new Date(max)) {
            return false;
        }

        if (types && !types.includes(data[1])) {
            return false;
        }

        return true;
    });
    //-----------------------------------------\date_filer--------------------------------------------------

    //-------------------------------------------select2----------------------------------------------------
    $('.select2').select2();

    $("select[name='type']").on('change', function() {
        table.draw();
    });
    //------------------------------------------\select2----------------------------------------------------
});

function clickExportAll() {
    var validateDownloadUrl = document.location.origin + "/club_content_dashboard/validateExport";
    var downloadUrl = document.location.origin + "/club_content_dashboard/export/";

    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(info),
        success: function (response) {
            $('#loading').hide();
            if (response.success) {
                window.location.assign(downloadUrl + response.data);
            } else {
                swal("Error", response.message, "error");
            }
        },
        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");
        }
    });
}

function showReactions(publicationId){
    $(location).attr("href", "/club_content_dashboard/reactions/" + publicationId);
}

function showComments(publicationId){
    $(location).attr("href", "/club_content_dashboard/comments/" + publicationId);
}