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

<xf:pageaction>
	<xf:button href="{{ link('user-group-promotions/manage') }}">{{ phrase('manage_promoted_users') }}</xf:button>
	<xf:button href="{{ link('user-group-promotions/add') }}" icon="add">{{ phrase('add_promotion') }}</xf:button>
</xf:pageaction>

<xf:if is="$userGroupPromotions is not empty">
	<xf:form action="{{ link('user-group-promotions/toggle') }}" ajax="true" class="block">
		<div class="block-outer">
			<xf:macro template="filter_macros" name="quick_filter" arg-key="promotions" arg-class="block-outer-opposite" />
		</div>
		<div class="block-container">
			<div class="block-body">
				<xf:datalist>
					<xf:foreach loop="$userGroupPromotions" value="$userGroupPromotion">
						<xf:datarow
							label="{$userGroupPromotion.title}"
							href="{{ link('user-group-promotions/edit', $userGroupPromotion) }}"
							delete="{{ link('user-group-promotions/delete', $userGroupPromotion) }}">

							<xf:toggle name="active[{$userGroupPromotion.promotion_id}]"
								selected="$userGroupPromotion.active" class="dataList-cell--separated" submit="true"
								tooltip="{{ phrase('enable_disable_x', {'title': $userGroupPromotion.title}) }}" />

						</xf:datarow>
					</xf:foreach>
				</xf:datalist>
			</div>
			<div class="block-footer">
				<span class="block-footer-counter">{{ display_totals($userGroupPromotions) }}</span>
			</div>
		</div>
	</xf:form>
<xf:else />
	<div class="blockMessage">{{ phrase('no_promotions_have_been_defined') }}</div>
</xf:if>