From 743a6911f55c0495ab9b9334f7f2e6aae52775dc Mon Sep 17 00:00:00 2001 From: Thibaut Valentin Date: Wed, 12 Feb 2025 14:24:27 +0100 Subject: [PATCH] feat(insc): add frontend --- .../competition/CompetitionRegisterAdmin.jsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/src/pages/competition/CompetitionRegisterAdmin.jsx b/src/main/webapp/src/pages/competition/CompetitionRegisterAdmin.jsx index cf202c6..74f515a 100644 --- a/src/main/webapp/src/pages/competition/CompetitionRegisterAdmin.jsx +++ b/src/main/webapp/src/pages/competition/CompetitionRegisterAdmin.jsx @@ -21,12 +21,19 @@ export function CompetitionRegisterAdmin() { const setLoading = useLoadingSwitcher() const {data, error} = useFetch(`/competition/${id}/register`, setLoading, 1) + const sortName = (a, b) => { + if (a.data.fname === b.data.fname) + return a.data.lname.localeCompare(b.data.lname); + return a.data.fname.localeCompare(b.data.fname); + } + useEffect(() => { if (!data) return; data.forEach((d, index) => { dispatch({type: 'UPDATE_OR_ADD', payload: {id: index, data: d}}) }) + dispatch({type: 'SORT', payload: sortName}) }, [data, clubFilter, catFilter]); const sendRegister = (event, new_state) => { @@ -57,6 +64,7 @@ export function CompetitionRegisterAdmin() { }) } dispatch({type: 'UPDATE_OR_ADD', payload: {id: maxId + 1, data: response.data}}) + dispatch({type: 'SORT', payload: sortName}) document.getElementById("closeModal").click(); }) } @@ -188,7 +196,7 @@ function Modal({sendRegister, modalState, setModalState}) {
- +
@@ -243,11 +251,14 @@ function MakeCentralPanel({data, dispatch, id, setModalState}) { {req.data.licence ? String(req.data.licence).padStart(5, '0') : "-------"}
{req.data.fname} {req.data.lname}
+ {req.data.club?.name || "Sans club"}
- {req.data.club?.name || "Sans club"}
{req.data.categorie}
+ {req.data.categorie + (req.data.overCategory === 0 ? "" : (" avec " + req.data.overCategory + " de surclassement"))}
+ {req.data.weight ? req.data.weight : "---"} kg +