<div>
  <table class="table" ng-if="transactions.length > 0">
    <thead>
      <tr>
        <th style="width:25%" translate>{{ 'app.shared.wallet.date' }}</th>
        <th style="width:25%" translate>{{ 'app.shared.wallet.operation' }}</th>
        <th style="width:25%" translate>{{ 'app.shared.wallet.operator' }}</th>
        <th style="width:25%" translate>{{ 'app.shared.wallet.amount' }}</th>
      </tr>
    </thead>
    <tbody>
    <tr ng-repeat="t in transactions">
      <td>{{ ::t.created_at | amDateFormat:'L' }}</td>
      <td>
        <span ng-if="t.transaction_type == 'credit'" translate>{{ 'app.shared.wallet.credit' }}</span>
        <span ng-if="t.transaction_type == 'debit'" translate>{{ 'app.shared.wallet.debit' }}</span>
        <a ng-href="api/invoices/{{t.invoice.id}}/download" target="_blank" ng-if="t.invoice.id">
          {{::t.invoice.reference}}
        </a>
        <a ng-href="api/payment_schedules/{{t.payment_schedule.id}}/download" target="_blank" ng-if="t.payment_schedule.id">
          {{::t.payment_schedule.reference}}
        </a>
      </td>
      <td>{{ ::t.user.full_name }}</td>
      <td ng-class="{'green':t.transaction_type == 'credit', 'red':t.transaction_type == 'debit'}">
        <span ng-if="t.transaction_type == 'credit'">+</span>
        <span ng-if="t.transaction_type == 'debit'">-</span>
        <strong>{{ ::t.amount | currency }}</strong>
      </td>
    </tr>
    </tbody>
  </table>
  <p ng-if="transactions.length == 0" translate>{{ 'app.shared.wallet.no_transactions_for_now' }}</p>
</div>
