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

<xf:form action="{{ link('users/batch-update/action') }}" class="block">
	<div class="block-container">
		<h2 class="block-header">{{ phrase('update_users') }}</h2>
		<div class="block-body">
			<xf:formrow label="{{ phrase('matched_users') }}">
				{$total|number}
				<xf:if is="!$userIds">
					<span role="presentation" aria-hidden="true">&middot;</span>
					<a href="{{ link('users/list', null, {'criteria': $criteria, 'all': true}) }}">{{ phrase('view_or_filter_matches') }}</a>
				</xf:if>
			</xf:formrow>

			<hr class="formRowSep" />

			<xf:selectrow name="actions[set_primary_group_id]"
				label="{{ phrase('set_primary_user_group') }}">

				<xf:option></xf:option>
				<xf:foreach loop="$userGroups" value="$userGroup">
					<xf:option value="{$userGroup.user_group_id}">{$userGroup.title}</xf:option>
				</xf:foreach>
			</xf:selectrow>

			<xf:selectrow name="actions[add_group_id]"
				label="{{ phrase('add_secondary_user_group') }}">

				<xf:option></xf:option>
				<xf:foreach loop="$userGroups" value="$userGroup">
					<xf:option value="{$userGroup.user_group_id}">{$userGroup.title}</xf:option>
				</xf:foreach>
			</xf:selectrow>

			<xf:selectrow name="actions[remove_group_id]"
				label="{{ phrase('remove_secondary_user_group') }}">

				<xf:option></xf:option>
				<xf:foreach loop="$userGroups" value="$userGroup">
					<xf:option value="{$userGroup.user_group_id}">{$userGroup.title}</xf:option>
				</xf:foreach>
			</xf:selectrow>

			<hr class="formRowSep" />

			<xf:selectrow name="actions[set_user_state]"
				label="{{ phrase('set_user_state') }}">

				<xf:option></xf:option>
				<xf:option value="valid">{{ phrase('valid') }}</xf:option>
				<xf:option value="email_confirm">{{ phrase('awaiting_email_confirmation') }}</xf:option>
				<xf:option value="email_confirm_edit">{{ phrase('awaiting_email_confirmation_from_edit') }}</xf:option>
				<xf:option value="email_bounce">{{ phrase('email_invalid_bounced') }}</xf:option>
				<xf:option value="moderated">{{ phrase('awaiting_approval') }}</xf:option>
				<xf:option value="rejected">{{ phrase('rejected') }}</xf:option>
				<xf:option value="disabled">{{ phrase('disabled') }}</xf:option>
			</xf:selectrow>

			<xf:selectrow name="actions[set_security_lock]"
				label="{{ phrase('set_security_lock') }}"
				explain="{{ phrase('administrators_will_not_be_security_locked') }}">

				<xf:option></xf:option>
				<xf:option value="none">{{ phrase('none') }}</xf:option>
				<xf:option value="change">{{ phrase('locked:') }} {{ phrase('user_must_change_password') }}</xf:option>
				<xf:option value="reset">{{ phrase('locked:') }} {{ phrase('user_must_reset_password') }}</xf:option>
			</xf:selectrow>

			<hr class="formRowSep" />

			<xf:textboxrow name="actions[custom_title]"
				label="{{ phrase('set_custom_title') }}" />

			<xf:checkboxrow
				explain="{{ phrase('super_admins_will_not_be_updated') }}">

				<xf:option name="actions[discourage]">{{ phrase('discourage_users') }}</xf:option>
				<xf:option name="actions[undiscourage]">{{ phrase('undiscourage_users') }}</xf:option>
				<xf:option name="actions[ban]">{{ phrase('ban_users_permanently') }}</xf:option>
				<xf:option name="actions[unban]">{{ phrase('unban_users') }}</xf:option>
				<xf:option name="actions[remove_avatar]">{{ phrase('remove_avatars') }}</xf:option>
				<xf:option name="actions[remove_signature]">{{ phrase('remove_signatures') }}</xf:option>
				<xf:option name="actions[remove_website]">{{ phrase('remove_websites') }}</xf:option>
				<xf:option name="actions[enable_activity_summary_email]">{{ phrase('enable_activity_summary_email') }}</xf:option>
				<xf:option name="actions[disable_activity_summary_email]">{{ phrase('disable_activity_summary_email') }}</xf:option>
			</xf:checkboxrow>
		</div>
		<xf:submitrow submit="{{ phrase('update_users') }}" icon="save" />
	</div>

	<xf:if is="$userIds">
		<xf:hiddenval name="user_ids">{$userIds|json}</xf:hiddenval>
	<xf:else />
		<xf:hiddenval name="criteria">{$criteria|json}</xf:hiddenval>
	</xf:if>
</xf:form>

<xf:form action="{{ link('users/batch-update/action') }}" class="block">
	<div class="block-container">
		<h2 class="block-header">{{ phrase('delete_users') }}</h2>
		<div class="block-body">
			<xf:checkboxrow
				explain="{{ phrase('administrators_and_moderators_will_not_be_deleted') }}">

				<xf:option name="actions[delete]">{{ phrase('confirm_deletion_of_x_users', {'total': $total|number}) }}</xf:option>
			</xf:checkboxrow>
		</div>
		<xf:submitrow name="confirm_delete" icon="delete" />
	</div>

	<xf:if is="$userIds">
		<xf:hiddenval name="user_ids">{$userIds|json}</xf:hiddenval>
	<xf:else />
		<xf:hiddenval name="criteria">{$criteria|json}</xf:hiddenval>
	</xf:if>
</xf:form>