Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52fbd5fcf8 | ||
|
|
b6651fabb4 | ||
|
|
9531019aae |
@@ -213,11 +213,11 @@ public class AdherentController {
|
||||
} else {
|
||||
adherentRepository.save(adherent);
|
||||
}
|
||||
} else {
|
||||
adherentRepository.save(adherent);
|
||||
}
|
||||
|
||||
return "redirect:/adherents";
|
||||
} else {
|
||||
Adherent saved = adherentRepository.save(adherent);
|
||||
return "redirect:/adherents/" + saved.getId() + "/edit";
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/{id}/edit")
|
||||
|
||||
@@ -34,7 +34,17 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="adherents-table-container" class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
||||
<!-- Table Container with Wrapper-level HTMX triggers for filters -->
|
||||
<div id="adherents-table-container"
|
||||
hx-get="/adherents"
|
||||
hx-target="this"
|
||||
hx-select="#adherents-table-container"
|
||||
hx-trigger="change from:#filter-row, keyup changed delay:300ms from:#filter-row"
|
||||
hx-include="#filter-row input, #filter-row select, input[name='query']"
|
||||
hx-sync="this:replace"
|
||||
hx-on::config-request="if (event.detail.trigger.tagName !== 'BUTTON') { event.detail.parameters['page'] = 0; }"
|
||||
class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
||||
|
||||
<div class="p-4 border-b border-gray-200 flex justify-between items-center">
|
||||
<form hx-get="/adherents" hx-target="#adherents-table-container" hx-select="#adherents-table-container" class="flex items-center space-x-2">
|
||||
<input type="text" name="query" th:value="${searchQuery}" placeholder="Nom, Prénom ou N° Licence..."
|
||||
@@ -44,9 +54,6 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form id="filter-form" hx-get="/adherents" hx-target="#adherents-table-container" hx-select="#adherents-table-container" hx-trigger="change, keyup changed delay:300ms" hx-sync="this:replace" hx-on::config-request="if (event.detail.trigger.tagName !== 'BUTTON') { event.detail.parameters['page'] = 0; }" class="m-0">
|
||||
<input type="hidden" name="query" th:value="${searchQuery}">
|
||||
|
||||
<table class="w-full text-left border-collapse">
|
||||
<thead>
|
||||
<tr class="bg-gray-50 text-gray-500 text-sm uppercase tracking-wider border-b border-gray-200">
|
||||
@@ -60,7 +67,7 @@
|
||||
<th class="py-3 px-6 font-medium text-right">Actions</th>
|
||||
</tr>
|
||||
<!-- Filter Row -->
|
||||
<tr class="bg-gray-100 border-b border-gray-200 text-xs">
|
||||
<tr id="filter-row" class="bg-gray-100 border-b border-gray-200 text-xs">
|
||||
<td class="py-2 px-3">
|
||||
<input type="text" id="filterNom" name="nom" th:value="${nomFilter}" placeholder="Filtrer Nom..." class="w-full border border-gray-300 rounded px-2 py-1 text-xs focus:ring-1 focus:ring-blue-500 focus:outline-none">
|
||||
</td>
|
||||
@@ -127,7 +134,6 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!-- 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">
|
||||
@@ -146,7 +152,7 @@
|
||||
hx-get="/adherents"
|
||||
hx-target="#adherents-table-container"
|
||||
hx-select="#adherents-table-container"
|
||||
hx-include="#filter-form"
|
||||
hx-include="#filter-row input, #filter-row select, input[name='query']"
|
||||
th:attr="hx-vals=|{'page': ${currentPage - 1}}|"
|
||||
class="px-3 py-1 border border-gray-300 rounded hover:bg-gray-100 transition-colors">
|
||||
Précédent
|
||||
@@ -161,7 +167,7 @@
|
||||
hx-get="/adherents"
|
||||
hx-target="#adherents-table-container"
|
||||
hx-select="#adherents-table-container"
|
||||
hx-include="#filter-form"
|
||||
hx-include="#filter-row input, #filter-row select, input[name='query']"
|
||||
th:attr="hx-vals=|{'page': ${pageNum}}|"
|
||||
th:text="${pageNum + 1}"
|
||||
class="px-3 py-1 rounded transition-colors"
|
||||
@@ -176,7 +182,7 @@
|
||||
hx-get="/adherents"
|
||||
hx-target="#adherents-table-container"
|
||||
hx-select="#adherents-table-container"
|
||||
hx-include="#filter-form"
|
||||
hx-include="#filter-row input, #filter-row select, input[name='query']"
|
||||
th:attr="hx-vals=|{'page': ${currentPage + 1}}|"
|
||||
class="px-3 py-1 border border-gray-300 rounded hover:bg-gray-100 transition-colors">
|
||||
Suivant
|
||||
|
||||
Reference in New Issue
Block a user