This commit is contained in:
0
templates/Maketank/table/index.html
Normal file
0
templates/Maketank/table/index.html
Normal file
92
templates/Maketank/table/macros.html.twig
Normal file
92
templates/Maketank/table/macros.html.twig
Normal file
@@ -0,0 +1,92 @@
|
||||
{% macro progressbar(data) %}
|
||||
<div class="progress progress-thin">
|
||||
<div class="progress-bar {{ data.style }}" style="width: {{ data.percent }}%;"></div>
|
||||
</div>
|
||||
<div class="text-end small">
|
||||
{% if data.infotext is not empty %}
|
||||
<i class="fa-solid fa-circle-info" data-bs-trigger="hover" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-html="true" data-bs-content="{{ data.infotext|raw|nl2br }}"></i>
|
||||
{% endif %}
|
||||
{{ data.text }}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro boolean(data) %}
|
||||
{% if (data) %}
|
||||
<i class="fa-solid fa-check-circle text-success"></i>
|
||||
{% else %}
|
||||
<i class="fa-solid fa-times-circle text-danger"></i>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro booleanWithInfo(data) %}
|
||||
{% if (data.checked) %}
|
||||
<i class="fa-solid fa-check-circle text-success"></i>
|
||||
{% else %}
|
||||
<i class="fa-solid fa-times-circle text-danger"></i>
|
||||
{% endif %}
|
||||
{% if data.info is not empty %}
|
||||
{{ data.info }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro link(data) %}
|
||||
{% apply spaceless %}
|
||||
<a href="{{ data.href }}" {% if data.class is defined %} class="{{ data.class }}" {% endif %} {% if data.target is defined %} target="{{ data.target }}" {% endif %} {% if data.title is defined %} title="{{ data.title }}" {% endif %}>
|
||||
{% if data.icon is defined %}
|
||||
<i class="{{ data.icon }}"></i>
|
||||
{% endif %}
|
||||
{% if data.text is defined %}
|
||||
{{ data.text }}
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endapply %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro button(data) %}
|
||||
{% apply spaceless %}
|
||||
<{% if data.href is defined %}a{% else %}span{% endif %} class="{% if data.class is defined %}btn btn-sm {{ data.class }}{% else %}btn btn-sm btn-outline-secondary{% endif %}" {% if data.modal is defined and data.modal is iterable %} data-bs-toggle="modal" role="button" href="#{{ data.modal.id }}" {% else %} {% if data.href is defined %}href="{{ data.href }}"{% endif %} {% endif %} {% if data.target is defined %} target="{{ data.target }}" {% endif %} {% if data.title is defined %} title="{{ data.title }}" {% endif %}>
|
||||
{% if data.icon is defined %}
|
||||
<i class="{{ data.icon }}"></i>
|
||||
{% endif %}
|
||||
{% if data.text is defined %}
|
||||
{{ data.text }}
|
||||
{% endif %}
|
||||
</{% if data.href is defined %}a{% else %}span{% endif %}>
|
||||
{% if data.modal is defined and data.modal is iterable %}
|
||||
<div class="modal fade" data-action="{{ data.modal.action|default('') }}" data-entry="{{ data.modal.entry }}" id="{{ data.modal.id }}" aria-hidden="true" aria-labelledby="{{ data.modal.id }}Label" tabindex="-1">
|
||||
<div class="modal-dialog {{ data.modal.size|default('modal-xl') }} modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="{{ data.modal.id }}Label">{{ data.modal.title }}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ lng('panel.modalclose') }}"></button>
|
||||
</div>
|
||||
<div class="modal-body text-start">
|
||||
{{ data.modal.body|raw }}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">{{ lng('panel.modalclose') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endapply %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro domainWithSan(data) %}
|
||||
{{ data.domain }}
|
||||
{% if data.san is not empty %}
|
||||
<br/>
|
||||
<span class="small">
|
||||
SAN: {{ data.san }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro actions(data) %}
|
||||
{% for action in data %}
|
||||
{% if action.visible is not defined or action.visible is defined and action.visible %}
|
||||
{{ _self.button(action) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
68
templates/Maketank/table/pagination.html.twig
Normal file
68
templates/Maketank/table/pagination.html.twig
Normal file
@@ -0,0 +1,68 @@
|
||||
{% macro paging(pagination) %}
|
||||
{% if pagination.last_page > 1 %}
|
||||
<div class="card-footer border-top">
|
||||
<nav aria-label="Pagination">
|
||||
<ul class="pagination justify-content-center mb-0">
|
||||
{% if pagination.current_page == 1 %}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
|
||||
<i class="fa-solid fa-angles-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
|
||||
<i class="fa-solid fa-chevron-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% elseif pagination.current_page > 1 %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ page }}&action={{ action }}{{ pagination.link_additions }}&pageno=1" tabindex="-1">
|
||||
<i class="fa-solid fa-angles-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ page }}&action={{ action }}{{ pagination.link_additions }}&pageno={{ pagination.current_page - 1 }}" tabindex="-1">
|
||||
<i class="fa-solid fa-chevron-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if pagination.current_page < pagination.last_page %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ page }}&action={{ action }}{{ pagination.link_additions }}&pageno={{ pagination.current_page + 1 }}" tabindex="-1">
|
||||
<i class="fa-solid fa-chevron-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ page }}&action={{ action }}{{ pagination.link_additions }}&pageno={{ pagination.last_page }}" tabindex="-1">
|
||||
<i class="fa-solid fa-angles-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
|
||||
<i class="fa-solid fa-chevron-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
|
||||
<i class="fa-solid fa-angles-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro titlesorting(pagination, key, th) %}
|
||||
{% if pagination is defined and key in pagination.sortfields %}
|
||||
<th class="p-3 {{ th.class }}">
|
||||
{{ th.text }}
|
||||
<a href="?page={{ page }}&action={{ action }}&pageno={{ pagination.current_page }}&sortfield={{ key }}&sortorder=desc">↓</a>
|
||||
<a href="?page={{ page }}&action={{ action }}&pageno={{ pagination.current_page }}&sortfield={{ key }}&sortorder=asc">↑</a>
|
||||
</th>
|
||||
{% else %}
|
||||
<th class="p-3 {{ th.class }}">{{ th.text }}</th>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
137
templates/Maketank/table/table.html.twig
Normal file
137
templates/Maketank/table/table.html.twig
Normal file
@@ -0,0 +1,137 @@
|
||||
{% macro table(listing) %}
|
||||
|
||||
{% import "Froxlor/table/macros.html.twig" as macros %}
|
||||
{% import "Froxlor/table/pagination.html.twig" as pagination %}
|
||||
|
||||
{% 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="d-flex flex-column align-items-end mt-n2">
|
||||
<div class="rounded-top bg-dark small py-1 px-2 me-3 opacity-25 text-white">
|
||||
{% if listing.no_search is not defined or (listing.no_search is defined and listing.no_search == false) %}
|
||||
{% if gSearchText is not empty %}
|
||||
<span class="me-2"><a href="{{ linker(listing.self_overview) }}"><i class="fa-solid fa-xmark"></i></a> Filter: <strong>{{ gSearchText }}</strong></span>
|
||||
{% endif %}
|
||||
<span type="button" data-bs-toggle="modal" data-bs-target="#searchColumnsModal-{{ listing.id }}" class="me-2"><i class="fa-solid fa-search"></i></span>
|
||||
{% endif %}
|
||||
<span type="button" data-bs-toggle="modal" data-bs-target="#manageColumnsModal-{{ listing.id }}"><i class="fa-solid fa-cog"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<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 %}
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade manageColumnsModal" id="manageColumnsModal-{{ listing.id }}" tabindex="-1" aria-labelledby="manageColumnsModalLabel-{{ listing.id }}" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<form method="POST" class="modal-content" data-listing="{{ listing.id }}">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="manageColumnsModalLabel-{{ listing.id }}">{{ lng('panel.managetablecolumnsmodal.title') }}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>{{ lng('panel.managetablecolumnsmodal.description') }}</p>
|
||||
{% for key, column in listing.available_columns %}
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" value="{{ key }}" id="checkColumn{{ key }}" name="columns[{{ key }}]" {{ column.checked ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="checkColumn{{ key }}">
|
||||
{{ column.label }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-action="select-all">{{ lng('panel.select_all') }}</button>
|
||||
<button type="button" class="btn btn-secondary" data-action="unselect-all">{{ lng('panel.unselect_all') }}</button>
|
||||
<button type="button" class="btn btn-secondary" data-action="reset">{{ lng('panel.default') }}</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ lng('panel.modalclose') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ lng('panel.save') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if listing.no_search is not defined or (listing.no_search is defined and listing.no_search == false) %}
|
||||
<!-- Modal -->
|
||||
<div class="modal fade searchColumnsModal" id="searchColumnsModal-{{ listing.id }}" tabindex="-1" aria-labelledby="searchColumnsModalLabel-{{ listing.id }}" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<form method="GET" class="modal-content" action="{{ linker(listing.self_overview) }}">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="searchColumnsModalLabel-{{ listing.id }}">{{ lng('panel.searchtablecolumnsmodal.title') }}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>{{ lng('panel.searchtablecolumnsmodal.description') }}</p>
|
||||
<div class="mb-3">
|
||||
<select class="form-select" name="searchfield" id="searchfield">
|
||||
{% for key, column in listing.available_columns %}
|
||||
{% if column.searchable is not defined or (column.searchable is defined and column.searchable == true) %}
|
||||
<option value="{{ key }}">{{ column.label }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<input class="form-control" type="text" name="searchtext" id="searchtext" placeholder="{{ lng('panel.search') }}..." value="" />
|
||||
</div>
|
||||
<input type="hidden" name="page" value="{{ page }}" />
|
||||
{% if listing.listing_search_additional_param is defined and listing.listing_search_additional_param|length > 0 %}
|
||||
{% for fldname,fldval in listing.listing_search_additional_param %}
|
||||
<input type="hidden" name="{{ fldname }}" value="{{ fldval }}" />
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ lng('panel.modalclose') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ lng('panel.search') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user