162 lines
13 KiB
HTML
162 lines
13 KiB
HTML
<!DOCTYPE html>
|
|
<html xmlns:th="http://www.thymeleaf.org">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Recherche Licences - AS Talange</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<script src="https://unpkg.com/htmx.org@1.9.11"></script>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<style> body { font-family: 'Inter', sans-serif; } </style>
|
|
</head>
|
|
<body class="bg-gray-50 text-gray-900 flex h-screen overflow-hidden">
|
|
<div th:replace="~{fragments/sidebar :: sidebar}"></div>
|
|
|
|
<main class="flex-1 flex flex-col h-screen overflow-hidden">
|
|
<header class="h-16 bg-white border-b border-gray-200 flex items-center px-6">
|
|
<h2 class="text-lg font-semibold text-gray-800">Recherche de Licences</h2>
|
|
</header>
|
|
|
|
<div class="flex-1 overflow-auto p-6">
|
|
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 mb-6">
|
|
<form th:action="@{/admin/licences/recherche}" method="get" class="flex flex-wrap items-end gap-4">
|
|
<div class="w-48">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Nom</label>
|
|
<input type="text" name="nom" th:value="${nomFilter}" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500">
|
|
</div>
|
|
<div class="w-48">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Prénom</label>
|
|
<input type="text" name="prenom" th:value="${prenomFilter}" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500">
|
|
</div>
|
|
<div class="w-48">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">N° Licence</label>
|
|
<input type="text" name="numeroLicence" th:value="${numeroLicenceFilter}" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500">
|
|
</div>
|
|
<div class="w-64">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
|
|
<input type="text" name="email" th:value="${emailFilter}" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500">
|
|
</div>
|
|
<div class="w-48">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Catégorie</label>
|
|
<select name="categorieId" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500">
|
|
<option value="">Toutes les catégories</option>
|
|
<option th:each="cat : ${categories}" th:value="${cat.id}" th:text="${cat.nom}" th:selected="${cat.id == categorieId}"></option>
|
|
</select>
|
|
</div>
|
|
<div class="w-48">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Type de Demande</label>
|
|
<select name="typeDemande" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500">
|
|
<option value="">Tous les types</option>
|
|
<option value="Nouvelle demande" th:selected="${typeDemandeFilter == 'Nouvelle demande'}">Nouvelle Demande</option>
|
|
<option value="Renouvellement" th:selected="${typeDemandeFilter == 'Renouvellement'}">Renouvellement</option>
|
|
<option value="Mutation" th:selected="${typeDemandeFilter == 'Mutation'}">Mutation</option>
|
|
</select>
|
|
</div>
|
|
<div class="flex space-x-2">
|
|
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700">Rechercher</button>
|
|
<a th:href="@{/admin/licences/recherche}" class="bg-gray-100 text-gray-700 px-4 py-2 rounded-lg text-sm font-medium hover:bg-gray-200">Réinitialiser</a>
|
|
<a th:href="@{/admin/licences/recherche/export(nom=${nomFilter},prenom=${prenomFilter},categorieId=${categorieId},numeroLicence=${numeroLicenceFilter},email=${emailFilter},typeDemande=${typeDemandeFilter})}"
|
|
class="bg-indigo-50 text-indigo-700 px-4 py-2 rounded-lg text-sm font-medium hover:bg-indigo-100 flex items-center">
|
|
Exporter CSV
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<div id="licences-table-container" class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left border-collapse min-w-[900px]">
|
|
<thead>
|
|
<tr class="bg-gray-50 text-gray-500 text-sm uppercase tracking-wider border-b border-gray-200">
|
|
<th class="py-3 px-4 font-medium text-left">Nom Prénom</th>
|
|
<th class="py-3 px-4 font-medium text-left">Catégorie</th>
|
|
<th class="py-3 px-4 font-medium text-left">N° Licence</th>
|
|
<th class="py-3 px-4 font-medium text-left">Type de Demande</th>
|
|
<th class="py-3 px-4 font-medium text-left">Email</th>
|
|
<th class="py-3 px-4 font-medium text-left">État</th>
|
|
<th class="py-3 px-4 font-medium text-right">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200 text-sm">
|
|
<tr th:if="${#lists.isEmpty(licences)}">
|
|
<td colspan="7" class="py-8 text-center text-gray-500">Aucun résultat trouvé pour cette recherche.</td>
|
|
</tr>
|
|
<tr th:each="licence : ${licences}" class="hover:bg-gray-50">
|
|
<td class="py-3 px-4 font-medium text-gray-900">
|
|
<span th:text="${licence.adherent.nom + ' ' + licence.adherent.prenom}">Nom Prénom</span>
|
|
</td>
|
|
<td class="py-3 px-4 text-gray-600" th:text="${licence.categorie != null ? licence.categorie.nom : '-'}">Catégorie</td>
|
|
<td class="py-3 px-4 text-gray-600 font-mono" th:text="${licence.numeroLicence != null ? licence.numeroLicence : '-'}">N°</td>
|
|
<td class="py-3 px-4 text-gray-600" th:text="${licence.typeDemande != null ? licence.typeDemande : '-'}">Type</td>
|
|
<td class="py-3 px-4 text-gray-600" th:text="${licence.adherent.email != null ? licence.adherent.email : '-'}">Email</td>
|
|
<td class="py-3 px-4 text-gray-600" th:text="${licence.etat != null ? licence.etat : '-'}">Etat</td>
|
|
<td class="py-3 px-4 text-right">
|
|
<a th:href="@{/adherents/{id}/edit(id=${licence.adherent.id})}" class="text-indigo-600 hover:text-indigo-900 font-medium">Voir Profil</a>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination Footer -->
|
|
<div class="px-6 py-4 border-t border-gray-200 flex items-center justify-between bg-gray-50 text-sm text-gray-700">
|
|
<div th:if="${totalElements > 0}">
|
|
Affichage de <span class="font-semibold" th:text="${currentPage * pageSize + 1}">1</span> à
|
|
<span class="font-semibold" th:text="${T(java.lang.Math).min((currentPage + 1) * pageSize, totalElements)}">20</span> sur
|
|
<span class="font-semibold" th:text="${totalElements}">100</span> licences
|
|
</div>
|
|
<div th:if="${totalElements == 0}">
|
|
Aucune licence à afficher
|
|
</div>
|
|
<div class="flex items-center space-x-2" th:if="${totalPages > 1}">
|
|
<!-- Page Précédente -->
|
|
<a th:if="${currentPage > 0}"
|
|
th:href="@{/admin/licences/recherche(nom=${nomFilter},prenom=${prenomFilter},categorieId=${categorieId},numeroLicence=${numeroLicenceFilter},email=${emailFilter},typeDemande=${typeDemandeFilter},page=${currentPage - 1})}"
|
|
hx-get="/admin/licences/recherche"
|
|
hx-target="#licences-table-container"
|
|
hx-select="#licences-table-container"
|
|
hx-push-url="true"
|
|
th:attr="hx-vals=|{"nom": "${nomFilter != null ? nomFilter : ''}", "prenom": "${prenomFilter != null ? prenomFilter : ''}", "categorieId": "${categorieId != null ? categorieId : ''}", "numeroLicence": "${numeroLicenceFilter != null ? numeroLicenceFilter : ''}", "email": "${emailFilter != null ? emailFilter : ''}", "typeDemande": "${typeDemandeFilter != null ? typeDemandeFilter : ''}", "page": ${currentPage - 1}}|"
|
|
class="px-3 py-1 border border-gray-300 rounded hover:bg-gray-100 transition-colors">
|
|
Précédent
|
|
</a>
|
|
<span th:if="${currentPage == 0}" class="px-3 py-1 border border-gray-200 rounded text-gray-400 bg-gray-50 cursor-not-allowed">
|
|
Précédent
|
|
</span>
|
|
|
|
<!-- Numéros de pages -->
|
|
<th:block th:each="pageNum : ${#numbers.sequence(0, totalPages - 1)}" th:if="${totalPages > 0}">
|
|
<a th:href="@{/admin/licences/recherche(nom=${nomFilter},prenom=${prenomFilter},categorieId=${categorieId},numeroLicence=${numeroLicenceFilter},email=${emailFilter},typeDemande=${typeDemandeFilter},page=${pageNum})}"
|
|
hx-get="/admin/licences/recherche"
|
|
hx-target="#licences-table-container"
|
|
hx-select="#licences-table-container"
|
|
hx-push-url="true"
|
|
th:attr="hx-vals=|{"nom": "${nomFilter != null ? nomFilter : ''}", "prenom": "${prenomFilter != null ? prenomFilter : ''}", "categorieId": "${categorieId != null ? categorieId : ''}", "numeroLicence": "${numeroLicenceFilter != null ? numeroLicenceFilter : ''}", "email": "${emailFilter != null ? emailFilter : ''}", "typeDemande": "${typeDemandeFilter != null ? typeDemandeFilter : ''}", "page": ${pageNum}}|"
|
|
th:text="${pageNum + 1}"
|
|
class="px-3 py-1 rounded transition-colors"
|
|
th:classappend="${currentPage == pageNum ? 'bg-blue-600 text-white' : 'border border-gray-300 hover:bg-gray-100'}">
|
|
1
|
|
</a>
|
|
</th:block>
|
|
|
|
<!-- Page Suivante -->
|
|
<a th:if="${currentPage < totalPages - 1}"
|
|
th:href="@{/admin/licences/recherche(nom=${nomFilter},prenom=${prenomFilter},categorieId=${categorieId},numeroLicence=${numeroLicenceFilter},email=${emailFilter},typeDemande=${typeDemandeFilter},page=${currentPage + 1})}"
|
|
hx-get="/admin/licences/recherche"
|
|
hx-target="#licences-table-container"
|
|
hx-select="#licences-table-container"
|
|
hx-push-url="true"
|
|
th:attr="hx-vals=|{"nom": "${nomFilter != null ? nomFilter : ''}", "prenom": "${prenomFilter != null ? prenomFilter : ''}", "categorieId": "${categorieId != null ? categorieId : ''}", "numeroLicence": "${numeroLicenceFilter != null ? numeroLicenceFilter : ''}", "email": "${emailFilter != null ? emailFilter : ''}", "typeDemande": "${typeDemandeFilter != null ? typeDemandeFilter : ''}", "page": ${currentPage + 1}}|"
|
|
class="px-3 py-1 border border-gray-300 rounded hover:bg-gray-100 transition-colors">
|
|
Suivant
|
|
</a>
|
|
<span th:if="${currentPage == totalPages - 1}" class="px-3 py-1 border border-gray-200 rounded text-gray-400 bg-gray-50 cursor-not-allowed">
|
|
Suivant
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</body>
|
|
</html>
|