Note: We appreciate your feedback and bug reports to continue improving our platform. Thank you for your continued support!
This commit is contained in:
@@ -126,55 +126,29 @@
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<script>
|
||||
const body = document.body;
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const darkModeSwitch = document.getElementById('darkModeSwitch');
|
||||
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
document.body.classList.toggle('dark-mode', darkModeMediaQuery.matches);
|
||||
darkModeMediaQuery.addListener(function (e) {
|
||||
document.body.classList.toggle('dark-mode', e.matches);
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('themeSwitcher').addEventListener('click', function () {
|
||||
body.classList.toggle('dark-mode');
|
||||
document.body.classList.toggle('dark-mode');
|
||||
});
|
||||
|
||||
document.getElementById('usersPerPage').addEventListener('change', function () {
|
||||
window.location.href = "/dpanel/dashboard/admin/users?page=1&limit=" + this.value;
|
||||
});
|
||||
|
||||
window.onload = function() {
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
var limit = urlParams.get('limit');
|
||||
window.onload = function () {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const limit = urlParams.get('limit');
|
||||
document.getElementById('usersPerPage').value = limit;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const darkModeSwitch = document.getElementById('darkModeSwitch');
|
||||
|
||||
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
|
||||
body.classList.toggle('dark-mode', darkModeMediaQuery.matches);
|
||||
|
||||
darkModeMediaQuery.addListener(function (e) {
|
||||
body.classList.toggle('dark-mode', e.matches);
|
||||
});
|
||||
});
|
||||
|
||||
function searchUsers() {
|
||||
var input = document.getElementById('searchInput');
|
||||
var filter = input.value.toUpperCase();
|
||||
var table = document.querySelector('.table');
|
||||
var tr = table.getElementsByTagName('tr');
|
||||
|
||||
for (var i = 0; i < tr.length; i++) {
|
||||
var tdName = tr[i].getElementsByTagName('td')[1];
|
||||
var tdId = tr[i].getElementsByTagName('td')[0];
|
||||
if (tdName || tdId) {
|
||||
var txtValueName = tdName.textContent || tdName.innerText;
|
||||
var txtValueId = tdId.textContent || tdId.innerText;
|
||||
if (txtValueName.toUpperCase().indexOf(filter) > -1 || txtValueId.toUpperCase().indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('searchButton').addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
searchUsers();
|
||||
@@ -187,19 +161,32 @@
|
||||
}
|
||||
});
|
||||
|
||||
var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
||||
var searchInput = document.getElementById('searchInput');
|
||||
searchInput.placeholder = isMac ? 'Rechercher par nom ou ID (Cmd + K)' : 'Rechercher par nom ou ID (Ctrl + K)';
|
||||
function searchUsers() {
|
||||
const input = document.getElementById('searchInput');
|
||||
const filter = input.value.toUpperCase();
|
||||
const table = document.querySelector('.table');
|
||||
const tr = table.getElementsByTagName('tr');
|
||||
|
||||
for (let i = 0; i < tr.length; i++) {
|
||||
const tdName = tr[i].getElementsByTagName('td')[1];
|
||||
const tdId = tr[i].getElementsByTagName('td')[0];
|
||||
if (tdName || tdId) {
|
||||
const txtValueName = tdName.textContent || tdName.innerText;
|
||||
const txtValueId = tdId.textContent || tdId.innerText;
|
||||
tr[i].style.display = txtValueName.toUpperCase().indexOf(filter) > -1 || txtValueId.toUpperCase().indexOf(filter) > -1 ? "" : "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('generate-token-form').addEventListener('submit', function(e) {
|
||||
// Ajout d'un événement pour les formulaires de génération de token
|
||||
document.querySelectorAll('form[id="generate-token-form"]').forEach(form => {
|
||||
form.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
var url = this.getAttribute('action');
|
||||
var method = this.getAttribute('method');
|
||||
|
||||
var name = this.querySelector('input[name="name"]').value;
|
||||
var id = this.querySelector('input[name="id"]').value;
|
||||
var data = { name: name, id: id };
|
||||
const url = this.getAttribute('action');
|
||||
const method = this.getAttribute('method');
|
||||
const name = this.querySelector('input[name="name"]').value;
|
||||
const id = this.querySelector('input[name="id"]').value;
|
||||
const data = { name: name, id: id };
|
||||
|
||||
fetch(url, {
|
||||
method: method,
|
||||
@@ -212,7 +199,7 @@
|
||||
.then(response => {
|
||||
Swal.fire({
|
||||
title: 'Votre Token',
|
||||
html: `<input type="text" id="swal-input1" class="swal2-input" value="${response.token}">`,
|
||||
html: `<input type="text" id="swal-input1" class="swal2-input" value="${response.token}" readonly>`,
|
||||
confirmButtonText: 'Copier le Token',
|
||||
footer: '<div style="text-align: center;">Gardez ce token en sécurité. Il ne sera pas possible de le récupérer sans le régénérer.</div>',
|
||||
focusConfirm: false,
|
||||
@@ -226,9 +213,10 @@
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
Swal.fire('Error', error.message, 'error');
|
||||
Swal.fire('Erreur', error.message, 'error');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user