templates/admin/user/_delete_form.html.twig line 1

Open in your IDE?
  1. {% set hasTrainings = user.trainings|length > 0 %}
  2. {% if not hasTrainings %}
  3.     <form method="post" action="{{ path('user_delete', {'id': user.id}) }}" onsubmit="return confirm('Voulez-vous vraiment supprimer cet utilisateur ?');">
  4.         <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ user.id) }}">
  5.         <button class="btn btn-danger delete-button" title="Supprimer l'utilisateur">
  6.             <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
  7.                 <path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z"/>
  8.             </svg>
  9.         </button>
  10.     </form>
  11. {% else %}
  12.     {% set class = 'User' %}
  13.     <form method="post" action="{{ path('trainings_list', {'entity': user.id}) }}" onsubmit="return confirm('Il y a des formation liées. Accéder à la liste ?');">
  14.         <input type="hidden" name="_class" value="{{ class }}">
  15.         <input type="hidden" name="_route" value="{{ app.request.get('_route') }}">
  16.         <button class="btn btn-danger delete-button" title="Supprimer l'utilisateur">
  17.             <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
  18.                 <path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z"/>
  19.             </svg>
  20.         </button>
  21.     </form>
  22. {% endif %}