diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2026-04-03 16:02:56 -0700 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2026-04-03 16:02:56 -0700 |
| commit | 5249744b01849b7158ff9cf796c550924f452320 (patch) | |
| tree | 1404319acfef55d9a99c56792922515875f9b06e /templates/game.html | |
start er up
Diffstat (limited to 'templates/game.html')
| -rw-r--r-- | templates/game.html | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/templates/game.html b/templates/game.html new file mode 100644 index 0000000..690e16d --- /dev/null +++ b/templates/game.html @@ -0,0 +1,185 @@ +{% extends "base.html" %} + +{% block content %} + <div style="display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem;"> + <a href="{{ url_for('index', season_id=game.season_id, tab='schedule') }}" + style="text-decoration: none; background: #ddd; color: #333; padding: 5px 15px; font-family: var(--sans-font); font-weight: bold; border: 1px solid #ccc;"> + ← Back to Schedule + </a> + <h2 style="margin: 0; flex: 1; border: none;">Game Details</h2> + </div> + + {% if game %} + <div style="display: flex; justify-content: center; gap: 4rem; align-items: center; margin: 2rem 0; background: var(--bg-primary); padding: 2rem; border: 2px solid var(--deco-border);"> + <div style="text-align: center;"> + <h3>Away</h3> + {% set is_away_team = current_user.is_authenticated and current_user.id|string == game.away_team_id|string %} + {% if game.away_icon %} + <img src="{{ url_for('static', filename='uploads/' + game.away_icon) }}" style="width:100px; height:100px; border-radius:50%; border: {{ '5px solid gold' if is_away_team else '2px solid var(--text-accent)' }};"> + {% else %} + <div style="width: 100px; height: 100px; border-radius: 50%; background-color: var(--deco-border); display: inline-block; border: {{ '5px solid gold' if is_away_team else 'none' }};"></div> + {% endif %} + <h4>{{ game.away_team if game.away_team else 'TBD' }}</h4> + <div style="font-size: 3rem; font-weight: bold; color: var(--deco-highlight);">{{ game.away_score if game.status == 'Final' else '-' }}</div> + </div> + + <div style="text-align: center;"> + <div style="color: var(--text-accent); font-size: 2rem; margin-bottom: 1rem;">VS</div> + <div style="color: var(--text-primary);">Date: {{ game.scheduled_date }}</div> + <div style="color: var(--deco-highlight); font-weight: bold; margin-top: 1rem; text-transform: uppercase;"> + {{ game.status }} + {% if game.is_conditional %}<span class="conditional-game" title="Conditional Game">*</span>{% endif %} + </div> + + {% if current_user.is_admin %} + <div style="margin-top: 1rem;"> + <a href="{{ url_for('admin_edit_game', game_id=game.id) }}" style="background: var(--deco-border); color: var(--bg-primary); padding: 5px 10px; text-decoration: none;">✎ Edit Game</a> + </div> + {% endif %} + </div> + + <div style="text-align: center;"> + <h3>Home</h3> + {% set is_home_team = current_user.is_authenticated and current_user.id|string == game.home_team_id|string %} + {% if game.home_icon %} + <img src="{{ url_for('static', filename='uploads/' + game.home_icon) }}" style="width:100px; height:100px; border-radius:50%; border: {{ '5px solid gold' if is_home_team else '2px solid var(--text-accent)' }};"> + {% else %} + <div style="width: 100px; height: 100px; border-radius: 50%; background-color: var(--deco-border); display: inline-block; border: {{ '5px solid gold' if is_home_team else 'none' }};"></div> + {% endif %} + <h4>{{ game.home_team if game.home_team else 'TBD' }}</h4> + <div style="font-size: 3rem; font-weight: bold; color: var(--deco-highlight);">{{ game.home_score if game.status == 'Final' else '-' }}</div> + </div> + </div> + + {% if game.status == 'Final' and game.box_score and (game.box_score.away|sum + game.box_score.home|sum) > 0 %} + <div style="margin-top: 2rem; overflow-x: auto;"> + <h3>Box Score</h3> + <table style="width: 100%; font-family: var(--sans-font); border: 2px solid #000;"> + <tr style="background: #eee;"> + <th>Team</th> + <th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>Extra</th> + <th style="background: #ddd;">R</th><th>H</th><th>E</th> + </tr> + <tr> + <td style="font-weight: bold;">{{ game.away_team }}</td> + {% for val in game.box_score.away %} + <td style="{{ 'background: #f9f9f9; font-weight: bold;' if loop.index > 10 else '' }}">{{ val }}</td> + {% endfor %} + </tr> + <tr> + <td style="font-weight: bold;">{{ game.home_team }}</td> + {% for val in game.box_score.home %} + <td style="{{ 'background: #f9f9f9; font-weight: bold;' if loop.index > 10 else '' }}">{{ val }}</td> + {% endfor %} + </tr> + </table> + </div> + {% endif %} + + {% if game.status != 'Final' and submissions %} + <div style="margin-top: 2rem;"> + <h3>Active Proposals</h3> + {% for s in submissions %} + {% set show_score = s.away_score is not none and (s.away_score != game.away_score or s.home_score != game.home_score) %} + {% set show_date = s.proposed_date and s.proposed_date != game.scheduled_date %} + + {% if show_score or show_date %} + <div style="background: #fff; border: 1px solid var(--deco-border); padding: 1rem; margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: flex-start;"> + <div> + <p style="margin: 0;"><strong>From:</strong> {{ s.team_name }} ({{ s.username }})</p> + {% if show_score %} + <p style="margin: 0.5rem 0 0 0;"><strong>Score:</strong> {{ game.away_team }} {{ s.away_score }} - {{ game.home_team }} {{ s.home_score }}</p> + {% if s.box_score %} + <details style="margin-top: 0.5rem;"> + <summary style="cursor: pointer; font-size: 0.85rem; color: #555;">View Proposed Box Score</summary> + <table style="width: 100%; font-size: 0.75rem; margin-top: 0.5rem; border: 1px solid #ddd;"> + <tr style="background: #f5f5f5;"> + <th>Team</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>Ex</th><th>R</th><th>H</th><th>E</th> + </tr> + <tr><td>Away</td>{% for v in s.box_score.away %}<td>{{ v }}</td>{% endfor %}</tr> + <tr><td>Home</td>{% for v in s.box_score.home %}<td>{{ v }}</td>{% endfor %}</tr> + </table> + </details> + {% endif %} + {% endif %} + {% if show_date %} + <p style="margin: 0.5rem 0 0 0;"><strong>Date Proposal:</strong> {{ s.proposed_date }}</p> + {% endif %} + </div> + <div style="display: flex; gap: 0.5rem;"> + {% if current_user.id|string == s.submitted_by_id|string %} + <form method="POST" action="{{ url_for('retract_submission', game_id=game.id) }}"> + <button type="submit" style="background-color: #cc0000; font-size: 0.8rem; padding: 5px 10px;">Retract</button> + </form> + {% elif current_user.is_authenticated and (current_user.id|string == game.away_team_id|string or current_user.id|string == game.home_team_id|string) %} + <form method="POST" action="{{ url_for('agree_submission', game_id=game.id, submission_id=s.id) }}"> + <button type="submit" style="background-color: #008800; font-size: 0.8rem; padding: 5px 10px;">Agree & Finalize</button> + </form> + {% endif %} + </div> + </div> + {% endif %} + {% endfor %} + </div> + {% endif %} + + {% if game.status != 'Final' and current_user.is_authenticated and (current_user.id|string == game.away_team_id|string or current_user.id|string == game.home_team_id|string) %} + <div style="margin-top: 2rem; display: flex; flex-direction: column; gap: 2rem;"> + <!-- Score Submission Form (Full Width) --> + <div style="background: var(--bg-primary); padding: 2rem; border: 1px solid var(--deco-border);"> + <h3>Submit Game Results</h3> + <form method="POST" action="{{ url_for('submit_game', game_id=game.id) }}" style="max-width: 100%;"> + <div style="display: flex; gap: 1rem; margin-bottom: 1rem; max-width: 400px;"> + <div style="flex: 1;"> + <label for="away_score" style="display: block; margin-bottom: 0.5rem;">{{ game.away_team }} Score:</label> + <input type="number" id="away_score" name="away_score" required style="width: 100%;"> + </div> + <div style="flex: 1;"> + <label for="home_score" style="display: block; margin-bottom: 0.5rem;">{{ game.home_team }} Score:</label> + <input type="number" id="home_score" name="home_score" required style="width: 100%;"> + </div> + </div> + + <div style="margin-bottom: 1rem; overflow-x: auto;"> + <label style="display: block; margin-bottom: 0.5rem;">Box Score (Optional):</label> + <table style="width: 100%; border: 1px solid var(--deco-border); background: #fff;"> + <tr style="background: #eee;"> + <th>Team</th> + <th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>Extra</th><th>R</th><th>H</th><th>E</th> + </tr> + <tr> + <td style="font-weight: bold; font-size: 0.8rem;">{{ game.away_team if game.away_team else 'Away' }}</td> + {% for col in ["1", "2", "3", "4", "5", "6", "7", "8", "9", "extra", "runs", "hits", "errors"] %} + <td><input type="number" name="away_inn_{{ col }}" value="0" style="width: 35px; padding: 2px; text-align: center;"></td> + {% endfor %} + </tr> + <tr> + <td style="font-weight: bold; font-size: 0.8rem;">{{ game.home_team if game.home_team else 'Home' }}</td> + {% for col in ["1", "2", "3", "4", "5", "6", "7", "8", "9", "extra", "runs", "hits", "errors"] %} + <td><input type="number" name="home_inn_{{ col }}" value="0" style="width: 35px; padding: 2px; text-align: center;"></td> + {% endfor %} + </tr> + </table> + </div> + + <button type="submit" style="width: 200px;">Submit Scores</button> + </form> + </div> + + <!-- Date Change Form --> + <div style="background: var(--bg-primary); padding: 2rem; border: 1px solid var(--deco-border); max-width: 400px;"> + <h3>Propose Date Change</h3> + <form method="POST" action="{{ url_for('submit_game', game_id=game.id) }}" style="max-width: 100%;"> + <div style="margin-bottom: 1rem;"> + <label for="proposed_date" style="display: block; margin-bottom: 0.5rem;">New Date:</label> + <input type="text" id="proposed_date" name="proposed_date" placeholder="YYYY-MM-DD" style="width: 100%;"> + </div> + <button type="submit" style="width: 100%; background-color: var(--deco-highlight); color: white;">Propose Date</button> + </form> + </div> + </div> + {% endif %} + {% else %} + <p>Game not found.</p> + {% endif %} +{% endblock %}
\ No newline at end of file |
