<div class="box_innerhead">{#Shop_go_myorders#}</div>
{if $smarty.session.user_group==2}
{#Shop_myListError#}
{else}
<script language="javascript" type="text/javascript">
<!-- //
function OrderShow(id,act)
{ldelim}
	var html = document.getElementById(id).innerHTML;
	html = html.replace(/&lt;/gi, '<' );
	html = html.replace(/&gt;/gi, '>' );
	var act = (act == 'preform') ? '<pre>' : '';
	var pFenster = window.open( '', null, 'height=600,width=780,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes' ) ;
	var HTML = '<html><head ></head><body style="font-family:arial,verdana;font-size:12px"><div align="center"><input type="button" value="{#Print#}" onclick="window.print();" /></div><hr noshade="noshade" size="1" />'+ act + html + '</body></html>' ;
	pFenster.document.write(HTML);
	pFenster.document.close();
{rdelim}

function OrderRequest(id)
{ldelim}
	var text = 'Sehr geehrte Damen und Herren,\nich habe eine Frage zu der Bestellung %%ORDER%%\n\n%%USER%%';
	text = text.replace(/%%ORDER%%/gi, id);
	text = text.replace(/%%USER%%/gi, '{$smarty.session.benutzer_vorname} {$smarty.session.benutzer_nachname}');
	
	document.getElementById('request').style.display='';
	document.getElementById('request_form').style.display='';
	document.getElementById('requestsubject').value = 'Anfrage zu Bestellung: ' + id + ' ';
	document.getElementById('request_text').value = text;
	document.getElementById('out_me').style.display='none';
{rdelim}
// -->
</script>


<script language="javascript" src="{$jspath}/jvalidate.js" type="text/javascript"></script>



<script type="text/javascript">
<!-- //
{include file="$incpath/other/validate_conf.tpl"}
{literal}
$.validator.setDefaults({
	submitHandler: function() 
	{ 
		document.forms['cf'].submit(); 
	}
});

$().ready(function() {
	// validate the comment form when it is submitted
	$("#requestform").validate(
	{ // validate
	rules: { // rules
				subject: {required: true,minLength:5},
				text: {required: true,minLength:50}
			} // end rules
			, // messages
			messages: 
			{
			}
	} // end validate
	);
}
)
// -->
</script>
{/literal}

{#Shop_myorders_inf#}
<br /> 
<br /> 
{if $msg}
<div id="out_me" class="ok_info_box">
{$msg}
</div>
{/if}



<div id="request" style="display:none">
<div class="shop_headers">Anfrage</div>
<div id="ShopOrderRequestDiv"></div>
<div id="request_form">
<form class="cmxform" id="requestform" name="cf" method="post" action="">
<input type="hidden" name="sub" value="sendrequest" />
      
	  <fieldset>
      <legend>Betreff</legend>
      
	  
	  <input class="input" id="requestsubject" name="subject" style="width: 97%;" type="text" />
	 
     </fieldset>
   <br />
    <fieldset>
      <legend>Nachricht</legend>
	
    
      <textarea class="input" id="request_text" name="text" rows="5" cols="5" style="width: 97%;"></textarea>
      
   <br />
   <input class="button" value="Anfrage abschicken" type="submit" />
  </fieldset>
  </form>
  </div>
</div>


<div class="infobox">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td width="100"><strong>{#Date#}</strong></td>
    <td width="100" align="center"><strong>{#Shop_f_ovall#}</strong></td>
    <td width="100" align="center"><strong>{#Shop_status#}</strong></td>
    <td><strong>{#Global_Action#}</strong></td>
  </tr>
  {foreach from=$orders_array item=o}
  <tr>
    <td width="100">{$o->Datum|date_format:$config_vars.DateFomat}</td>
    <td width="100" align="center">{$o->Betrag|numformat} {$currency_symbol}</td>
    <td width="100" align="center" {popup text=$o->SText}><div class="shop_status_{$o->Status}">&nbsp;</div></td>
    <td>
    <a style="text-decoration:none" href="javascript:OrderShow('h_{$o->Id}');"><img class="absmiddle" src="{$imgpath}/shop/search_small.png" alt="" border="0" />&nbsp;{#Shop_myorders_show#}</a>&nbsp;&nbsp;
    <a style="text-decoration:none" href="javascript:void(0);" onclick="OrderRequest({$o->Id})"><img class="absmiddle" src="{$imgpath}/shop/odrerrequest.png" alt="" border="0" />&nbsp;{#Shop_myorders_request#}</a>
      <textarea style="display: none;" cols="1" rows="1" id="h_{$o->Id}">{$o->Bestellung|koobispecialchars}</textarea>    </td>
  </tr>
  {/foreach}
</table>
</div>
<br />

{if $pages}
{$pages}
{/if}
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td>{#Shop_status#}:  <a href="index.php?p=shop&amp;action=myorders&amp;show=ok">{#Shop_status_ok#}</a></td>
    <td align="right"><strong>{$orders_summ->Betrag|numformat}</strong> {$currency_symbol}</td>
  </tr>
  <tr>
    <td>{#Shop_status#}: <a href="index.php?p=shop&amp;action=myorders&amp;show=wait">{#Shop_status_wait#}</a></td>
    <td align="right"><strong>{$orders_summWait->Betrag|numformat}</strong> {$currency_symbol}</td>
  </tr>
  <tr>
    <td>{#Shop_status#}: <a href="index.php?p=shop&amp;action=myorders&amp;show=failed">{#Shop_status_failed#}</a></td>
    <td align="right"><strong>{$orders_summFailed->Betrag|numformat}</strong> {$currency_symbol}</td>
  </tr>
</table>

{/if}