Fix settings
This commit is contained in:
@@ -162,79 +162,7 @@ function sortTable(table, column) {
|
||||
rows.forEach(row => tbody.appendChild(row));
|
||||
}
|
||||
|
||||
function createSettingsModal() {
|
||||
const backdrop = document.createElement('div');
|
||||
backdrop.className = 'settings-modal-backdrop';
|
||||
backdrop.innerHTML = `
|
||||
<div class="settings-modal ascii-frame-outer">
|
||||
<span class="bottom-left-corner">╚</span>
|
||||
<span class="bottom-right-corner">╝</span>
|
||||
|
||||
<div class="ascii-section-header">Dashboard Settings</div>
|
||||
|
||||
<div class="ascii-content">
|
||||
<div class="ascii-frame-inner">
|
||||
<div class="setting-group">
|
||||
<h3>Rows per Page</h3>
|
||||
<select id="rows-per-page">
|
||||
<option value="15">15</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ascii-divider"></div>
|
||||
|
||||
<div class="ascii-content">
|
||||
<div class="settings-modal-footer">
|
||||
<button class="save-settings">Save Settings</button>
|
||||
<button class="cancel-settings">Cancel</button>
|
||||
<button class="close-modal">×</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(backdrop);
|
||||
|
||||
// Load saved rows per page setting
|
||||
const savedRowsPerPage = localStorage.getItem('ticketsPerPage') || '15';
|
||||
const rowsPerPageSelect = backdrop.querySelector('#rows-per-page');
|
||||
rowsPerPageSelect.value = savedRowsPerPage;
|
||||
|
||||
// Event listeners
|
||||
backdrop.querySelector('.close-modal').addEventListener('click', closeSettingsModal);
|
||||
backdrop.querySelector('.cancel-settings').addEventListener('click', closeSettingsModal);
|
||||
backdrop.querySelector('.save-settings').addEventListener('click', saveSettings);
|
||||
|
||||
backdrop.addEventListener('click', (e) => {
|
||||
if (e.target === backdrop) {
|
||||
closeSettingsModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function closeSettingsModal() {
|
||||
const backdrop = document.querySelector('.settings-modal-backdrop');
|
||||
if (backdrop) {
|
||||
backdrop.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function saveSettings() {
|
||||
// Save rows per page
|
||||
const rowsPerPage = document.querySelector('#rows-per-page').value;
|
||||
localStorage.setItem('ticketsPerPage', rowsPerPage);
|
||||
|
||||
// Set cookie for PHP to read
|
||||
document.cookie = `ticketsPerPage=${rowsPerPage}; path=/`;
|
||||
|
||||
// Reload page to apply pagination changes
|
||||
window.location.reload();
|
||||
}
|
||||
// Old settings modal functions removed - now using settings.js with new settings modal
|
||||
|
||||
function initStatusFilter() {
|
||||
const filterContainer = document.createElement('div');
|
||||
|
||||
Reference in New Issue
Block a user