{#
  Variables
    - activePage
    - items
#}
{% set isIndex = 'index' == tmpl ? true : false %}
{% set tmpl = 'list' %}
{% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %}

{% block mauticContent %}pageresult{% endblock %}

{% block headerTitle %}
  {{ 'mautic.page.result.header.index'|trans({
        '%name%': activePage.getName(),
  }) }}
{% endblock %}

{% block actions %}
  {% set buttons = [
          {
              'attr': {
                  'target': '_new',
                  'data-toggle': '',
                  'class': 'btn btn-ghost btn-nospin',
                  'href': path('mautic_page_export', {'objectId': activePage.id, 'format': 'html'}),
              },
              'btnText': 'mautic.form.result.export.html'|trans,
              'iconClass': 'ri-file-code-line',
              'primary': true,
          },
          {
              'attr': {
                  'data-toggle': '',
                  'class': 'btn btn-ghost btn-nospin',
                  'href': path('mautic_page_export', {'objectId': activePage.id, 'format': 'csv'}),
              },
              'btnText': 'mautic.form.result.export.csv'|trans,
              'iconClass': 'ri-file-text-line',
              'primary': true,
          }
  ] %}

  {% if '\\PhpOffice\\PhpSpreadsheet\\Spreadsheet' is class %}
    {% set buttons = buttons|merge([{
          'attr': {
              'data-toggle': '',
              'class': 'btn btn-ghost btn-nospin',
              'href': path('mautic_page_export', {'objectId': activePage.id, 'format': 'xlsx'}),
          },
          'btnText': 'mautic.form.result.export.xlsx'|trans,
          'iconClass': 'ri-file-excel-2-fill',
          'primary': true,
    }]) %}
  {% endif %}

  {% set buttons = buttons|merge([{
        'attr': {
            'class': 'btn btn-ghost',
            'href': path('mautic_page_action', {'objectAction': 'view', 'objectId': activePage.id}),
            'data-toggle': 'ajax',
        },
        'iconClass': 'ri-close-line',
        'btnText': 'mautic.core.form.close'|trans,
  }]) %}

  {{ include('@MauticCore/Helper/page_actions.html.twig', {'customButtons': buttons}) }}
{% endblock %}

{% block content %}
  {% if isIndex %}
    <div class="page-list">
  {% endif %}

  {{ include('@MauticPage/Result/_list.html.twig') }}

  {% if isIndex %}
    </div>
  {% endif %}
{% endblock %}
