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

<div class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:formrow label="{{ phrase('current_username') }}" rowtype="button">
				<div class="contentRow contentRow--alignMiddle">
					<div class="contentRow-figure">
						<xf:avatar user="$entry.User" size="xs" />
					</div>
					<div class="contentRow-main">
						<h3 class="contentRow-title"><xf:username user="$entry.User" rich="true" /></h3>
					</div>
				</div>
			</xf:formrow>

			<xf:formrow label="{{ phrase('old_username') }}">
				{$entry.old_username}
			</xf:formrow>

			<xf:formrow label="{{ phrase('new_username') }}">
				{$entry.new_username}
			</xf:formrow>

			<xf:formrow label="{{ phrase('change_reason') }}">
				{{ $entry.change_reason ? $entry.change_reason|nl2br : phrase('n_a') }}
			</xf:formrow>

			<hr class="formRowSep" />

			<xf:formrow label="{{ phrase('change_state') }}">
				<xf:if is="$entry.change_state == 'approved'">
					{{ phrase('approved') }}
				<xf:elseif is="$entry.change_state == 'moderated'" />
					{{ phrase('awaiting_approval') }}
				<xf:elseif is="$entry.change_state == 'rejected'" />
					{{ phrase('rejected') }}
				</xf:if>
			</xf:formrow>

			<xf:if is="$entry.change_state == 'rejected'">
				<xf:formrow label="{{ phrase('rejected_by') }}">
					<xf:if is="$entry.moderator_user_id AND $entry.Moderator">
						<xf:username user="$entry.Moderator" href="{{ link('users/edit', $entry.Moderator) }}" />
					<xf:else />
						{{ phrase('n_a') }}
					</xf:if>
				</xf:formrow>

				<xf:formrow label="{{ phrase('reason') }}">
					<xf:if is="$entry.reject_reason">
						{$entry.reject_reason}
					<xf:else />
						{{ phrase('n_a') }}
					</xf:if>
				</xf:formrow>
			<xf:elseif is="$entry.user_id != $entry.change_user_id" />
				<xf:formrow label="{{ phrase('changed_by') }}">
					<xf:if is="$entry.change_user_id AND $entry.ChangeUser">
						<xf:username user="$entry.ChangeUser" href="{{ link('users/edit', $entry.ChangeUser) }}" />
					<xf:else />
						{{ phrase('n_a') }}
					</xf:if>
				</xf:formrow>
			<xf:elseif is="$entry.change_state == 'approved' AND $entry.moderator_user_id AND $entry.Moderator" />
				<xf:formrow label="{{ phrase('approved_by') }}">
					<xf:username user="$entry.Moderator" href="{{ link('users/edit', $entry.Moderator) }}" />
				</xf:formrow>
			</xf:if>

			<xf:formrow label="{{ phrase('date') }}">
				<xf:date time="{$entry.change_date}" />
			</xf:formrow>
		</div>
	</div>
</div>