Uname:Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64

403WebShell
403Webshell
Server IP : 13.126.101.145  /  Your IP : 216.73.216.131
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/rentals_updated/wp-content/plugins/operators/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/rentals_updated/wp-content/plugins/operators/multiselect-operator-columns.php
<!-- Include Bootstrap CSS and JS for Multiselect -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.bundle.min.js"></script>
<!-- Include Bootstrap Multiselect CSS and JS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-multiselect@0.9.15/dist/css/bootstrap-multiselect.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap-multiselect@0.9.15/dist/js/bootstrap-multiselect.min.js"></script>

<div class="form-group" style="margin-bottom:unset;">
    <label for="columnSelector">Select Columns:</label>
    <select id="columnSelector" multiple class="form-control">
        <option value="0">Sr. No</option>
        <option value="1">Profile Pic</option>
        <option value="2">First Name</option>
        <option value="3">Last Name</option>
        <option value="4">Employee ID</option>
        <option value="5">Email</option>
        <option value="6">Phone Number</option>
        <option value="7">Work Location</option>
        <option value="8">Status</option>
        <option value="9">Actions</option>
    </select>
</div>

<style>
/* Updated CSS */
select[multiple] {
    height: 150px;
    width: 100%;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    box-sizing: border-box;
    background-color: #f8f9fa;
    color: #333;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

select[multiple]:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
    outline: none;
}

.multiselect-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    background-color: #fff;
    padding: 10px;
    box-sizing: border-box;
    width: 240px;
}

.multiselect-container > li > a > label {
    padding: 3px 10px 3px 3px !important;
    display: flex !important;
    align-items: center !important;
}

.multiselect-container > li > a > label > input[type="checkbox"] {
    margin-right: 5px !important;
    position: relative !important;
}

.dropdown-item {
    color: #333;
    padding: 5px 10px;
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f1f1f1;
    color: #007bff;
}

.dropdown-item.active {
    background-color: unset;
    color: #000;
}

.multiselect-container .multiselect-item label {
    margin: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.multiselect-container .multiselect-item label:hover {
    background-color: #f1f1f1;
}

.multiselect-container .multiselect-item.active {
    background-color: #007bff;
    color: #fff;
    border-radius: 3px;
}

.form-group input[type=checkbox] {
    margin: 0 !important;
}

.multiselect-container>li>a>label.checkbox, 
.multiselect-container>li>a>label.radio {
    margin: 0;
    background-color: #fff;
    color: #000;
}
</style>

<script>
jQuery(document).ready(function($) {
    // Initialize DataTable first
    var dataTable = $('#operator-table').DataTable({
        "scrollX": true,
        "columnDefs": [
            { "visible": true, "targets": '_all' }
        ]
    });

    // Function to initialize Multiselect
    function initializeMultiselect() {
        if ($('#columnSelector').data('multiselect')) {
            $('#columnSelector').multiselect('destroy');
        }

        $('#columnSelector').multiselect({
            includeSelectAllOption: true,
            enableFiltering: false,
            maxHeight: 300,
            numberDisplayed: 7,
            selectAllText: 'Select All',
            buttonText: function(options, select) {
                return options.length + ' selected';
            },
            onChange: function(option, checked) {
                var columnIdx = $(option).val();
                dataTable.column(columnIdx).visible(checked);
                saveColumnVisibility();
                updateButtonText();
            },
            onSelectAll: function() {
                dataTable.columns().visible(true);
                saveColumnVisibility();
                updateButtonText();
            },
            onDeselectAll: function() {
                dataTable.columns().visible(false);
                saveColumnVisibility();
                updateButtonText();
            }
        });

        // Load saved column visibility
        loadColumnVisibility();
    }

    // Function to update button text
    function updateButtonText() {
        var selectedCount = $('#columnSelector option:selected').length;
        $('#columnSelector').siblings('.multiselect-selected-text').text(selectedCount + ' selected');
    }

    // Function to save column visibility state to localStorage
    function saveColumnVisibility() {
        var visibleColumns = [];
        $('#columnSelector option').each(function() {
            var columnIdx = $(this).val();
            if (dataTable.column(columnIdx).visible()) {
                visibleColumns.push(columnIdx);
            }
        });
        localStorage.setItem('columnVisibility', JSON.stringify(visibleColumns));
    }

    // Function to load column visibility state from localStorage
    function loadColumnVisibility() {
        var visibleColumns = JSON.parse(localStorage.getItem('columnVisibility'));
        if (visibleColumns) {
            dataTable.columns().visible(false);
            $('#columnSelector').multiselect('deselectAll', false);
            $.each(visibleColumns, function(index, columnIdx) {
                dataTable.column(columnIdx).visible(true);
                $('#columnSelector').multiselect('select', columnIdx);
            });
        } else {
            // Default: show all columns
            dataTable.columns().visible(true);
            $('#columnSelector').multiselect('selectAll', false);
        }
        updateButtonText();
    }

    // Initialize multiselect immediately
    initializeMultiselect();

    // Handle initialization on first click if needed
    $(document).on('click', '#columnSelector, .multiselect.dropdown-toggle', function(e) {
        if (!$('#columnSelector').data('multiselect')) {
            initializeMultiselect();
        }
    });
});
</script>

Youez - 2016 - github.com/yon3zu
LinuXploit