{% extends 'site_elements/base.html' %}

{% block description %}Team {{ scoreboard.team_1_name }} ({{ scoreboard.team_1_score }}) vs Team {{ scoreboard.team_2_name }} ({{ scoreboard.team_2_score }}) | Map: {{ scoreboard.map }} | Match ID: {{ scoreboard.match_id }}{% endblock %}

{% block title %}Home{% endblock %}

{% block nav_title %}
    <a class="navbar-brand text-light" href="{{ request.url_for('CommunityPage', community=request.path_params['community']) }}">
        {{ request.path_params['community'] }} <span style="font-size: 10px;">&nbsp;hosted by SQLMatches</span>
    </a>
{% endblock %}

{% block content %}
        <div class="card text-light scoreboard-card">
            <div class="card-body scoreboard-body">
                <h4 class="text-center card-title" style="background: {% if scoreboard.team_1_side == 0 %}rgb(91,118,141); background: linear-gradient(90deg, rgba(91,118,141,1) 0%, rgba(10,47,78,1) 100%){% else %}rgb(172,155,102); background: linear-gradient(90deg, rgba(172,155,102,1) 0%, rgba(99,79,15,1) 100%){% endif %};margin: 0px;">Team {{ scoreboard.team_1_name }}</h4>
                <div class="table-responsive text-light scoreboard">
                    <table class="table table-hover">
                        <thead class="text-light">
                            <tr>
                                <th class="player-cell">Name</th>
                                <th class="stats-cell">Kills</th>
                                <th class="stats-cell">Assists</th>
                                <th class="stats-cell">Deaths</th>
                                <th class="stats-cell">KDR</th>
                                <th class="stats-cell">HS %</th>
                                <th class="stats-cell">HIT %</th>
                                <th class="stats-cell">MVPs</th>
                                <th class="stats-cell">Score</th>
                                <th class="stats-cell">Ping</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for player in scoreboard.team_1() %}
                                <tr class="text-light" style="cursor: pointer;" onclick="location.href = 'https://steamcommunity.com/profiles/{{ player.steam_id }}';">
                                    <td>{{ player.name }}</td>
                                    <td class="text-center">{{ player.kills }}</td>
                                    <td class="text-center">{{ player.assists }}</td>
                                    <td class="text-center">{{ player.deaths }}</td>
                                    <td class="text-center">{{ player.kdr }}</td>
                                    <td class="text-center">{{ player.hs_percentage }}%</td>
                                    <td class="text-center">{{ player.hit_percentage }}%</td>
                                    <td class="text-center">{{ player.mvps }}</td>
                                    <td class="text-center">{{ player.score }}</td>
                                    <td class="text-center">{{ player.ping }}</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="text-center" style="margin: 25px 0;">
            <h1 class="text-light">
                {% if scoreboard.status == 0 and scoreboard.team_1_score != scoreboard.team_2_score %}
                    {% if scoreboard.team_1_score > scoreboard.team_2_score %}
                        <span class="won">{{ scoreboard.team_1_score }}</span>:<span class="lost">{{ scoreboard.team_2_score }}</span>
                    {% else %}
                        <span class="lost">{{ scoreboard.team_1_score }}</span>:<span class="won">{{ scoreboard.team_2_score }}</span>
                    {% endif %}
                {% else %}
                    <span>{{ scoreboard.team_1_score }}</span>:<span>{{ scoreboard.team_2_score }}</span>
                {% endif %}
            </h1>
            {% if scoreboard.demo_status == 2 %}
                <a href="{{ request.url_for('DownloadPage', match_id=request.path_params['match_id']) }}">
                    <button class="btn btn-success btn-sm" type="button"><i class="icon-cloud-download"></i>&nbsp;Download</button>
                </a>
            {% elif scoreboard.demo_status == 1 %}
                <button class="btn btn-warning btn-sm" type="button" disabled><i class="icon-reload"></i>&nbsp;Processing</button>
            {% elif scoreboard.demo_status == 0 %}
                {% if scoreboard.status == 1 %}
                    <button class="btn btn-info btn-sm" type="button" disabled><i class="icon-shield"></i>&nbsp;Match in progress</button>
                {% else %}
                    <button class="btn btn-danger btn-sm" type="button" disabled><i class="icon-minus"></i>&nbsp;No download</button>
                {% endif %}
            {% endif %}
        </div>
        <div class="card text-light scoreboard-card">
            <div class="card-body scoreboard-body">
                <h4 class="text-center card-title" style="background: {% if scoreboard.team_2_side == 0 %}rgb(91,118,141); background: linear-gradient(90deg, rgba(91,118,141,1) 0%, rgba(10,47,78,1) 100%){% else %}rgb(172,155,102); background: linear-gradient(90deg, rgba(172,155,102,1) 0%, rgba(99,79,15,1) 100%){% endif %};margin: 0px;">Team {{ scoreboard.team_2_name }}</h4>
                <div class="table-responsive text-light scoreboard">
                    <table class="table table-hover">
                        <thead class="text-light">
                            <tr>
                                <th class="player-cell">Name</th>
                                <th class="stats-cell">Kills</th>
                                <th class="stats-cell">Assists</th>
                                <th class="stats-cell">Deaths</th>
                                <th class="stats-cell">KDR</th>
                                <th class="stats-cell">HS %</th>
                                <th class="stats-cell">HIT %</th>
                                <th class="stats-cell">MVPs</th>
                                <th class="stats-cell">Score</th>
                                <th class="stats-cell">Ping</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for player in scoreboard.team_2() %}
                                <tr class="text-light" style="cursor: pointer;" onclick="location.href = 'https://steamcommunity.com/profiles/{{ player.steam_id }}';">
                                    <td>{{ player.name }}</td>
                                    <td class="text-center">{{ player.kills }}</td>
                                    <td class="text-center">{{ player.assists }}</td>
                                    <td class="text-center">{{ player.deaths }}</td>
                                    <td class="text-center">{{ player.kdr }}</td>
                                    <td class="text-center">{{ player.hs_percentage }}%</td>
                                    <td class="text-center">{{ player.hit_percentage }}%</td>
                                    <td class="text-center">{{ player.mvps }}</td>
                                    <td class="text-center">{{ player.score }}</td>
                                    <td class="text-center">{{ player.ping }}</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
{% endblock %}