<xf:if is="$permission.isInsert()">
	<xf:title>{{ phrase('add_permission') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_permission:') }} {$permission.title}</xf:title>
</xf:if>

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

<xf:form action="{{ link('permission-definitions/permissions/save', $permission) }}" ajax="true" class="block">

	<div class="block-container">
		<div class="block-body">
			<xf:textboxrow name="permission_group_id" value="{$permission.permission_group_id}"
				maxlength="{{ max_length($permission, 'permission_group_id') }}"
				label="{{ phrase('permission_group') }}"
				dir="ltr" />
			<xf:textboxrow name="permission_id" value="{$permission.permission_id}"
				maxlength="{{ max_length($permission, 'permission_id') }}"
				label="{{ phrase('permission_id') }}"
				dir="ltr" />

			<xf:textboxrow name="title" value="{{ $permission.exists() ? $permission.MasterTitle.phrase_text : '' }}"
				label="{{ phrase('title') }}" />

			<xf:textboxrow name="depend_permission_id" value="{$permission.depend_permission_id}"
				maxlength="{{ max_length($permission, 'depend_permission_id') }}"
				label="{{ phrase('depends_on_permission_id') }}"
				hint="{{ phrase('must_be_in_same_permission_group') }}" />

			<hr class="formRowSep" />

			<xf:radiorow name="permission_type" value="{$permission.permission_type}"
				label="{{ phrase('permission_type') }}">

				<xf:option value="flag">{{ phrase('flag') }}</xf:option>
				<xf:option value="integer">{{ phrase('integer') }}</xf:option>
			</xf:radiorow>

			<hr class="formRowSep" />

			<xf:selectrow name="interface_group_id" value="{$permission.interface_group_id}"
				label="{{ phrase('interface_group') }}">

				<xf:option value="" />
				<xf:foreach loop="$interfaceGroups" value="$interfaceGroup">
					<xf:option value="{$interfaceGroup.interface_group_id}">{$interfaceGroup.title}</xf:option>
				</xf:foreach>
			</xf:selectrow>

			<xf:macro template="display_order_macros" name="row"
				arg-value="{$permission.display_order}" />

			<hr class="formRowSep" />

			<xf:macro template="addon_macros" name="addon_edit" arg-addOnId="{$permission.addon_id}" />
		</div>
		<xf:submitrow sticky="true" icon="save" />
	</div>

</xf:form>