{% extends 'base.html.twig' %}
{% block title %}Vos groupes d'adresses{% endblock %}
{% block body %}
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h1>Liste des adresses du groupe "{{ addresses_list.Title }}"</h1>
<table class="table" id="datatable">
<thead>
<tr>
<th>Dénomination</th>
<th>Adresse</th>
<th>Code postal</th>
<th>Ville</th>
<th>Statut</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for addresse in addresses_list.getAddresses() %}
<tr>
<td>{{ addresse.Title }}</td>
<td>{{ addresse.Address }}</td>
<td>{{ addresse.Zipcode }}</td>
<td>{{ addresse.City }}</td>
<td>
<span class="badge rounded-pill badge-soft-{{ addresse.getStatusBadgeInfo() }} font-size-13">
{{ addresse.getStatusTextInfo() }}
</span>
</td>
<td>
{#
<a href="{{ path('app_addresse_show', {'id': addresse.id}) }}"><i style="font-size: 24px" class="mdi mdi-format-list-bulleted-square"></i></a>
#}
{% if not(addresses_list.locked) %}
<a href="{{ path('app_addresse_edit', {'id': addresse.id , 'addressesList': addresses_list.id}) }}"><i style="font-size: 24px" class="mdi mdi-square-edit-outline"></i></a>
<form style="display: inline-block" method="post" action="{{ path('app_addresse_delete', {'id': addresse.id , 'addressesList': addresses_list.id }) }}" onsubmit="return confirm('Are you sure you want to delete this item?');" id=deleteForm_{{ addresse.id }} name="deleteForm_{{ addresse.id }}">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ addresse.id) }}">
<a href="javascript: if(confirm('Are you sure you want to delete this item?') == true){ document.forms['deleteForm_{{ addresse.id }}'].submit();}" ><i style="font-size: 24px" class="mdi mdi-delete-forever"></i></a>
</form>
<a href="{{ path('app_addresse_geocode', {'id': addresse.id }) }}"><i style="font-size: 24px" class="mdi mdi-earth"></i></a>
{% if addresse.getStatus() == constant('STATUT_GEOCODED', addresse) %}
<a href="{{ path('app_addresse_show', {'id': addresse.id }) }}"><i style="font-size: 24px" class="mdi mdi-map-marker"></i></a>
{% endif %}
{% else %}
<span class="badge rounded-pill badge-soft-info font-size-13">
Groupe d'adresses vérrouillé
</span>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="3">Aucun enregistrement trouvé</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if not(addresses_list.locked) %}
<a href="{{ path('app_addresse_new' , {addressesList: addresses_list.id} ) }}" class="btn btn-primary">Ajouter une nouvelle adresse</a>
<a href="{{ path('app_addresse_import' , {id: addresses_list.id} ) }}" class="btn btn-primary">Importer des adresses</a>
<a href="{{ path('app_addresse_bulk_geoloc' , {id: addresses_list.id} ) }}" class="btn btn-primary">Géolocaliser en masse</a>
{% else %}
<div class="alert alert-info mb-0" role="alert">
Ce groupe d'adresses est vérouillé.
</div>
{% endif %}
<br/>
<br/>
<a class="btn btn-outline-secondary waves-effect" href="{{ path('app_addresses_list_index') }}">Revenir à la liste</a>
</div>
</div>
</div>
</div>
{% endblock %}