Files
as-talange/as-talange-web/src/main/resources/templates/parametrage/equipements_recherche.html
T

213 lines
17 KiB
HTML

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<script src="https://unpkg.com/htmx.org@1.9.11"></script>
<meta charset="UTF-8">
<title>Paramétrage - Recherche Équipements</title>
<script src="https://cdn.tailwindcss.com"></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">
<!-- Sidebar -->
<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 Équipements</h2>
</header>
<div class="flex-1 overflow-auto p-6">
<div class="bg-white p-6 rounded-lg border border-gray-200 shadow-sm mb-6">
<form th:action="@{/admin/equipements/recherche}" method="get" class="space-y-4">
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Équipement</label>
<select name="equipementId" class="w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm px-3 py-2 border">
<option value="">Tous les équipements</option>
<option th:each="equip : ${equipements}" th:value="${equip.id}" th:text="${equip.nom}" th:selected="${equip.id == equipementId}"></option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Catégorie</label>
<select name="categorieId" class="w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm px-3 py-2 border">
<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>
<label class="block text-sm font-medium text-gray-700 mb-1">Fourni</label>
<select name="fourni" class="w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm px-3 py-2 border">
<option value="">Tous</option>
<option value="true" th:selected="${fourni != null && fourni}">Oui</option>
<option value="false" th:selected="${fourni != null && !fourni}">Non</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Commandé</label>
<select name="commandee" class="w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm px-3 py-2 border">
<option value="">Tous</option>
<option value="false" th:selected="${commandee != null && !commandee}">Non commandé</option>
<option value="true" th:selected="${commandee != null && commandee}">Commandé</option>
</select>
</div>
</div>
<div class="flex flex-wrap items-center justify-between gap-3 pt-2">
<div class="flex flex-wrap items-center gap-2">
<a th:href="@{/admin/equipements/export-commande}"
onclick="return confirm('Exporter les équipements non encore commandés et les marquer comme commandés ?');"
class="bg-indigo-600 text-white px-3.5 py-2 rounded-lg text-sm font-medium hover:bg-indigo-700 flex items-center space-x-1 shadow-sm transition-colors">
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
Exporter Commande Équipementier (Regroupé)
</a>
<a th:href="@{/admin/equipements/export-flocage-initiales}"
onclick="return confirm('Exporter la liste des équipements commandés pour le flocage des initiales et les marquer comme exportés ?');"
class="bg-purple-600 text-white px-3.5 py-2 rounded-lg text-sm font-medium hover:bg-purple-700 flex items-center space-x-1 shadow-sm transition-colors"
title="Exporter les articles commandés nécessitant le flocage des initiales">
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h10M7 12h10M7 17h10"/>
</svg>
Exporter Flocage Initiales
</a>
<a th:href="@{/admin/equipements/export-flocage-prenom-numero}"
onclick="return confirm('Exporter la liste des équipements commandés pour le flocage du prénom/numéro et les marquer comme exportés ?');"
class="bg-teal-600 text-white px-3.5 py-2 rounded-lg text-sm font-medium hover:bg-teal-700 flex items-center space-x-1 shadow-sm transition-colors"
title="Exporter les articles commandés nécessitant le flocage prénom et/ou numéro">
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
</svg>
Exporter Flocage Prénom / N°
</a>
</div>
<div class="flex space-x-3">
<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/equipements/recherche/export(equipementId=${equipementId},categorieId=${categorieId},fourni=${fourni},commandee=${commandee})}" class="bg-green-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-green-700">Exporter Recherche</a>
</div>
</div>
</form>
</div>
<div id="equipements-table-container" class="bg-white rounded-lg border border-gray-200 overflow-hidden">
<table class="w-full text-left border-collapse">
<thead>
<tr class="bg-gray-50 text-gray-500 text-xs uppercase tracking-wider border-b border-gray-200">
<th class="py-3 px-4 font-medium text-left">Licencié</th>
<th class="py-3 px-4 font-medium text-left">Poste / Sexe</th>
<th class="py-3 px-4 font-medium text-left">Catégorie</th>
<th class="py-3 px-4 font-medium text-left">Équipement</th>
<th class="py-3 px-4 font-medium text-left">Référence</th>
<th class="py-3 px-4 font-medium text-left">Taille / Floc.</th>
<th class="py-3 px-4 font-medium text-center">Commandé</th>
<th class="py-3 px-4 font-medium text-center">Fourni</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 text-sm">
<tr th:if="${#lists.isEmpty(dotations)}">
<td colspan="8" class="py-8 text-center text-gray-500">Aucun résultat trouvé pour cette recherche.</td>
</tr>
<tr th:each="dotation : ${dotations}" class="hover:bg-gray-50">
<td class="py-3 px-4 font-medium text-gray-900">
<span th:text="${dotation.licence.adherent.nom + ' ' + dotation.licence.adherent.prenom}">Nom Prénom</span>
</td>
<td class="py-3 px-4 text-gray-600 text-xs">
<div th:text="${dotation.licence.adherent.typeMaillot}">Joueur</div>
<div th:text="${dotation.licence.adherent.sexe}">Masculin</div>
</td>
<td class="py-3 px-4 text-gray-600" th:text="${dotation.licence.categorie != null ? dotation.licence.categorie.nom : '-'}">Catégorie</td>
<td class="py-3 px-4 text-gray-900 font-medium" th:text="${dotation.equipement != null ? dotation.equipement.nom : '-'}">Maillot</td>
<td class="py-3 px-4">
<span th:if="${dotation.equipement != null && dotation.equipement.reference != null && !dotation.equipement.reference.trim().isEmpty()}"
class="font-mono text-xs text-gray-700 bg-gray-100 border border-gray-200 px-2 py-0.5 rounded font-semibold"
th:text="${dotation.equipement.reference}">REF-01</span>
<span th:unless="${dotation.equipement != null && dotation.equipement.reference != null && !dotation.equipement.reference.trim().isEmpty()}"
class="inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-semibold bg-amber-50 text-amber-700 border border-amber-200" title="Référence non renseignée sur cet équipement">
⚠️ Non renseignée
</span>
</td>
<td class="py-3 px-4 text-gray-600">
<div th:text="'T: ' + (${dotation.taille != null && !dotation.taille.isEmpty() ? dotation.taille : '-'})">Taille</div>
<div th:if="${dotation.flocage != null && !dotation.flocage.isEmpty()}" th:text="'F: ' + ${dotation.flocage}">Flocage</div>
<div th:if="${dotation.numero != null && !dotation.numero.isEmpty()}" th:text="'N: ' + ${dotation.numero}"></div>
</td>
<td class="py-3 px-4 text-center">
<span th:if="${dotation.commandee}" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800" th:title="${dotation.dateCommande != null ? #temporals.format(dotation.dateCommande, 'dd/MM/yyyy HH:mm') : ''}">
Oui <span th:if="${dotation.dateCommande != null}" class="ml-1 text-[10px] text-blue-600" th:text="'(' + ${#temporals.format(dotation.dateCommande, 'dd/MM')} + ')'"></span>
</span>
<span th:unless="${dotation.commandee}" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600">Non</span>
</td>
<td class="py-3 px-4 text-center">
<span th:if="${dotation.fourni}" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">Oui</span>
<span th:unless="${dotation.fourni}" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800">Non</span>
</td>
</tr>
</tbody>
</table>
<!-- 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> équipements
</div>
<div th:if="${totalElements == 0}">
Aucun équipement à 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/equipements/recherche(equipementId=${equipementId},categorieId=${categorieId},fourni=${fourni},commandee=${commandee},page=${currentPage - 1})}"
hx-get="/admin/equipements/recherche"
hx-target="#equipements-table-container"
hx-select="#equipements-table-container"
hx-push-url="true"
th:attr="hx-vals=|{&quot;equipementId&quot;: &quot;${equipementId != null ? equipementId : ''}&quot;, &quot;categorieId&quot;: &quot;${categorieId != null ? categorieId : ''}&quot;, &quot;fourni&quot;: &quot;${fourni != null ? fourni : ''}&quot;, &quot;commandee&quot;: &quot;${commandee != null ? commandee : ''}&quot;, &quot;page&quot;: ${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/equipements/recherche(equipementId=${equipementId},categorieId=${categorieId},fourni=${fourni},commandee=${commandee},page=${pageNum})}"
hx-get="/admin/equipements/recherche"
hx-target="#equipements-table-container"
hx-select="#equipements-table-container"
hx-push-url="true"
th:attr="hx-vals=|{&quot;equipementId&quot;: &quot;${equipementId != null ? equipementId : ''}&quot;, &quot;categorieId&quot;: &quot;${categorieId != null ? categorieId : ''}&quot;, &quot;fourni&quot;: &quot;${fourni != null ? fourni : ''}&quot;, &quot;commandee&quot;: &quot;${commandee != null ? commandee : ''}&quot;, &quot;page&quot;: ${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/equipements/recherche(equipementId=${equipementId},categorieId=${categorieId},fourni=${fourni},commandee=${commandee},page=${currentPage + 1})}"
hx-get="/admin/equipements/recherche"
hx-target="#equipements-table-container"
hx-select="#equipements-table-container"
hx-push-url="true"
th:attr="hx-vals=|{&quot;equipementId&quot;: &quot;${equipementId != null ? equipementId : ''}&quot;, &quot;categorieId&quot;: &quot;${categorieId != null ? categorieId : ''}&quot;, &quot;fourni&quot;: &quot;${fourni != null ? fourni : ''}&quot;, &quot;commandee&quot;: &quot;${commandee != null ? commandee : ''}&quot;, &quot;page&quot;: ${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>