fix settings page
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Only initialize if we're on the events tab
|
||||
if (!document.getElementById('events-tab')?.classList.contains('active')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize variables
|
||||
let currentPage = parseInt(document.getElementById('currentPage').textContent) || 1;
|
||||
let totalPages = parseInt(document.getElementById('totalPages').textContent) || 1;
|
||||
|
||||
@@ -50,13 +50,17 @@ function updateFilters() {
|
||||
|
||||
// Build URL with current page number
|
||||
const currentPage = new URLSearchParams(window.location.search).get('page') || 1;
|
||||
const url = `/settings/mails?page=${currentPage}&status=${status}&date_range=${dateRange}&user_id=${userId}&template_id=${templateId}`;
|
||||
const url = `/settings?tab=mails&page=${currentPage}&status=${status}&date_range=${dateRange}&user_id=${userId}&template_id=${templateId}`;
|
||||
|
||||
// Update URL with current filters
|
||||
window.history.pushState({}, '', url);
|
||||
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
function clearFilters() {
|
||||
window.location.href = '/settings/mails';
|
||||
// Reset filters
|
||||
window.location.href = '/settings?tab=mails';
|
||||
}
|
||||
|
||||
function changePage(page) {
|
||||
@@ -65,12 +69,16 @@ function changePage(page) {
|
||||
const userId = document.getElementById('userFilter').value;
|
||||
const templateId = document.getElementById('templateFilter').value;
|
||||
|
||||
window.location.href = `/settings/mails?page=${page}&status=${status}&date_range=${dateRange}&user_id=${userId}&template_id=${templateId}`;
|
||||
// Update URL with new page
|
||||
const url = `/settings?tab=mails&page=${page}&status=${status}&date_range=${dateRange}&user_id=${userId}&template_id=${templateId}`;
|
||||
window.history.pushState({}, '', url);
|
||||
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
function viewMailDetails(mailId) {
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]').content;
|
||||
fetch(`/settings/mails/${mailId}`, {
|
||||
fetch(`/settings?tab=mails&mail_id=${mailId}`, {
|
||||
headers: {
|
||||
'X-CSRF-Token': csrfToken
|
||||
}
|
||||
@@ -99,5 +107,5 @@ function downloadMailLog() {
|
||||
const userId = document.getElementById('userFilter').value;
|
||||
const templateId = document.getElementById('templateFilter').value;
|
||||
|
||||
window.location.href = `/settings/mails/download?status=${status}&date_range=${dateRange}&user_id=${userId}&template_id=${templateId}`;
|
||||
window.location.href = `/settings?tab=mails&download=true&status=${status}&date_range=${dateRange}&user_id=${userId}&template_id=${templateId}`;
|
||||
}
|
||||
Reference in New Issue
Block a user