{% extends "base.html" %}

{% block page_content %}
  <div class="row">

  {% include "admin/admin_tasks.html" %}

    <div class="col-md-12">
    <div class="panel panel-info">
      <div class="panel-heading">All Transactions</div>
      <div class="panel-body">
          <div class="no-more-tables"> 
          <table class="table table-hover table-striped table-condensed cf">
          <thead>
            <tr>
              <th>ID</th>
              <th>Description</th>
              <th>Amount</th>
              <th>Date</th>
              <th>User</th>
            </tr>
          </thead>
 
          <tbody>
          {% for transaction in transactions %}
            {% if transaction.value > 0 %}
              <tr class="default">
                <td data-title="ID">{{ transaction.id }}</td>
                <td data-title="Description">{{ transaction.description }}</td>
                <td data-title="Amount">{{ transaction.value }} {{ transaction.currency }}</td>
                <td data-title="Date">{{ moment(transaction.date_created).format('lll') }}</td>
                <td data-title="User"><a href="{{ url_for('admin.transaction', user_id=transaction.owner.id) }}">{{ transaction.owner.email }}</a></td>
            {% else %}
              <tr class="default">
                <td data-title="ID">{{ transaction.id }}</td>
                <td data-title="Description">{{ transaction.description }}</td>
                <td data-title="Amount">{{ transaction.value }} {{ transaction.currency }}</td>
                <td data-title="Date">{{ moment(transaction.date_created).format('lll') }}</td>
                <td data-title="User"><a href="{{ url_for('admin.transaction', user_id=transaction.owner.id) }}">{{ transaction.owner.email }}</a></td>
            {% endif %}
              </tr>
           </tbody>
           {% endfor %}
        </table>
        {% if transactions.has_prev %}<a href="{{ url_for('view', page=transactions.prev_num) }}">&lt;&lt; Previous</a>{% else %}&lt;&lt; Previous{% endif %} |
        {% if transactions.has_next %}<a href="{{ url_for('view', page=transactions.next_num) }}">Next &gt;&gt;</a>{% else %}Next &gt;&gt;{% endif %}
       </div>

        </div>
      </div>


  </div>

{% endblock %}

