Add a DocumentVersion overview that can be sorted and can be filtered.

This commit is contained in:
Josako
2024-08-20 14:18:07 +02:00
parent 926a4e8cc2
commit 6219d11e56
9 changed files with 316 additions and 5 deletions

View File

@@ -135,6 +135,48 @@
</div>
{% endmacro %}
{% macro render_selectable_sortable_table(headers, rows, selectable, id, sort_by, sort_order) %}
<div class="card">
<div class="table-responsive">
<table class="table align-items-center mb-0" id="{{ id }}">
<thead>
<tr>
{% if selectable %}
<th>Select</th>
{% endif %}
{% for header in headers %}
<th class="sortable" data-sort="{{ header|lower|replace(' ', '_') }}">
{{ header }}
{% if sort_by == header|lower|replace(' ', '_') %}
{% if sort_order == 'asc' %}
<i class="fas fa-sort-up"></i>
{% elif sort_order == 'desc' %}
<i class="fas fa-sort-down"></i>
{% endif %}
{% else %}
<i class="fas fa-sort"></i>
{% endif %}
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
{% if selectable %}
<td><input type="radio" name="selected_row" value="{{ row[0].value }}"></td>
{% endif %}
{% for cell in row %}
<td>{{ cell.value }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endmacro %}
{% macro render_accordion(accordion_id, accordion_items, header_title, header_description) %}
<div class="accordion-1">
<div class="container">
@@ -253,3 +295,41 @@
</nav>
{% endmacro %}
{% macro render_filter_field(field_name, label, options, current_value) %}
<div class="form-group">
<label for="{{ field_name }}">{{ label }}</label>
<select class="form-control" id="{{ field_name }}" name="{{ field_name }}">
<option value="">All</option>
{% for value, text in options %}
<option value="{{ value }}" {% if value == current_value %}selected{% endif %}>{{ text }}</option>
{% endfor %}
</select>
</div>
{% endmacro %}
{% macro render_date_filter_field(field_name, label, current_value) %}
<div class="form-group">
<label for="{{ field_name }}">{{ label }}</label>
<input type="date" class="form-control" id="{{ field_name }}" name="{{ field_name }}" value="{{ current_value }}">
</div>
{% endmacro %}
{% macro render_collapsible_section(id, title, content) %}
<div class="accordion" id="accordion{{ id }}">
<div class="accordion-item mb-3">
<h5 class="accordion-header" id="heading{{ id }}">
<button class="accordion-button border-bottom font-weight-bold collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse{{ id }}" aria-expanded="false" aria-controls="collapse{{ id }}">
{{ title }}
<i class="collapse-close fa fa-plus text-xs pt-1 position-absolute end-0 me-3" aria-hidden="true"></i>
<i class="collapse-open fa fa-minus text-xs pt-1 position-absolute end-0 me-3" aria-hidden="true"></i>
</button>
</h5>
<div id="collapse{{ id }}" class="accordion-collapse collapse" aria-labelledby="heading{{ id }}" data-bs-parent="#accordion{{ id }}">
<div class="accordion-body text-sm opacity-8">
{{ content }}
</div>
</div>
</div>
</div>
{% endmacro %}