feat: add permission setting to admin page
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m44s

This commit is contained in:
2026-01-03 21:49:36 +01:00
parent 959e356fb9
commit 3933954e09
10 changed files with 176 additions and 18 deletions

View File

@@ -51,9 +51,11 @@ export function CompetitionEdit() {
<Content data={data} refresh={refresh}/>
{data.id !== null && <button style={{marginBottom: "1.5em", width: "100%"}} className="btn btn-primary"
onClick={_ => navigate(`/competition/${data.id}/register?type=${data.registerMode}`)}>Voir/Modifier les participants</button>}
onClick={_ => navigate(`/competition/${data.id}/register?type=${data.registerMode}`)}>Voir/Modifier
les participants</button>}
{data.id !== null && data.system === "SAFCA" && <ContentSAFCA data2={data}/>}
{data.id !== null && (data.system === "SAFCA" || data.system === "INTERNAL") &&
<ContentSAFCAAndInternal data2={data} type={data.system}/>}
{data.id !== null && <>
<div className="col" style={{textAlign: 'right', marginTop: '1em'}}>
@@ -72,9 +74,12 @@ export function CompetitionEdit() {
</>
}
function ContentSAFCA({data2}) {
function ContentSAFCAAndInternal({data2, type = "SAFCA"}) {
const getDataPath = type === "SAFCA" ? `/competition/${data2.id}/safcaData` : `/competition/${data2.id}/internalData`
const setDataPath = type === "SAFCA" ? "/competition/safcaData" : "/competition/internalData"
const setLoading = useLoadingSwitcher()
const {data, error} = useFetch(`/competition/${data2.id}/safcaData`, setLoading, 1)
const {data, error} = useFetch(getDataPath, setLoading, 1)
const [state, dispatch] = useReducer(SimpleReducer, [])
const [state2, dispatch2] = useReducer(SimpleReducer, [])
@@ -109,7 +114,7 @@ function ContentSAFCA({data2}) {
out['table'] = state2.map(d => d.data)
toast.promise(
apiAxios.post(`/competition/safcaData`, out),
apiAxios.post(setDataPath, out),
{
pending: "Enregistrement des paramètres en cours",
success: "Paramètres enregistrée avec succès 🎉",
@@ -402,7 +407,8 @@ function Content({data}) {
<li><strong>Configurer l'url de notification : </strong>afin que nous puissions recevoir une notification à
chaque inscription, il est nécessaire de configurer l'url de notification de votre compte HelloAsso pour
qu'il redirige vers "https://intra.ffsaf.fr/api/webhook/ha". Pour ce faire, depuis la page d'accueil de
votre association sur HelloAsso, allez dans <strong>Mon compte</strong> &gt; <strong>Paramètres</strong> &gt;
votre association sur HelloAsso, allez dans <strong>Mon compte</strong> &gt;
<strong>Paramètres</strong> &gt;
<strong> Intégrations et API</strong> section Notification et copier-coller <strong>https://intra.ffsaf.fr/api/webhook/ha </strong>
dans le champ <strong>Mon URL de callback</strong> et enregister.
<img src="/img/HA-help-4.png" alt="" className="img-fluid" style={{objectFit: "contain"}}/></li>

View File

@@ -79,6 +79,13 @@ function MakeContent({data}) {
href={`https://www.helloasso.com/associations/${data.data1}/evenements/${data.data2}`} target="_blank"
rel="noopener noreferrer">{`https://www.helloasso.com/associations/${data.data1}/evenements/${data.data2}`}</a></p>
}
{data.canEditRegisters &&
<div style={{marginTop: "0.5em"}}>
<button type="button" className="btn btn-primary"
onClick={_ => navigate("/competition/" + data.id + "/register")}>Inscription - mode administrateur
</button>
</div>
}
</div>
</div>
}

View File

@@ -342,7 +342,7 @@ function CategoryHeader({cat, setCatId}) {
}, [cats]);
useEffect(() => {
if (cats && cats.length > 0 && !cat || (cats && !cats.find(c => c.id === cat.id))) {
if (cats && cats.length > 0 && (!cat || (cats && !cats.find(c => c.id === cat.id)))) {
setCatId(cats.sort((a, b) => a.name.localeCompare(b.name))[0].id);
} else if (cats && cats.length === 0) {
setModal({});