{% extends 'common/layout.html.twig' %}

{% block content %}
<div class='container prestataire_infos'>
	<div class="row">
		<div class="col-sm-12 col-md-6">
			<div class='infos mt-4'>
				{{form_start(form)}}
					<h4><a class="btn btn-block btn-secondary" data-toggle="collapse" href="#infospresta" role="button" aria-expanded="false" aria-controls="infospresta"><span class="btn-label"><i class="fas fa-cogs mr-2"></i></span>Modifier les informations du prestataire</a></h4>
					<div class="collapse" id="infospresta">
	      				<div class="card card-body">
							{{ form_row(form.groupe) }}
							{{ form_row(form.raison) }}
							{{ form_row(form.statut) }}
							{{ form_row(form.siret) }}
							{{ form_row(form.iban) }}
							{{ form_row(form.responsable) }}
							{{ form_row(form.metier) }}
							{{ form_row(form.geoloc) }}
							{{ form_row(form.save) }}
						</div>
					</div>
					<h4><a class="btn btn-block btn-secondary" data-toggle="collapse" href="#infosuser" role="button" aria-expanded="false" aria-controls="infosuser">Modifier les informations du l'utilisateur</a></h4>
					<div class="collapse" id="infosuser">
	      				<div class="card card-body">
							{{ form_row(form.user) }}
							{{ form_row(form.save2) }}
						</div>
					</div>
				{{form_end(form)}}
			</div>
		</div>
		<div class="col-sm-12 col-md-6">
			{% if app.user.prestataire is not null and app.user.prestataire.compte >= 0 %}
				<div class='compte mt-4'>
					<h4>Mon compte :</h4>
					<ul class='list-group'>
						<li class="list-group-item">{{(app.user.prestataire.compte)|number_format(2, '.', ',')}}</li>
					</ul>
				</div>
			{% endif %}
			{% if app.user.cotisations|length > 0 %}
				<div class='cotisations mt-4'>
					<h4>Mes cotisations :</h4>
					<ul class='list-group'>
						{% for cotisation in app.user.cotisations %}
							<li class="list-group-item">{{cotisation.annee|upper}} : {{cotisation.montant}}&euro; (payée le {{cotisation.createdAt|date('d-m-Y')}})</li>
						{% endfor %}
					</ul>
				</div>
			{% endif %}
			{% if getAllFlux(app.user, app.request).getTotalItemCount > 0 %}
				<div class='flux mt-4'>
					<h4>Mes transactions :</h4>
					<h5>({{getAllFlux(app.user, app.request).getTotalItemCount}})</h5>
					<ul class='list-group'>
						{% for flux in getAllFlux(app.user, app.request) %}
							<li class="list-group-item">{{flux.parenttype|capitalize}} à {{flux.destinataire}} {{flux.montant}}&euro; (payée le {{flux.createdAt|date('d-m-Y')}})</li>
						{% endfor %}
					</ul>
				</div>
			{% endif %}
			{% if app.user.prestataire.rubriques|length > 0 %}
				<div class='flux mt-4'>
					<h4>Mes rubriques :</h4>
					<ul class='list-group'>
						{% for rubrique in app.user.prestataire.rubriques %}
							{% if rubrique.enabled %}
								<li class="list-group-item">{{rubrique.name|capitalize}}</li>
							{% endif %}
						{% endfor %}
					</ul>
				</div>
			{% endif %}
		</div>
	</div>
</div>
{% endblock %}
