{% 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;
        }
    </style>
{% endblock %}
{% block body %}
    <header class="masthead">
        <div class="container h-100">
            {% include '_flash.html.twig' %}
            <div class="row h-100 align-items-center justify-content-center text-center" style="background: #01013a">
                <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">Student name</th>
                            <th scope="col">Club name</th>
                            <th scope="col">Kata name</th>
                            <th scope="col">Status</th>
                            <th scope="col">Action</th>
                        </tr>
                        </thead>
                        <tbody>
                            {% for player in group.players %}
                            <tr>
                                <th scope="row">{{ loop.index }}</th>
                                <td>{{ player.student.name }}</td>
                                <td>{{ player.student.club.name }}</td>
                                <td>{{ player.kata.name }}</td>
                                <td>{{ player.status }}</td>
                                {% if player.status == 'pending' %}
                                    <td><a class="btn btn-primary btn-sm" href="/player/{{ player.id }}/start">Start</a></td>
                                {% else %}
                                    <td><a class="btn btn-success btn-sm" href="/player/{{ player.id }}/details">Details</a></td>
                                {% endif %}
                            </tr>
                            {% else %}
                            <tr>
                                <td colspan="3">No data available</td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>

                {% if group.status != 'completed' %}
                <div class="col-lg-12 align-self-baseline">
                    <p class="text-white-75 font-weight-light mb-5">You can Submit the group only after all the players completed their game</p>
                    <a class="btn btn-primary btn-xl js-scroll-trigger" href="/group/{{ group.id }}/submit">Submit</a>
                </div>
                    {% include 'footer-no-colour.html.twig' %}
                {% endif %}
            </div>
        </div>
    </header>

    <script type="text/javascript">
        setTimeout(function(){
            window.location.reload(1);
        }, 5000);
    </script>
{% endblock %}
