<!--// $Id$ //-->
<TABLE class="lmsbox">
	<THEAD>
	<TR>
		<TD style="width: 100%;" class="hand text-left bold nobr" onClick="showOrHide('promotiontariffs');">
			{icon name="money"}
			{if empty($promotion.tariffs)}{$count = 0}{else}{$count = count($promotion.tariffs)}{/if}
			{t a=$count}Promotion's Tariffs ($a):{/t}
		</TD>
	</TR>
	</THEAD>
	<TBODY>
	<TR id="promotiontariffs" style="display:none;">
		<TD style="width: 100%;">
			<TABLE class="lmsbox-inner lms-ui-background-cycle">
				<colgroup>
					<col style="width: 94%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
				</colgroup>
				<THEAD>
				<TR class="fbottom">
					<TD class="bold nobr">
						{trans("Name")}
						{trans("(taxation)")}
					</TD>
					<TD class="text-right nobr">{trans("ID")}</TD>
					<TD class="nobr">{trans("Type")}</TD>
					<TD class="text-right bold nobr">{trans("Value")}</TD>
					<TD class="text-right nobr">{trans("Downceil")}</TD>
					<TD class="text-right nobr">{trans("Upceil")}</TD>
					<TD>&nbsp;</TD>
				</TR>
				</THEAD>
				<TBODY>
				{foreach $promotion.tariffs as $tariff}
				<TR class="highlight">
					<TD class="bold nobr" onClick="return self.location.href='?m=tariffinfo&id={$tariff.id}';">
						{$tariff.name}
						{if ($tariff.flags & $smarty.const.TARIFF_FLAG_NET_ACCOUNT) > 0}
							{trans("(net)")}
						{else}
							{trans("(gross)")}
						{/if}
					</TD>
					<TD class="text-right nobr" onClick="return self.location.href='?m=tariffinfo&id={$tariff.id}';">
						({$tariff.id|string_format:"%04d"})
					</TD>
					<TD class="nobr">
						{$_SERVICETYPES[$tariff.type]}
					</TD>
					<TD class="bold nobr" onClick="return self.location.href='?m=tariffinfo&id={$tariff.id}';">
						{if ($tariff.flags & $smarty.const.TARIFF_FLAG_NET_ACCOUNT) > 0}
							{Localisation::smartFormatNumber($tariff.netvalue)}
						{else}
							{Localisation::smartFormatNumber($tariff.value)}
						{/if}
					</TD>
					<TD class="nobr" onClick="return self.location.href='?m=tariffinfo&id={$tariff.id}';">
						{if $tariff.downceil}{$tariff.downceil} kbit/s{else}-{/if}
					</TD>
					<TD class="nobr" onClick="return self.location.href='?m=tariffinfo&id={$tariff.id}';">
						{if $tariff.upceil}{$tariff.upceil} kbit/s{else}-{/if}
					</TD>
					<TD>
						{button type="link" class="delete-promotiontariff" icon="delete" tip="Delete assignment"
							href="?m=promotionedit&action=tariffdel&id={$promotion.id}&tid={$tariff.id}"}
					</TD>
				</TR>
				{foreachelse}
				<tr>
					<td colspan="7" class="empty-table">
						{trans("This promotion has no assigned tariffs.")}
					</td>
				</tr>
				{/foreach}
				</TBODY>
			</TABLE>
		</TD>
	</TR>
	</TBODY>
</TABLE>
<script>

	if (getCookie('promotiontariffs') == '1') {
		$('#promotiontariffs').show();
	}

	$('.delete-promotiontariff').click(function() {
		confirmDialog($t("Are you sure, you want to delete this assignment?"), this).done(function() {
			location.href = $(this).attr('href');
		});
		return false;
	});

</script>
