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

<xf:form action="{{ link('user-title-ladder/update') }}" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:datalist data-xf-init="responsive-data-list">
				<colgroup>
					<col style="width: 1%" />
					<col />
					<col style="width: 130px" />
				</colgroup>
				<xf:datarow rowtype="header">
					<xf:cell>{{ phrase('delete') }}</xf:cell>
					<xf:cell>{{ phrase('title') }}</xf:cell>
					<xf:cell>{{ phrase('minimum_value') }}</xf:cell>
				</xf:datarow>
				<xf:foreach loop="$ladder" value="$title">
					<xf:set var="$maxLength" value="{{ max_length($title, 'title') }}" />
					<xf:datarow>
						<xf:toggle name="delete[]" value="{$title.minimum_level}" />
						<xf:cell>
							<xf:textbox name="update[{$title.minimum_level}][title]" value="{$title.title}" maxlength="{{ max_length($title, 'title') }}" />
						</xf:cell>
						<xf:cell>
							<xf:numberbox name="update[{$title.minimum_level}][minimum_level]"min="0"
								value="{$title.minimum_level}" />
						</xf:cell>
					</xf:datarow>
				</xf:foreach>
				<xf:datarow>
					<xf:cell data-hide-label="true">{{ phrase('new:') }}</xf:cell>
					<xf:cell>
						<xf:textbox name="title" maxlength="{$maxLength}" />
					</xf:cell>
					<xf:cell>
						<xf:numberbox name="minimum_level" min="0" value="0" />
					</xf:cell>
				</xf:datarow>
			</xf:datalist>
		</div>
		<div class="block-footer block-footer--split">
			<span class="block-footer-counter">{{ display_totals($ladder) }}</span>
			<span class="block-footer-select"><xf:checkbox standalone="true"><xf:option check-all="< .block-container" label="{{ phrase('select_all') }}" /></xf:checkbox></span>
			<span class="block-footer-controls"><xf:button type="submit">{{ phrase('update_user_titles') }}</xf:button></span>
		</div>
	</div>
</xf:form>

<xf:macro id="option_macros::option_form_block" arg-options="{$options}" />