{% if aParams.search_terms_caption is not defined or (aParams.search_terms_caption is defined and aParams.search_terms_caption) %}
{% if aParams.search_terms is defined and aParams.search_terms and aParams.page == 1 %}
<div class="_search_totals alert alert-warning">
<span>Search results for: </span><b>{{ aParams.search_terms }}</b>
{% if all_results.total_results is defined %}
<br />
<span>{{ all_results.total_results }} results found</span>
{% endif %}
</div>
{% elseif aParams.show_total_results is defined and aParams.show_total_results and aParams.page == 1 and all_results.total_results is defined %}
<div class="_search_totals alert alert-warning">
<span>{{ all_results.total_results }} results found</span>
</div>
{% endif %}
{% endif %}
{% if aParams.double_pagination is defined and aParams.double_pagination %}
{% if pagination %}
{% if aParams.show_pagination is defined and aParams.show_pagination %}
<div class="_pagination" style="{{ aParams.infinite_scroll is defined and aParams.infinite_scroll ? 'display: none;' : '' }}">
{{ knp_pagination_render(pagination, aParams.pagination_template) }}
</div>
{% endif %}
{% endif %}
{% endif %}
{% if results|length %}
{% if aParams.renderMode is defined and aParams.renderMode == 'table' %}
<table class="_table">
{% if aParams.tableHeaders is defined %}
<thead>
<tr>
{% for tableHeader in aParams.tableHeaders %}
{% set colWidth = aParams.tableWidths is defined ? aParams.tableWidths[loop.index0] : '' %}
<th {{ colWidth ? ('style="width: '~colWidth~'"')|raw : '' }}>{{ tableHeader|capitalize }}</th>
{% endfor %}
</tr>
</thead>
{% endif %}
{% for result in results %}
<tbody>
{% if aParams.item_source is defined and aParams.item_source %}
{{ include(template_from_string(aParams.item_source), {
'item': result,
'aParams': aParams,
'result_idx': loop.index
}) }}
{% else %}
{% include aParams.item_template with {
'item': result,
'aParams': aParams,
'result_idx': loop.index
} %}
{% endif %}
</tbody>
{% endfor %}
</table>
{% else %}
<div class="_results _results_{{ aParams.contentType }} {{ aParams.results_items_wrapper_class is defined ? aParams.results_items_wrapper_class : '' }}">
{% for result in results %}
{% if aParams.item_source is defined and aParams.item_source %}
<div class="_results_item _results_{{ aParams.contentType }}_item">
{{ include(template_from_string(aParams.item_source), {
'item': result,
'aParams': aParams,
'result_idx': loop.index
}) }}
</div>
{% else %}
<div class="_results_item _results_{{ aParams.contentType }}_item {{ aParams.results_item_class is defined ? aParams.results_item_class : '' }}">
{% include aParams.item_template with {
'item': result,
'aParams': aParams,
'result_idx': loop.index
} %}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% else %}
{% if aParams.remove_block_if_no_results is defined and aParams.remove_block_if_no_results %}
{% if aParams.container_id is defined and aParams.container_id %}
<script>
$('div[data-container-id="{{ aParams.container_id }}"]').remove();
</script>
{% endif %}
{% elseif aParams.hide_block_if_no_results is defined and aParams.hide_block_if_no_results %}
{% if aParams.container_id is defined and aParams.container_id %}
<script>
$('div[data-container-id="{{ aParams.container_id }}"]').hide();
</script>
{% endif %}
{% elseif aParams.page == 1 %}
{% if aParams.no_results_template is defined and aParams.no_results_template %}
{% include aParams.no_results_template %}
{% else %}
<div class="_no_results">
{% if aParams.no_results_html is defined and aParams.no_results_html %}
{{ aParams.no_results_html|raw }}
{% else %}
<div class="_noContent text-center">
{#<span>No results to show ;(</span>#}
{#
<img src="{{ asset('img/no_results_found.webp') }}" style="opacity: .8;" />
#}
<i class="fas fa-search mt-5 mb-4" style="font-size: 2.5em;"></i>
<h5>No results found</h5>
</div>
{% endif %}
</div>
{% endif %}
{# Suggested results #}
{% if results_suggested is defined and results_suggested and results_suggested|length %}
<div class="search_results_suggested" style="float: left; padding: 20px 20px 0;">
<span>You might be interested in:</span>
</div>
<div class="_results _results_{{ aParams.contentType }}">
{% for result in results_suggested %}
{% if aParams.item_source is defined and aParams.item_source %}
<div class="_results_item _results_{{ aParams.contentType }}_item">
{{ include(template_from_string(aParams.item_source), {
'item': result,
'aParams': aParams,
'result_idx': loop.index
}) }}
</div>
{% else %}
<div class="_results_item _results_{{ aParams.contentType }}_item">
{% include aParams.item_template with {
'item': result,
'aParams': aParams,
'result_idx': loop.index
} %}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endif %}
{% if pagination %}
{% if aParams.show_pagination is defined and aParams.show_pagination %}
<div class="_pagination mt-4" style="{{ aParams.infinite_scroll is defined and aParams.infinite_scroll ? 'display: none;' : '' }}">
{{ knp_pagination_render(pagination, aParams.pagination_template) }}
</div>
{% endif %}
{% endif %}