Enhance question overview filters to support multi-selection for categories, findings, structures, conditions, subspecialties, and presentations

This commit is contained in:
Ross
2025-10-28 08:35:03 +00:00
parent 15c243172d
commit 15791fa883
2 changed files with 158 additions and 127 deletions
+55 -50
View File
@@ -19,10 +19,9 @@
<div class="col-auto">
<label class="form-label small">Category</label>
<select name="category" class="form-select form-select-sm">
<option value="">(All)</option>
<select name="category" multiple class="form-select form-select-sm" size="4">
{% for c in categories %}
<option value="{{ c.id }}" {% if selected_category|default:'' == c.id|stringformat:"s" %}selected{% endif %}>{{ c.category }}</option>
<option value="{{ c.id }}" {% if c.id|stringformat:"s" in selected_category %}selected{% endif %}>{{ c.category }}</option>
{% endfor %}
</select>
</div>
@@ -38,54 +37,60 @@
<div class="w-100"></div>
<div class="col-md-4 col-sm-6">
<label class="form-label small">Finding</label>
<select name="finding" class="form-select form-select-sm">
<option value="">(Any)</option>
{% for f in findings %}
<option value="{{ f.id }}" {% if selected_finding|default:'' == f.id|stringformat:"s" %}selected{% endif %}>{{ f.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-12">
<p>
<a class="btn btn-sm btn-outline-secondary" data-bs-toggle="collapse" href="#advanced-filters" role="button" aria-expanded="false" aria-controls="advanced-filters">Advanced filters</a>
</p>
<div class="collapse" id="advanced-filters">
<div class="card card-body">
<div class="row g-2">
<div class="col-md-4 col-sm-6">
<label class="form-label small">Finding</label>
<select name="finding" multiple class="form-select form-select-sm" size="6">
{% for f in findings %}
<option value="{{ f.id }}" {% if f.id|stringformat:"s" in selected_findings %}selected{% endif %}>{{ f.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4 col-sm-6">
<label class="form-label small">Structure</label>
<select name="structure" class="form-select form-select-sm">
<option value="">(Any)</option>
{% for s in structures %}
<option value="{{ s.id }}" {% if selected_structure|default:'' == s.id|stringformat:"s" %}selected{% endif %}>{{ s.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4 col-sm-6">
<label class="form-label small">Structure</label>
<select name="structure" multiple class="form-select form-select-sm" size="6">
{% for s in structures %}
<option value="{{ s.id }}" {% if s.id|stringformat:"s" in selected_structures %}selected{% endif %}>{{ s.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4 col-sm-6">
<label class="form-label small">Condition</label>
<select name="condition" class="form-select form-select-sm">
<option value="">(Any)</option>
{% for c in conditions %}
<option value="{{ c.id }}" {% if selected_condition|default:'' == c.id|stringformat:"s" %}selected{% endif %}>{{ c.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4 col-sm-6">
<label class="form-label small">Condition</label>
<select name="condition" multiple class="form-select form-select-sm" size="6">
{% for c in conditions %}
<option value="{{ c.id }}" {% if c.id|stringformat:"s" in selected_conditions %}selected{% endif %}>{{ c.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4 col-sm-6">
<label class="form-label small">Subspecialty</label>
<select name="subspecialty" class="form-select form-select-sm">
<option value="">(Any)</option>
{% for ss in subspecialties %}
<option value="{{ ss.id }}" {% if selected_subspecialty|default:'' == ss.id|stringformat:"s" %}selected{% endif %}>{{ ss.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4 col-sm-6">
<label class="form-label small">Subspecialty</label>
<select name="subspecialty" multiple class="form-select form-select-sm" size="6">
{% for ss in subspecialties %}
<option value="{{ ss.id }}" {% if ss.id|stringformat:"s" in selected_subspecialties %}selected{% endif %}>{{ ss.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4 col-sm-6">
<label class="form-label small">Presentation</label>
<select name="presentation" class="form-select form-select-sm">
<option value="">(Any)</option>
{% for p in presentations %}
<option value="{{ p.id }}" {% if selected_presentation|default:'' == p.id|stringformat:"s" %}selected{% endif %}>{{ p.name }}</option>
{% endfor %}
</select>
<div class="col-md-4 col-sm-6">
<label class="form-label small">Presentation</label>
<select name="presentation" multiple class="form-select form-select-sm" size="6">
{% for p in presentations %}
<option value="{{ p.id }}" {% if p.id|stringformat:"s" in selected_presentations %}selected{% endif %}>{{ p.name }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
</div>
<div class="col-auto align-self-end">
@@ -99,10 +104,10 @@
{% if counts %}
<ul class="list-group list-group-flush">
{% for name, count in counts %}
{% for row in counts %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>{{ name }}</div>
<div class="text-muted">{{ count }}</div>
<div><a href="{{ row.link }}">{{ row.cat_name }}</a></div>
<div class="text-muted">{{ row.count }}</div>
</li>
{% endfor %}
</ul>