Use bootstrap-modal for single-calc.

This commit is contained in:
MaxJa4
2024-01-25 15:18:12 +01:00
parent 130fe2ad57
commit acf756765b
6 changed files with 119 additions and 51 deletions

View File

@@ -9,45 +9,6 @@ const swalClasses = {
htmlContainer: 'fs-5 text-center text-secondary-emphasis',
};
function showSingleCalcDialog(btn) {
Swal.fire({
title: 'Einzel-Abfrage',
input: 'text',
inputLabel: 'Welcher Spieler soll abgefragt werden?\nDie Abfrage kann ein paar Sekunden dauern.',
inputPlaceholder: 'Spieler-Name eingeben...',
confirmButtonText: 'Berechnen',
showCancelButton: true,
cancelButtonText: 'Abbrechen',
customClass: swalClasses,
buttonsStyling: false
}).then((result) => {
if (result.isConfirmed) {
let promise = htmx.ajax('POST', '/score/' + result.value, {target: '#' + btn.id, swap: 'none'});
}
});
}
function showSingleCalcResultDialog(xhr, reqPath) {
let icon;
switch (xhr.status) {
case 200:
icon = 'success';
break;
case 404:
icon = 'warning';
break;
default:
icon = 'error';
}
Swal.fire({
title: 'Abfrage für "' + reqPath.replace("/score/", '') + '"',
text: "Score: " + xhr.response,
icon: icon,
customClass: swalClasses
});
}
function showAdminActionExecutedDialog(xhr, method) {
Swal.fire({
title: 'Action executed',