{% 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">
                <div class="col-lg-10 align-self-end">
                    <h4 class="text-uppercase text-white font-weight-bold">Following groups exists</h4>
                    <hr class="divider my-4">
                </div>
                <div class="col-lg-8 align-self-baseline">
                    <table class="table table-striped table-light ml-5" style="background: #efeaea">
                        <thead>
                        <tr>
                            <th scope="col">#</th>
                            <th scope="col">Group name</th>
                            <th scope="col">Tatami</th>
                            <th scope="col">Status</th>
                            <th scope="col">Action</th>
                        </tr>
                        </thead>
                        <tbody>
                            {% for group in groups %}
                            <tr >
                                <th scope="row">{{ loop.index }}</th>
                                <td>{{ group.name }}</td>
                                <td>{{ group.tatami }}</td>
                                <td>{{ group.status }}</td>
                                {% if group.status == 'pending' %}
                                <td><a class="btn btn-primary btn-sm " href="/group/{{ group.id }}/start">Start</a></td>
                                {% else %}
                                <td><a class="btn btn-success btn-sm " href="/group/{{ group.id }}">Details</a></td>
                                {% endif %}
                                {% if group.status == 'finished' or group.status == 'completed'%}
                                    <td><a class="btn btn-secondary btn-sm " href="/group/{{ group.id }}/report">Report</a></td>
                                {% endif %}
                            </tr>
                            {% else %}
                            <tr>
                                <td colspan="5">No data available</td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                    {% include 'footer-no-colour.html.twig' %}
                </div>
            </div>
        </div>
    </header>
{% endblock %}
