Commit 210f15b4 authored by Mat's avatar Mat

modale de confirmation avant d'effacer

parent 7642b2f1
......@@ -28,14 +28,33 @@
<td>{{ asso.tva }}</td>
<td>{{ asso.getMembres()|length }}</td>
<td>
<a class="btn btn-primary btn-sm" role="button"
href="{{ path('asso_association_update', {'id': asso.id }) }}">Editer</a>
{% if asso.getMembres()|length == 0 %}
<a class="btn btn-danger btn-sm" role="button"
href="{{ path('asso_association_delete', {'id': asso.id }) }}">Effacer</a>
<a class="btn btn-primary btn-sm" role="button" href="{{ path('asso_association_update', {'id': asso.id }) }}">Editer</a>
{% if asso.getMembres() | length == 0 %}
<a class="btn btn-danger btn-sm" role="button" href="#" id="btn-{{ asso.id }}">Effacer</a>
<div class="modal modal-{{ asso.id }} fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Effacer l'association n°{{ asso.id }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Cette action n'est pas réversible. Souhaitez-vous continuer ?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
<a class="btn btn-danger" role="button" href="{{ path('asso_association_delete', {'id': asso.id }) }}">
Oui, effacer !
</a>
</div>
</div>
</div>
</div>
{% else %}
<a class="btn btn-danger btn-sm disabled" tabindex="-1" role="button"
aria-disabled="true">Effacer</a>
<a class="btn btn-danger btn-sm disabled" tabindex="-1" role="button" aria-disabled="true">Effacer</a>
{% endif %}
</td>
</tr>
......
......@@ -26,10 +26,32 @@
<td>{{ membre.email }}</td>
<td>{{ membre.getAssociation().nom }}</td>
<td>
<a class="btn btn-primary btn-sm" role="button"
href="{{ path('asso_membre_update', {'id': membre.id }) }}">Editer</a>
<a class="btn btn-danger btn-sm" role="button"
href="{{ path('asso_membre_delete', {'id': membre.id }) }}">Effacer</a>
<a class="btn btn-primary btn-sm" role="button" href="{{ path('asso_membre_update', {'id': membre.id }) }}">Editer</a>
<a class="btn btn-danger btn-sm" role="button" href="#" id="btn-{{ membre.id }}">Effacer</a>
<div class="modal modal-{{ membre.id }} fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Effacer le membre n°{{ membre.id }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Cette action n'est pas réversible. Souhaitez-vous continuer ?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
<a class="btn btn-danger" role="button"
href="{{ path('asso_membre_delete', {'id': membre.id }) }}">
Oui, effacer !
</a>
</div>
</div>
</div>
</div>
</td>
</tr>
{% endfor %}
......
......@@ -26,6 +26,11 @@
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
{% block javascripts %}
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
<script src="{{ asset('js/script_asso.js') }}"></script>
{% endblock %}
{% endblock %}
let xkjhjh;
let dropbtns = document.querySelectorAll("table.table a.btn-danger:not(.disabled)");
for (let bouton of dropbtns)
{
if (bouton.getAttribute('id') !== null) {
let id = bouton.getAttribute('id').replace("btn-", "");
bouton.addEventListener("click", function() {
$('.modal-' + id ).modal({
focus: true
});
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment