Files
cardio/templates/partials/user_workouts_graphs.html

98 lines
5.8 KiB
HTML

<div class="flex flex-wrap mb-5">
<div class="w-full md:w-1/5 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">
Attributes
</label>
<select data-te-select-init data-te-select-size="lg" name="attributes"
class="bg-gray-50 border border-gray-300 " multiple _="init js(me)
te.Select.getOrCreateInstance(me).setValue({{ [] }})
end">
{% for val,name in user.attributes %}
<option value="{{ val }}">{{ name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="w-full md:w-1/5 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">
Start date
</label>
<div class="relative">
<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 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 w-full"
name="start_date" value="{{ user.first_workout_date }}">
</div>
</div>
<div class="w-full md:w-1/5 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">
End date
</label>
<div class="relative">
<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 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 w-full"
name="end_date" value="{{ user.last_workout_date }}">
</div>
</div>
<div class="w-full md:w-1/5 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">
Period
</label>
<select data-te-select-init data-te-select-size="lg" name="period" class="bg-gray-50 border border-gray-300"
_="init js(me)
te.Select.getOrCreateInstance(me).setValue({{ ['week'] }})
end">
{% for val,name in user.periods %}
<option value="{{ val }}">{{ name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="w-full md:w-1/5 px-3 mb-6 md:mb-0">
<div class="w-full h-full flex">
<button
class="shadow bg-purple-500 hover:bg-purple-400 focus:shadow-outline focus:outline-none text-white font-bold py-2 px-4 rounded w-full ml-0 inline-flex items-center justify-center mt-0 md:mt-6 mb-0 md:mb-1"
type="submit" hx-get="{{ url_for('graph_user_workouts', user_id=user.id) }}"
hx-include="[name='attributes'],[name='start_date'],[name='end_date'],[name='period']"
hx-target="#user-workouts-overview-graphs-{{ user.id }}" hx-swap="afterbegin">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6 mr-2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z" />
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<span>Display</span>
</button>
</div>
</div>
</div>
<div id="user-workouts-overview-graphs-{{ user.id }}">
{% for graph in user.graphs %}
<img src="{{ url_for('graph_user_workouts', user_id=user.id, start_date=graph.start_date, end_date=graph.end_date, period=graph.period, attributes=graph.attributes) }}"
loading="lazy" alt="No image" class="mx-auto"
hx-delete="{{ url_for('delete_user_graph', user_id=user.id, start_date=graph.start_date, end_date=graph.end_date, period=graph.period, attributes=graph.attributes ) }}"
hx-swap="outerHTML">
{% endfor %}
</div>