<xf:if is="$advertisingPosition.isInsert()">
	<xf:title>{{ phrase('add_advertising_position') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_advertising_position:') }} {$advertisingPosition.title}</xf:title>
</xf:if>

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

<xf:form action="{{ link('advertising/positions/save', $advertisingPosition) }}" class="block" ajax="true">
	<div class="block-container">
		<div class="block-body">

			<xf:textboxrow name="position_id" value="{$advertisingPosition.position_id}"
				maxlength="{{ max_length($advertisingPosition, 'position_id') }}"
				label="{{ phrase('position_id') }}"
				dir="ltr" />

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

			<xf:codeeditorrow name="description" value="{$advertisingPosition.MasterDescription.phrase_text}"
				mode="html" data-line-wrapping="true"
				class="codeEditor--autoSize codeEditor--proportional"
				label="{{ phrase('description') }}"
				hint="{{ phrase('you_may_use_html') }}" />

			<xf:formrow rowtype="input"
				label="{{ phrase('arguments') }}"
				explain="{{ phrase('list_arguments_that_this_advertising_position_requires') }}">

				<ul class="listPlain inputGroup-container">
					<xf:foreach loop="$advertisingPosition.arguments" key="$counter" value="$argument">
						<li class="inputGroup">
							<xf:textbox name="arguments[{$counter}][argument]" value="{$argument.argument}" placeholder="{{ phrase('name_of_argument') }}" size="20" />
							<span class="inputGroup-splitter"></span>

							<xf:checkbox value="{$argument.required}" standalone="true">
								<xf:option name="arguments[{$counter}][required]" value="1" labelclass="inputGroup-text">{{ phrase('required') }}</xf:option>
							</xf:checkbox>
						</li>
					</xf:foreach>

					<li class="inputGroup" data-xf-init="field-adder" data-increment-format="arguments[{counter}]">
						<xf:textbox name="arguments[{$nextCounter}][argument]" placeholder="{{ phrase('name_of_argument') }}" size="20" />
						<span class="inputGroup-splitter"></span>

						<xf:checkbox standalone="true">
							<xf:option name="arguments[{$nextCounter}][required]" value="1" labelclass="inputGroup-text">{{ phrase('required') }}</xf:option>
						</xf:checkbox>
					</li>
				</ul>
			</xf:formrow>

			<xf:checkboxrow>
				<xf:option name="active" value="1" selected="$advertisingPosition.active">{{ phrase('advertising_position_is_active') }}</xf:option>
			</xf:checkboxrow>

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