Files
Froxlor/templates/Froxlor/table/table.html.twig
2022-03-14 18:18:35 +01:00

61 lines
2.2 KiB
Twig

{% macro table(listing) %}
{% import "Froxlor/table/macros.html.twig" as macros %}
{% import "Froxlor/table/pagination.html.twig" as pagination %}
<form action="{{ action|default("") }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
{% if listing.table.tr|length == 0 %}
<div class="alert alert-info" role="alert">
<h4 class="alert-heading">{{ lng('admin.note') }}</h4>
<p>{{ listing.empty_msg|default(lng('panel.listing_empty'))|raw }}</p>
</div>
{% else %}
<div class="card table-responsive">
<table class="table table-borderless table-striped align-middle mb-0 px-3">
<thead>
<tr>
{% for key,th in listing.table.th %}
{{ pagination.titlesorting(listing.pagination, key, th) }}
{% endfor %}
</tr>
</thead>
<tbody>
{% for tr in listing.table.tr %}
<tr {% if tr.class is defined %} class="{{ tr.class }}" {% endif %}>
{% for td in tr.td %}
<td class="px-3{% if td.class is defined %} {{ td.class }}{% endif %}">
{% if td.data is iterable %}
{% if td.data.macro == 'progressbar' %}
{{ macros.progressbar(td.data.data) }}
{% elseif td.data.macro == 'boolean' %}
{{ macros.boolean(td.data.data) }}
{% elseif td.data.macro == 'booleanWithInfo' %}
{{ macros.booleanWithInfo(td.data.data) }}
{% elseif td.data.macro == 'link' %}
{{ macros.link(td.data.data) }}
{% elseif td.data.macro == 'domainWithSan' %}
{{ macros.domainWithSan(td.data.data) }}
{% elseif td.data.macro == 'actions' %}
{{ macros.actions(td.data.data) }}
{% else %}
Table macro '{{ td.data.macro|json_encode }}' is not implemented!
Unable to handle this data: {{ td.data|json_encode }}
{% endif %}
{% else %}
{{ td.data|raw }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% if listing.pagination is not empty %}
{{ pagination.paging(listing.pagination) }}
{% endif %}
</div>
{% endif %}
</form>
{% endmacro %}