{include file="header.tpl"}

<h3>{t}RCB Requests{/t}</h3>

<script type="text/javascript">
{literal}
function go(p) {
  document.nav.p.value = p;
  document.nav.submit();
}
{/literal}
</script>

<div class="refbacks">
<table class="form">
<tr>
 <th>{t}Active Requests:{/t}</th>
 <td>{$totals.active|intval}</td>
</tr>
<tr>
 <th>{t}Processed Requests:{/t}</th>
 <td>{$totals.processed|intval}</td>
</tr>
<tr>
 <th>{t}RCB Received:{/t}</th>
 <td>${$totals.received|number_format:2}</td>
</tr>
<tr>
 <th>{t}RCB Pending:{/t}</th>
 <td>${$totals.pending|number_format:2}</td>
</tr>
</table>
<br>
<form name="nav" action="">
<input type=hidden name=p>
<input type=hidden name=a value="refback_requests">
<select name="status" class=inpts onchange="document.nav.submit()">
<option value="0"{if $frm.status == 0} selected{/if}>New</option>
<option value="1"{if $frm.status == 1} selected{/if}>Processed</option>
<option value="2"{if $frm.status == 2} selected{/if}>Declined</option>
</select>
<input type="submit" value="Go">
</form>
<br>
{if $frm.display == 'deleted'}
<div class="ok">{t}Request has been successfully deleted{/t}</div>
{/if}
{if $refbacks}
{section name=s loop=$refbacks}
<table class="list">
<tr>
 <th>{t}Request{/t}
{if $frm.status == 0}
  <a href="{"?a=refback_requests&action=delete&id=`$refbacks[s].id`"|encurl}" class="staff" onclick="return confirm('{t}Do you really want to remove this request?{/t}')">{t}Delete{/t}</a>
{/if}
</th>
 <th>{t}Refback{/t}</th>
</tr>
<tr class="info">
 <td valign=top>
<table class="form">
  <tr><th>{t}Program{/t}</th><td><a href="{"?a=details&lid=`$refbacks[s].listing_id`"|encurl}" target="_blank">{$refbacks[s].program_name}</a></td></tr>
  <tr><th>{t}Date{/t}</th><td>{$refbacks[s].date_added} {$refbacks[s].time_added}</td></tr>
  <tr><th>{t}Username{/t}</th><td>{$refbacks[s].username}</td></tr>
  <tr><th>{t}Investment{/t}</th><td>${$refbacks[s].inv_amount}</td></tr>
</table>
 </td>
 <td valign=top>
<table class="form">                                                                                   
  <tr><th>{t}Date{/t}</th><td>{$refbacks[s].date_processed|default:"n/a"} {$refbacks[s].time_processed}</td></tr>
  <tr><th>{t}Amount{/t}</th><td>{if $refbacks[s].rcb_amount}${$refbacks[s].rcb_amount|number_format:2}{else}n/a{/if}</td></tr>
  <tr><th>{t}System{/t}</th><td>{$refbacks[s].paysystem}</td></tr>
  <tr><th>{t}Account{/t}</th><td>{$refbacks[s].psaccount}</td></tr>
</table>
 </td>
</tr>
<tr>
 <td colspan=3>
  {if $refbacks[s].comments}
  <div class="comments">
   <b>{t}Comments{/t}</b>: {$refbacks[s].comments|nl2br|escape:htmlall}
  </div>
  {/if}
  {if $refbacks[s].reply}
  <div class="reply">
    <b>{t}Reply{/t}</b>: {$refbacks[s].reply|nl2br|escape:htmlall}
  </div>
  {/if}
 </td>
</tr>
</table>
{/section}
{else}
 <div class="message">{t}No Refback Requests{/t}</div>
{/if}
</div>

{paginator col=$pages.col cur=$pages.cur url="javascript:go('%s')"}

{include file="footer.tpl"}