<xf:if is="$navigation.isInsert()">
	<xf:title>{{ phrase('add_navigation') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_navigation:') }} {$navigation.title}</xf:title>
</xf:if>

<xf:pageaction>
	<xf:if is="$navigation.canDelete()">
		<xf:button href="{{ link('navigation/delete', $navigation) }}" icon="delete" overlay="true" />
	</xf:if>
	<xf:if is="$navigation.is_customized">
		<xf:button href="{{ link('navigation/revert', $navigation) }}" overlay="true">{{ phrase('revert') }}</xf:button>
	</xf:if>
</xf:pageaction>

<xf:if is="$navigation.is_customized">
	<div class="blockMessage blockMessage--important blockMessage--iconic">
		{{ phrase('this_navigation_customized_your_changes_maintained') }}
	</div>
</xf:if>

<xf:if is="$xf.development AND $navigation.addon_id">
	<div class="blockMessage blockMessage--warning">
		{{ phrase('user_customizations_to_navigation_maintained_addon_upgrade') }}
	</div>
</xf:if>

<xf:form action="{{ link('navigation/save', $navigation) }}" class="block" ajax="true">
	<div class="block-container">
		<div class="block-body">
			<xf:textboxrow name="navigation_id" value="{$navigation}" readonly="{{ !$navigation.canEdit() }}"
				label="{{ phrase('navigation_id') }}"
				dir="ltr" />

			<xf:textboxrow name="title" value="{$navigation}"
				readonly="{{ !$navigation.canEdit() }}"
				label="{{ phrase('title') }}" />

			<xf:selectrow name="parent_navigation_id" value="{$navigation}"
				label="{{ phrase('parent_navigation_entry') }}">

				<xf:option value="">&nbsp;</xf:option>
				<xf:foreach loop="$navigationTree.getFlattened()" value="$treeEntry">
					<xf:option value="{$treeEntry.record.navigation_id}">{{ repeat('--', $treeEntry.depth) }}
						{$treeEntry.record.title}
					</xf:option>
				</xf:foreach>
			</xf:selectrow>

			<xf:macro id="display_order_macros::row" arg-value="{$navigation}" />

			<xf:radiorow name="navigation_type_id" value="{$selectedType}"
				label="{{ phrase('type') }}">

				<xf:foreach loop="$typeHandlers" key="$type" value="$handler">
					<xf:option value="{$type}" data-xf-init="disabler" data-container=".js-navTypeForm--{$type}" data-hide="true">{{ $handler.getTitle() }}</xf:option>
				</xf:foreach>
			</xf:radiorow>

			<hr class="formRowSep" />

			<xf:foreach loop="$typeHandlers" key="$type" value="$handler">
				<div class="js-navTypeForm js-navTypeForm--{$type}">
					{{ $handler.renderEditForm($navigation, $navigation.navigation_type_id == $type ? $navigation.type_config : [], 'config[' . $type . ']')|raw }}
				</div>
			</xf:foreach>

			<hr class="formRowSep" />

			<xf:checkboxrow>
				<xf:option name="enabled" selected="{$navigation.enabled}">{{ phrase('enabled') }}</xf:option>
			</xf:checkboxrow>

			<xf:macro id="addon_macros::addon_edit" arg-addOnId="{$navigation.addon_id}" />

		</div>

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