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

<xf:if is="$entries is not empty">
	<div class="block">
		<div class="block-container">
			<div class="block-body">
				<xf:datalist>
					<xf:foreach loop="$entries" value="$entry">
						<xf:datarow
							label="{$entry.User.username}"
							hint="{$entry.Promotion.title}">

							<xf:explain>
								<xf:date time="$entry.promotion_date" />
								<xf:if is="$entry.promotion_state == 'manual'">
									- {{ phrase('manually_applied') }}
								<xf:elseif is="$entry.promotion_state == 'disabled'" />
									- {{ phrase('promotion_disabled') }}
								<xf:else />
									- {{ phrase('automatically_promoted') }}
								</xf:if>
							</xf:explain>

							<xf:action
								href="{{ link('user-group-promotions/demote', null, {'promotion_id': $entry.promotion_id, 'user_id': $entry.user_id}) }}"
								overlay="true">

								<xf:if is="$entry.promotion_state == 'disabled'">
									{{ phrase('enable_promotion') }}
								<xf:else />
									{{ phrase('disable_promotion') }}
								</xf:if>
							</xf:action>
						</xf:datarow>
					</xf:foreach>
				</xf:datalist>
			</div>
		</div>

		<xf:pagenav page="{$page}" perpage="{$perPage}" total="{$totalEntries}"
			link="user-group-promotions/history" params="{$linkParams}"
			wrapperclass="block-outer block-outer--after" />
	</div>
<xf:else />
	<div class="blockMessage">{{ phrase('no_promotion_history_meeting_criteria_found') }}</div>
</xf:if>