{% 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">
			<div class="float-right pb-3">
				<div class="btn-group" role="group">
					<button type="button" class="btn btn-outline-secondary" id="scoreboard-edit-button" data-toggle="tooltip" title="Hide/Unhide Accounts">
						<i class="btn-fa fas fa-eye"></i>
					</button>
				</div>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12">
			<table id="scoreboard" class="table table-striped border">
				<thead>
					<tr>
						<th class="border-right" data-checkbox>
							<div class="form-check text-center">
								<input type="checkbox" class="form-check-input" id="scoreboard-bulk-select" data-checkbox-all>&nbsp;
							</div>
						</th>
						<th class="sort-col text-center"><b>Place</b></th>
						<th class="sort-col"><b>Team</b></th>
						<th class="sort-col"><b>Score</b></th>
						<th class="sort-col"><b>Visibility</b></th>
					</tr>
				</thead>
				<tbody>
				{% for standing in standings %}
					<tr data-href="{{ generate_account_url(standing.account_id, admin=True) }}">
						<td class="border-right text-center" data-checkbox>
							<div class="form-check">
								<input type="checkbox" class="form-check-input" value="{{ standing.account_id }}" data-account-id="{{ standing.account_id }}">&nbsp;
							</div>
						</td>
						<td class="text-center" width="10%">{{ 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 %}
								<span class="badge badge-danger">hidden</span>
							{% else %}
								<span class="badge badge-success">visible</span>
							{% 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 %}
