<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 if="$navigation.isUpdate()">
	<xf:button href="{{ link('admin-navigation/delete', $navigation) }}" icon="delete" overlay="true" />
</xf:pageaction>

<xf:form action="{{ link('admin-navigation/save', $navigation) }}" class="block" ajax="true">
	<div class="block-container">
		<div class="block-body">
			<xf:textboxrow name="navigation_id" value="{$navigation}"
				label="{{ phrase('admin_navigation_id') }}"
				dir="ltr" />
			<xf:textboxrow name="title" value="{$navigation}"
				label="{{ phrase('title') }}" />
			<xf:textboxrow name="link" value="{$navigation}"
				label="{{ phrase('link') }}"
				dir="ltr" />
			<xf:textboxrow name="icon" value="{$navigation}"
				label="{{ phrase('font_awesome_icon') }}"
				explain="{{ phrase('admin_navigation_icon_explain') }}"
				dir="ltr" />

			<hr class="formRowSep" />

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

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

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

			<hr class="formRowSep" />

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

				<xf:option>&nbsp;</xf:option>
				<xf:foreach loop="$adminPermissions" value="$adminPermission">
					<xf:option value="{$adminPermission.admin_permission_id}">{$adminPermission.title}</xf:option>
				</xf:foreach>
			</xf:selectrow>
			<xf:checkboxrow>
				<xf:option name="debug_only" selected="$navigation.debug_only">{{
					phrase('display_this_navigation_in_debug_mode_only') }}
				</xf:option>
				<xf:option name="development_only" selected="$navigation.development_only">{{
					phrase('display_this_navigation_in_development_mode_only') }}
				</xf:option>
				<xf:option name="hide_no_children" selected="$navigation.hide_no_children">{{
					phrase('hide_this_navigation_when_there_no_viewable_children') }}
				</xf:option>
			</xf:checkboxrow>

			<hr class="formRowSep" />

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

		</div>

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