<commit_before>{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load wger_extras %}

{% block title %}{% trans "Nutrition plan" %} – {{ plan.creation_date}}{% endblock %}


{% block header %}
<script>
function custom_modal_init()
{
    // Init the autocompleter after loading the modal dialog
    init_ingredient_autocompleter();
}
</script>
{% endblock %}



{% block content %}
{% if plan.description %}
<p>
    <strong>{% trans "Goal" %}:</strong> {{plan.description}}
</p>
{% endif %}

<table class="table table-bordered">
    <thead>
        <tr style="background: #E0E0E0;">
            <th>{% trans "Meal" %}</th>
            <th>{% trans "Contents" %}</th>
            <th>{% trans "Energy" %}</th>
            <th>{% trans "Protein" %}</th>
            <th>{% trans "Carbohydrates" %}</th>
            <th>{% trans "Fat" %}</th>
        </tr>
    </thead>
    <tbody>
    <tr>
        <td colspan="2"></td>
        <td>{% trans 'kcal' %}</td>
        <td>{% trans_weight_unit 'g' user %}</td>
        <td>{% trans_weight_unit 'g' user %}</td>
        <td>{% trans_weight_unit 'g' user %}</td>
    </tr>
{% for meal in plan.meal_set.select_related %}
    {% for item in meal.mealitem_set.select_related %}
    <tr>
        {% ifchanged meal.pk %}
        <td rowspan="{{meal.mealitem_set.count}}">
            <strong>
            {% trans "Nr."%} {{ forloop.parentloop.counter }}
            {% if meal.time %} &ndash; {{meal.time|time:"H:i"}}{% endif %}
            </strong>

            <div class="editoptions">
                <a href="{% url 'nutrition:meal:delete' meal.id %}"
                   title="{% trans 'Delete' %}">
                   <img src="{% static 'images/icons/trash.svg' %}"
                        width="16"
                        height="16"
                        alt="{% trans 'Delete meal' %}"
                        title="{% trans 'Delete meal' %}">
                </a>
                <a href="{% url 'nutrition:meal:edit' meal.id %}"
                   title="{% trans 'Edit' %}"
                   class="wger-modal-dialog">
                    <img src="{% static 'images/icons/edit.svg' %}"
                         width="16"
                         height="16"
                         alt="{% trans 'Edit meal' %}"
                         title="{% trans 'Edit meal' %}">
                </a>
                <a href="{% url 'nutrition:meal_item:add' meal.id %}"
                   title="{% trans 'Add' %}"
                   class="wger-modal-dialog edit-meal">
                    <img src="{% static 'images/icons/add.svg' %}"
                         width="16"
                         height="16"
                         alt="{% trans 'Add item to meal' %}"
                         title="{% trans 'Add item to meal' %}">
               </a>
            </div>
        </td>
        {% endifchanged %}
        <td>
            {% if item.get_unit_type == MEALITEM_WEIGHT_GRAM %}{{ item.amount|floatformat:"0" }}g
            {% else %}
                {{ item.amount|floatformat:"0" }} × {{ item.weight_unit.unit.name }}
            {% endif %}
            {{ item.ingredient.name }}

            <span class="editoptions">
                <a href="{% url 'nutrition:meal_item:delete' item.id %}"
                   title="{% trans 'Delete' %}"
                   class="delete-mealitem">
                   <img src="{% static 'images/icons/trash.svg' %}"
                        width="16"
                        height="16"
                        alt="{% trans 'Delete' %}">
                </a>
                <a href="{% url 'nutrition:meal_item:edit' item.id %}"
                   title="{% trans 'Edit' %}"
                   class="wger-modal-dialog edit-meal edit-mealitem">
                    <img src="{% static 'images/icons/edit.svg' %}"
                         width="16"
                         height="16"
                         alt="{% trans 'Edit' %}">
                </a>
            </span>
            </td>
            <td>{{item.get_nutritional_values.energy|floatformat}}</td>
            <td>{{item.get_nutritional_values.protein|floatformat}}</td>
            <td>{{item.get_nutritional_values.carbohydrates|floatformat}}</td>
            <td>{{item.get_nutritional_values.fat|floatformat}}</td>
</tr>
    {% empty %}
    <tr>
    <td colspan="7">
       <a href="{% url 'nutrition:meal_item:add' meal.id %}"
          title="{% trans 'Add one now.' %}"
          class="wger-modal-dialog edit-meal btn btn-default btn-block">
            {% trans "No items for this meal." %}
            {% trans "Add one now."%}
        </a>
    </td>
</tr>
    {% endfor %}

{% empty %}
<p>
     <a href="{% url 'nutrition:meal:add' plan.id %}"
        class="wger-modal-dialog btn btn-default btn-block">
            {% trans "No meals for this plan." %}
            {% trans "Add one now." %}
        </a>
</p>
{% endfor %}
        <tr>
            <td colspan="6">
            <a href="{% url 'nutrition:meal:add' plan.id %}"
               class="wger-modal-dialog">
                <img src="{% static 'images/icons/edit.svg' %}"
                     width="16"
                     height="16"
                     alt="{% trans 'Add a new meal' %}"
                     title="{% trans 'Add a new meal' %}">
                {% trans "Add a new meal" %}
            </a>
            </td>
        <tr>
    </tbody>
</table>

{% if language.short_name != 'en' %}
    <p>
    {% trans "If you find the ingredient list too short, you might want to activate the preference to also show English ingredients." %}
    <a href="{% url 'core:user:preferences' %}" id="ajax-english-ingredients">{% trans "That's done here" %}</a>.
    </p>
{% endif %}


<h3>{% trans "Nutritional data" %}</h3>
<table class="table table-condensed">
    <thead>
        <tr>
            <th>{% trans "Macronutrients" %}</th>
            <th class="align-right">{% trans "Total" %}</th>
            <th class="align-right">{% trans "Percent of energy" %}</th>
            <th class="align-right">{% trans "g per body kg" %}</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>{% trans "Energy" %}</td>
            <td class="align-right">{{nutritional_data.total.energy|floatformat}} {% trans "kcal" %}</td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>{% trans "Protein" %}</td>
            <td class="align-right">{{nutritional_data.total.protein|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td class="align-right">{{nutritional_data.percent.protein|floatformat}} %</td>
            <td class="align-right">{{nutritional_data.per_kg.protein|floatformat}}</td>
        </tr>
        <tr>
            <td>{% trans "Carbohydrates" %}</td>
            <td class="align-right">{{nutritional_data.total.carbohydrates|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td class="align-right">{{nutritional_data.percent.carbohydrates|floatformat}} %</td>
            <td class="align-right">{{nutritional_data.per_kg.carbohydrates|floatformat}}</td>
        </tr>
        <tr>
            <td style="padding-left: 2em;">{% trans "Sugar content in carbohydrates" %}</td>
            <td class="align-right">{{nutritional_data.total.carbohydrates_sugar|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>{% trans "Fat" %}</td>
            <td class="align-right">{{nutritional_data.total.fat|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td class="align-right">{{nutritional_data.percent.fat|floatformat}} %</td>
            <td class="align-right">{{nutritional_data.per_kg.fat|floatformat}}</td>
        </tr>
        <tr>
            <td style="padding-left: 2em;">{% trans "Saturated fat content in fats" %}</td>
            <td class="align-right">{{nutritional_data.total.fat_saturated|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td></td>
            <td></td>
        </tr>


        <tr>
            <th colspan="4">{% trans "Others" %}</th>
        </tr>
        <tr>
            <td>{% trans "Fibres" %}</td>
            <td class="align-right">{{nutritional_data.total.fibres|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>{% trans "Sodium" %}</td>
            <td class="align-right">{{nutritional_data.total.sodium|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td></td>
            <td></td>
        </tr>
    </tbody>
</table>
{% endblock %}



{% block sidebar %}
<h3>{% trans "Energy" %}</h3>
<table class="table table-condensed" id="nutritional-data-energy">
    <thead>
        <tr>
            <th>{% trans "Energy" %}</th>
            <th class="align-right">{{nutritional_data.total.energy|floatformat}} {% trans "kcal" %}</th>
        </tr>
    </thead>
    <tbody>

        {% if user.userprofile.calories and plan.has_goal_calories %}
        {% with total=plan.get_calories_approximation %}
        <tr style="background-color:{% if total == 1 %}#8ae234;{% elif total == 2 %}#fce94f;{% elif total == 3 %}#fcaf3e;{% elif total > 3 %}#ef2929;{% endif %}">
            <td>{% trans "Goal" %}</td>
            <td class="align-right">
                <strong>{{user.userprofile.calories}} {% trans "kcal" %}</strong></td>
        </tr>
        {% endwith %}
        {% endif %}
    </tbody>
</table>

{% if plan.has_goal_calories %}
    <p>{% blocktrans %}You have selected that this nutritional plan has a
    goal amount of calories. Use the calculator or enter the value yourself.{% endblocktrans %}
    <a href="{% url 'nutrition:calories:view' %}">{% trans "That's done here" %}</a>
    </p>
{% endif %}




<h3>{% trans "Options" %}</h3>
<p>
<a href="{% url 'nutrition:plan:export-pdf' plan.id uid token %}"
   target="_blank">
    <img src="{% static 'images/icons/save.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Download as PDF' %}"
         title="{% trans 'Download as PDF' %}">
    {% trans "Download as PDF" %}
</a>
</p>

<p>
<a href="{% url 'nutrition:plan:edit' plan.id %}"
   class="wger-modal-dialog">
    <img src="{% static 'images/icons/edit.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Edit nutrition plan' %}">
    {% trans "Edit nutrition plan" %}
</a>
</p>


<p>
<a href="{% url 'nutrition:plan:copy' plan.id %}">
    <img src="{% static 'images/icons/copy.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Make a copy of this nutrition plan' %}">
    {% trans "Make a copy of this nutrition plan" %}
</a>
</p>

<p>
<a href="{% url 'nutrition:plan:delete' plan.id %}"
   class="wger-modal-dialog">
    <img src="{% static 'images/icons/trash.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Delete nutrition plan' %}">
    {% trans "Delete nutrition plan" %}
</a>
</p>
{% endblock %}
<commit_msg>Right align nutritional values for plan<commit_after>{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load wger_extras %}

{% block title %}{% trans "Nutrition plan" %} – {{ plan.creation_date}}{% endblock %}


{% block header %}
<script>
function custom_modal_init()
{
    // Init the autocompleter after loading the modal dialog
    init_ingredient_autocompleter();
}
</script>
{% endblock %}



{% block content %}
{% if plan.description %}
<p>
    <strong>{% trans "Goal" %}:</strong> {{plan.description}}
</p>
{% endif %}

<table class="table table-bordered">
    <thead>
        <tr style="background: #E0E0E0;">
            <th>{% trans "Meal" %}</th>
            <th>{% trans "Contents" %}</th>
            <th class="align-right">{% trans "Energy" %}</th>
            <th class="align-right">{% trans "Protein" %}</th>
            <th class="align-right">{% trans "Carbohydrates" %}</th>
            <th class="align-right">{% trans "Fat" %}</th>
        </tr>
    </thead>
    <tbody>
    <tr>
        <td colspan="2"></td>
        <td class="align-right">{% trans 'kcal' %}</td>
        <td class="align-right">{% trans_weight_unit 'g' user %}</td>
        <td class="align-right">{% trans_weight_unit 'g' user %}</td>
        <td class="align-right">{% trans_weight_unit 'g' user %}</td>
    </tr>
{% for meal in plan.meal_set.select_related %}
    {% for item in meal.mealitem_set.select_related %}
    <tr>
        {% ifchanged meal.pk %}
        <td rowspan="{{meal.mealitem_set.count}}">
            <strong>
            {% trans "Nr."%} {{ forloop.parentloop.counter }}
            {% if meal.time %} &ndash; {{meal.time|time:"H:i"}}{% endif %}
            </strong>

            <div class="editoptions">
                <a href="{% url 'nutrition:meal:delete' meal.id %}"
                   title="{% trans 'Delete' %}">
                   <img src="{% static 'images/icons/trash.svg' %}"
                        width="16"
                        height="16"
                        alt="{% trans 'Delete meal' %}"
                        title="{% trans 'Delete meal' %}">
                </a>
                <a href="{% url 'nutrition:meal:edit' meal.id %}"
                   title="{% trans 'Edit' %}"
                   class="wger-modal-dialog">
                    <img src="{% static 'images/icons/edit.svg' %}"
                         width="16"
                         height="16"
                         alt="{% trans 'Edit meal' %}"
                         title="{% trans 'Edit meal' %}">
                </a>
                <a href="{% url 'nutrition:meal_item:add' meal.id %}"
                   title="{% trans 'Add' %}"
                   class="wger-modal-dialog edit-meal">
                    <img src="{% static 'images/icons/add.svg' %}"
                         width="16"
                         height="16"
                         alt="{% trans 'Add item to meal' %}"
                         title="{% trans 'Add item to meal' %}">
               </a>
            </div>
        </td>
        {% endifchanged %}
        <td>
            {% if item.get_unit_type == MEALITEM_WEIGHT_GRAM %}{{ item.amount|floatformat:"0" }}g
            {% else %}
                {{ item.amount|floatformat:"0" }} × {{ item.weight_unit.unit.name }}
            {% endif %}
            {{ item.ingredient.name }}

            <span class="editoptions">
                <a href="{% url 'nutrition:meal_item:delete' item.id %}"
                   title="{% trans 'Delete' %}"
                   class="delete-mealitem">
                   <img src="{% static 'images/icons/trash.svg' %}"
                        width="16"
                        height="16"
                        alt="{% trans 'Delete' %}">
                </a>
                <a href="{% url 'nutrition:meal_item:edit' item.id %}"
                   title="{% trans 'Edit' %}"
                   class="wger-modal-dialog edit-meal edit-mealitem">
                    <img src="{% static 'images/icons/edit.svg' %}"
                         width="16"
                         height="16"
                         alt="{% trans 'Edit' %}">
                </a>
            </span>
            </td>
            <td class="align-right">{{item.get_nutritional_values.energy|floatformat}}</td>
            <td class="align-right">{{item.get_nutritional_values.protein|floatformat}}</td>
            <td class="align-right">{{item.get_nutritional_values.carbohydrates|floatformat}}</td>
            <td class="align-right">{{item.get_nutritional_values.fat|floatformat}}</td>
</tr>
    {% empty %}
    <tr>
    <td colspan="7">
       <a href="{% url 'nutrition:meal_item:add' meal.id %}"
          title="{% trans 'Add one now.' %}"
          class="wger-modal-dialog edit-meal btn btn-default btn-block">
            {% trans "No items for this meal." %}
            {% trans "Add one now."%}
        </a>
    </td>
</tr>
    {% endfor %}

{% empty %}
<p>
     <a href="{% url 'nutrition:meal:add' plan.id %}"
        class="wger-modal-dialog btn btn-default btn-block">
            {% trans "No meals for this plan." %}
            {% trans "Add one now." %}
        </a>
</p>
{% endfor %}
        <tr>
            <td colspan="6">
            <a href="{% url 'nutrition:meal:add' plan.id %}"
               class="wger-modal-dialog">
                <img src="{% static 'images/icons/edit.svg' %}"
                     width="16"
                     height="16"
                     alt="{% trans 'Add a new meal' %}"
                     title="{% trans 'Add a new meal' %}">
                {% trans "Add a new meal" %}
            </a>
            </td>
        <tr>
    </tbody>
</table>

{% if language.short_name != 'en' %}
    <p>
    {% trans "If you find the ingredient list too short, you might want to activate the preference to also show English ingredients." %}
    <a href="{% url 'core:user:preferences' %}" id="ajax-english-ingredients">{% trans "That's done here" %}</a>.
    </p>
{% endif %}


<h3>{% trans "Nutritional data" %}</h3>
<table class="table table-condensed">
    <thead>
        <tr>
            <th>{% trans "Macronutrients" %}</th>
            <th class="align-right">{% trans "Total" %}</th>
            <th class="align-right">{% trans "Percent of energy" %}</th>
            <th class="align-right">{% trans "g per body kg" %}</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>{% trans "Energy" %}</td>
            <td class="align-right">{{nutritional_data.total.energy|floatformat}} {% trans "kcal" %}</td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>{% trans "Protein" %}</td>
            <td class="align-right">{{nutritional_data.total.protein|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td class="align-right">{{nutritional_data.percent.protein|floatformat}} %</td>
            <td class="align-right">{{nutritional_data.per_kg.protein|floatformat}}</td>
        </tr>
        <tr>
            <td>{% trans "Carbohydrates" %}</td>
            <td class="align-right">{{nutritional_data.total.carbohydrates|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td class="align-right">{{nutritional_data.percent.carbohydrates|floatformat}} %</td>
            <td class="align-right">{{nutritional_data.per_kg.carbohydrates|floatformat}}</td>
        </tr>
        <tr>
            <td style="padding-left: 2em;">{% trans "Sugar content in carbohydrates" %}</td>
            <td class="align-right">{{nutritional_data.total.carbohydrates_sugar|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>{% trans "Fat" %}</td>
            <td class="align-right">{{nutritional_data.total.fat|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td class="align-right">{{nutritional_data.percent.fat|floatformat}} %</td>
            <td class="align-right">{{nutritional_data.per_kg.fat|floatformat}}</td>
        </tr>
        <tr>
            <td style="padding-left: 2em;">{% trans "Saturated fat content in fats" %}</td>
            <td class="align-right">{{nutritional_data.total.fat_saturated|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td></td>
            <td></td>
        </tr>


        <tr>
            <th colspan="4">{% trans "Others" %}</th>
        </tr>
        <tr>
            <td>{% trans "Fibres" %}</td>
            <td class="align-right">{{nutritional_data.total.fibres|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>{% trans "Sodium" %}</td>
            <td class="align-right">{{nutritional_data.total.sodium|floatformat}} {% trans_weight_unit 'g' user %}</td>
            <td></td>
            <td></td>
        </tr>
    </tbody>
</table>
{% endblock %}



{% block sidebar %}
<h3>{% trans "Energy" %}</h3>
<table class="table table-condensed" id="nutritional-data-energy">
    <thead>
        <tr>
            <th>{% trans "Energy" %}</th>
            <th class="align-right">{{nutritional_data.total.energy|floatformat}} {% trans "kcal" %}</th>
        </tr>
    </thead>
    <tbody>

        {% if user.userprofile.calories and plan.has_goal_calories %}
        {% with total=plan.get_calories_approximation %}
        <tr style="background-color:{% if total == 1 %}#8ae234;{% elif total == 2 %}#fce94f;{% elif total == 3 %}#fcaf3e;{% elif total > 3 %}#ef2929;{% endif %}">
            <td>{% trans "Goal" %}</td>
            <td class="align-right">
                <strong>{{user.userprofile.calories}} {% trans "kcal" %}</strong></td>
        </tr>
        {% endwith %}
        {% endif %}
    </tbody>
</table>

{% if plan.has_goal_calories %}
    <p>{% blocktrans %}You have selected that this nutritional plan has a
    goal amount of calories. Use the calculator or enter the value yourself.{% endblocktrans %}
    <a href="{% url 'nutrition:calories:view' %}">{% trans "That's done here" %}</a>
    </p>
{% endif %}




<h3>{% trans "Options" %}</h3>
<p>
<a href="{% url 'nutrition:plan:export-pdf' plan.id uid token %}"
   target="_blank">
    <img src="{% static 'images/icons/save.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Download as PDF' %}"
         title="{% trans 'Download as PDF' %}">
    {% trans "Download as PDF" %}
</a>
</p>

<p>
<a href="{% url 'nutrition:plan:edit' plan.id %}"
   class="wger-modal-dialog">
    <img src="{% static 'images/icons/edit.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Edit nutrition plan' %}">
    {% trans "Edit nutrition plan" %}
</a>
</p>


<p>
<a href="{% url 'nutrition:plan:copy' plan.id %}">
    <img src="{% static 'images/icons/copy.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Make a copy of this nutrition plan' %}">
    {% trans "Make a copy of this nutrition plan" %}
</a>
</p>

<p>
<a href="{% url 'nutrition:plan:delete' plan.id %}"
   class="wger-modal-dialog">
    <img src="{% static 'images/icons/trash.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Delete nutrition plan' %}">
    {% trans "Delete nutrition plan" %}
</a>
</p>
{% endblock %}

{'fraction_non_alphanumeric': 0.18945958016971862, 'fraction_numerical': 0.0066100937918713715, 'mean_word_length': 1.8943898655635987, 'pattern_counts': {'":': 0, '<': 491, '<?xml version=': 0, '>': 493, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4612820', 'n_tokens_mistral': 7780, 'n_tokens_neox': 6907, 'n_words': 1601}