<div class="header">{#Shop_couponcodes_title#}</div>

  <form action="" method="post">
  <div class="header_inf">
	  {if $smarty.request.show==all || $smarty.request.show==''}
	  {assign var='selected' value='selected'}
	  {/if}
      <select class="input" name="show">
      <option value="all" {$selected}>Alle</option>
       <option value="free" {if $smarty.request.show==free}selected="selected"{/if}>Ungenutzte</option>
        <option value="red" {if $smarty.request.show==red}selected="selected"{/if}>Eingel&ouml;ste</option>
      </select>
	<select class="input" name="limit">
	  {section name=lim loop=100 step=10}
	  <option value="{$smarty.section.lim.index+10}" {if $smarty.section.lim.index+10==$smarty.request.limit}selected="selected" {/if}>{$smarty.section.lim.index+10} {#DataRecords#}</option>
	  {/section}
      </select>
		<input type="submit" class="button" value="{#Global_Show#}">
    </div>
</form>

<form action="" method="post" name="kform">
<div class="subheaders">{#Shop_couponcodes_hinf#}</div>
 <table width="100%"  border="0" cellpadding="4" cellspacing="0" class="tableborder">
    <tr>
      <td width="2%" class="headers">{#Shop_couponcodes_coupon#}</td>
      <th width="2%" class="headers">{#Shop_couponcodes_cval#}</th>
      <th width="2%" class="headers">{#Shop_couponcodes_cmin#}</th>
      <th width="2%" class="headers">{#Shop_couponcodes_cmulti#}</th>
      <th width="100" class="headers">{#Shop_couponcodes_cguest#}</th>
      <th width="2%" class="headers">{#Shop_couponcodes_cgtill#}</th>
      <th width="2%" class="headers">{#Shop_couponcodes_cinfos#}</th>
      <td class="headers"><label {popup sticky=$config_vars.POPSTICKY  text=$config_vars.Global_SelAll width=100}><input name="allbox" type="checkbox" id="d" onclick="selall();" value="" /></label></td>
    </tr>
    {foreach from=$codes item=c}
    <tr class="{cycle name=pm values='first,second'}">
      <td width="80" class="row_spacer">
	  <input class="input" name="Code[{$c->Id}]" type="text" size="9" maxlength="10" value="{$c->Code}" {if $c->Eingeloest>1}disabled{/if} />
	  {if $c->Eingeloest>1}
	  <input type="hidden" name="Code[{$c->Id}]" value="{$c->Code}">
	  {/if}	  </td>
      <td align="center" nowrap="nowrap" class="row_spacer">
	  <input class="input"  name="Wert[{$c->Id}]" type="text" value="{if $c->Typ=='pro'}{$c->Wert}{else}{$c->Wert|string_format:'%.2f'}{/if}" size="5" maxlength="8" {if $c->Eingeloest>1}disabled{/if}>
	  
	  <select class="input" name="Typ[{$c->Id}]" {if $c->Eingeloest>1}disabled{/if}>
	  <option value="pro" {if $c->Typ=='pro'}selected="selected"{/if}>%</option>
	   <option value="wert" {if $c->Typ=='wert'}selected="selected"{/if}>-</option>
	   </select>	  </td>
      <td align="center" class="row_spacer"><input class="input"  name="MinBestellwert[{$c->Id}]" type="text" size="8" maxlength="10" value="{$c->MinBestellwert|string_format:'%.2f'}" {if $c->Eingeloest>1}disabled readonly{/if} /></td>
      <td align="center"class="row_spacer" nowrap="nowrap">
	  <label><input type="radio" name="Endlos[{$c->Id}]" value="1" {if $c->Endlos==1}checked{/if} {if $c->Eingeloest>1}disabled{/if}>{#Yes#}</label>
	  <label><input type="radio" name="Endlos[{$c->Id}]" value="0" {if $c->Endlos!=1}checked{/if} {if $c->Eingeloest>1}disabled{/if}>{#No#}</label></td>
      <td align="center" nowrap="nowrap" class="row_spacer">
      <label><input type="radio" name="Gastbestellung[{$c->Id}]" value="1" {if $c->Gastbestellung==1}checked{/if} {if $c->Eingeloest>1}disabled{/if}>{#Yes#}</label>
	  <label><input type="radio" name="Gastbestellung[{$c->Id}]" value="0" {if $c->Gastbestellung!=1}checked{/if} {if $c->Eingeloest>1}disabled{/if}>{#No#}</label>      </td>
      <td align="center" nowrap="nowrap" class="row_spacer">
     {if $c->Eingeloest>1}
     {$c->GueltigBis|date_format:'%d.%m.%Y'}
     {else}
        <input class="input" id="dateinput_{$c->Id}" name="GueltigBis[{$c->Id}]" type="text" size="8" maxlength="10" value="{$c->GueltigBis|date_format:'%d.%m.%Y'}" {if $c->Eingeloest>1}disabled{/if} />      
      {/if}      </td>
      <td align="center" nowrap="nowrap" class="row_spacer"><a  {popup sticky=$config_vars.POPSTICKY  width=250 text=$c->InfT sticky=true caption='Info' closetext=$config_vars.Global_C} href="javascript:void(0)"><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></a></td>
     <td class="row_spacer">
    
     <label {popup sticky=$config_vars.POPSTICKY  text=$config_vars.Global_Delete width=100}><input class="absmiddle" name="Del[{$c->Id}]" type="checkbox" id="Del[]" value="1"><img class="absmiddle" src="{$imgpath}/delete.png" alt="" border="" /></label></td>
    </tr>
    {/foreach}
  </table>
  
  <input type="submit" class="button big" value="{#Save#}">
  <input name="save" type="hidden" id="save" value="1" />
</form>
{if $navi}
  <div class="navi_div">
  {$navi}
  </div>
  {/if}

<br />

<form method="post" action="">
<fieldset>
<legend>{#Shop_couponcodes_new#}</legend>

<table width="100%"  border="0" cellpadding="3" cellspacing="0">
<tr>
  <th width="2%" class="headers">{#Shop_couponcodes_coupon#}</th>
  <th width="2%" class="headers">{#Shop_couponcodes_cval#}</th>
  <th width="2%" class="headers">{#Shop_couponcodes_cmin#}</th>
  <th width="2%" class="headers">{#Shop_couponcodes_cmulti#}</th>
  <th width="100" class="headers">{#Shop_couponcodes_cguest#}</th>
  <td class="headers">{#Shop_couponcodes_cgtill#}</td>
  </tr>
{foreach from=$nc item=n}
{assign var=cnn value=$cnn+1}
<tr class="{cycle name=pm values='second,first'}">
<td>
<input class="input" size="9" maxlength="10" type="text" name="Code[{$cnn}]" value="{$n|upper}"></td>
<td nowrap="nowrap" class="row_spacer">
  <input class="input" name="Wert[{$cnn}]" type="text" value="10" size="5" maxlength="8" />
  <select class="input" name="Typ[{$cnn}]">
	  <option value="pro">%</option>
	   <option value="wert">-</option>
</select></td>
<td align="center" class="row_spacer"><input class="input" name="MinBestellwert[{$cnn}]" type="text" size="8" maxlength="10" value="0.00"/></td>
<td align="center" nowrap="nowrap" class="row_spacer">
<label><input type="radio" name="Endlos[{$cnn}]" value="1" checked>{#Yes#}</label>
<label><input type="radio" name="Endlos[{$cnn}]" value="0" >{#No#}</label></td>
<td align="center" nowrap="nowrap" class="row_spacer">
<label><input type="radio" name="Gastbestellung[{$cnn}]" value="1" checked="checked">{#Yes#}</label>
<label><input type="radio" name="Gastbestellung[{$cnn}]" value="0">{#No#}</label>
</td>
<td nowrap="nowrap" class="row_spacer">
  <input id="dateinput2_{$cnn}" class="input" name="GueltigBis[{$cnn}]" type="text" size="12" maxlength="10" value="{$new_till|date_format:'%d.%m.%Y'}"/></td>
</tr>
{/foreach}
</table>
<input class="button big" type="submit" value="{#Save#}" />
  <input name="new" type="hidden" id="new" value="1" />
</fieldset>
</form>
<script language="javascript" src="{$jspath}/calendar.js" type="text/javascript"></script>
<style type="text/css" media="screen,projection">
@import url({$csspath}/calendar.css);
</style>


<script type="text/javascript">
			jQuery(function($){ldelim}
			$.datepicker.setDefaults({ldelim}
			{include file="$incpath/other/calendar.conf.tpl"}
			 {rdelim}); 
	
			{foreach from=$codes item=c name=dp}
				$("#dateinput_{$c->Id}").attachDatepicker();
			{/foreach}
			{foreach from=$nc item=n}
			{assign var=xcnn value=$xcnn+1}
				$("#dateinput2_{$xcnn}").attachDatepicker();
			{/foreach}
			{rdelim});
</script>
 