Start refactoring person overview (list) page, currently is accessible through tags and workout exercise select. Doesnt have any stats or graphs
This commit is contained in:
@@ -2,10 +2,6 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<a hx-get="{{ url_for('get_calendar', person_id=person_id) }}" hx-target="#container"
|
||||
hx-vals='{"date": "{{ date }}", "view": "{{ view }}"}' hx-trigger="refreshView" id="refreshViewElement"
|
||||
hx-swap="innerHTML swap:0.5s"></a>
|
||||
|
||||
<div class="flex flex-grow flex-col bg-white sm:rounded shadow overflow-hidden animate-fadeIn">
|
||||
<div class="flex items-center justify-between pt-2 pb-2">
|
||||
<div class="flex">
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<a hx-get="{{ url_for('get_calendar', person_id=person_id) }}" hx-target="#container" hx-vals='{"view": "notes"}'
|
||||
hx-trigger="refreshView" id="refreshViewElement"></a>
|
||||
|
||||
<div class="flex flex-grow flex-col bg-white sm:rounded shadow overflow-hidden">
|
||||
<div class="flex items-center justify-between pt-2 pb-2">
|
||||
<div class="flex">
|
||||
@@ -47,8 +44,8 @@
|
||||
{% for workout_note in workout_notes %}
|
||||
<tr class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted">
|
||||
<td class="p-4 align-middle [&:has([role=checkbox])]:pr-0 cursor-pointer"
|
||||
hx-get="{{ url_for('get_workout_modal', person_id=person_id, workout_id=workout_note.workout_id) }}"
|
||||
hx-target='body' hx-swap='beforeend'>
|
||||
hx-get="{{ url_for('show_workout', person_id=person_id, workout_id=workout_note.workout_id) }}"
|
||||
hx-push-url="true" hx-target="#container">
|
||||
<div class="flex flex-row items-center justify-center">
|
||||
<button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap text-sm font-medium h-10 px-2 py-1 bg-transparent text-black rounded hidden md:block"
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
<div id='modal' _='on closeModal
|
||||
add .closing
|
||||
then wait for animationend
|
||||
then remove me
|
||||
then toggle .hide-scrollbar on document.body
|
||||
then send refreshView to #refreshViewElement
|
||||
on closeModalWithoutRefresh
|
||||
add .closing
|
||||
then wait for animationend
|
||||
then remove me
|
||||
then toggle .hide-scrollbar on document.body'>
|
||||
<div class='modal-underlay' _='on click trigger closeModal'></div>
|
||||
<div class='modal-content p-2 md:p-4 m-2 sm:mt-24 max-h-[98%]' _='init toggle .hide-scrollbar on document.body'>
|
||||
<div class="relative w-full h-full max-w-2xl md:h-auto overflow-auto">
|
||||
<!-- Modal content -->
|
||||
<div class="relative bg-white rounded-lg shadow">
|
||||
<!-- Modal header -->
|
||||
<div class="flex items-start justify-between p-2 md:p-4 border-0 md:border-b rounded-t">
|
||||
<div class="flex flex-col w-full">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="w-full">
|
||||
<h3 class="text-xl font-bold text-gray-900">{{ person_name }}</h3>
|
||||
|
||||
{{ render_partial('partials/workout_tags.html', person_id=person_id,
|
||||
workout_id=workout_id,
|
||||
person_tags=person_tags, workout_tags=workout_tags,
|
||||
selected_workout_tag_ids=selected_workout_tag_ids) }}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2">
|
||||
{{ render_partial('partials/start_date.html', person_id=person_id,
|
||||
workout_id=workout_id,
|
||||
start_date=start_date) }}
|
||||
|
||||
|
||||
{{ render_partial('partials/workout_note.html', person_id=person_id,
|
||||
workout_id=workout_id,
|
||||
note=note) }}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="button"
|
||||
class="absolute right-0 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
|
||||
data-modal-toggle="defaultModal" _="on click trigger closeModal">
|
||||
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg" data-darkreader-inline-fill=""
|
||||
style="--darkreader-inline-fill:currentColor;">
|
||||
<path fill-rule="evenodd"
|
||||
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
<span class="sr-only">Close modal</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Modal body -->
|
||||
<div class="p-3 md:p-6 space-y-6">
|
||||
<table class="items-center w-full bg-transparent border-collapse table-fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th
|
||||
class="px-4 bg-gray-50 text-gray-700 align-middle py-3 text-xs font-semibold text-left uppercase border-l-0 border-r-0 whitespace-nowrap">
|
||||
Exercise</th>
|
||||
<th
|
||||
class="px-4 bg-gray-50 text-gray-700 align-middle py-3 text-xs font-semibold text-left uppercase border-l-0 border-r-0 whitespace-nowrap">
|
||||
Top Set</th>
|
||||
<th
|
||||
class="bg-gray-50 text-gray-700 align-middle py-3 text-xs font-semibold text-left uppercase border-l-0 border-r-0 whitespace-nowrap w-9 sm:w-20">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100" id="new-workout" hx-target="closest tr"
|
||||
hx-swap="outerHTML swap:0.5s">
|
||||
{% for topset in top_sets %}
|
||||
{{ render_partial('partials/topset.html', person_id=person_id,
|
||||
workout_id=workout_id,
|
||||
topset_id=topset.topset_id, exercise_id=topset.exercise_id, exercise_name=topset.exercise_name,
|
||||
repetitions=topset.repetitions,
|
||||
weight=topset.weight) }}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if top_sets|length == 0 %}
|
||||
<div class="bg-purple-100 rounded-lg py-5 px-6 mb-4 text-base text-purple-700 mb-3" role="alert"
|
||||
id="no-workouts">
|
||||
No topsets found.
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<!-- Modal footer -->
|
||||
<div class="flex items-center p-3 md:p-6 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
|
||||
{{ render_partial('partials/new_set_form.html', person_id=person_id,
|
||||
workout_id=workout_id,
|
||||
exercises=exercises,
|
||||
has_value=False) }}
|
||||
</div>
|
||||
<div id="exercise-progress-{{ person_id }}" class="mx-0 md:mx-5">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -10,10 +10,6 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<a hx-get="{{ url_for('get_person', person_id=person['PersonId']) }}"
|
||||
hx-include="[name='exercise_id'],[name='min_date'],[name='max_date']" hx-target="#container"
|
||||
hx-trigger="refreshView" id="refreshViewElement"></a>
|
||||
|
||||
<div class="flex max-w-full overflow-x-hidden">
|
||||
<div class="bg-white shadow rounded-lg pt-2 pb-2 sm:w-full xl:p-8 md:w-full">
|
||||
|
||||
|
||||
168
templates/person_overview.html
Normal file
168
templates/person_overview.html
Normal file
@@ -0,0 +1,168 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="flex max-w-full overflow-x-hidden">
|
||||
<div class="bg-white shadow rounded-lg pt-2 pb-2 sm:w-full xl:p-8 md:w-full">
|
||||
|
||||
<div class="mb-4 flex items-center justify-between px-2 md:px-3">
|
||||
<div>
|
||||
<h3 class="text-xl font-bold text-gray-900 mb-2">{{ person_name }}</h3>
|
||||
<span class="text-base font-normal text-gray-500">List of workouts</span>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<select name="view" hx-get="{{ url_for('get_calendar', person_id=person_id) }}"
|
||||
hx-target="#container" hx-push-url="true" _="init js(me) tail.select(me, {}) end"
|
||||
class="h-10 invisible">
|
||||
<option value="month">Month</option>
|
||||
<option value="year">Year</option>
|
||||
<option value="notes">Notes</option>
|
||||
<option value="all" selected>All</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap mb-1">
|
||||
<div class="w-full md:w-1/3 px-2 md:px-3 mb-6 md:mb-0">
|
||||
<div class="mb-1 w-full">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
|
||||
Exercises
|
||||
</label>
|
||||
<select data-te-select-filter="true" data-te-select-size="lg" name="exercise_id"
|
||||
class="bg-gray-50 border border-gray-300 " multiple
|
||||
hx-get="{{ url_for('person_overview', person_id=person_id) }}"
|
||||
hx-include="[name='exercise_id'],[name='min_date'],[name='max_date'],[name='graph_axis']"
|
||||
hx-target="#container" hx-push-url="true" _="init js(me)
|
||||
tail.select(me, {
|
||||
multiple: true,
|
||||
search: true,
|
||||
placeholder: 'Filter exercises',
|
||||
})
|
||||
end">
|
||||
{% for exercise in exercises %}
|
||||
<option value="{{ exercise.id }}" {% if exercise.selected %}selected{% endif %}>
|
||||
{{ exercise.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full md:w-1/3 px-2 md:px-3 mb-6 md:mb-0">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
|
||||
Min date
|
||||
</label>
|
||||
<div class="relative pr-2">
|
||||
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
|
||||
<svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor"
|
||||
viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<input type="date"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 w-full"
|
||||
name="min_date" value="{{ min_date }}"
|
||||
hx-get="{{ url_for('person_overview', person_id=person_id) }}"
|
||||
hx-include="[name='exercise_id'],[name='min_date'],[name='max_date'],[name='graph_axis']"
|
||||
hx-target="#container" hx-push-url="true" hx-trigger="change">
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full md:w-1/3 px-2 md:px-3 mb-6 md:mb-0">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-zip">
|
||||
Max date
|
||||
</label>
|
||||
<div class="relative pr-2">
|
||||
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
|
||||
<svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor"
|
||||
viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<input type="date"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 w-full"
|
||||
name="max_date" value="{{ max_date }}"
|
||||
hx-get="{{ url_for('person_overview', person_id=person_id) }}"
|
||||
hx-include="[name='exercise_id'],[name='min_date'],[name='max_date'],[name='graph_axis']"
|
||||
hx-target="#container" hx-push-url="true" hx-trigger="change">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ render_partial('partials/tags.html',person_id=person_id, tags=tags) }}
|
||||
|
||||
<div class="flex flex-col mt-3 w-screen sm:w-full overflow-auto">
|
||||
<div class="overflow-x-auto rounded-lg">
|
||||
<div class="flex justify-center">
|
||||
<div class="flex justify-center shadow sm:rounded-lg w-screen sm:w-screen">
|
||||
|
||||
{% if workouts|length > 0 %}
|
||||
<table class="min-w-content divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col"
|
||||
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Date
|
||||
</th>
|
||||
{% for exercise in selected_exercises %}
|
||||
<th scope="col"
|
||||
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
{{ exercise.name }}
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white">
|
||||
|
||||
{% for workout in workouts %}
|
||||
<tr hx-get="{{ url_for('show_workout', person_id=person_id, workout_id=workout.id) }}"
|
||||
hx-push-url="true" hx-target="#container" class="cursor-pointer">
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
|
||||
{{ workout.start_date | strftime("%b %d %Y") }}
|
||||
</td>
|
||||
|
||||
{% for exercise in selected_exercises %}
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
{% for set in workout.exercises[exercise.id] %}
|
||||
{{ set.repetitions }} x {{ set.weight }}kg
|
||||
{% endfor %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if workouts|length == 0 %}
|
||||
<div class="bg-purple-100 rounded-lg py-5 px-6 mb-4 text-base text-purple-700 mb-3"
|
||||
role="alert">
|
||||
No workouts found.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ render_partial('partials/stats.html', stats=stats) }}
|
||||
|
||||
<button
|
||||
class="fixed z-90 bottom-10 right-8 bg-blue-600 w-20 h-20 rounded-full drop-shadow-lg flex justify-center items-center text-white text-4xl hover:bg-blue-700 hover:drop-shadow-2xl hover:animate-bounce duration-300"
|
||||
hx-post="{{ url_for('create_workout', person_id=person_id) }}" hx-target='body' hx-swap='beforeend'>
|
||||
<svg viewBox="0 0 20 20" enable-background="new 0 0 20 20" class="w-6 h-6 inline-block">
|
||||
<path fill="#FFFFFF" d="M16,10c0,0.553-0.048,1-0.601,1H11v4.399C11,15.951,10.553,16,10,16c-0.553,0-1-0.049-1-0.601V11H4.601
|
||||
C4.049,11,4,10.553,4,10c0-0.553,0.049-1,0.601-1H9V4.601C9,4.048,9.447,4,10,4c0.553,0,1,0.048,1,0.601V9h4.399
|
||||
C15.952,9,16,9.447,16,10z" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user