{% extends 'base.html.twig' %}

{% block stylesheets %}
    <!-- Theme CSS - Includes Bootstrap -->
    <style type="text/css">
        .masthead{
            background: url(../img/bg-pattern.png),linear-gradient(to right,#943129,#826412) !important;
        }
        tbody>tr>:nth-child(1) {
            vertical-align: middle;
        }
        tbody>tr>:nth-child(2) {
            vertical-align: middle;
        }
        tbody>tr>:nth-child(n) {
            vertical-align: middle;
        }

        .red-strike {
            text-decoration: line-through;
            color: red;
        }
        .success {
            background: #02c502;
            color: white;
            font-weight: 800;
            font-size: 20px;
        }
        .text-red {
            color: #00e765;
        }
	@media print {
            table { page-break-after:auto }
            tr    { page-break-inside:avoid; page-break-after:auto; border: solid }
            td    { page-break-inside:avoid; page-break-after:auto }
            thead { display: table-row-group; }
            tfoot { display:table-footer-group }
        }
    </style>
{% endblock %}
{% block body %}
    <header class="masthead">
        <div class="">
            {% include '_flash.html.twig' %}
            <div class="row h-100 align-items-center justify-content-center text-center">
                <div class="col-lg-10 align-self-end">
                    <h4 class="text-uppercase text-white font-weight-bold">{{ group.name }}</h4>
                    <hr class="divider my-4">
                </div>
                <div class="col-lg-12 align-self-baseline">
                    <table class="table table-striped table-light" style="background: #efeaea">
                        <thead>
                        <tr>
                            <th scope="col">#</th>
                            <th scope="col" colspan="2">Student Details</th>
                                {% for judge in group.judges %}
                                    <th>{{ judge.name }}</td>
                                {% endfor %}
                            <th scope="col">Total</th>
                        </tr>
                        </thead>
                        <tbody>
                            {% for player in rankedPlayers %}
                            <tr>
                                <th scope="row">{{ loop.index }}</th>
                                <td colspan="2">{{ player.student.name }} <p>({{player.student.club.name}}/ {{player.kata.name}})</p></td>
                                {% for judge in group.judges %}
                                {% set break = false %}
                                {% for score in player.scores if not break and score.scoreType == 'technical' and score.judge is same as(judge) %}
                                    <td class="{{ score.isRemoved ? 'red-strike': '' }}">{{ score.score }}</td>
                                    {% set break = true %}
                                {% endfor %}
                                {%endfor%}
                                <td>{{ player.totalTech  }}</td>
                            </tr>
                            {% else %}
                            <tr>
                                <td colspan="3">No data available</td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>

                {% include 'footer-no-colour.html.twig' %}
            </div>
        </div>
    </header>
<!---
    <script type="text/javascript">
        setTimeout(function(){
            window.location.reload(1);
        }, 5000);
    </script>
    -->
{% endblock %}
