Compare commits
26 Commits
dev-comp
...
8517e9824c
| Author | SHA1 | Date | |
|---|---|---|---|
| 8517e9824c | |||
| 6cec8ff31d | |||
| e7deba52e9 | |||
| d95c173fa8 | |||
| 8a0e4423f2 | |||
| b956236934 | |||
| 7767c98304 | |||
| 7e380ccb69 | |||
| 94d1148eb1 | |||
| 8a14f58ce5 | |||
| 79dbbdaaec | |||
| bf5704db54 | |||
| dec98f9508 | |||
| d3a62e980d | |||
| b89ed62795 | |||
| 5ffc9fb495 | |||
| 5e48bc4623 | |||
| 81b953fb05 | |||
| c6659f8d85 | |||
| e86fe42b3d | |||
| ef528aa524 | |||
| e6cc4cbc96 | |||
| c58dedf80a | |||
| 1908de681e | |||
| 76381c75bd | |||
| 7d281196c1 |
@@ -76,6 +76,7 @@ jobs:
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
script: |
|
||||
cd ${{ secrets.TARGET_DIR }}
|
||||
docker logs ffsaf > "log/ffsaf_logs_$(date +"%Y-%m-%d_%H-%M-%S").log" 2>&1
|
||||
docker stop ffsaf
|
||||
docker rm ffsaf
|
||||
docker compose up --build -d ffsaf
|
||||
|
||||
@@ -30,8 +30,10 @@ public class LogModel {
|
||||
|
||||
Long target_id;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
String target_name;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
String message;
|
||||
|
||||
public enum ActionType {
|
||||
|
||||
@@ -82,4 +82,22 @@ public class MembreModel implements LoggableModel {
|
||||
public LogModel.ObjectType getObjectType() {
|
||||
return LogModel.ObjectType.Membre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MembreModel{" +
|
||||
"id=" + id +
|
||||
", userId='" + userId + '\'' +
|
||||
", lname='" + lname + '\'' +
|
||||
", fname='" + fname + '\'' +
|
||||
", categorie=" + categorie +
|
||||
", genre=" + genre +
|
||||
", licence=" + licence +
|
||||
", country='" + country + '\'' +
|
||||
", birth_date=" + birth_date +
|
||||
", email='" + email + '\'' +
|
||||
", role=" + role +
|
||||
", grade_arbitrage=" + grade_arbitrage +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.hibernate.reactive.mutiny.Mutiny;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -30,6 +31,7 @@ import java.util.stream.Stream;
|
||||
@WithSession
|
||||
@ApplicationScoped
|
||||
public class AffiliationService {
|
||||
private static final Logger LOGGER = Logger.getLogger(AffiliationService.class);
|
||||
|
||||
@Inject
|
||||
CombRepository combRepository;
|
||||
@@ -146,6 +148,9 @@ public class AffiliationService {
|
||||
}
|
||||
|
||||
public Uni<String> save(AffiliationRequestForm form) {
|
||||
LOGGER.debug("Affiliation Request Created");
|
||||
LOGGER.debug(form.toString());
|
||||
|
||||
// noinspection ResultOfMethodCallIgnored,ReactiveStreamsUnusedPublisher
|
||||
return pre_save(form, true)
|
||||
.chain(model -> Panache.withTransaction(() -> repositoryRequest.persist(model)))
|
||||
@@ -169,6 +174,9 @@ public class AffiliationService {
|
||||
}
|
||||
|
||||
public Uni<?> saveAdmin(AffiliationRequestSaveForm form) {
|
||||
LOGGER.debug("Affiliation Request Saved");
|
||||
LOGGER.debug(form.toString());
|
||||
|
||||
return repositoryRequest.findById(form.getId())
|
||||
.onItem().ifNull().failWith(new DNotFoundException("Demande d'affiliation non trouvé"))
|
||||
.map(model -> {
|
||||
@@ -259,7 +267,9 @@ public class AffiliationService {
|
||||
}).call(m -> Panache.withTransaction(() -> combRepository.persist(m)));
|
||||
}
|
||||
})
|
||||
.call(m -> ((m.getUserId() == null) ? keycloakService.initCompte(m.getId()) :
|
||||
.call(m -> ((m.getUserId() == null) ? keycloakService.initCompte(m.getId())
|
||||
.onFailure().invoke(t -> LOGGER.warnf("Failed to init account: %s", t.getMessage())).onFailure()
|
||||
.recoverWithNull() :
|
||||
keycloakService.setClubGroupMembre(m, club).map(__ -> m.getUserId()))
|
||||
.call(userId -> keycloakService.setAutoRoleMembre(userId, m.getRole(), m.getGrade_arbitrage()))
|
||||
.call(userId -> keycloakService.setEmail(userId, m.getEmail())))
|
||||
@@ -273,6 +283,9 @@ public class AffiliationService {
|
||||
}
|
||||
|
||||
public Uni<?> accept(AffiliationRequestSaveForm form) {
|
||||
LOGGER.debug("Affiliation Request Accepted");
|
||||
LOGGER.debug(form.toString());
|
||||
|
||||
return repositoryRequest.findById(form.getId())
|
||||
.onItem().ifNull().failWith(new DNotFoundException("Demande d'affiliation non trouvé"))
|
||||
.chain(req ->
|
||||
@@ -298,6 +311,7 @@ public class AffiliationService {
|
||||
}
|
||||
|
||||
private Uni<ClubModel> acceptNew(AffiliationRequestSaveForm form, AffiliationRequestModel model) {
|
||||
LOGGER.debug("New Club Accepted");
|
||||
return Uni.createFrom().nullItem()
|
||||
.chain(() -> {
|
||||
ClubModel club = new ClubModel();
|
||||
@@ -336,6 +350,7 @@ public class AffiliationService {
|
||||
}
|
||||
|
||||
private Uni<ClubModel> acceptOld(AffiliationRequestSaveForm form, AffiliationRequestModel model, ClubModel club) {
|
||||
LOGGER.debug("Old Club Accepted");
|
||||
return Uni.createFrom().nullItem()
|
||||
.chain(() -> {
|
||||
club.setName(form.getName());
|
||||
|
||||
@@ -18,6 +18,7 @@ import io.smallrye.mutiny.unchecked.Unchecked;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import org.hibernate.reactive.mutiny.Mutiny;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
@@ -26,6 +27,7 @@ import java.util.function.Function;
|
||||
@WithSession
|
||||
@ApplicationScoped
|
||||
public class LicenceService {
|
||||
private static final Logger LOGGER = Logger.getLogger(LicenceService.class);
|
||||
|
||||
@Inject
|
||||
LicenceRepository repository;
|
||||
@@ -125,7 +127,9 @@ public class LicenceService {
|
||||
.chain(() -> combRepository.persist(membreModel))
|
||||
: Uni.createFrom().nullItem())
|
||||
.call(__ -> (membreModel.getUserId() == null) ?
|
||||
keycloakService.initCompte(membreModel.getId())
|
||||
keycloakService.initCompte(membreModel.getId()).onFailure()
|
||||
.invoke(t -> LOGGER.infof("Failed to init account: %s", t.getMessage())).onFailure()
|
||||
.recoverWithNull()
|
||||
: Uni.createFrom().nullItem());
|
||||
}
|
||||
|
||||
|
||||
@@ -197,6 +197,11 @@ public class MembreService {
|
||||
return Uni.createFrom().nullItem();
|
||||
AtomicReference<ClubModel> clubModel = new AtomicReference<>();
|
||||
|
||||
LOGGER.debugf("Membre import (size=%d)", data2.size());
|
||||
for (SimpleMembreInOutData simpleMembreInOutData : data2) {
|
||||
LOGGER.debugf("-> %s", simpleMembreInOutData.toString());
|
||||
}
|
||||
|
||||
return repository.find("userId = ?1", subject).firstResult()
|
||||
.chain(membreModel -> {
|
||||
clubModel.set(membreModel.getClub());
|
||||
@@ -205,20 +210,24 @@ public class MembreService {
|
||||
return repository.list("licence IN ?1 OR LOWER(lname || ' ' || fname) IN ?2 OR email IN ?3",
|
||||
data2.stream().map(SimpleMembreInOutData::getLicence).filter(Objects::nonNull).toList(),
|
||||
data2.stream().map(o -> (o.getNom() + " " + o.getPrenom()).toLowerCase()).toList(),
|
||||
data2.stream().map(SimpleMembreInOutData::getEmail).filter(Objects::nonNull).toList());
|
||||
data2.stream().map(SimpleMembreInOutData::getEmail).filter(o -> o != null && !o.isBlank())
|
||||
.toList());
|
||||
})
|
||||
.call(Unchecked.function(membres -> {
|
||||
for (MembreModel membreModel : membres) {
|
||||
if (!Objects.equals(membreModel.getClub(), clubModel.get()))
|
||||
if (!Objects.equals(membreModel.getClub(), clubModel.get())) {
|
||||
LOGGER.info("Similar membres found: " + membreModel);
|
||||
throw new DForbiddenException(
|
||||
"Le membre n°" + membreModel.getLicence() + " n'appartient pas à votre club");
|
||||
}
|
||||
}
|
||||
Uni<Void> uniResult = Uni.createFrom().voidItem();
|
||||
for (SimpleMembreInOutData dataIn : data2) {
|
||||
MembreModel model = membres.stream()
|
||||
.filter(m -> Objects.equals(m.getLicence(), dataIn.getLicence()) || m.getLname()
|
||||
.equals(dataIn.getNom()) && m.getFname().equals(dataIn.getPrenom()) ||
|
||||
Objects.equals(m.getFname(), dataIn.getEmail())).findFirst()
|
||||
(dataIn.getEmail() != null && !dataIn.getEmail().isBlank() && Objects.equals(
|
||||
m.getFname(), dataIn.getEmail()))).findFirst()
|
||||
.orElseGet(() -> {
|
||||
MembreModel mm = new MembreModel();
|
||||
mm.setClub(clubModel.get());
|
||||
@@ -229,12 +238,14 @@ public class MembreService {
|
||||
|
||||
if (model.getEmail() != null) {
|
||||
if (model.getLicence() != null && !model.getLicence().equals(dataIn.getLicence())) {
|
||||
LOGGER.info("Similar membres found: " + model);
|
||||
throw new DBadRequestException("Email déja utiliser");
|
||||
}
|
||||
|
||||
if (StringSimilarity.similarity(model.getLname().toUpperCase(),
|
||||
dataIn.getNom().toUpperCase()) > 3 || StringSimilarity.similarity(
|
||||
model.getFname().toUpperCase(), dataIn.getPrenom().toUpperCase()) > 3) {
|
||||
LOGGER.info("Similar membres found: " + model);
|
||||
throw new DBadRequestException("Email déja utiliser");
|
||||
}
|
||||
}
|
||||
@@ -244,6 +255,7 @@ public class MembreService {
|
||||
if ((!add && StringSimilarity.similarity(model.getLname().toUpperCase(),
|
||||
dataIn.getNom().toUpperCase()) > 3) || (!add && StringSimilarity.similarity(
|
||||
model.getFname().toUpperCase(), dataIn.getPrenom().toUpperCase()) > 3)) {
|
||||
LOGGER.info("Similar membres found: " + model);
|
||||
throw new DBadRequestException(
|
||||
"Pour enregistrer un nouveau membre, veuillez laisser le champ licence vide.");
|
||||
}
|
||||
@@ -319,7 +331,7 @@ public class MembreService {
|
||||
return update(repository.findById(id)
|
||||
.call(__ -> repository.count("email LIKE ?1 AND id != ?2", membre.getEmail(), id)
|
||||
.invoke(Unchecked.consumer(c -> {
|
||||
if (c > 0)
|
||||
if (c > 0 && !membre.getEmail().isBlank())
|
||||
throw new DBadRequestException("Email déjà utiliser");
|
||||
})))
|
||||
.chain(membreModel -> clubRepository.findById(membre.getClub())
|
||||
@@ -341,7 +353,7 @@ public class MembreService {
|
||||
return update(repository.findById(id)
|
||||
.call(__ -> repository.count("email LIKE ?1 AND id != ?2", membre.getEmail(), id)
|
||||
.invoke(Unchecked.consumer(c -> {
|
||||
if (c > 0)
|
||||
if (c > 0 && !membre.getEmail().isBlank())
|
||||
throw new DBadRequestException("Email déjà utiliser");
|
||||
})))
|
||||
.invoke(Unchecked.consumer(membreModel -> {
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
@@ -69,7 +70,8 @@ public class ClubEndpoints {
|
||||
@APIResponse(responseCode = "500", description = "Erreur interne du serveur")
|
||||
})
|
||||
public Uni<List<SimpleClubModel>> getAll() {
|
||||
return clubService.getAll().map(clubModels -> clubModels.stream().map(SimpleClubModel::fromModel).toList());
|
||||
return clubService.getAll().map(clubModels -> clubModels.stream().map(SimpleClubModel::fromModel).sorted(
|
||||
Comparator.comparing(SimpleClubModel::getName)).toList());
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
import org.jboss.resteasy.reactive.PartType;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@ToString(exclude = {"status", "logo"})
|
||||
public class AffiliationRequestForm {
|
||||
@Schema(description = "L'identifiant de l'affiliation. (null si nouvelle demande d'affiliation)")
|
||||
@FormParam("id")
|
||||
|
||||
@@ -4,12 +4,10 @@ import fr.titionfire.ffsaf.utils.RoleAsso;
|
||||
import jakarta.ws.rs.FormParam;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
import org.jboss.resteasy.reactive.PartType;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
public class AffiliationRequestSaveForm {
|
||||
@Schema(description = "L'identifiant de l'affiliation.", example = "1", required = true)
|
||||
@FormParam("id")
|
||||
@@ -171,4 +169,39 @@ public class AffiliationRequestSaveForm {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AffiliationRequestSaveForm{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", siret=" + siret +
|
||||
", rna='" + rna + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", contact='" + contact + '\'' +
|
||||
", status_len=" + status.length +
|
||||
", logo_len=" + logo.length +
|
||||
", m1_mode=" + m1_mode +
|
||||
", m1_role=" + m1_role +
|
||||
", m1_lincence='" + m1_lincence + '\'' +
|
||||
", m1_lname='" + m1_lname + '\'' +
|
||||
", m1_fname='" + m1_fname + '\'' +
|
||||
", m1_email='" + m1_email + '\'' +
|
||||
", m1_email_mode=" + m1_email_mode +
|
||||
", m2_mode=" + m2_mode +
|
||||
", m2_role=" + m2_role +
|
||||
", m2_lincence='" + m2_lincence + '\'' +
|
||||
", m2_lname='" + m2_lname + '\'' +
|
||||
", m2_fname='" + m2_fname + '\'' +
|
||||
", m2_email='" + m2_email + '\'' +
|
||||
", m2_email_mode=" + m2_email_mode +
|
||||
", m3_mode=" + m3_mode +
|
||||
", m3_role=" + m3_role +
|
||||
", m3_lincence='" + m3_lincence + '\'' +
|
||||
", m3_lname='" + m3_lname + '\'' +
|
||||
", m3_fname='" + m3_fname + '\'' +
|
||||
", m3_email='" + m3_email + '\'' +
|
||||
", m3_email_mode=" + m3_email_mode +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {useEffect, useRef} from 'react'
|
||||
import {Nav} from "./components/Nav.jsx";
|
||||
import {createBrowserRouter, Outlet, RouterProvider, useRouteError} from "react-router-dom";
|
||||
import {createBrowserRouter, Outlet, RouterProvider, useLocation, useRouteError} from "react-router-dom";
|
||||
import {Home} from "./pages/Homepage.jsx";
|
||||
import {AdminRoot, getAdminChildren} from "./pages/admin/AdminRoot.jsx";
|
||||
import {AuthCallback} from "./components/auhCallback.jsx";
|
||||
import {KeycloakContextProvider, useAuthDispatch} from "./hooks/useAuth.jsx";
|
||||
import {check_validity} from "./utils/auth.js";
|
||||
import {KeycloakContextProvider, useAuth, useAuthDispatch} from "./hooks/useAuth.jsx";
|
||||
import {check_validity, login} from "./utils/auth.js";
|
||||
import {ToastContainer} from "react-toastify";
|
||||
|
||||
import './App.css'
|
||||
@@ -14,6 +14,7 @@ import {ClubRoot, getClubChildren} from "./pages/club/ClubRoot.jsx";
|
||||
import {DemandeAff, DemandeAffOk} from "./pages/DemandeAff.jsx";
|
||||
import {MePage} from "./pages/MePage.jsx";
|
||||
import {CompetitionRoot, getCompetitionChildren} from "./pages/competition/CompetitionRoot.jsx";
|
||||
import {FallingLines} from "react-loader-spinner";
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
@@ -113,6 +114,43 @@ function Root() {
|
||||
theme="light"
|
||||
transition: Flip
|
||||
/>
|
||||
<ReAuthMsg/>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
|
||||
function ReAuthMsg() {
|
||||
const {is_authenticated} = useAuth()
|
||||
const location = useLocation()
|
||||
|
||||
const notAuthPaths = [
|
||||
/^\/$/s,
|
||||
/^\/affiliation(\/)?$/s,
|
||||
/^\/affiliation\/ok(\/)?$/s,
|
||||
/^\/complete\/auth.*$/s
|
||||
]
|
||||
|
||||
if (is_authenticated || notAuthPaths.some(r => r.test(location.pathname)))
|
||||
return <></>
|
||||
return <>
|
||||
<div className="overlayBG" style={{position: 'fixed'}}>
|
||||
<div className="overlayContent" onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
}}>
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h5>Session expirée</h5>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="card-text">Votre session a expirée, veuillez vous reconnecter pour continuer à
|
||||
utiliser l'application.</p>
|
||||
</div>
|
||||
<div className="card-footer">
|
||||
<button className="btn btn-primary" onClick={() => login()} style={{marginRight: "0.5em"}}>Se reconnecter</button>
|
||||
<a className="btn btn-secondary" href="/">Accueil</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export function HoraireEditor({data}) {
|
||||
|
||||
return <div className="row mb-3">
|
||||
<input name="training_day_time" value={JSON.stringify(out_data)} readOnly hidden/>
|
||||
<span className="input-group-text">Horaires d'entrainements</span>
|
||||
<span className="input-group-text">Horaires d'entraînements</span>
|
||||
<ul className="list-group form-control">
|
||||
{state.map((d, index) => {
|
||||
return <div key={index} className="input-group">
|
||||
|
||||
@@ -42,7 +42,7 @@ export function LocationEditor({data, setModal, sendData}) {
|
||||
|
||||
return <div className="row mb-3">
|
||||
<input name="training_location" value={JSON.stringify(out_data)} readOnly hidden/>
|
||||
<span className="input-group-text">Lieux d'entrainements</span>
|
||||
<span className="input-group-text">Lieux d'entraînements</span>
|
||||
<ul className="list-group form-control">
|
||||
{state.map((d, index) => {
|
||||
return <div key={index} className="input-group">
|
||||
|
||||
@@ -88,13 +88,14 @@ export function CountryList({name, text, value, values = undefined, disabled = f
|
||||
</div>
|
||||
}
|
||||
|
||||
export function TextField({name, text, value, placeholder, type = "text", disabled = false, required = true}) {
|
||||
return <div className="row">
|
||||
<div className="input-group mb-3">
|
||||
export function TextField({name, text, value, placeholder, type = "text", disabled = false, required = true, ttip = null}) {
|
||||
return <div className="row mb-3">
|
||||
<div className="input-group">
|
||||
<span className="input-group-text" id={name}>{text}</span>
|
||||
<input type={type} className="form-control" placeholder={placeholder ? placeholder : text} aria-label={name}
|
||||
name={name} aria-describedby={name} defaultValue={value} disabled={disabled} required={required}/>
|
||||
</div>
|
||||
{ttip}
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ function ClubMenu() {
|
||||
</div>
|
||||
<ul className="dropdown-menu">
|
||||
<li className="nav-item"><NavLink className="nav-link" to="/club/me">Mon club</NavLink></li>
|
||||
<li className="nav-item"><NavLink className="nav-link" to="/club/member">Member</NavLink></li>
|
||||
<li className="nav-item"><NavLink className="nav-link" to="/club/member">Membres</NavLink></li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
@@ -70,7 +70,7 @@ function AdminMenu() {
|
||||
Administration
|
||||
</div>
|
||||
<ul className="dropdown-menu">
|
||||
<li className="nav-item"><NavLink className="nav-link" to="/admin/member">Member</NavLink></li>
|
||||
<li className="nav-item"><NavLink className="nav-link" to="/admin/member">Membres</NavLink></li>
|
||||
<li className="nav-item"><NavLink className="nav-link" to="/admin/club">Club</NavLink></li>
|
||||
<li className="nav-item"><NavLink className="nav-link" to="/admin/stats">Statistiques</NavLink></li>
|
||||
</ul>
|
||||
|
||||
@@ -20,11 +20,11 @@ function reconstruireAdresse(infos) {
|
||||
console.log(infos);
|
||||
let adresseReconstruite = "";
|
||||
|
||||
if(infos.numero_voie === null){
|
||||
if (infos.numero_voie === null) {
|
||||
if (infos.complement_adresse) {
|
||||
adresseReconstruite += formatAdresse(infos.complement_adresse) + ', ';
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
adresseReconstruite += infos.numero_voie + ' ';
|
||||
}
|
||||
|
||||
@@ -46,6 +46,13 @@ function reconstruireAdresse(infos) {
|
||||
return adresseReconstruite;
|
||||
}
|
||||
|
||||
function getSaisonToAff(currentDate = new Date()) {
|
||||
if (currentDate.getMonth() >= 7) { //aout et plus
|
||||
return currentDate.getFullYear()
|
||||
} else {
|
||||
return currentDate.getFullYear() - 1
|
||||
}
|
||||
}
|
||||
|
||||
export function DemandeAff() {
|
||||
const {hash} = useLocation();
|
||||
@@ -145,7 +152,7 @@ export function DemandeAff() {
|
||||
}
|
||||
|
||||
return <div>
|
||||
<h1>Demande d'affiliation</h1>
|
||||
<h1>Demande d'affiliation {getSaisonToAff() + "-" + (getSaisonToAff() + 1)}</h1>
|
||||
<p>L'affiliation est annuelle et valable pour une saison sportive : du 1er septembre au 31 août de l’année
|
||||
suivante.</p>
|
||||
Pour s’affilier, une association sportive doit réunir les conditions suivantes :
|
||||
@@ -216,7 +223,6 @@ function AssoInfo({initData, needFile}) {
|
||||
const [rna, setRna] = useState(initData.rna ? initData.rna : "")
|
||||
const [rnaEnable, setRnaEnable] = useState(false)
|
||||
const [adresse, setAdresse] = useState(initData.address ? initData.address : "")
|
||||
const [saison, setSaison] = useState(initData.saison ? initData.saison : getSaison())
|
||||
const [contact, setContact] = useState(initData.contact ? initData.contact : "")
|
||||
|
||||
const fetchSiret = () => {
|
||||
@@ -245,26 +251,8 @@ function AssoInfo({initData, needFile}) {
|
||||
setAdresse(reconstruireAdresse(data2.etablissement_siege))
|
||||
})
|
||||
}
|
||||
|
||||
const currentSaison = getSaison();
|
||||
|
||||
return <>
|
||||
<div className="input-group mb-3">
|
||||
<div className="input-group-text">
|
||||
<input className="form-check-input mt-0" type="radio" value={currentSaison} aria-label={currentSaison + "-" + (currentSaison + 1)}
|
||||
name={"saison"} checked={saison === currentSaison}
|
||||
onChange={e => setSaison(Number(e.target.value))}/>
|
||||
{currentSaison + "-" + (currentSaison + 1)}
|
||||
</div>
|
||||
<span className="input-group-text">OU</span>
|
||||
<div className="input-group-text">
|
||||
<input className="form-check-input mt-0" type="radio" value={currentSaison + 1}
|
||||
aria-label={(currentSaison + 1) + "-" + (currentSaison + 2)}
|
||||
name={"saison"} checked={saison === currentSaison + 1}
|
||||
onChange={e => setSaison(Number(e.target.value))}/>
|
||||
{(currentSaison + 1) + "-" + (currentSaison + 2)}
|
||||
</div>
|
||||
</div>
|
||||
<input name="saison" value={getSaisonToAff()} readOnly hidden/>
|
||||
|
||||
<div className="input-group mb-3">
|
||||
<span className="input-group-text" id="basic-addon1">Nom de l'association*</span>
|
||||
|
||||
@@ -5,22 +5,22 @@ export const Home = () => {
|
||||
return <>
|
||||
<div className="container">
|
||||
<div style={{textAlign: "center", margin: "2em"}}>
|
||||
<h1 className="text-green-800 text-4xl">Bienvenu sur l'intranet de Fédération Française de Soft Armored Fighting</h1>
|
||||
<h1 className="text-green-800 text-4xl">Bienvenue sur l’intranet de la Fédération France Soft Armored Fighting</h1>
|
||||
</div>
|
||||
<div className="row" style={{marginTop: "3em"}}>
|
||||
<div className="col" style={{backgroundColor: "#FFFFFF79", padding: "0", borderRadius: "3em 3em 1em 1em", margin: "1em"}}>
|
||||
<div className="align-content-center"
|
||||
style={{textAlign: "center", backgroundColor: "#FFFFFF79", padding: "1em 1em 0em 1em", borderRadius: "3em 3em 0 0"}}>
|
||||
<h2><FontAwesomeIcon icon={faUser} size="2xl"/></h2>
|
||||
<h2>Pour les combatants</h2>
|
||||
<h2>Pour les licenciés</h2>
|
||||
</div>
|
||||
<p style={{padding: "0.5em 1em 0.5em 1em"}}>
|
||||
Vous y retrouverez toutes vos informations ainsi que l'état de votre inscription à la fédération. Vous pouvez également
|
||||
télécharger votre attestation d'inscription, vous inscrire aux compétitions ainsi qu'en consultée vos résultats sous réserve
|
||||
que le club organisateur les ait renseignés. <br/>
|
||||
télécharger votre attestation d'inscription, vous inscrire aux compétitions ainsi que consulter vos résultats sous réserve que
|
||||
le club organisateur les ait renseignés. <br/>
|
||||
<br/>
|
||||
Lors de votre première inscription, vous réservez un email contenant vos
|
||||
informations d'identification sur ce site, ce mail sera envoyé une fois votre inscription validée par nos soins.
|
||||
Lors de votre première inscription, vous recevrez un email contenant vos informations d'identification, ce mail sera envoyé
|
||||
une fois votre licence validée par le secrétariat.
|
||||
</p>
|
||||
</div>
|
||||
<div className="col" style={{backgroundColor: "#FFFFFF79", padding: "0", borderRadius: "3em 3em 1em 1em", margin: "1em"}}>
|
||||
@@ -30,12 +30,12 @@ export const Home = () => {
|
||||
<h2>Pour les clubs</h2>
|
||||
</div>
|
||||
<p style={{padding: "0.5em 1em 0.5em 1em"}}>
|
||||
C'est ici que vous pouvez faire l'inscription de vos membres à la fédération, que vous pouvez demander où renouveler votre
|
||||
demande d'affiliation, renseigné vos horaires, lieux d'entraînement et réseaux sociaux qui seront par la suite affichés sur le
|
||||
site ffsaf.fr.<br/>
|
||||
C'est ici que vous pouvez prendre les licences fédérales pour vos adhérents, que vous pouvez demander ou renouveler votre
|
||||
affiliation, renseigner vos horaires, lieux d'entraînement et réseaux sociaux qui seront par la suite affichés sur
|
||||
le site ffsaf.fr.<br/>
|
||||
Vous aurez par ailleurs la possibilité de publier des formulaires d'inscriptions pour vos compétitions ainsi
|
||||
que d'un publié les résultats.<br/><br/>
|
||||
Vous n'étes pas encore affilié à la fédération ? Vous pouvez faire une demande d'affiliation en cliquant <a href="/affiliation">içi</a>.
|
||||
que d'enregistrer les résultats.<br/><br/>
|
||||
Vous n'êtes pas encore affilié à la fédération ? Cliquez <a href="/affiliation">içi</a> pour faire votre première demande.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,6 @@ import {RoleList, TextField} from "../../../components/MemberCustomFiels.jsx";
|
||||
import {useEffect, useRef, useState} from "react";
|
||||
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
||||
import {faFilePdf} from "@fortawesome/free-solid-svg-icons";
|
||||
import {ConfirmDialog} from "../../../components/ConfirmDialog.jsx";
|
||||
|
||||
const vite_url = import.meta.env.VITE_URL;
|
||||
|
||||
@@ -166,7 +165,7 @@ function Content({data, refresh}) {
|
||||
<input name="id" value={data.id} readOnly hidden/>
|
||||
<div className="card-header">Demande d'affiliation</div>
|
||||
<div className="card-body text-center">
|
||||
{data.club && <h5>Ce club a déjà ete affilier (affiliation n°{data.club_no_aff})</h5>}
|
||||
{data.club && <h5>Ce club a déjà été affilié (affiliation n°{data.club_no_aff})</h5>}
|
||||
<h4 id="saison">Saison {data.saison}-{data.saison + 1}</h4>
|
||||
|
||||
<div className="row mb-3">
|
||||
|
||||
@@ -172,6 +172,7 @@ function InformationForm({data}) {
|
||||
export function BureauCard({clubData}) {
|
||||
const setLoading = useLoadingSwitcher()
|
||||
const {data, error} = useFetch(`/club/desk/${clubData.id}`, setLoading, 1)
|
||||
const navigate = useNavigate();
|
||||
|
||||
return <>
|
||||
<div className="card mb-4">
|
||||
@@ -179,7 +180,8 @@ export function BureauCard({clubData}) {
|
||||
<div className="card-body">
|
||||
<ul className="list-group">
|
||||
{data && data.map((d, index) => {
|
||||
return <div key={index} className="list-group-item d-flex justify-content-between align-items-start">
|
||||
return <div key={index} className="list-group-item d-flex justify-content-between align-items-start list-group-item-action"
|
||||
onClick={__ => navigate(`/admin/member/${d.id}`)}>
|
||||
<div className="me-auto"><small>{d.role}</small><br/>{d.lname} {d.fname}</div>
|
||||
</div>
|
||||
})}
|
||||
|
||||
@@ -23,7 +23,7 @@ export function ClubRoot() {
|
||||
|
||||
return <>
|
||||
<div style={{display: 'flex', flexDirection: 'row', alignItems: 'center', flexWrap: 'wrap'}}>
|
||||
<h1>Espace club</h1><h3 style={{marginLeft: '0.75em'}}>{club}</h3></div>
|
||||
<h3 style={{marginLeft: '0.75em'}}>Club: {club}</h3></div>
|
||||
<LoadingProvider>
|
||||
<Outlet/>
|
||||
</LoadingProvider>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import {useLoadingSwitcher} from "../../../hooks/useLoading.jsx";
|
||||
import {useFetch} from "../../../hooks/useFetch.js";
|
||||
import {useEffect, useReducer, useState} from "react";
|
||||
import {useState} from "react";
|
||||
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
||||
import {faEye, faFilePdf, faPen} from "@fortawesome/free-solid-svg-icons";
|
||||
import {faEye, faFilePdf} from "@fortawesome/free-solid-svg-icons";
|
||||
import {AxiosError} from "../../../components/AxiosError.jsx";
|
||||
import {apiAxios, getSaison} from "../../../utils/Tools.js";
|
||||
import {apiAxios} from "../../../utils/Tools.js";
|
||||
import {toast} from "react-toastify";
|
||||
import {SimpleReducer} from "../../../utils/SimpleReducer.jsx";
|
||||
import {useNavigate} from "react-router-dom";
|
||||
|
||||
const vite_url = import.meta.env.VITE_URL;
|
||||
@@ -42,8 +41,8 @@ export function AffiliationCard({clubData}) {
|
||||
|
||||
<a href={`${vite_url}/api/club/me/affiliation`} target='#'>
|
||||
<button className="btn btn-primary" type="button" id="button-addon1" style={{marginTop: '1em'}}
|
||||
onClick={e => null}>
|
||||
Téléchargée l'attestation d'affiliation <FontAwesomeIcon icon={faFilePdf}></FontAwesomeIcon>
|
||||
onClick={_ => null}>
|
||||
Télécharger l’attestation d’affiliation <FontAwesomeIcon icon={faFilePdf}></FontAwesomeIcon>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
@@ -140,10 +139,10 @@ function ModalContent2({clubData, data}) {
|
||||
}
|
||||
}
|
||||
|
||||
if (list.length !== 3) {
|
||||
toast.error("Il faut sélectionner 3 membres pour renouveler l'affiliation")
|
||||
return
|
||||
while (list.length < 3) {
|
||||
list.push(-1)
|
||||
}
|
||||
|
||||
apiAxios.get(`/club/renew/${clubData.id}?m1=${list[0]}&m2=${list[1]}&m3=${list[2]}`).then(data => {
|
||||
navigate('/affiliation#d' + encodeURI(JSON.stringify(data.data)))
|
||||
})
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import {useNavigate, useParams} from "react-router-dom";
|
||||
import {LoadingProvider, useLoadingSwitcher} from "../../../hooks/useLoading.jsx";
|
||||
import {useFetch} from "../../../hooks/useFetch.js";
|
||||
import {toast} from "react-toastify";
|
||||
import {apiAxios, errFormater} from "../../../utils/Tools.js";
|
||||
import {ConfirmDialog} from "../../../components/ConfirmDialog.jsx";
|
||||
import {AxiosError} from "../../../components/AxiosError.jsx";
|
||||
import {AffiliationCard, BureauCard} from "./AffiliationCard.jsx";
|
||||
import {CountryList, TextField} from "../../../components/MemberCustomFiels.jsx";
|
||||
@@ -22,7 +20,7 @@ export function MyClubPage() {
|
||||
const {data, error} = useFetch(`/club/me`, setLoading, 1)
|
||||
|
||||
return <>
|
||||
<h2>Mon club</h2>
|
||||
<h3>Données administratives</h3>
|
||||
{data
|
||||
? <div>
|
||||
<div className="row">
|
||||
@@ -91,7 +89,7 @@ function InformationForm({data}) {
|
||||
<div className="col-md-6">
|
||||
<a href={`${vite_url}/api/club/${data.id}/status`} target='_blank'>
|
||||
<button className="btn btn-outline-secondary" type="button" id="button-addon1"
|
||||
onClick={e => null}>
|
||||
onClick={_ => null}>
|
||||
<FontAwesomeIcon icon={faFilePdf} size="5x"></FontAwesomeIcon><br/>
|
||||
Voir les statues
|
||||
</button>
|
||||
|
||||
@@ -49,7 +49,9 @@ export function InformationForm({data}) {
|
||||
<TextField name="lname" text="Nom" value={data.lname}/>
|
||||
<TextField name="fname" text="Prénom" value={data.fname}/>
|
||||
<TextField name="email" text="Email" value={data.email} placeholder="name@example.com"
|
||||
type="email"/>
|
||||
type="email" ttip={<small className="form-text">L'email sert à la création de compte pour se connecter au site et doit être unique. <br/>
|
||||
Pour les mineurs, l'email des parents peut être utilisé plusieurs fois grâce à la syntaxe suivante : {'email.parent+<caractères alphanumériques>@exemple.com'}.<br/>
|
||||
Exemples : mail.parent+1@exemple.com, mail.parent+titouan@exemple.com, mail.parent+cedrique@exemple.com</small>}/>
|
||||
<OptionField name="genre" text="Genre" value={data.genre}
|
||||
values={{NA: 'N/A', H: 'H', F: 'F'}}/>
|
||||
<CountryList name="country" text="Pays" value={data.country}/>
|
||||
|
||||
@@ -9,8 +9,11 @@ export function check_validity(online_callback = () => {
|
||||
axios.get(`${vite_url}/api/auth/userinfo`).then(data => {
|
||||
online_callback({state: true, userinfo: data.data});
|
||||
})
|
||||
}else{
|
||||
online_callback({state: false});
|
||||
}
|
||||
}).catch(() => {
|
||||
console.log("=> Not authenticated");
|
||||
online_callback({state: false});
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user