{#
  Variables
    - event
    - campaignId
#}
{% set route = route|default('mautic_campaignevent_action') %}
{% if update is not defined %}
  <div id="CampaignEvent_{{ event['id'] }}"
       data-type="{{ event['eventType'] }}"
       class="draggable list-campaign-event list-campaign-{{ event['eventType'] }}"
       data-event="{{ event['type'] }}"
       data-event-id="{{ event['id'] }}">
{% endif %}
    <div class="campaign-event-type">

    {% if event['eventType'] == 'decision' %}
    <div class="campaign-event-content fw-nowrap gap-xs ai-center fd-row d-flex fg-1 pa-md">
        <span class="h5 fw-b event-type-color">{{ 'mautic.campaign.when'|trans }}</span>
        <span>{{ ('mautic.campaign.'~event['type'])|trans }}</span>
        <span class="campaign-event-name label label-info ml-5 mr-lg ellipsis">
            {% if ('dev' == constant('MAUTIC_ENV')) %}<small>{{ event['id'] }}</small> {% endif %}{{ event['name'] }}
        </span>
        <i class="{{ getCampaignEventIcon(event['type']) }} ri-lg ml-a campaign-event-icon event-type-color"></i>
    </div>

    {% elseif event['eventType'] == 'action' %}
        <div class="campaign-event-content d-flex fw-nowrap ai-center gap-sm">
            <div class="campaign-event-icon pa-sm mr-5"><i class="{{ getCampaignEventIcon(event['type']) }}"></i></div>
            <div class="d-flex fd-column ai-start">
                <span class="fs-18 fw-l">{{ ('mautic.campaign.'~event['type'])|trans }}</span>
                <span class="campaign-event-name ellipsis">{% if ('dev' == constant('MAUTIC_ENV')) %}<small>{{ event['id'] }}</small> {% endif %}{{ event['name'] }}</span>
            </div>
        </div>

    {% elseif event['eventType'] == 'condition' %}
    <div class="campaign-event-content fw-nowrap gap-xs ai-center fd-row d-flex fg-1 pa-md">
        <span class="h5 fw-b event-type-color">{{ 'mautic.campaign.if'|trans }}</span>
        <span>{{ ('mautic.campaign.'~event['type'])|trans }}</span>
            <span class="campaign-event-name label label-warning ml-5 mr-lg ellipsis">
            {% if ('dev' == constant('MAUTIC_ENV')) %}<small>{{ event['id'] }}</small> {% endif %}{{ event['name'] }}
            </span>
        <i class="{{ getCampaignEventIcon(event['type']) }} ri-lg ml-a campaign-event-icon event-type-color"></i>
    </div>
    {% endif %}
    </div>


{% if update is not defined %}
    <div class="campaign-event-buttons hide">
        {% include '@MauticCore/Helper/button.html.twig' with {
            buttons: [
                {
                    href: path(route, {
                        'objectAction': 'clone',
                        'objectId': event['id'],
                        'campaignId': campaignId
                    }),
                    variant: 'secondary',
                    icon: 'ri-file-copy-line',
                    size: 'xs',
                    icon_only: true,
                    label: 'mautic.campaign.event.clone.btn.tooltip'|trans,
                    attributes: {
                        'data-toggle': 'ajax',
                        'data-target': 'CampaignEvent_' ~ event['id'],
                        'data-ignore-formexit': 'true',
                        'data-method': 'POST',
                        'data-hide-loadingbar': 'true',
                        'class': 'btn-clone'
                    }
                },
                {
                    href: path(route, {
                        'objectAction': 'edit',
                        'objectId': event['id'],
                        'campaignId': campaignId
                    }),
                    variant: 'secondary',
                    icon: 'ri-pencil-line',
                    size: 'xs',
                    icon_only: true,
                    label: 'mautic.campaign.event.edit.btn.tooltip'|trans,
                    attributes: {
                        'data-toggle': 'ajaxmodal',
                        'data-prevent-dismiss': 'true',
                        'data-target': '#CampaignEventModal',
                        'data-method': 'POST',
                        'class': 'btn-edit'
                    }
                },
                {
                    href: path(route, {
                        'objectAction': 'delete',
                        'objectId': event['id'],
                        'campaignId': campaignId
                    }),
                    variant: 'primary',
                    icon: 'ri-delete-bin-line',
                    size: 'xs',
                    danger: true,
                    icon_only: true,
                    label: 'mautic.campaign.event.remove.btn.tooltip'|trans,
                    attributes: {
                        'data-toggle': 'ajax-delete',
                        'data-target': 'CampaignEvent_' ~ event['id'],
                        'data-ignore-formexit': 'true',
                        'data-method': 'POST',
                        'data-hide-loadingbar': 'true',
                        'class': 'btn-delete'
                    }
                }
            ]
        } %}
    </div>
</div>
{% endif %}
