ui tweaks, admin form

This commit is contained in:
Jakub Senderák
2020-04-22 14:16:49 +02:00
parent d657dedf5f
commit d12f5c093c
6 changed files with 238 additions and 124 deletions
+115 -113
View File
@@ -1,8 +1,9 @@
<html>
<head>
<title>Bridžik</title>
<link href="/static/style.css" rel="stylesheet">
{% if not action%}
<meta http-equiv="refresh" content="1">
<meta http-equiv="refresh" content="2">
{% endif %}
</head>
<body>
@@ -19,132 +20,133 @@
{% if 'active_player' not in status %}
<h1>Hra sa skončila.</h1>
{% else %}
<table style="width: auto;">
<td>
<h1>Na ťahu je: {{ status['active_player'] }}</h1>
</td>
<td>
<h1>Tipy:</h1>
<div id="header">
<div>
<p id="active_player">Na ťahu je: {{ players[status['active_player']] }}</p>
</div>
<div id="active_round_guesses">
<p></p>
<table style="width: auto;">
<th>0</th>
<th>1</th>
<th>2</th>
<th>3</th>
<tr>
{% for player in status['active_round_guesses'] %}
<td>{{ status['active_round_guesses'][player] }}</td>
{% endfor %}
</tr>
</table>
</td>
{% if status['active_round_stashes'] %}
<td>
<h1>Kôpky v tomto kole:</h1>
<table style="width: auto;">
<th>0</th>
<th>1</th>
<th>2</th>
<th>3</th>
<thead>
<th></th>
<th class="state_column_header">{{ players[0] }}</th>
<th class="state_column_header">{{ players[1] }}</th>
<th class="state_column_header">{{ players[2] }}</th>
<th class="state_column_header">{{ players[3] }}</th>
</thead>
<tbody>
<tr>
{% for player in status['active_round_stashes'] %}
<td>{{ player }}</td>
<th class="state_row_header">Tipy v tomto kole:</th>
{% for player in status['active_round_guesses'] %}
<td class="points">{{ status['active_round_guesses'][player] }}</td>
{% endfor %}
</tr>
</table>
</td>
{% endif %}
</table>
{% if action == 'guess' %}
<hr>
<h1>Zadaj tip:</h1>
{% include "_guess_form.html" %}
{% endif %}
{% if status['active_stash'] %}
<hr>
<h1>Aktuálna kôpka:</h1>
<table style="width: auto;">
{% for player in range(status['active_stash']['first_player'], status['active_stash']['first_player'] + 4) %}
<th>{{ player % 4 }}</th>
{% endfor %}
<tr>
{% for player in range(status['active_stash']['first_player'], status['active_stash']['first_player'] + 4) %}
{% if status['active_stash']['cards'][player % 4] %}
<td>
<img src="/static/cards/{{ status['active_stash']['cards'][player % 4] }}.png" width="80" height="auto">
</td>
{% else %}
<td></td>
{% endif %}
{% endfor %}
</tr>
</table>
{% endif %}
{% if status['active_round_stashes'] %}
<tr>
<th class="state_row_header">Kôpky v tomto kole:</th>
{% for player in status['active_round_stashes'] %}
<td class="points">{{ player }}</td>
{% endfor %}
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
<hr>
{% if action != 'play' %}
<h1>Moje karty:</h1>
<table id="player_hand">
{% for card in status['player_cards'] %}
<td>
<img src="/static/cards/{{ card }}.png" width="80" height="auto">
</td>
{% endfor %}
</table>
{% else %}
<h1>{{ form.card.label }}:</h1>
<form action="{{ url_for('play_card', player=player) }}" method="post">
{{ form.hidden_tag() }}
<p>
<table style="width: auto">
<div id="wrapper">
<div id="table">
{% if action == 'guess' %}
<h1>Zadaj tip:</h1>
{% include "_guess_form.html" %}
{% endif %}
{% if status['active_stash'] %}
<h1>Aktuálna kôpka:</h1>
<table style="width: auto;">
{% for player in range(status['active_stash']['first_player'], status['active_stash']['first_player'] + 4) %}
<th>{{ players[player % 4] }}</th>
{% endfor %}
<tr>
{% for player in range(status['active_stash']['first_player'], status['active_stash']['first_player'] + 4) %}
<td class="card_display">
{% if status['active_stash']['cards'][player % 4] %}
<img src="/static/cards/{{ status['active_stash']['cards'][player % 4] }}.png" width="80" height="auto">
{% endif %}
</td>
{% endfor %}
</tr>
</table>
{% endif %}
<hr>
{% if action != 'play' %}
<h1>Moje karty:</h1>
<table id="player_hand">
{% for card in status['player_cards'] %}
<td>
<img src="/static/cards/{{ card }}.png" width="80" height="auto">
</td>
{% endfor %}
<tr>
{% for card in status['player_cards'] %}
<td>
<input id="card-{{ loop.index }}" name="card" type="radio" value="{{ card }}">
</td>
{% endfor %}
</tr>
</table>
{% for error in form.card.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
{{ form.submit() }}
</p>
</form>
{% endif %}
{% endif %}
<hr>
<h1>Výsledky</h1>
<table style="width: auto;">
{% for series in status['standings'] %}
<tr>
<th>0</th>
<th>1</th>
<th>2</th>
<th>3</th>
</tr>
{% if series %}
{% for round in series %}
{% if round %}
<tr>
{% for player in round %}
<td>{{ player }}</td>
{% else %}
<h1>{{ form.card.label }}:</h1>
<form action="{{ url_for('play_card', player=player) }}" method="post">
{{ form.hidden_tag() }}
<p>
<table style="width: auto">
{% for card in status['player_cards'] %}
<td>
<img src="/static/cards/{{ card }}.png" width="80" height="auto">
</td>
{% endfor %}
<tr>
{% for card in status['player_cards'] %}
<td>
<input id="card-{{ loop.index }}" name="card" type="radio" value="{{ card }}">
</td>
{% endfor %}
</tr>
</table>
{% for error in form.card.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</tr>
{{ form.submit() }}
</p>
</form>
{% endif %}
{% endif %}
</div>
<div id="standings">
<h1>Výsledky</h1>
<table style="width: auto;">
{% for series in status['standings'] %}
<tr>
<th>{{ players[0] }}</th>
<th>{{ players[1] }}</th>
<th>{{ players[2] }}</th>
<th>{{ players[3] }}</th>
</tr>
{% if series %}
{% for round in series %}
{% if round %}
<tr>
{% for player in round %}
<td class="points">{{ player }}</td>
{% endfor %}
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</table>
</table>
</div>
</div>
</body>
</html>