{% set fluxs = getAllFlux(app.user, app.request) %}
{% set title = title|default('Opérations'|trans) %}
{% if fluxs and fluxs.getTotalItemCount > 0 %}
	{% set idcard = 'transactions' %}
	{% extends '@kohinos/block/block_collapse.html.twig' %}

	{% block blocktitle %}
		<i class="fa fa-list-alt mr-4"></i> {{ title }}
	{% 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.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('exportUserFlux', {'format' : 'json'}) }}">
                    <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
                    JSON
                </a>
                <a class="dropdown-item" href="{{ path('exportUserFlux', {'format' : 'xml'}) }}">
                    <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
                    XML
                </a>
                <a class="dropdown-item" href="{{ path('exportUserFlux', {'format' : 'csv'}) }}">
                    <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
                    CSV
                </a>
                <a class="dropdown-item" href="{{ path('exportUserFlux', {'format' : 'xls'}) }}">
                    <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
                    XLS
                </a>
			</div>
        </div>
	{% endblock blockcontent %}
{% endif %}
