{% extends 'base.html.twig' %}
{% block title %}
	{{parent()}}Liste des batteries (A-Z)
{% endblock %}
{% block body %}
	<div class="container-fluid">
		<h1 class="text-center text-primary mt-4 pt-4 display-1 fw-bold">
			Liste des batteries</h1>
		<div class="row justify-content-center">
			<div class="col-12 col-md-8 bg-white p-4 m-0 text-primary text-center">
				<div class="table-responsive">
					{{ form_start(form) }}
					<table class="table table-hover">
						<thead>
							<tr class="fw-bold text-primary">
								<th scope="col">Reference</th>
								<th scope="col">Capacité</th>
								<th scope="col">Pays</th>
								<th scope="col"></th>
								<th scope="col"></th>
								<th scope="col"></th>
							</tr>
						</thead>
						<tbody>
							{% for batterie in batteries |sort((a, b) =>
a.reference <=> b.reference) %}
								<tr class="{{ cycle(['table-primary', 'table-secondary'], loop.index0) }}">
									<td class="textstart">{{ batterie.reference | capitalize }}</td>
									<td class="textstart">{{ batterie.capacite }} W</td>
									<td class="textstart">{{ batterie.pays | capitalize }}</td>
									<td>
										<a href="{{path("app_modifier_batterie",{'id':batterie.id})}}">
											<i class="bi bi-pen-fill text-dark"></i>
										</a>
									</td>
									<td>
										<a href="{{path("app_supprimer_batterie",{'id':batterie.id})}}">
											<i class="bi bi-trash-fill text-dark"></i>
										</a>
									</td>
									<td>{{ form_widget(form.batteries[batterie.id]) }}</td>
								</tr>
							{% endfor %}
						</tbody>
					</table>
					{{ form_widget(form.supprimer) }}
					{{ form_end(form) }}
				</div>
			</div>
		</div>
	</div>
{% endblock %}
