summaryrefslogtreecommitdiff
path: root/templates/season.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/season.html')
-rw-r--r--templates/season.html285
1 files changed, 285 insertions, 0 deletions
diff --git a/templates/season.html b/templates/season.html
new file mode 100644
index 0000000..43ca0de
--- /dev/null
+++ b/templates/season.html
@@ -0,0 +1,285 @@
+{% extends "base.html" %}
+
+{% block content %}
+ <div style="margin-bottom: 2rem;">
+ <form method="GET" style="flex-direction: row; align-items: center; max-width: 100%; border: none; padding: 0;">
+ <label for="season_id" style="margin-right: 10px; font-family: var(--sans-font); font-weight: bold; text-transform: uppercase;">Select Season:</label>
+ <select id="season_id" name="season_id" onchange="this.form.submit()" style="padding: 5px 10px;">
+ {% for season in seasons %}
+ <option value="{{ season.id }}" {% if season.id|string == selected_season_id|string %}selected{% endif %}>{{ season.name }}</option>
+ {% endfor %}
+ </select>
+ <input type="hidden" name="tab" value="{{ active_tab }}">
+ </form>
+ </div>
+
+ <!-- Tabs Navigation -->
+ <div style="border-bottom: 2px solid var(--text-accent); margin-bottom: 1rem; display: flex; gap: 5px;">
+ <a href="{{ url_for('index', season_id=selected_season_id, tab='overview') }}"
+ style="padding: 10px 20px; text-decoration: none; font-family: var(--sans-font); font-weight: bold; text-transform: uppercase; border: 1px solid var(--deco-border); border-bottom: none; {{ 'background: white; color: black;' if active_tab == 'overview' else 'background: #ddd; color: #555;' }}">
+ Season Overview
+ </a>
+ <a href="{{ url_for('index', season_id=selected_season_id, tab='standings') }}"
+ style="padding: 10px 20px; text-decoration: none; font-family: var(--sans-font); font-weight: bold; text-transform: uppercase; border: 1px solid var(--deco-border); border-bottom: none; {{ 'background: white; color: black;' if active_tab == 'standings' else 'background: #ddd; color: #555;' }}">
+ Standings
+ </a>
+ <a href="{{ url_for('index', season_id=selected_season_id, tab='schedule') }}"
+ style="padding: 10px 20px; text-decoration: none; font-family: var(--sans-font); font-weight: bold; text-transform: uppercase; border: 1px solid var(--deco-border); border-bottom: none; {{ 'background: white; color: black;' if active_tab == 'schedule' else 'background: #ddd; color: #555;' }}">
+ Schedule
+ </a>
+ <a href="{{ url_for('index', season_id=selected_season_id, tab='playoffs') }}"
+ style="padding: 10px 20px; text-decoration: none; font-family: var(--sans-font); font-weight: bold; text-transform: uppercase; border: 1px solid var(--deco-border); border-bottom: none; {{ 'background: white; color: black;' if active_tab == 'playoffs' else 'background: #ddd; color: #555;' }}">
+ Playoffs
+ </a>
+ </div>
+
+ {% if active_tab == 'overview' %}
+ <div class="tab-content">
+ <h3>{{ season_info.name }} - Overview</h3>
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 1rem;">
+ <div style="background: white; padding: 1.5rem; border: 1px solid var(--deco-border);">
+ <p><strong>Total Games (Per Team):</strong> {{ season_info.total_games }}</p>
+ <p><strong>Games Per Week:</strong> {{ season_info.games_per_week }}</p>
+ <p><strong>Season Start:</strong> {{ season_info.start_date }}</p>
+ <p><strong>Season End:</strong> {{ season_info.end_date }}</p>
+ {% if season_info.total_games %}
+ <p><strong>Playoff Teams:</strong> {{ season_info.playoff_teams }}</p>
+ {% endif %}
+ <p><strong>Status:</strong> {{ season_info.status }} {% if season_info.is_finished %}(Finished){% else %}(In Progress){% endif %}</p>
+ </div>
+
+ <div style="background: white; padding: 1.5rem; border: 1px solid var(--deco-border);">
+ {% if season_info.is_finished %}
+ <h4>Final Standings</h4>
+ {% if standings %}
+ <table style="margin-top: 0; width: 100%;">
+ {% for row in standings %}
+ <tr>
+ <td>{{ loop.index }}. <strong>{{ row.team_name }}</strong></td>
+ <td>{{ row.wins }} - {{ row.losses }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+ {% else %}
+ <p>No teams enrolled.</p>
+ {% endif %}
+ {% else %}
+ <h4>League Action</h4>
+ <p>The season is currently active or upcoming.</p>
+
+ {% if current_user.is_authenticated and not current_user.is_admin %}
+ {% if user_season_status == 'Approved' %}
+ <div style="background: #f0fff0; border: 1px solid green; padding: 10px; margin-top: 10px;">
+ <p style="color: green; font-weight: bold; margin: 0;">You are currently enrolled in this season.</p>
+ </div>
+ {% elif user_season_status == 'Pending' %}
+ <div style="background: #fffbe6; border: 1px solid orange; padding: 10px; margin-top: 10px;">
+ <p style="color: orange; font-weight: bold; margin: 0;">Your request to join is pending approval.</p>
+ </div>
+ {% else %}
+ <form method="POST" action="{{ url_for('join_season', season_id=selected_season_id) }}">
+ <button type="submit" style="width: 100%; padding: 12px; font-size: 1.1rem;">Apply to Join Season</button>
+ </form>
+ {% endif %}
+ {% elif not current_user.is_authenticated %}
+ <p style="border: 1px solid #ccc; padding: 10px; background: #eee;">
+ <a href="{{ url_for('login') }}" style="font-weight: bold; color: black; text-decoration: underline;">Login</a> to apply for this season.
+ </p>
+ {% endif %}
+ {% endif %}
+ </div>
+ </div>
+ </div>
+
+ {% elif active_tab == 'standings' %}
+ <div class="tab-content">
+ <h3>{{ season_info.name }} - Standings</h3>
+ {% if standings %}
+ <table>
+ <tr>
+ <th>Team</th>
+ <th>Wins (W)</th>
+ <th>Losses (L)</th>
+ <th>Runs For (RF)</th>
+ <th>Runs Against (RA)</th>
+ <th>Games Back (GB)</th>
+ </tr>
+ {% for row in standings %}
+ {% set is_my_team = current_user.is_authenticated and current_user.id|string == row.user_id|string %}
+ {% set is_cutoff = loop.index == season_info.playoff_teams %}
+ <tr style="{{ 'background-color: #ffffcc;' if is_my_team else '' }} {{ 'border-bottom: 4px solid #333;' if is_cutoff else '' }}">
+ <td style="display: flex; align-items: center; justify-content: center; gap: 10px;">
+ {% if row.team_icon %}
+ <img src="{{ url_for('static', filename='uploads/' + row.team_icon) }}" alt="{{ row.team_name }}"
+ class="{{ 'team-icon-highlight' if is_my_team else '' }}"
+ style="width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--deco-border);">
+ {% else %}
+ <div class="{{ 'team-icon-highlight' if is_my_team else '' }}"
+ style="width: 30px; height: 30px; border-radius: 50%; background-color: var(--deco-highlight); display: inline-block;"></div>
+ {% endif %}
+ {{ row.team_name }}
+ {% if row.clinch %}<span class="clinch-marker" title="Clinched Playoff Spot {{ '(1st Seed)' if row.clinch == '**' else '' }}">{{ row.clinch }}</span>{% endif %}
+ </td>
+ <td>{{ row.wins }}</td>
+ <td>{{ row.losses }}</td>
+ <td>{{ row.runs_for }}</td>
+ <td>{{ row.runs_against }}</td>
+ <td>{{ row.games_back }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+ {% else %}
+ <p>No standings available for the selected season.</p>
+ {% endif %}
+ </div>
+
+ {% elif active_tab == 'schedule' %}
+ <div class="tab-content">
+ <h3>{{ season_info.name }} - Schedule</h3>
+
+ <form method="GET" style="flex-direction: row; align-items: center; max-width: 100%; margin-bottom: 1.5rem; border: none; padding: 0;">
+ <input type="hidden" name="season_id" value="{{ selected_season_id }}">
+ <input type="hidden" name="tab" value="schedule">
+ <label for="team_id" style="margin-right: 10px; font-family: var(--sans-font); font-weight: bold; text-transform: uppercase;">Filter by Team:</label>
+ <select id="team_id" name="team_id" onchange="this.form.submit()" style="padding: 5px 10px;">
+ <option value="all">All Teams</option>
+ {% for team in all_teams %}
+ <option value="{{ team.id }}" {% if team.id|string == selected_team_id|string %}selected{% endif %}>{{ team.team_name }}</option>
+ {% endfor %}
+ </select>
+ </form>
+
+ {% for month in months %}
+ <div class="calendar-month">
+ <h4>{{ month.name }}</h4>
+ <div class="calendar-grid">
+ {% for day in ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] %}
+ <div class="calendar-day-head">{{ day }}</div>
+ {% endfor %}
+
+ {% for week in month.weeks %}
+ {% for day in week %}
+ {% set date_str = "%04d-%02d-%02d" % (month.year, month.month, day) if day != 0 else "" %}
+ <div class="calendar-day {{ 'other-month' if day == 0 else '' }} {{ 'today' if date_str == today else '' }}">
+ {% if day != 0 %}
+ <span class="calendar-day-num">{{ day }}</span>
+ {% if date_str in games_by_date %}
+ {% for game in games_by_date[date_str] %}
+ {% set is_away_mine = current_user.is_authenticated and current_user.id|string == game.away_team_id|string %}
+ {% set is_home_mine = current_user.is_authenticated and current_user.id|string == game.home_team_id|string %}
+ <div class="calendar-game-item" onclick="window.location='{{ url_for('game', game_id=game.id) }}'">
+ <span title="{{ game.away_team if game.away_team else 'TBD' }} @ {{ game.home_team if game.home_team else 'TBD' }}">
+ {% if game.away_icon %}
+ <img src="{{ url_for('static', filename='uploads/' + game.away_icon) }}" class="team-icon-small {{ 'team-icon-highlight' if is_away_mine else '' }}">
+ {% else %}
+ <div class="team-icon-small {{ 'team-icon-highlight' if is_away_mine else '' }}" style="display:inline-block; background:#ccc;"></div>
+ {% endif %}
+ {{ game.away_score if game.status == 'Final' else '' }} @
+ {{ game.home_score if game.status == 'Final' else '' }}
+ {% if game.home_icon %}
+ <img src="{{ url_for('static', filename='uploads/' + game.home_icon) }}" class="team-icon-small {{ 'team-icon-highlight' if is_home_mine else '' }}">
+ {% else %}
+ <div class="team-icon-small {{ 'team-icon-highlight' if is_home_mine else '' }}" style="display:inline-block; background:#ccc;"></div>
+ {% endif %}
+ {% if game.is_conditional %}*{% endif %}
+ {% if game.pending_proposals > 0 %}
+ <span class="pending-icon" title="Game has pending proposals!">&#9888;</span>
+ {% endif %}
+ </span>
+ </div>
+ {% endfor %}
+ {% endif %}
+ {% endif %}
+ </div>
+ {% endfor %}
+ {% endfor %}
+ </div>
+ </div>
+ {% endfor %}
+
+ {% if games_by_date['TBD'] %}
+ <h3>TBD Games</h3>
+ <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem;">
+ {% for game in games_by_date['TBD'] %}
+ <div class="calendar-game-item" onclick="window.location='{{ url_for('game', game_id=game.id) }}'" style="padding: 1rem; font-size: 0.9rem;">
+ TBD @ TBD (Playoff)
+ </div>
+ {% endfor %}
+ </div>
+ {% endif %}
+ </div>
+ {% elif active_tab == 'playoffs' %}
+ <div class="tab-content">
+ <h3>{{ season_info.name }} - Playoffs</h3>
+
+ {% if bracket %}
+ <div class="bracket-container">
+ {% for round_games in bracket %}
+ <div class="bracket-round">
+ <h4 style="border: none; text-align: center; font-size: 0.9rem;">Round {{ loop.index }}</h4>
+ {% for g in round_games %}
+ <div class="bracket-game {{ 'winner' if g.status == 'Final' }}" onclick="window.location='{{ url_for('game', game_id=g.id) }}'" style="cursor: pointer;">
+ <div class="bracket-team">
+ <span>{{ g.away_team if g.away_team else 'TBD' }} {{ g.away_record if g.away_team else '' }}</span>
+ <span style="font-weight: bold; margin-left: 10px;">{{ g.away_series_wins }}</span>
+ </div>
+ <div class="bracket-team">
+ <span>{{ g.home_team if g.home_team else 'TBD' }} {{ g.home_record if g.home_team else '' }}</span>
+ <span style="font-weight: bold; margin-left: 10px;">{{ g.home_series_wins }}</span>
+ </div>
+ <div style="font-size: 0.6rem; color: #777; margin-top: 3px;">
+ Best of {{ season_info.playoff_series_length }}
+ </div>
+ </div>
+ {% endfor %}
+ </div>
+ {% endfor %}
+ </div>
+ {% else %}
+ <p>Playoff bracket not yet generated.</p>
+ {% endif %}
+
+ <h3>Playoff Schedule</h3>
+ {% if playoff_games %}
+ <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem;">
+ {% for game in playoff_games %}
+ {% set is_away_mine = current_user.is_authenticated and current_user.id|string == game.away_team_id|string %}
+ {% set is_home_mine = current_user.is_authenticated and current_user.id|string == game.home_team_id|string %}
+ <div style="border: 1px solid var(--deco-border); padding: 1rem; background: white; cursor: pointer;"
+ onclick="window.location='{{ url_for('game', game_id=game.id) }}'">
+ <div style="font-size: 0.8rem; color: var(--deco-highlight); margin-bottom: 0.5rem; font-family: var(--sans-font); font-weight: bold; text-transform: uppercase;">
+ {{ game.scheduled_date }} - {{ game.status }}
+ {% if game.is_conditional %}<span class="conditional-game">*</span>{% endif %}
+ {% if game.pending_proposals > 0 %}<span class="pending-icon">&#9888;</span>{% endif %}
+ </div>
+ <div style="display: flex; justify-content: space-between; align-items: center;">
+ <div style="text-align: center; flex: 1;">
+ {% if game.away_icon %}
+ <img src="{{ url_for('static', filename='uploads/' + game.away_icon) }}" class="team-icon-small {{ 'team-icon-highlight' if is_away_mine else '' }}">
+ {% else %}
+ <div class="team-icon-small {{ 'team-icon-highlight' if is_away_mine else '' }}" style="display:inline-block; background:#ccc; border-radius: 50%;"></div>
+ {% endif %}
+ <br><strong style="font-size: 0.8rem;">{{ game.away_team if game.away_team else 'TBD' }}</strong>
+ <br><span style="font-weight: bold;">{{ game.away_score if game.status == 'Final' else '-' }}</span>
+ </div>
+ <div style="font-weight: bold;">@</div>
+ <div style="text-align: center; flex: 1;">
+ {% if game.home_icon %}
+ <img src="{{ url_for('static', filename='uploads/' + game.home_icon) }}" class="team-icon-small {{ 'team-icon-highlight' if is_home_mine else '' }}">
+ {% else %}
+ <div class="team-icon-small {{ 'team-icon-highlight' if is_home_mine else '' }}" style="display:inline-block; background:#ccc; border-radius: 50%;"></div>
+ {% endif %}
+ <br><strong style="font-size: 0.8rem;">{{ game.home_team if game.home_team else 'TBD' }}</strong>
+ <br><span style="font-weight: bold;">{{ game.home_score if game.status == 'Final' else '-' }}</span>
+ </div>
+ </div>
+ </div>
+ {% endfor %}
+ </div>
+ {% else %}
+ <p>No playoff games scheduled.</p>
+ {% endif %}
+ </div>
+ {% endif %}
+
+{% endblock %} \ No newline at end of file