XH_Digital_Management/templates/table.html

42 lines
1.8 KiB
HTML
Raw Normal View History

2024-06-04 16:50:30 +08:00
{% load custom_filters %}
2024-05-30 17:06:23 +08:00
{% load tags %}
<div class="card-body table-border-style">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
{% for column in table_columns %}
2024-06-04 16:50:30 +08:00
<th class="text-center">{{ column.header }}</th>
2024-05-30 17:06:23 +08:00
{% endfor %}
</tr>
</thead>
<tbody id="result" style="color: white;">
{% for item in items %}
2024-05-30 17:06:23 +08:00
<tr>
{% for column in table_columns %}
{% if column.field == 'actions' %}
2024-06-04 16:50:30 +08:00
<td class="text-center">
<a href="#" class="edit-btn" data-target_id="{{ item|getattr_filter:list_key }}"
{% for field, config in form_fields_config.fields.items %}
data-{{ field }}="{{ item|getattr_filter:field }}"
{% endfor %}
2024-06-04 16:50:30 +08:00
data-bs-toggle="modal" style="color: deepskyblue;" data-bs-target="#addModifyModal">编辑</a>
<a href="#" class="delete-btn" style="color: red;" data-target_id="{{ item|getattr_filter:list_key }}"
data-bs-toggle="modal" data-bs-target="#deleteModal">删除</a>
</td>
2024-05-30 17:06:23 +08:00
{% else %}
2024-06-04 16:50:30 +08:00
<td class="text-center">{{ item|getattr_filter:column.field }}</td>
2024-05-30 17:06:23 +08:00
{% endif %}
{% endfor %}
</tr>
{% empty %}
2024-05-30 17:12:34 +08:00
<tr>
2024-05-31 20:17:40 +08:00
<td class="text-center" colspan="{{ table_columns|length }}">暂无数据</td>
2024-05-30 17:12:34 +08:00
</tr>
{% endfor %}
2024-05-30 17:06:23 +08:00
</tbody>
</table>
</div>
2024-06-04 16:50:30 +08:00
</div>