{% extends "Froxlor/userarea.html.twig" %}

{% block heading %}

	{% if listing.title is not empty %}
		<h5 class="mb-1">
			{% if listing.icon is not empty %}
				<i class="{{ listing.icon }} me-1"></i>
			{% endif %}
			{{ listing.title }}
			{% if listing.total_entries > 0 %}
				<small>
					<span class="badge rounded-pill bg-secondary">{{ listing.total_entries }}</span>
				</small>
			{% endif %}
		</h5>
		{% if listing.description is not empty %}
			<span class="text-body-secondary mt-2">{{ listing.description }}</span>
		{% endif %}
	{% endif %}

{% endblock %}

{% block actions %}

	{% if listing.is_search and listing.self_overview is defined and listing.self_overview is iterable  %}
		{% set actions_tmp = actions_links|default([]) %}
		{% set actions_links = {'href': linker(listing.self_overview), 'icon': 'fa-solid fa-reply','label': lng('panel.backtooverview')} %}
		{% set actions_links = {actions_links}|merge(actions_tmp) %}
	{% endif %}

	{% if actions_links is iterable or (entity_info is defined and entity_info is not empty) %}
		<div>
			{% if actions_links is iterable %}
				{% for link in actions_links %}
					{% if link.visible is not defined or (link.visible is defined and link.visible == true) %}
						<a class="btn {{ link.class|default('btn-outline-primary') }}{% if not loop.last %} me-1{% endif %}" href="{{ link.href|raw }}" {% if link.target is defined %}target="{{ link.target }}"{% endif %}>
							<i class="{{ link.icon|default('fa-solid fa-plus-circle') }}"></i>
							{% if link.label is defined and link.label is not empty %}<span class="d-none d-lg-inline ms-lg-1">{{ link.label }}</span>{% endif %}
						</a>
					{% endif %}
				{% endfor %}
			{% endif %}
		</div>
	{% endif %}
{% endblock %}


{% block content %}

	{% import "Froxlor/table/table.html.twig" as table %}

	{{ table.table(listing) }}

{% endblock %}
