hegresphere/templates/skill/index.html.twig
2025-04-08 08:11:56 +02:00

76 lines
3.5 KiB
Twig

{% extends 'base.html.twig' %}
{% block title %}Liste des Compétences{% endblock %}
{% block body %}
<div class="container mx-auto p-6">
<h1 class="text-3xl font-bold mb-4">Liste des Compétences</h1>
{% if 'ROLE_INTERN' in app.user.roles %}
<form method="post" action="{{ path('app_intern_add_skills') }}">
{% endif %}
<!-- Tableau des compétences -->
<div class="overflow-x-auto bg-white shadow-lg rounded-lg">
<table class="min-w-full table-auto">
<thead>
<tr class="bg-gray-800 text-white">
<th class="px-4 py-2 text-left">ID</th>
<th class="px-4 py-2 text-left">Label</th>
<th class="px-4 py-2 text-left">Actions</th>
</tr>
</thead>
<tbody>
{% for skill in skills %}
<tr class="border-b">
<td class="px-4 py-2">{{ skill.id }}</td>
<td class="px-4 py-2">{{ skill.label }}</td>
<td class="px-4 py-2">
{% if 'ROLE_INTERN' in app.user.roles %}
<label>
<input type="checkbox" name="selected_skills[]" value="{{ skill.id }}" class="mr-2">
Sélectionner
</label>
{% endif %}
{% if 'ROLE_ADMIN' in app.user.roles %}
<!-- Modifier la compétence -->
<a href="{{ path('app_skill_edit', {'id': skill.id}) }}" class="text-yellow-500 hover:text-yellow-700 mr-3">
<i class="fas fa-edit"></i> Modifier
</a>
<!-- Supprimer la compétence -->
<form method="post" action="{{ path('app_skill_delete', {'id': skill.id}) }}" style="display:inline;">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ skill.id) }}">
<button type="submit" class="text-red-500 hover:text-red-700">
<i class="fas fa-trash-alt"></i> Supprimer
</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if 'ROLE_INTERN' in app.user.roles %}
<div class="mt-4">
<button type="submit" class="bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded-full">
<i class="fas fa-check-circle"></i> Valider la sélection
</button>
</div>
</form>
{% endif %}
{% if 'ROLE_ADMIN' in app.user.roles %}
<div class="mt-4">
<a href="{{ path('app_skill_new') }}" class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full">
<i class="fas fa-plus-circle"></i> Ajouter une compétence
</a>
</div>
{% endif %}
</div>
{% endblock %}