<xf:pageaction>
	<xf:button href="{{ link($prefix . '/add') }}" icon="add">{{ phrase('add_field') }}</xf:button>
</xf:pageaction>

<xf:if is="$fieldsGrouped is not empty">
	<xf:form action="{{ link($prefix . '/toggle') }}" class="block" ajax="true">
		<div class="block-outer">
			<xf:macro template="filter_macros" name="quick_filter" arg-key="user-fields" arg-class="block-outer-opposite" />
		</div>
		<div class="block-container">
			<div class="block-body">
				<xf:datalist>
					<xf:foreach loop="$displayGroups" key="$displayGroupId" value="$displayGroup">
						<xf:if is="{$fieldsGrouped.{$displayGroupId}} is not empty">
							<tbody class="dataList-rowGroup">
								<xf:datarow rowtype="subsection" rowclass="dataList-row--noHover">
									<xf:cell colspan="2">{$displayGroup}</xf:cell>
								</xf:datarow>
								<xf:foreach loop="{$fieldsGrouped.{$displayGroupId}}" value="$field">
									<xf:datarow
										label="{$field.title|htmlspecialchars}"
										href="{{ link($prefix . '/edit', $field) }}"
										delete="{{ link($prefix . '/delete', $field) }}"
										hash="{$field.field_id}">
										<xf:hint>
											{$fieldTypes.{$field.field_type}.label}
										</xf:hint>
									</xf:datarow>
								</xf:foreach>
							</tbody>
						</xf:if>
					</xf:foreach>
				</xf:datalist>
			</div>
			<div class="block-footer">
				<span class="block-footer-counter">{{ display_totals($displayGroups) }}</span>
			</div>
		</div>
	</xf:form>
<xf:else />
	<div class="blockMessage">{{ phrase('no_items_have_been_created_yet') }}</div>
</xf:if>