Add admin-route & dropdown-menu. Add clear-cache & create-code. Adjustments for activation-code and user models. Add sweet-alert for admin-tools.
This commit is contained in:
@@ -144,3 +144,39 @@ function deselectAllPlayers(playerListId) {
|
||||
|
||||
checkCounter.innerText = 0;
|
||||
}
|
||||
|
||||
function confirmAndTrigger(btn) {
|
||||
Swal.fire({
|
||||
title: btn.innerText,
|
||||
text: 'Do you want to continue?',
|
||||
confirmButtonText: 'Yes',
|
||||
confirmButtonColor: '#dd6b55',
|
||||
denyButtonColor: '#3085d6',
|
||||
icon: 'warning',
|
||||
showDenyButton: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
htmx.trigger(btn, 'confirmed');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createCodeDialog(btn) {
|
||||
Swal.fire({
|
||||
title: btn.innerText,
|
||||
input: 'select',
|
||||
inputOptions: {
|
||||
'READER': 'Reader',
|
||||
'AUTHOR': 'Author',
|
||||
'ADMIN': 'Admin'
|
||||
},
|
||||
inputPlaceholder: 'Select a role',
|
||||
confirmButtonText: 'Generate',
|
||||
showCancelButton: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
btn.setAttribute('hx-vals', '{"user_role": "' + result.value + '"}');
|
||||
htmx.trigger(btn, 'confirmed');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user