{extends file="layout.html"}
{block name=title}LMS: {$layout.pagetitle|striphtml}{/block}
{block name=module_content}
<!-- $Id$ -->
<h1>{$layout.pagetitle}</h1>

<form method="post" name="promotionadd" id="promotionadd" action="?m=promotionadd">
</form>

<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 1%;">
		<col style="width: 98%;">
	</colgroup>
	<thead>
		<TR>
			<td>
				{icon name="money"}
			</td>
			<td>
				<strong>{trans("Name")}</strong>
			</td>
			<td>
				<input type="text" name="promotion[name]" value="{$promotion.name|escape}" size="40" form="promotionadd"
					{tip text="Enter promotion name" trigger="name" bold=1}
					required>
			</td>
		</TR>
	</thead>
	<tbody>
		<tr>
			<td>
				{icon name="period"}
			</td>
			<td>
				<strong>{trans("Period")}</strong>
			</td>
			<td>
				{trans("from")}
				<input type="text" name="promotion[datefrom]" form="promotionadd"
					value="{if $promotion.datefrom}{$promotion.datefrom}{/if}"
					placeholder="{trans("yyyy/mm/dd")}" size="10"
					{tip class="lms-ui-date lms-ui-date-unix" text="Enter tariff start date in YYYY/MM/DD format. If you don't want to define 'From' date leave this field empty" trigger="datefrom"}>
				{trans("to")}
				<input type="text" name="promotion[dateto]" form="promotionadd"
					value="{if $promotion.dateto}{$promotion.dateto}{/if}"
					placeholder="{trans("yyyy/mm/dd")}" size="10"
					{tip class="lms-ui-date lms-ui-date-unix" text="Enter tariff end date in YYYY/MM/DD format. Leave this field empty if you don't want to set expiration date" trigger="dateto"}>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="optional-info"}
			</td>
			<td>
				<strong>{trans("Description")}</strong>
			</td>
			<td>
				<textarea name="promotion[description]" cols="50" rows="5" form="promotionadd"
					{tip text="Enter additional information (optional)"}>{$promotion.description|escape}</textarea>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="import"}
			</td>
			<td class="nobr">
				<strong>{trans("New files")}</strong>
			</td>
			<td>
				{$item_custom_contents = array()}
				{foreach $fileupload.attachments as $fileidx => $file}
					{capture assign="item_custom_content"}{strip}
						<label>
							<input type="checkbox" name="fileupload[attachments][{$fileidx}][checked]"
								value="1" form="promotionadd" {if $file.checked} checked{/if}>
							{trans("default checked")}
						</label>
						<input size="10" type="text" name="fileupload[attachments][{$fileidx}][label]"
							value="{$file.label}" form="promotionadd" placeholder="{trans("text label")}">
					{/strip}{/capture}
					{$item_custom_contents[] = $item_custom_content}
				{/foreach}
				{capture assign="new_item_custom_content"}{strip}
					<label>
						<input type="checkbox" name="fileupload[attachments][%idx%][checked]"
							value="1" form="promotionadd">
						{trans("default checked")}
					</label>
					<input size="10" type="text" name="fileupload[attachments][%idx%][label]"
						value="" form="promotionadd" placeholder="{trans("text label")}">
				{/strip}{/capture}
				{fileupload id="attachments" fileupload=$fileupload form="promotionadd"
					item_custom_contents=$item_custom_contents
					new_item_custom_content=$new_item_custom_content}
			</td>
		</tr>
		<tr>
			<td class="lms-ui-box-buttons" colspan="3">
				{button type="submit" icon="save" label="Submit" form="promotionadd"}
				{button icon="cancel" label="Cancel" href="?m=promotionlist"}
				<label>
					<input type="checkbox" name="promotion[reuse]" value="ON" id="reuse" form="promotionadd"
						{if $promotion.reuse} checked{/if}>
					{trans("Display this form again, when this promotion is saved")}
				</label>
			</td>
		</tr>
	</tbody>
</table>

<script>

	$('[name="promotion[name]"]').focus();

</script>
{/block}
