54 lines
2.6 KiB
HTML
54 lines
2.6 KiB
HTML
{# Approaches as "weight × reps" chips #}
|
||
{% macro approach_chips(approaches) %}{% for approach in approaches %}<span class="approach">{% if approach.weight %}{{ '%g'|format(approach.weight) }} кг{% else %}без веса{% endif %} × {{ approach.reps }}</span>{% endfor %}{% endmacro %}
|
||
|
||
{# One table for all trainings: a row per exercise. Search, sorting and paging come from DataTables (main.js) #}
|
||
{% macro trainings_table(trainings) %}
|
||
{% set ns = namespace(exercises=0) %}
|
||
{% for training in trainings %}{% set ns.exercises = ns.exercises + training.exercises|length %}{% endfor %}
|
||
|
||
<p class="text-muted">
|
||
Тренировок: <strong>{{ trainings|length }}</strong>,
|
||
упражнений: <strong>{{ ns.exercises }}</strong>
|
||
</p>
|
||
|
||
<div class="table-responsive">
|
||
<table class="table table-sm table-hover align-middle" id="trainings-table">
|
||
<thead>
|
||
<tr>
|
||
<th scope="col">Дата</th>
|
||
<th scope="col">Тренер</th>
|
||
<th scope="col">Упражнение</th>
|
||
<th scope="col">Подходы (вес × повторения)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for training in trainings %}
|
||
{% for exercise in training.exercises %}
|
||
<tr>
|
||
{# data-order: ISO date, so sorting by date is chronological #}
|
||
<td class="text-nowrap date" data-order="{{ training.date.isoformat() }}">{{ training.date.strftime('%d.%m.%Y') }}</td>
|
||
<td class="text-nowrap">{{ training.trainer or '' }}</td>
|
||
<td>
|
||
{{ exercise.name }}
|
||
{% if exercise.splitted_weight %}
|
||
<span class="badge text-bg-light border" title="Вес указан на каждую руку (гантель)">на руку</span>
|
||
{% endif %}
|
||
</td>
|
||
<td>
|
||
{{ approach_chips(exercise.approaches) }}
|
||
</td>
|
||
</tr>
|
||
{% else %}
|
||
{# DataTables needs the same number of cells in every row (no colspan) #}
|
||
<tr>
|
||
<td class="text-nowrap date" data-order="{{ training.date.isoformat() }}">{{ training.date.strftime('%d.%m.%Y') }}</td>
|
||
<td class="text-nowrap">{{ training.trainer or '' }}</td>
|
||
<td class="text-muted fst-italic">Упражнения не записаны</td>
|
||
<td></td>
|
||
</tr>
|
||
{% endfor %}
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% endmacro %}
|