{% import "TopxiaAdminBundle::macro.html.twig" as admin_macro %}
{% extends 'TopxiaAdminBundle:Order:layout.html.twig' %}

{% block title %}账户明细 - {{ parent() }}{% endblock %}

{% set menu = 'money_records' %}

{% block main %}
  <div class="page-header">
    <h1>账户明细</h1>
  </div>

  <form id="message-search-form" class="form-inline well well-sm" action="" method="get" novalidate>
    <div class="form-group">
      <select class="form-control" name="type">
        {{ select_options(dict('moneyRecordType'), app.request.query.get('type'), '交易类型') }}
      </select>
    </div>
    <div class="form-group">
      <input class="form-control" type="text" placeholder="交易号" name="transactionNo" value="{{ app.request.get('transactionNo') }}">
    </div>
    <div class="form-group">
      <input class="form-control" type="text" placeholder="交易人昵称" name="nickname" value="{{ app.request.get('nickname') }}">
    </div>

    <button class="btn btn-primary">搜索</button>
  </form>

  <table class="table table-striped table-hover" id="record-table">
    <thead>
      <tr>
        <th>编号</th>
        <th width="20%">金额(元)</th>
        <th>名称</th>
        <th>交易类型</th>
        <th>交易人</th>
        <th>交易号</th>
        <th>交易时间</th>
      </tr>
    </thead>
    <tbody>
      {% for record in records %}
        {% set user = users[record.userId]|default(null) %}
        <tr>
          <td>{{ record.id }}</td>
          <td><span class="money-text">{{ record.amount }}</span></td>
          <td>{{ record.title }}</td>
          <td>{{ record.type }}</td>
          <td>{{ admin_macro.user_link(user) }}</td>
          <td>{{ record.transactionNo }}</td>
          <td>{{ record.transactionTime|date('Y-n-d H:i') }}</td>
        </tr>
      {% else %}
        <tr><td colspan="20"><div class="empty">暂无交易记录</div></td></tr>
      {% endfor %}
    </tbody>

	</table>
  {{ web_macro.paginator(paginator) }}

{% endblock %}