<xf:title>{{ phrase('code_event_listeners') }}</xf:title>

<xf:pageaction>
	<xf:button href="{{ link('code-events/listeners/add') }}" icon="add">{{ phrase('add_code_event_listener') }}</xf:button>
</xf:pageaction>

<xf:if is="$listeners is not empty">
	<xf:form action="{{ link('code-events/listeners/toggle') }}" class="block" ajax="true">
		<div class="block-outer">
			<xf:macro template="filter_macros" name="quick_filter" arg-key="listeners" arg-class="block-outer-opposite" />
		</div>
		<div class="block-container">
			<div class="block-body">
				<xf:datalist>
					<xf:foreach loop="$listeners" key="$addOnId" value="$listenerEntity">
						<tbody class="dataList-rowGroup">
							<xf:datarow rowtype="subsection" rowclass="dataList-row--noHover">
								<xf:cell colspan="3">
									<xf:if is="{{ {$addOns.{$addOnId}} }}">
										{$addOns.{$addOnId}.title}
									<xf:else />
										{{ phrase('custom_event_listeners') }}
									</xf:if>
								</xf:cell>
							</xf:datarow>
							<xf:foreach loop="$listenerEntity" value="$listener">
								<xf:datarow>
									<xf:main hash="{$listener.event_listener_id}"
										href="{{ link('code-events/listeners/edit', $listener) }}"
										label="{$listener.event_id}"
										explain="{$listener.description}" />
									<xf:toggle name="active[{$listener.event_listener_id}]" selected="$listener.active"
										class="dataList-cell--separated" submit="true"
										tooltip="{{ phrase('enable_disable_x', {'title': $listener.event_id}) }}" />
									<xf:delete href="{{ link('code-events/listeners/delete', $listener) }}" />
								</xf:datarow>
							</xf:foreach>
						</tbody>
					</xf:foreach>
				</xf:datalist>
			</div>
			<div class="block-footer">
				<span class="block-footer-counter">{{ display_totals($totalListeners) }}</span>
			</div>
		</div>
	</xf:form>
<xf:else />
	<div class="blockMessage">{{ phrase('no_items_have_been_created_yet') }}</div>
</xf:if>