{#
  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-default btn-nospin',
                  'href': path('mautic_page_export', {'objectId': activePage.id, 'format': 'html'}),
              },
              'btnText': 'mautic.form.result.export.html'|trans,
              'iconClass': 'fa fa-file-code-o',
              'primary': true,
          },
          {
              'attr': {
                  'data-toggle': '',
                  'class': 'btn btn-default btn-nospin',
                  'href': path('mautic_page_export', {'objectId': activePage.id, 'format': 'csv'}),
              },
              'btnText': 'mautic.form.result.export.csv'|trans,
              'iconClass': 'fa fa-file-text-o',
              'primary': true,
          }
  ] %}

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

  {% set buttons = buttons|merge([{
        'attr': {
            'class': 'btn btn-default',
            'href': path('mautic_page_action', {'objectAction': 'view', 'objectId': activePage.id}),
            'data-toggle': 'ajax',
        },
        'iconClass': 'fa fa-remove',
        '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 %}
