Add Single-Calc for player name. Refactor admin+single-calc dialogs.

This commit is contained in:
MaxJa4
2024-01-21 12:12:47 +01:00
parent 4ff139b217
commit 8edbbb4347
6 changed files with 132 additions and 47 deletions

View File

@@ -67,7 +67,7 @@
</button>
</div>
<div class="col-auto position-absolute end-0">
<button class="btn btn-lg btn-outline-secondary text-secondary-emphasis" type="button" disabled>
<button class="btn btn-lg btn-outline-secondary text-secondary-emphasis" id="singleCalcBtn" onclick="showSingleCalcDialog(this)">
<i class="bi bi-person me-2"></i>
Einzel-Abfrage
</button>
@@ -76,16 +76,15 @@
<script>
document.body.addEventListener('htmx:afterRequest', function (event) {
if (event.detail.pathInfo.requestPath.startsWith("/admin/")) {
Swal.fire({
title: 'Action executed',
text: event.detail.xhr.response,
icon: event.detail.xhr.status === 200 ? 'success' : 'error'
}).then(() => {
if (event.detail.requestConfig.verb === "delete") {
location.reload();
}
});
let detail = event.detail;
let reqPath = detail.pathInfo.requestPath;
let method = detail.requestConfig.verb;
let xhr = detail.xhr;
if (reqPath.startsWith("/admin/")) {
showAdminActionExecutedDialog(xhr, method);
} else if (reqPath.startsWith("/score/") && method === "post") {
showSingleCalcResultDialog(xhr, method);
}
});
</script>

View File

@@ -5,6 +5,7 @@
<title>Infantry Skill Calculator</title>
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
<script src="../static/index.js"></script>
<script src="../static/dialogs.js"></script>
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">