{% extends 'TopxiaAdminBundle:Course:layout.html.twig' %}

{% block title %}交易管理 - {{ parent() }}{% endblock %}

{#
    {% set script_controller = 'trade/index' %}
#}

{% set menu = 'course-order' %}

{% block main %}

  <div class="page-header clearfix">
    <h1>交易管理</h1>
  </div>

  <form id="user-search-form" class="form-inline well well-sm" action="" method="get" novalidate>
    <div class="form-group">
      <select class="form-control" name="status">
        {{ select_options(dict('orderStatus'), app.request.get('status'), '交易状态') }}
      </select>
    </div>

    <div class="form-group">
      <select class="form-control" name="payment">
        {{ select_options(dict('payment'), app.request.get('payment'), '支付方式') }}
      </select>
    </div>

    <div class="form-group" style="display:none;">
      <input class="form-control" type="text" name="paidTimeRange", placeholder="付款时间段">
    </div>

    <span class="divider"></span>

    <div class="form-group">
      <select class="form-control" name="keywordType">
        {% set options = {sn: '订单号', buyer:'购买者用户名', courseId: '课程编号'} %}
        {{ select_options(options, app.request.get('keywordType')) }}
      </select>
    </div>

    <div class="form-group">
      <input class="form-control" type="text" name="keyword" value="{{ app.request.get('keyword') }}" placeholder="关键词">
    </div>

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

  </form>
      
  <table class="table table-striped table-hover" id="order-table">
    <thead>
      <tr>
        <th width="50%">名称</th>
        <th>状态</th>
        <th>价格(元)</th>
        <th>购买者</th>
        <th>付款方式</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
      {% for order in orders %}
        {% set buyer = users[order.userId]|default(null) %}
        {% include 'TopxiaAdminBundle:CourseOrder:tr.html.twig' %}
      {% else %}
        <tr><td colspan="20"><div class="empty">暂无交易记录</div></td></tr>
      {% endfor %}
    </tbody>
  </table>

  <div class="paginator">
    {{ web_macro.paginator(paginator) }} 
  </div>


{% endblock %}
