{% extends 'lib/base.html' %}
{% load static %}
{% block body %}
    <title>All Sports | Workoutizer</title>
    <h3>Your Sports</h3>
    <hr>
    <br>
    <div class="container">
        {% include "lib/messages.html" %}
        <table class="table table-hover">
            <thead>
            <tr>
                <th>Sport Name</th>
                <th>Icon</th>
                <th>Number of Activities &nbsp;<i class="fas fa-hashtag"></i></th>
                <th>Total Duration &nbsp;<i class="fas fa-history"></i></th>
                <th>Total Distance &nbsp;<i class="fas fa-road"></i></th>
            </tr>
            </thead>
            {% for sport in sports %}
                {% if sport.slug != 'unknown' %}
                    <tbody>
                    <tr>
                        <td><a href="/sport/{{ sport.slug }}">{{ sport.name }}</a></td>
                        <td style="color:{{ sport.color }}"><i class="fas fa-{{ sport.icon }}"></i></td>
                        <td>{{ sport.total_count }}</td>
                        <td>
                            {% if sport.total_duration != 0.0 %}
                                {{ sport.total_duration }}
                            {% else %}
                                -
                            {% endif %}
                        </td>
                        <td>
                            {% if sport.total_distance != 0.0 %}
                                {{ sport.total_distance }} km
                            {% else %}
                                -
                            {% endif %}
                        </td>
                    </tr>
                    </tbody>
                {% endif %}
            {% endfor %}
        </table>
        <br>
        <a href="{% url 'add-sport' %}" class="btn btn-warning"><i class="fas fa-plus"></i>&nbsp;&nbsp;Add new Sport</a>
    </div>
{% endblock %}