<xf:if is="$userGroupPromotion.isInsert()">
	<xf:title>{{ phrase('add_promotion') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_promotion:') }} {$userGroupPromotion.title}</xf:title>
</xf:if>

<xf:pageaction if="$userGroupPromotion.isUpdate()">
	<xf:button href="{{ link('user-group-promotions/delete', $userGroupPromotion) }}" icon="delete" overlay="true" />
</xf:pageaction>

<xf:form action="{{ link('user-group-promotions/save', $userGroupPromotion) }}" ajax="true" class="block">
	<div class="block-container">
		<h2 class="block-tabHeader tabs hScroller" data-xf-init="tabs h-scroller" role="tablist">
			<span class="hScroller-scroll">
				<a class="tabs-tab is-active" role="tab" tabindex="0" aria-controls="promotion-options">{{ phrase('promotion_options') }}</a>
				<xf:macro template="helper_criteria" name="user_tabs"
					arg-userTabTitle="{{ phrase('apply_this_promotion_while') }}" />
			</span>
		</h2>

		<ul class="tabPanes block-body">
			<li class="is-active" role="tabpanel" id="promotion-options">
				<xf:textboxrow name="title" value="{$userGroupPromotion.title}"
					maxlength="{{ max_length($userGroupPromotion, 'title') }}"
					label="{{ phrase('title') }}" />

				<xf:checkboxrow>
					<xf:option name="active" selected="$userGroupPromotion.active">{{ phrase('promotion_is_active') }}</xf:option>
				</xf:checkboxrow>

				<hr class="formRowSep" />

				<xf:checkboxrow rowid="addUserGroups" name="extra_user_group_ids[]" value="{$userGroupPromotion.extra_user_group_ids}"
					listclass="listColumns"
					label="{{ phrase('add_user_to_user_groups') }}">

					<xf:hint>
						<xf:checkbox standalone="true">
							<xf:option check-all="#addUserGroups" label="{{ phrase('select_all') }}" />
						</xf:checkbox>
					</xf:hint>
					<xf:options source="$userGroups" />
				</xf:checkboxrow>
			</li>

			<xf:macro template="helper_criteria" name="user_panes"
				arg-criteria="{{ $userCriteria.getCriteriaForTemplate() }}"
				arg-data="{{ $userCriteria.getExtraTemplateData() }}" />
		</ul>

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