Add ability to add/update/delete exercise categories
This commit is contained in:
@@ -279,6 +279,48 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Category & Attribute Management Section -->
|
||||
<div class="mt-12 pt-12 border-t border-gray-100">
|
||||
<div class="mb-8">
|
||||
<h4 class="text-lg font-bold text-gray-900">Manage Categories & Options</h4>
|
||||
<p class="text-sm text-gray-500">Add or edit muscle groups, equipment types, and other exercise
|
||||
attributes.</p>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-8" id="categories-admin-list">
|
||||
{% for cat in categories_list %}
|
||||
{% set options = all_attributes.get(cat.name, []) %}
|
||||
{{ render_partial('partials/exercise/category_admin.html', category_id=cat.category_id,
|
||||
name=cat.name, attributes=options) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Add New Category Form -->
|
||||
<div class="mt-8 p-6 bg-gray-50/50 rounded-2xl border border-dashed border-gray-300">
|
||||
<form hx-post="{{ url_for('exercises.create_category') }}" hx-target="#categories-admin-list"
|
||||
hx-swap="beforeend" _="on htmx:afterRequest reset() me"
|
||||
class="flex flex-col sm:flex-row items-center gap-4">
|
||||
<div class="w-full sm:flex-1">
|
||||
<label class="block text-xs font-bold text-gray-400 uppercase mb-2">New Category
|
||||
Name</label>
|
||||
<input type="text" name="name" placeholder="e.g. Difficulty, Intensity..."
|
||||
class="w-full text-sm bg-white border border-gray-200 rounded-xl px-4 py-2.5 focus:ring-2 focus:ring-cyan-500/20 focus:border-cyan-500 outline-none transition-all shadow-sm"
|
||||
required>
|
||||
</div>
|
||||
<div class="w-full sm:w-auto self-end">
|
||||
<button type="submit"
|
||||
class="w-full flex items-center justify-center text-white bg-gray-800 hover:bg-gray-900 font-bold rounded-xl text-sm px-6 py-2.5 transition-all shadow-md active:scale-95">
|
||||
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M12 4v16m8-8H4"></path>
|
||||
</svg>
|
||||
Create Category
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user