{% extends "admin/base.html" %}

{% block content %}
<div class="jumbotron">
	<div class="container">
		<h1>Scoreboard</h1>
	</div>
</div>
<div class="container">
	<div class="row">
		<div class="col-md-12">
			<table id="scoreboard" class="table table-striped">
				<thead>
					<tr>
						<td width="10px"><b>Place</b></td>
						<td><b>Team</b></td>
						<td><b>Score</b></td>
						<td><b>Visibility</b></td>
					</tr>
				</thead>
				<tbody>
				{% for standing in standings %}
					<tr data-href="{{ generate_account_url(standing.account_id, admin=True) }}">
						<td>{{ loop.index }}</td>
						<td>
							<a href="{{ generate_account_url(standing.account_id, admin=True) }}">
								{{ standing.name }}
								{% if standing.oauth_id %}
									{% if get_config('user_mode') == 'teams' %}
										<a href="https://majorleaguecyber.org/t/{{ standing.name }}">
											<span class="badge badge-primary">Official</span>
										</a>
									{% elif get_config('user_mode') == 'users' %}
										<a href="https://majorleaguecyber.org/u/{{ standing.name }}">
											<span class="badge badge-primary">Official</span>
										</a>
									{% endif %}
								{% endif %}
							</a>
						</td>
						<td>{{ standing.score }}</td>
						<td>
						{% if standing.hidden %}
							<button class="btn-sm btn-danger cursor-pointer scoreboard-toggle" type="submit"
								data-account-id="{{ standing.account_id }}" data-state="hidden">Hidden
							</button>
						{% else %}
							<button class="btn-sm btn-success cursor-pointer scoreboard-toggle" type="submit"
								data-account-id="{{ standing.account_id }}" data-state="visible">Visible
							</button>
						{% endif %}
						</td>
					</tr>
				{% endfor %}
				</tbody>
			</table>
		</div>
	</div>
</div>
{% endblock %}

{% block scripts %}
{% endblock %}

{% block entrypoint %}
	<script defer src="{{ url_for('views.themes', theme='admin', path='js/pages/scoreboard.js') }}"></script>
{% endblock %}
