{% set fluxs = getAllFlux(app.user, app.request) %}
{% if fluxs.getTotalItemCount > 0 %}
	{% set idcard = 'transactions' %}
	{% extends 'block/block_collapse.html.twig' %}

	{% block blocktitle %}
		<i class="fa fa-list-alt mr-4"></i> {{ 'Opérations'|trans }}
	{% endblock blocktitle %}
	{% block blocksubtitle %}
	{% endblock blocksubtitle %}
	{% block blockcontent %}
    <div class="table-responsive">
  		<table class="table">
            <thead>
              <tr>
                <th scope="col">Date</th>
                <th scope="col">Type</th>
                <th scope="col">Expediteur</th>
                <th scope="col">Destinataire</th>
                <th scope="col">Montant</th>
              </tr>
            </thead>
            <tbody>
  			{% for flux in fluxs %}
                <tr>
                    <td>{{flux.createdAt|date('d/m/Y H:i')}}</td>
                    {% if flux.type == 'reconversion' %}
                        <td>Demande de reconversion</td>
                    {% else %}
                        <td>{{flux.parenttype|capitalize}} de {{ flux.type|capitalize|replace({'_' : ' à '}) }}</td>
                    {% endif %}
                    <td>{{flux.expediteur}}</td>
                    <td>{{flux.destinataire}}</td>
                    <td>{{flux.montant}}</td>
                </tr>
  			{% endfor %}
  		  </tbody>
  		</table>
    </div>
		<br/>
		<div class="btn-group">
            <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" id="dropdownMenuLink">
                <i class="fa fa-share-square-o" aria-hidden="true"></i>
                Exporter 
                <span class="caret"></span>
            </button>
            <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
                <a class="dropdown-item" href="{{ path('exportPrestaFlux', {'format' : 'json'}) }}">
                    <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
                    JSON
                </a>
                <a class="dropdown-item" href="{{ path('exportPrestaFlux', {'format' : 'xml'}) }}">
                    <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
                    XML
                </a>
                <a class="dropdown-item" href="{{ path('exportPrestaFlux', {'format' : 'csv'}) }}">
                    <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
                    CSV
                </a>
                <a class="dropdown-item" href="{{ path('exportPrestaFlux', {'format' : 'xls'}) }}">
                    <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
                    XLS
                </a>
			</div>
        </div>
	{% endblock blockcontent %}
{% endif %}