inventory/inventory/templates/crudkit/table.html

28 lines
1.1 KiB
HTML

<div class="table-responsive mx-5" style="max-height: 80vh;">
<table class="table table-light table-striped table-hover table-bordered border-tertiary text-nowrap overflow-x-auto mx-auto">
<thead>
<tr>
{% for col in columns %}
<th>{{ col.label }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% if rows %}
{% for row in rows %}
<tr onclick="location.href='{{ url_for( 'crudkit.' + kwargs['opts']['object_class'] + '.get_item', id=row.id) }}'" style="cursor: pointer;">
{% for cell in row.cells %}
{% if cell.href %}
<td class="{{ cell.class or '' }}"><a href="{{ cell.href }}" class="link-success link-underline link-underline-opacity-0 fw-semibold">{{ cell.text if cell.text is not none else '-' }}</a></td>
{% else %}
<td class="{{ cell.class or '' }}">{{ cell.text if cell.text is not none else '-' }}</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
{% else %}
<tr><td colspan="{{ columns|length }}">No data.</td></tr>
{% endif %}
</tbody>
</table>
</div>