2024-05-28 00:17:57 +02:00
|
|
|
<%- include('partials/header') %>
|
|
|
|
|
|
|
|
<h1><%= spiel.name %></h1>
|
|
|
|
|
|
|
|
<div id="view" class="mt-5">
|
2024-05-30 18:16:36 +02:00
|
|
|
<% if (spiel.type === 1) { %>
|
|
|
|
<p>Aufwärmen und Spiel</p>
|
|
|
|
<% } else if (spiel.type ===2) { %>
|
|
|
|
<p>Spiel</p>
|
|
|
|
|
|
|
|
<% } else if (spiel.type === 3) { %>
|
|
|
|
<p>Aufwärmen</p>
|
|
|
|
|
|
|
|
<% } else {%>
|
|
|
|
<p>Spieltyp noch nicht festgelegt</p>
|
|
|
|
<% } %>
|
|
|
|
|
2024-05-28 00:17:57 +02:00
|
|
|
<h2>Material</h2>
|
2024-05-29 22:37:24 +02:00
|
|
|
<p><%- spiel.material %></p>
|
2024-05-28 00:17:57 +02:00
|
|
|
<h2>Dauer</h2>
|
2024-05-29 22:37:24 +02:00
|
|
|
<p><%- spiel.dauer %></p>
|
2024-05-28 00:17:57 +02:00
|
|
|
|
|
|
|
<h2>Regeln</h2>
|
2024-05-29 22:37:24 +02:00
|
|
|
<p><%- spiel.regeln %></p>
|
2024-05-29 22:07:17 +02:00
|
|
|
|
|
|
|
<h2>Variationen</h2>
|
2024-05-29 22:37:24 +02:00
|
|
|
<p><%- spiel.variationen %></p>
|
2024-05-28 00:17:57 +02:00
|
|
|
<% if (session && (session.role === 'user' || session.role==='admin')) {%>
|
2024-05-30 18:29:14 +02:00
|
|
|
<button class="btn btn-primary" onclick="toggleDivs()">Bearbeiten</button>
|
2024-05-28 00:17:57 +02:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="edit" class="mt-5 d-none">
|
|
|
|
<form method="POST" action="/edit-Spiel">
|
|
|
|
<input type="hidden" name="id" value="<%= spiel.id %>">
|
2024-05-29 22:37:24 +02:00
|
|
|
<strong>Material: </strong><br><textarea name="material"><%- spiel.material %> </textarea><br>
|
|
|
|
<strong>Dauer: </strong><input name="dauer" value="<%=spiel.dauer %>"><%= spiel.dauer %></input><br>
|
2024-05-30 18:16:36 +02:00
|
|
|
<strong>Typ: </strong><select name="type" >
|
|
|
|
<option value=1 <%= (spiel.type === 1) ? 'selected' : '' %>>Aufwärmen und Spiel</option>
|
|
|
|
<option value=2 <%= (spiel.type === 1) ? 'selected' : '' %>>Spiel</option>
|
|
|
|
<option value=3 <%= (spiel.type === 1) ? 'selected' : '' %>>Aufwärmen</option>
|
|
|
|
</select><%= spiel.dauer %><br>
|
2024-05-29 22:37:24 +02:00
|
|
|
<strong>Regeln: </strong><br><textarea name="regeln"><%- spiel.regeln %> </textarea><br>
|
|
|
|
<strong>Variationen: </strong><br><textarea name="variationen"><%- spiel.variationen %> </textarea><br>
|
2024-05-30 18:29:14 +02:00
|
|
|
<button type="submit" class="btn btn-success">Speichern</button>
|
2024-05-28 00:17:57 +02:00
|
|
|
</form>
|
2024-05-30 18:29:14 +02:00
|
|
|
|
2024-05-30 18:32:16 +02:00
|
|
|
<% if (session.role === 'admin') { %>
|
2024-05-30 18:29:14 +02:00
|
|
|
<form method="POST" action="/delete-spiel">
|
|
|
|
<input type="hidden" name="spielId" value="<%= spiel.id %>">
|
|
|
|
<button type="submit" class="btn btn-danger">Spiel löschen</button>
|
|
|
|
</form>
|
2024-05-30 18:32:16 +02:00
|
|
|
<% } %>
|
|
|
|
|
2024-05-30 18:29:14 +02:00
|
|
|
<button class="btn btn-secondary" onclick="toggleDivs()">Abbrechen</button>
|
2024-05-28 00:17:57 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function toggleDivs() {
|
|
|
|
$('#view').toggleClass('d-none d-block');
|
|
|
|
$('#edit').toggleClass('d-none d-block');
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<% } else{ %>
|
|
|
|
</div>
|
|
|
|
<% } %>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
|
|
|
|
|
|
<%- include('partials/footer') %>
|