<xf:if is="$warning.isInsert()">
	<xf:title>{{ phrase('add_warning') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_warning:') }} {$warning.title}</xf:title>
</xf:if>

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

<xf:form action="{{ link('warnings/save', $warning) }}" ajax="true" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:textboxrow name="title" value="{$warning.MasterTitle.phrase_text}" maxlength="{{ max_length($warning, 'title') }}"
				label="{{ phrase('title') }}" />

			<xf:numberboxrow name="points_default" value="{$warning.points_default}" min="0" max="65535"
				label="{{ phrase('warning_points') }}" />

			<xf:radiorow name="expiry_type_base"
				label="{{ phrase('points_expiry') }}">

				<xf:option value="never" selected="$warning.expiry_type == 'never'">{{ phrase('never') }}</xf:option>
				<xf:option value="other" selected="$warning.expiry_type != 'never'" label="{{ phrase('after_time:') }}">
					<xf:dependent>
						<div class="inputGroup">
							<xf:numberbox name="expiry_default" value="{{ $warning.expiry_default ? $warning.expiry_default : 1 }}" min="0" />
							<span class="inputGroup-splitter"></span>
							<xf:select name="expiry_type" value="{{ $warning.expiry_type == 'never' ? 'months' : $warning.expiry_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>

			<xf:checkboxrow>
				<xf:option name="is_editable" selected="$warning.is_editable">{{ phrase('points_and_expiry_time_editable_when_giving_warning') }}</xf:option>
			</xf:checkboxrow>

			<xf:checkboxrow name="extra_user_group_ids" value="{$warning.extra_user_group_ids}"
				label="{{ phrase('extra_user_groups') }}"
				explain="{{ phrase('user_receiving_warning_can_be_added_to_groups_until_expiry') }}">

				<xf:options source="$userGroups" />
			</xf:checkboxrow>
		</div>

		<h3 class="block-formSectionHeader"><span class="block-formSectionHeader-aligner">{{ phrase('conversation_settings') }}</span></h3>
		<div class="block-body">
			<xf:textboxrow name="conversation_title" value="{$warning.MasterConversationTitle.phrase_text}"
				label="{{ phrase('default_title') }}" />

			<xf:textarearow name="conversation_text" value="{$warning.MasterConversationText.phrase_text}" autosize="true"
				label="{{ phrase('default_text') }}"
				explain="{{ phrase('you_may_use_placeholders_to_dynamically_insert_warning') }}" />
		</div>

		<xf:submitrow icon="save" sticky="true" />
	</div>
</xf:form>