{include file="header.tpl"}

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

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

{include file="footer.tpl"}