{% if items|length > 0 %}
    <div class="table-responsive">
        <table class="table table-hover pointtrigger-list" id="triggerTable">
            <thead>
            <tr>
                {{ include('@MauticCore/Helper/tableheader.html.twig', {
                    'checkall': 'true',
                    'target': '#triggerTable',
                }) }}

                {{ include('@MauticCore/Helper/tableheader.html.twig', {
                        'sessionVar': 'point.trigger',
                        'orderBy': 't.name',
                        'text': 'mautic.core.name',
                        'class': 'col-pointtrigger-name',
                        'default': true,
                }) }}

                {{ include('@MauticCore/Helper/tableheader.html.twig', {
                        'sessionVar': 'point.trigger',
                        'orderBy': 'cat.title',
                        'text': 'mautic.core.category',
                        'class': 'col-pointtrigger-category visible-md visible-lg',
                }) }}

                {{ include('@MauticCore/Helper/tableheader.html.twig', {
                        'sessionVar': 'point.trigger',
                        'orderBy': 'pl.name',
                        'text': 'mautic.point.thead.group',
                        'class': 'visible-md visible-lg col-point-group',
                }) }}

                {{ include('@MauticCore/Helper/tableheader.html.twig', {
                        'sessionVar': 'point.trigger',
                        'orderBy': 't.points',
                        'text': 'mautic.point.trigger.thead.points',
                        'class': 'col-pointtrigger-points',
                }) }}

                {{ include('@MauticCore/Helper/tableheader.html.twig', {
                        'sessionVar': 'point.trigger',
                        'orderBy': 't.id',
                        'text': 'mautic.core.id',
                        'class': 'col-pointtrigger-id visible-md visible-lg',
                }) }}
            </tr>
            </thead>
            <tbody>
            {% for item in items %}
                <tr>
                    <td>
                        {{ include('@MauticCore/Helper/list_actions.html.twig', {
                                'item': item,
                                'templateButtons': {
                                    'edit': permissions['point:triggers:edit'],
                                    'clone': permissions['point:triggers:create'],
                                    'delete': permissions['point:triggers:delete'],
                                },
                                'routeBase': 'pointtrigger',
                                'langVar': 'point.trigger',
                        }) }}
                    </td>
                    <td>
                        <div>
                            {{ include('@MauticCore/Helper/publishstatus_icon.html.twig', {'item': item, 'model': 'point.trigger'}) }}
                            {% if permissions['point:triggers:edit'] %}
                                <a href="{{ path('mautic_pointtrigger_action', {'objectAction': 'edit', 'objectId': item.id}) }}" data-toggle="ajax">
                                    {{ item.name }}
                                </a>
                            {% else %}
                                {{ item.name }}
                            {% endif %}
                            {{ customContent('trigger.name', _context) }}
                        </div>
                        {{ include('@MauticCore/Helper/description--inline.html.twig', {
                            'description': item.description
                        }) }}
                    </td>
                    <td class="visible-md visible-lg">
                        {{ include('@MauticCore/Modules/category--expanded.html.twig', {'category': item.category}) }}
                    </td>
                    <td class="visible-md visible-lg">
                        {{ item.group.name|default('mautic.point.group.form.nogroup'|trans) }}
                    </td>
                    <td>{{ item.points }}</td>
                    <td class="visible-md visible-lg">{{ item.id }}</td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
    <div class="panel-footer">
        {{ include('@MauticCore/Helper/pagination.html.twig', {
                'totalItems': items|length,
                'page': page,
                'limit': limit,
                'menuLinkId': 'mautic_pointtrigger_index',
                'baseUrl': path('mautic_pointtrigger_index'),
                'sessionVar': 'point.trigger',
        }) }}
    </div>
{% else %}
    {% if searchValue is not empty %}
        {{ include('@MauticCore/Helper/noresults.html.twig', {'tip': 'mautic.point.trigger.noresults.tip'}) }}
    {% else %}
        <div class="mt-80 col-md-offset-2 col-lg-offset-3 col-md-8 col-lg-5 height-auto">
            {% set childContainer %}
            <div class="mb-md">
                {% include '@MauticCore/Components/pictogram.html.twig' with {
                    'pictogram': 'react-to-data',
                    'size': '80'
                } %}
            </div>

            {{ include('@MauticCore/Components/content-item-row.html.twig', {
                type: 'default',
                eyebrow: 'mautic.point.trigger.onboarding.eyebrow',
                heading: 'mautic.point.trigger.onboarding.heading',
                copy: 'mautic.point.trigger.onboarding.copy',
            }) }}

            {% set triggersUseContainer %}
            <div class="mb-md">
                {% include '@MauticCore/Components/pictogram.html.twig' with {
                    'pictogram': 'construct',
                    'size': '64'
                } %}
            </div>
            <div class="type-body-02">
                {% include '@MauticCore/Components/list--styled.html.twig' with {
                    'type': 'ordered',
                    'style': 'numbers', 
                    'items': [
                        'mautic.point.trigger.onboarding.step1',
                        'mautic.point.trigger.onboarding.step2',
                        'mautic.point.trigger.onboarding.step3',
                    ]
                } %}
            </div>
            <div class="mt-lg">
                {{ include('@MauticCore/Notification/inline_notification.html.twig', {
                    'title': 'mautic.point.trigger.onboarding.notification.title',
                    'content': 'mautic.point.trigger.onboarding.notification.content',
                    'alert_type': 'success',
                    'dismissible': false,
                }) }}
            </div>
            {% endset %}

        {{ include('@MauticCore/Components/content-group.html.twig', {
            heading: 'mautic.point.trigger.onboarding.group.heading',
            childContainer: triggersUseContainer,
            cta: {
                'label': 'mautic.point.trigger.onboarding.cta',
                'link': path('mautic_pointtrigger_action', {'objectAction': 'new'}),
                attributes: {
                    'data-toggle': 'ajax',
                },
            }
        }) }}
        {% endset %}

        {{ include('@MauticCore/Components/content-block.html.twig', {
            heading: 'mautic.point.trigger.empty.heading',
            subheading: 'mautic.point.trigger.empty.subheading',
            childContainer: childContainer,
        }) }}
    </div>
    {% endif %}
{% endif %}
