Add add-player modal and player bar button setup.

This commit is contained in:
MaxJa4
2024-01-15 11:26:55 +01:00
parent 65d3d994d7
commit 04a2a2815d
7 changed files with 139 additions and 7 deletions

View File

@@ -0,0 +1,54 @@
{{ define "add_player" }}
<div class="modal fade" id="addPlayerModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-3 text-success fw-bold" id="addPlayerModalLabel">Spieler hinzufügen</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="form-floating mb-3">
<input type="text" class="form-control form-control-lg" id="clanName" placeholder="Clan-Name" disabled>
<label for="clanName">Clan-Name</label>
</div>
<div class="form-floating">
<input type="text" class="form-control form-control-lg" id="playerName" placeholder="Spieler-Name">
<label for="playerName">Spieler-Name</label>
</div>
</div>
<div class="modal-footer">
<button type="submit" name="submit" class="btn btn-lg btn-primary">Hinzufügen</button>
<button type="button" class="btn btn-lg btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
</div>
</div>
</div>
</div>
<script lang="javascript">
document.addEventListener('DOMContentLoaded', function() {
const addPlayerModal = document.getElementById('addPlayerModal');
const addPlayerModalBS = new bootstrap.Modal('#addPlayerModal');
if (addPlayerModal) {
addPlayerModal.addEventListener('show.bs.modal', event => {
const [playerList, otherPlayerList] = getPlayerLists(event);
const selectedClan = getSelectedClan(event);
const clanTag = addPlayerModal.querySelector('#playerName');
const clanName = addPlayerModal.querySelector('#clanName');
clanName.value = selectedClan.innerText;
const submitButton = addPlayerModal.querySelector('button[name="submit"]');
submitButton.addEventListener('click', function (e) {
e.preventDefault();
submitButton.onclick = function () {}
})
});
}
});
</script>
{{ end }}