{% extends "base.html" %}{% load static %}
{% block title %} {{ event.data.formatted_title }}{% endblock %}

{% block content %}
    <div class="card mx-auto" style="max-width: 455px">
        <div class="border-bottom p-2">
            <h4 class="card-title text-nowrap">{{ event.data.formatted_title }}</h4>
            <h6 class="text-muted card-subtitle text-nowrap">{{ event.data.start_date|date:"D, F j, Y g:i A" }}</h6>

            <div class="row">
                <div class="col text-end">
                    <form method="get"
                          action="{% url "teamsnap_image_generator_generate" team_id=request.user.profile.teamsnapsettings.managed_team.id event_id=event.data.id %}">
                        <select hidden class="form-select" name="game_id" id="game_id">
                            <optgroup label="Events">
                                <option value="" disabled="disabled">Select an event...</option>
                                <option selected
                                        value="{{ event.data.id }}">{{ event.data.formatted_title }}</option>
                            </optgroup>
                        </select>
                        <input hidden class="form-check-input" type="radio" name="background"
                               id="backgroundLocation" checked value="location">
                        <input hidden class="form-check-input" type="radio" name="dimensions" id="square" checked
                               value="1080x1080">
                        <button type="submit" class="btn btn-primary btn-sm py-0 m-1"><i class="bi bi-instagram"></i>
                        </button>
                    </form>
                    <a class="btn btn-primary btn-sm py-0 m-1"
                       href="{% url "teamsnap_image_generator" team_id=request.user.profile.teamsnapsettings.managed_team.id event_id=event.data.id %}"
                       role="button">
                        <div class="d-inline-block"><i class="bi bi-instagram"></i> <i class="bi bi-three-dots"></i>
                        </div>
                    </a>
                </div>
            </div>
        </div>

        <div class="card-body p-0 m-0">
            <div>
                <div class="row m-0">
                    <div class="col border-bottom bg-light">
                        <span class="text-uppercase fw-bold small"></span>
                    </div>
                </div>
                <div class="row m-0">
                    <div class="table-responsive p-0">
                        <table class="table table-sm">
                            {#    <thead>#}
                            {#    </thead>#}
                            <tbody>
                            <tr>
                                <th scope="col">
                                    Date
                                </th>
                                <td>
                                    {{ event.data.start_date|date:"D, F j, Y g:i A"  }}
                                </td>
                            </tr>
                            <tr>
                                <th scope="col">
                                    Opponent
                                </th>
                                <td>
                                    <a href="{%  url 'teamsnap_opponent' team_id=request.user.profile.teamsnapsettings.managed_team.id id=event.data.opponent_id %}">{{ event.data.opponent_name }}</a>
                                </td>
                            </tr>
                            <tr>
                                <th scope="col">
                                    Location
                                </th>
                                <td>
                                    <a href="{%  url 'teamsnap_location' team_id=request.user.profile.teamsnapsettings.managed_team.id id=event.data.location_id %}">{{ event.data.location_name }}</a>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div>
                <div class="row m-0">
                    <div class="col border-bottom border-top bg-light">
                        <span class="text-uppercase fw-bold small">Availabilities</span>
                    </div>
                </div>
                <div class="row m-0">
                    <div class="table-responsive p-0">
                        <table class="table table-sm">

                            <tbody>
                            <tr>
                                <th scope="col" class="col-1">
                                    <i class="bi bi-check-circle-fill text-success"></i>
                                </th>
                                <td>
                                    {{ availability_summary.data.player_going_count }}
                                </td>

                                <th scope="col" class="col-1">
                                    <i class="bi bi-question-circle-fill text-info"></i>
                                </th>
                                <td>
                                    {{ availability_summary.data.player_maybe_count }}
                                </td>

                                <th scope="col" class="col-1">
                                    <i class="bi bi-x-circle-fill text-danger"></i>
                                </th>
                                <td>
                                    {{ availability_summary.data.player_not_going_count }}
                                </td>

                                <th scope="col" class="col-1">
                                    <i class="bi bi-question-circle"></i>
                                </th>
                                <td>
                                    {{ availability_summary.data.player_unknown_count }}
                                </td>
                            </tr>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div>
                <div class="row m-0">
                    <div class="col border-bottom border-top bg-light">
                        <span class="text-uppercase fw-bold small">Lineup</span>
                    </div>
                </div>
                <div class="row m-0">
                    <div class="flex-column m-2">
                        <a class="btn btn-primary btn-sm"
                           href="{% url 'teamsnap_edit_lineup' event_ids=event.data.id team_id=request.user.profile.teamsnapsettings.managed_team.id %}"
                           role="button">Edit</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}