{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% load staticfiles %}

{% block title %} {% trans "Dashboard" %}{% endblock %}


{% block content %}
<div class="ym-grid linearize-level-1">
    <div class="ym-g50 ym-gl">
        <div class="ym-gbox-left">
            <h3>{% trans "Workout"%}</h3>
            {% if current_workout %}
            <p>
            <a href="{% url 'wger.manager.views.workout.view' current_workout.id %}">
                {% if current_workout.comment %}
                    {{ current_workout.comment }}
                {% else %}
                    {% trans "Workout" %}
                {% endif %}
            </a>
            </p>
             – {{ current_workout.creation_date }}

            <ul>
                {% for day, exercise, is_workout in weekdays %}
                <li>
                    {% if not is_workout %}<span class="dimmed">{% endif%}
                    {{ day }}:

                    {{ exercise }}
                    {% if not is_workout %}</span>{% endif%}

                </li>
                {% endfor %}
            </ul>

            {% if schedule %}
            <p>
                → {% trans "This workout is part of a schedule:" %}
                <a href="{{schedule.get_absolute_url}}">{{schedule.name}}</a>
            </p>
            {% endif %}

            {% else %}
                <p>
                    <a href="{% url 'wger.manager.views.workout.add' %}" class="btn btn-block">
                    {% trans "No workouts found." %} {% trans "Add one now." %}
                    </a>
                </p>
            {% endif %}
        </div>
    </div>
    <div class="ym-g50 ym-gr">
        <div class="ym-gbox-right">


            <h3>{% trans "Nutrition plan"%}</h3>

            {% if plan %}
                <p>
                <a href="{% url 'wger.nutrition.views.plan.view' plan.id %}">
                    {% if plan.description %}
                        {{ plan.description }}
                    {% else %}
                        {% trans "Nutrition plan" %}
                    {% endif %}
               </a>
               </p>
               – {{ plan.creation_date }}

               <ul>
                   <li>
                       {% trans "Energy" %}: {{nutritional_info.energy}} kcal
                   </li>
                   <li>
                       {% trans "Protein" %}: {{nutritional_info.protein|floatformat}} g
                   </li>
                   <li>
                       {% trans "Carbohydrates" %}: {{nutritional_info.carbohydrates|floatformat}} g
                   </li>
                   <li>
                       {% trans "Fat" %}: {{nutritional_info.fat|floatformat}} g
                   </li>
               </ul>

            {% else %}
                <p>
                    <a href="{% url 'wger.nutrition.views.plan.add' %}" class="btn btn-block">
                    {% trans "No nutrition plans." %} {% trans "Add one now." %}
                    </a>
                </p>
            {% endif %}
            {% if weight %}
            <p>
                {% trans "Your current weight is: "%} <strong>{{weight.weight|floatformat}} kg.</strong>
            </p>
            {% endif %}
        </div>
    </div>
</div>

<div class="ym-grid linearize-level-1">
    <div class="ym-g50 ym-gl">
        <div class="ym-gbox-left">
            <p>
                <a href="{% url 'wger.manager.views.workout.add' %}">
                <img src="{% static 'images/icons/new.svg' %}"
                     width="32"
                     height="32"
                     alt="{% trans 'Add workout' %}"
                     title="{% trans 'Add workout' %}">
                {% trans "Add workout" %}</a>
            </p>
        </div>
    </div>
    <div class="ym-g50 ym-gr">
        <div class="ym-gbox-right">
            <p>
                <a href="{% url 'wger.nutrition.views.plan.add' %}">
                <img src="{% static 'images/icons/new.svg' %}"
                     width="32"
                     height="32"
                     alt="{% trans 'Add nutrition plan' %}"
                     title="{% trans 'Add nutrition plan' %}">
                    {% trans "Add nutrition plan" %}</a>
            </p>
        </div>
    </div>
</div>
{% endblock %}



{% block sidebar %}
<h3>{% trans "Options" %}</h3>
<p>
<a href="{% url 'wger.manager.views.user.preferences' %}">
<img src="{% static 'images/icons/preferences.svg' %}"
     width="32"
     height="32"
     alt="{% trans 'My preferences' %}"
     title="{% trans 'My preferences' %}">
{% trans "My preferences" %}</a>
</p>

<h3>{% trans "Info" %}</h3>
<p>{% blocktrans %}The current workout is selected from your active schedule
or, if you don't have one, simply by date.{% endblocktrans %}</p>

<p>{% trans "After adding a workout or a nutritional plan, you can edit them to set a goal." %}
</p>
{% endblock %}
