<xf:if is="$action.isInsert()">
	<xf:title>{{ phrase('add_warning_action') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_warning_action:') }} {{ phrase('points:') }} {$action.points}</xf:title>
</xf:if>

<xf:pageaction if="$action.isUpdate()">
	<xf:button href="{{ link('warnings/actions/delete', $action) }}" icon="delete" overlay="true" />
</xf:pageaction>

<xf:form action="{{ link('warnings/actions/save', $action) }}" ajax="true" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:numberboxrow name="points" value="{$action}"
				label="{{ phrase('points_threshold') }}"
				explain="{{ phrase('warning_action_applied_crossing_threshold') }}" />

			<xf:radiorow name="action" value="{$action}"
				label="{{ phrase('action_to_take') }}">

				<xf:option value="ban"
					label="{{ phrase('ban') }}" />
				<xf:option value="discourage"
					label="{{ phrase('discourage') }}" />
				<xf:option value="groups"
					label="{{ phrase('add_to_selected_groups') }}">

					<xf:checkbox name="extra_user_group_ids" value="{$action.extra_user_group_ids}">
						<xf:options source="$userGroups" />
					</xf:checkbox>
				</xf:option>
			</xf:radiorow>

			<xf:radiorow name="action_length_type_base" value="{$action}"
				label="{{ phrase('for_time_period') }}">

				<xf:option value="points">{{ phrase('while_at_or_above_points_threshold') }}</xf:option>
				<xf:option value="permanent">{{ phrase('permanent') }}</xf:option>
				<xf:option value="temporary" selected="$action.action_length_type != 'permanent' AND $action.action_length_type != 'points'" label="{{ phrase('temporary') }}">
					<xf:dependent>
						<div class="inputGroup">
							<xf:numberbox name="action_length" value="{{ $action.action_length ?: 1 }}" min="1" />
							<span class="inputGroup-splitter"></span>
							<xf:select name="action_length_type" value="{{ ($action.action_length_type == 'permanent' OR $action.action_length_type == 'points') ? 'months' : $action.action_length_type }}" class="input--inline">
								<xf:option value="days">{{ phrase('days') }}</xf:option>
								<xf:option value="weeks">{{ phrase('weeks') }}</xf:option>
								<xf:option value="months">{{ phrase('months') }}</xf:option>
								<xf:option value="years">{{ phrase('years') }}</xf:option>
							</xf:select>
						</div>
					</xf:dependent>
				</xf:option>
			</xf:radiorow>
		</div>
		<xf:submitrow sticky="true" icon="save" />
	</div>
</xf:form>