{include file="header.tpl"}

{literal}
<script language="javascript">
function go(p) {
  document.opts.page.value = p;
  document.opts.submit();
}
</script>
{/literal}

<div class="main-content">
  <div class="page-content">
    <div class="container-fluid">

      <!-- Title + Filter -->
      <section class="w3-auto">
        <div class="w3-padding w3-responsive w3-black w3-margin-top">
          <h1 class="fbold w3-large upper w3-text-white grad w3-padding"><b>Deposit History</b></h1>
          <div class="w3-padding w3-tiny">
            <div class="w3-text-dark-grey upper fbold"><b>Filters</b></div>
            <form class="w3-row" method="post" action="?a=deposit_history" name="opts">
              <input type="hidden" name="page" value="{$current_page}">
              <div class="w3-col l2 s6">
                <div style="margin:2px;">
                  <label class="w3-text-blue fbold">From</label>
                  <input type="date" name="from" value="{$frm.from|default:''}" class="w3-input w3-border" required>
                </div>
              </div>
              <div class="w3-col l2 s6">
                <div style="margin:2px;">
                  <label class="w3-text-blue fbold">To</label>
                  <input type="date" name="to" value="{$frm.to|default:''}" class="w3-input w3-border" required>
                </div>
              </div>
              <div class="w3-col l2 s6">
                <div style="margin:2px;">
                  <label class="w3-hide-small">&nbsp;</label>
                  <button class="w3-input w3-button w3-blue fbold w3-round w3-border w3-border-black upper">
                    <b>Filter</b>
                  </button>
                </div>
              </div>
              <div class="w3-col l2 s6">
                <div style="margin:2px;">
                  <label class="w3-hide-small">&nbsp;</label>
                  <a href="?a=deposit_history" class="w3-input w3-button w3-red fbold w3-round w3-border w3-border-black upper"><b>Clear</b></a>
                </div>
              </div>
            </form>
          </div>
          <hr><br>
        </div>
      </section>

      <!-- Table -->
      <section class="w3-small w3-auto">
        <div class="w3-padding w3-black w3-margin-top w3-responsive">
          <br>
          <a href="?a=withdraw_history" class="w3-card-4 w3-padding w3-red">Withdraw History</a>
          <a href="?a=deposit_history" class="w3-card-4 w3-padding w3-red">Deposit History</a>
          <br><br>

          <table cellspacing="10" cellpadding="10" class="w3-table w3-dark-grey w3-text-grey">
            <tr class="w3-red" style="font-weight: bolder;">
              <td>Date</td>
              <td>Payment</td>
              <td>Amount</td>
            </tr>

            {if $qtrans > 0}
              {section name=trans loop=$trans}
              <tr>
                <td>{$trans[trans].d}</td>
                <td>
                  <b>{$trans[trans].transtype}</b><br>
                  <small>{$trans[trans].description}</small>
                </td>
                <td><b>{$currency_sign}{$trans[trans].actual_amount}</b> 
                  <img src="images/{$trans[trans].ec}.gif" height="17" align="absmiddle">
                </td>
              </tr>
              {/section}
            {else}
              <tr class="w3-center w3-padding">
                <td colspan="3"><b>No deposit Transaction ...</b></td>
              </tr>
            {/if}
          </table>

          <!-- Totals (if available) -->
          {if $qtrans > 0}
          <div class="w3-margin-top w3-text-white">
            <p><b>Total This Period:</b> {$currency_sign}{$periodsum}</p>
            <p><b>Total:</b> {$currency_sign}{$allsum}</p>
          </div>
          {/if}

          <!-- Pagination -->
          {if $colpages > 1}
          <nav aria-label="Page navigation" class="w3-margin-top">
            <ul class="pagination">
              {if $prev_page > 0}
              <li class="page-item"><a class="page-link" href="javascript:go('{$prev_page}')">&laquo;</a></li>
              {/if}

              {section name=p loop=$pages}
              <li class="page-item {if $pages[p].current == 1}active{/if}">
                <a class="page-link" href="javascript:go('{$pages[p].page}')">{$pages[p].page}</a>
              </li>
              {/section}

              {if $next_page > 0}
              <li class="page-item"><a class="page-link" href="javascript:go('{$next_page}')">&raquo;</a></li>
              {/if}
            </ul>
          </nav>
          {/if}

        </div>
      </section>

    </div>
  </div>
</div>

{include file="footer.tpl"}
