<xf:if is="$admin.isInsert()">
	<xf:title>{{ phrase('add_administrator') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_administrator:') }} {$admin.username}</xf:title>
</xf:if>

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

<xf:form action="{{ link('admins/save', $admin) }}" class="block" ajax="true">
	<div class="block-container">
		<div class="block-body">
			<xf:passwordboxrow name="visitor_password"
				label="{{ phrase('your_password') }}"
				explain="{{ phrase('you_must_enter_your_current_password_to_validate_this_request') }}" />

			<hr class="formRowSep" />

			<xf:if is="!$admin.user_id">
				<xf:textboxrow name="username" ac="single"
					label="{{ phrase('user') }}" />
			</xf:if>

			<xf:checkboxrow name="extra_user_group_ids" value="{$admin.extra_user_group_ids}" listclass="listColumns"
				label="{{ phrase('add_user_to_user_groups') }}">
				<xf:hint><br />
					<xf:checkbox standalone="true"><xf:option check-all="< .formRow" label="{{ phrase('select_all') }}" /></xf:checkbox>
				</xf:hint>
				<xf:options source="$userGroups" />
			</xf:checkboxrow>

			<hr class="formRowSep" />

			<xf:checkboxrow>
				<xf:option name="advanced" selected="{$admin.advanced}">{{ phrase('show_advanced_control_panel_options') }}</xf:option>
			</xf:checkboxrow>

			<hr class="formRowSep" />

			<xf:radiorow name="is_super_admin" value="{$admin.is_super_admin}"
				label="{{ phrase('administrator_type') }}">

				<xf:option value="1"
					label="{{ phrase('super_administrator') }}"
					hint="{{ phrase('super_admins_have_all_admin_permissions_and_can_manage_other_admins') }}" />
				<xf:option value="0" data-hide="true" data-xf-init="disabler" data-container=".js-adminPermissions"
					label="{{ phrase('regular_administrator') }}" />
			</xf:radiorow>

			<div class="js-adminPermissions">
				<xf:checkboxrow name="permission_cache" value="{{ array_keys($admin.permission_cache) }}" listclass="listColumns"
					label="{{ phrase('permissions') }}">
					<xf:hint><br />
						<xf:checkbox standalone="true"><xf:option check-all="< .formRow" label="{{ phrase('select_all') }}" /></xf:checkbox>
					</xf:hint>
					<xf:options source="$permissions" />
				</xf:checkboxrow>
			</div>
		</div>
		<xf:submitrow sticky="true" icon="save" />
	</div>
</xf:form>