Feat: Decks page.
This commit is contained in:
111
templates/pages/tcg/mtg/_decks.html
Normal file
111
templates/pages/tcg/mtg/_decks.html
Normal file
@@ -0,0 +1,111 @@
|
||||
{% extends 'layouts/layout_tcg.html' %}
|
||||
|
||||
{% block page_head %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/tcg_decks.bundle.css') }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block page_body %}
|
||||
{#
|
||||
<div class="section-header">
|
||||
<h2 class="tcg-section-title">Decks</h2>
|
||||
</div>
|
||||
#}
|
||||
|
||||
<!-- Filters Form -->
|
||||
<form id="{{ model.ID_FORM_FILTERS }}" class="tcg-card {{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}">
|
||||
{{ model.form_filters.hidden_tag() }}
|
||||
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
||||
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_COLUMN }} {{ model.FLAG_FILTER }} {{ model.FLAG_SEARCH }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ model.form_filters.search.data }}">
|
||||
{{ model.form_filters.search.label(class="tcg-label") }}
|
||||
{{ model.form_filters.search(class="tcg-input", placeholder="Search decks...") }}
|
||||
</div>
|
||||
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_COLUMN }} {{ model.FLAG_FILTER }} {{ model.FLAG_ACTIVE }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ model.form_filters.active_only.data }}">
|
||||
{{ model.form_filters.active_only() }}
|
||||
{{ model.form_filters.active_only.label(class="tcg-label") }}
|
||||
</div>
|
||||
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_COLUMN }} {{ model.FLAG_FILTER }} {{ model.FLAG_IS_COMMANDER }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ model.form_filters.is_commander.data }}">
|
||||
{{ model.form_filters.is_commander() }}
|
||||
{{ model.form_filters.is_commander.label(class="tcg-label") }}
|
||||
</div>
|
||||
</div>
|
||||
{% set block_id = 'buttons_table_default' %}
|
||||
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
|
||||
</form>
|
||||
{#
|
||||
{% set block_id = 'container_buttons_save_cancel' %}
|
||||
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
|
||||
</form>
|
||||
#}
|
||||
|
||||
<div class="decks-section tcg-card">
|
||||
<!-- Decks Table -->
|
||||
<table class="decks-table {{ model.FLAG_TABLE_MAIN }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }} {{ model.FLAG_DECK }}" id="{{ model.ID_TABLE_MAIN }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="{{ model.FLAG_NAME }}">Name</th>
|
||||
<th class="{{ model.FLAG_IS_COMMANDER }}">Is Commander</th>
|
||||
<th class="{{ model.ATTR_COMMANDER_BRACKET_ID }}">Commander Bracket</th>
|
||||
<th class="{{ model.FLAG_ACTIVE }}">
|
||||
{% set class_name = model.FLAG_ACTIVE %}
|
||||
{% set attribute_text = '' %}
|
||||
{% include 'components/common/buttons/_icon_add.html' %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set is_blank_row = False %}
|
||||
{% for deck in model.decks %}
|
||||
{% include 'components/tcg/_row_deck.html' %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- Statistics -->
|
||||
<div class="section-header">
|
||||
<h2 class="tcg-section-title">Statistics</h2>
|
||||
</div>
|
||||
<table class="{{ model.FLAG_STATISTICS }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }} {{ model.FLAG_DECK }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="{{ model.FLAG_DECK }}">Deck</th>
|
||||
<th class="{{ model.FLAG_NAME }}">Name</th>
|
||||
<th class="{{ model.FLAG_VALUE }}">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for statistic in model.statistics %}
|
||||
<tr class="{{ model.FLAG_ROW_NEW }} {{ model.FLAG_STATISTIC }}" {{ model.ATTR_STATISTIC_ID }}>
|
||||
<td class="{{ model.ATTR_DECK_ID }} {{ model.ATTR_ENTITY_RECORD_ID }}">{{ statistic.entity_record_name }}</td>
|
||||
<td class="{{ model.FLAG_NAME }}">{{ statistic.name }}</td>
|
||||
<td class="{{ model.FLAG_VALUE }}">{{ statistic.get_formatted_value() }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% include 'components/common/temporary/_overlay_confirm.html' %}
|
||||
{% include 'components/common/temporary/_overlay_error.html' %}
|
||||
|
||||
<div id="{{ model.ID_CONTAINER_TEMPLATE_ELEMENTS }}">
|
||||
<!-- Active column -->
|
||||
<!-- Delete -->
|
||||
{% set class_name = '' %}
|
||||
{% include 'components/common/buttons/_icon_trash.html' %}
|
||||
<!-- Undelete -->
|
||||
{% set class_name = model.FLAG_ACTIVE %}
|
||||
{% set attribute_text = '' %}
|
||||
{% include 'components/common/buttons/_icon_add.html' %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var attrCommanderBracketId = "{{ model.ATTR_COMMANDER_BRACKET_ID }}";
|
||||
var commanderBrackets = {{ model.convert_list_objects_to_json(model.commander_brackets) | tojson | safe }};
|
||||
var decks = {{ model.convert_list_objects_to_json(model.decks) | tojson | safe }};
|
||||
var flagStatistics = "{{ model.FLAG_STATISTICS }}";
|
||||
var flagIsCommander = "{{ model.FLAG_IS_COMMANDER }}";
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -135,7 +135,8 @@
|
||||
<th class="{{ model.ATTR_ROUND_ID }}">Round</th>
|
||||
<th class="{{ model.ATTR_PLAYER_ID }}">Player</th>
|
||||
<th class="{{ model.ATTR_RECEIVED_FROM_COMMANDER_PLAYER_ID }}">Received From Commander</th>
|
||||
<th class="{{ model.FLAG_HEALTH_CHANGE }}">Health Change</th>
|
||||
<th class="{{ model.FLAG_LIFE_GAIN }}">Life Gain</th>
|
||||
<th class="{{ model.FLAG_LIFE_LOSS }}">Life Loss</th>
|
||||
<th class="{{ model.FLAG_COMMANDER_DEATHS }}">Commander Deaths</th>
|
||||
<th class="{{ model.FLAG_IS_ELIMINATED }}">Is Eliminated</th>
|
||||
</tr>
|
||||
@@ -181,9 +182,6 @@
|
||||
var damageRecords = {{ model.convert_list_objects_to_json(model.damage_records) | tojson | safe }};
|
||||
var decks = {{ model.convert_list_objects_to_json(model.decks) | tojson | safe }};
|
||||
var flagDamageLog = "{{ model.FLAG_DAMAGE_LOG }}";
|
||||
var flagDisplayOrder = "{{ model.FLAG_DISPLAY_ORDER }}";
|
||||
var flagHealthChange = "{{ model.FLAG_HEALTH_CHANGE }}";
|
||||
var flagIsEliminated = "{{ model.FLAG_IS_ELIMINATED }}";
|
||||
var flagRoundDisplayOrderButton = "{{ model.FLAG_ROUND_DISPLAY_ORDER_BUTTON }}";
|
||||
var flagRoundDisplayOrderMinus = "{{ model.FLAG_ROUND_DISPLAY_ORDER_MINUS }}";
|
||||
var flagRoundDisplayOrderPlus = "{{ model.FLAG_ROUND_DISPLAY_ORDER_PLUS }}";
|
||||
|
||||
@@ -40,67 +40,65 @@
|
||||
</form>
|
||||
|
||||
<!-- Games Table -->
|
||||
<div class="games-table-container">
|
||||
<table class="games-table" id="gamesTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Game ID</th>
|
||||
<th>Type</th>
|
||||
<th>Location</th>
|
||||
<th>Started</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if model.games and model.games|length > 0 %}
|
||||
{% for game in model.games %}
|
||||
<tr class="game-row {% if not game.active %}inactive{% endif %}" data-game-id="{{ game.game_id }}">
|
||||
<td class="game-id">#{{ game.game_id }}</td>
|
||||
<td class="game-type">
|
||||
{% if game.is_commander %}
|
||||
<span class="badge badge-commander">Commander</span>
|
||||
{% elif game.is_draft %}
|
||||
<span class="badge badge-draft">Draft</span>
|
||||
{% elif game.is_sealed %}
|
||||
<span class="badge badge-sealed">Sealed</span>
|
||||
{% else %}
|
||||
<span class="badge badge-standard">Standard</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="game-location">{{ game.location_name or 'Unknown' }}</td>
|
||||
<td class="game-date">{{ model.format_datetime_text(game.start_on) if game.start_on else 'Not started' }}</td>
|
||||
<td class="game-status">
|
||||
{% if game.end_on %}
|
||||
<span class="status status-ended">Ended</span>
|
||||
{% elif game.active %}
|
||||
<span class="status status-active">Active</span>
|
||||
{% else %}
|
||||
<span class="status status-inactive">Inactive</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="game-actions">
|
||||
<a href="{{ model.HASH_PAGE_MTG_GAME }}/{{ game.game_id }}" class="btn-tcg btn-join">Join Game</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr class="no-games-row">
|
||||
<td colspan="6" class="no-games">
|
||||
<div class="no-games-message">
|
||||
<span class="no-games-icon">⚔</span>
|
||||
<p>No games found. Start a new battle!</p>
|
||||
</div>
|
||||
<table class="games-table {{ model.FLAG_TABLE_MAIN }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }} {{ model.FLAG_DECK }}" id="{{ model.ID_TABLE_MAIN }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="{{ model.ATTR_GAME_ID }}">Game ID</th>
|
||||
<th class="{{ model.FLAG_IS_COMMANDER }}">Type</th>
|
||||
<th class="{{ model.FLAG_LOCATION_NAME }}">Location</th>
|
||||
<th class="{{ model.FLAG_START_ON }}">Started</th>
|
||||
<th class="{{ model.FLAG_ACTIVE }}">Status</th>
|
||||
<th class="{{ model.FLAG_NAV_MTG_GAME }}">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if model.games and model.games|length > 0 %}
|
||||
{% for game in model.games %}
|
||||
<tr class="game-row {% if not game.active %}inactive{% endif %}" data-game-id="{{ game.game_id }}">
|
||||
<td class="{{ model.ATTR_GAME_ID }}">#{{ game.game_id }}</td>
|
||||
<td class="{{ model.FLAG_IS_COMMANDER }}">
|
||||
{% if game.is_commander %}
|
||||
<span class="badge badge-commander">Commander</span>
|
||||
{% elif game.is_draft %}
|
||||
<span class="badge badge-draft">Draft</span>
|
||||
{% elif game.is_sealed %}
|
||||
<span class="badge badge-sealed">Sealed</span>
|
||||
{% else %}
|
||||
<span class="badge badge-standard">Standard</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="{{ model.FLAG_LOCATION_NAME }}">{{ game.location_name or 'Unknown' }}</td>
|
||||
<td class="{{ model.FLAG_START_ON }}">{{ model.format_datetime_text(game.start_on) if game.start_on else 'Not started' }}</td>
|
||||
<td class="{{ model.FLAG_ACTIVE }}">
|
||||
{% if game.end_on %}
|
||||
<span class="status status-ended">Ended</span>
|
||||
{% elif game.active %}
|
||||
<span class="status status-active">Active</span>
|
||||
{% else %}
|
||||
<span class="status status-inactive">Inactive</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="{{ model.FLAG_NAV_MTG_GAME }}">
|
||||
<a href="{{ model.HASH_PAGE_MTG_GAME }}/{{ game.game_id }}" class="btn-tcg btn-join">Join Game</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr class="no-games-row">
|
||||
<td colspan="6" class="no-games">
|
||||
<div class="no-games-message">
|
||||
<span class="no-games-icon">⚔</span>
|
||||
<p>No games found. Start a new battle!</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- New Game Modal -->
|
||||
<div id="newGameModal" class="modal-overlay hidden">
|
||||
<div id="newGameModal" class="modal-overlay {{ model.FLAG_IS_COLLAPSED }}">
|
||||
<div class="modal-content tcg-card">
|
||||
<div class="modal-header">
|
||||
<h2 class="tcg-section-title">Create New Game</h2>
|
||||
@@ -158,5 +156,4 @@
|
||||
var flagStartOn = "{{ model.FLAG_START_ON }}";
|
||||
var flagStartingLife = "{{ model.FLAG_STARTING_LIFE }}";
|
||||
</script>
|
||||
{# <script src="{{ url_for('static', filename='js/pages/tcg/mtg_games.js') }}"></script> #}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user