first working prototype

This commit is contained in:
Jakub Senderák
2020-04-21 13:36:09 +02:00
parent a43a7c4881
commit d657dedf5f
4 changed files with 226 additions and 0 deletions
+150
View File
@@ -0,0 +1,150 @@
<html>
<head>
<title>Bridžik</title>
{% if not action%}
<meta http-equiv="refresh" content="1">
{% endif %}
</head>
<body>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
<hr>
{% endif %}
{% endwith %}
{% 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>
<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>
<tr>
{% for player in status['active_round_stashes'] %}
<td>{{ 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 %}
<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">
{% 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>
{% endfor %}
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</table>
</body>
</html>