feat: admin club filter fetch all club
fix: log null update case
This commit is contained in:
parent
1e260caddb
commit
3fd5ae3741
@ -86,7 +86,9 @@ public class LoggerService {
|
|||||||
public void logChange(String champ, Object o1, Object o2, LoggableModel model) {
|
public void logChange(String champ, Object o1, Object o2, LoggableModel model) {
|
||||||
if (Objects.equals(o1, o2))
|
if (Objects.equals(o1, o2))
|
||||||
return;
|
return;
|
||||||
log(ActionType.UPDATE, champ + ": " + o1.toString() + " -> " + o2.toString(), model);
|
log(ActionType.UPDATE,
|
||||||
|
champ + ": " + (o1 == null ? "null" : o1.toString()) + " -> " + (o2 == null ? "null" : o2.toString()),
|
||||||
|
model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logDelete(LoggableModel model) {
|
public void logDelete(LoggableModel model) {
|
||||||
|
|||||||
@ -96,10 +96,17 @@ public class MembreService {
|
|||||||
if (club == null || club.isBlank()) {
|
if (club == null || club.isBlank()) {
|
||||||
query = repository.find(FIND_NAME_REQUEST, Sort.ascending("fname", "lname"), search)
|
query = repository.find(FIND_NAME_REQUEST, Sort.ascending("fname", "lname"), search)
|
||||||
.page(Page.ofSize(limit));
|
.page(Page.ofSize(limit));
|
||||||
} else
|
} else {
|
||||||
query = repository.find(
|
if (club.equals("null")) {
|
||||||
"LOWER(club.name) LIKE LOWER(?2) AND (" + FIND_NAME_REQUEST + ")",
|
query = repository.find(
|
||||||
Sort.ascending("fname", "lname"), search, club + "%").page(Page.ofSize(limit));
|
"club IS NULL AND (" + FIND_NAME_REQUEST + ")",
|
||||||
|
Sort.ascending("fname", "lname"), search).page(Page.ofSize(limit));
|
||||||
|
} else {
|
||||||
|
query = repository.find(
|
||||||
|
"LOWER(club.name) LIKE LOWER(?2) AND (" + FIND_NAME_REQUEST + ")",
|
||||||
|
Sort.ascending("fname", "lname"), search, club + "%").page(Page.ofSize(limit));
|
||||||
|
}
|
||||||
|
}
|
||||||
return getPageResult(query, limit, page);
|
return getPageResult(query, limit, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +209,8 @@ public class MembreService {
|
|||||||
}
|
}
|
||||||
model.setGenre(Genre.fromString(dataIn.getGenre()));
|
model.setGenre(Genre.fromString(dataIn.getGenre()));
|
||||||
if (dataIn.getBirthdate() != null) {
|
if (dataIn.getBirthdate() != null) {
|
||||||
if (!Objects.equals(model.getBirth_date().getTime(), dataIn.getBirthdate().getTime()))
|
if (model.getBirth_date() == null || !Objects.equals(model.getBirth_date().getTime(),
|
||||||
|
dataIn.getBirthdate().getTime()))
|
||||||
ls.logChange("Date de naissance", model.getBirth_date(), dataIn.getBirthdate(), model);
|
ls.logChange("Date de naissance", model.getBirth_date(), dataIn.getBirthdate(), model);
|
||||||
model.setBirth_date(dataIn.getBirthdate());
|
model.setBirth_date(dataIn.getBirthdate());
|
||||||
model.setCategorie(Utils.getCategoryFormBirthDate(model.getBirth_date(), new Date()));
|
model.setCategorie(Utils.getCategoryFormBirthDate(model.getBirth_date(), new Date()));
|
||||||
@ -301,7 +309,8 @@ public class MembreService {
|
|||||||
target.setLname(membre.getLname().toUpperCase());
|
target.setLname(membre.getLname().toUpperCase());
|
||||||
ls.logChange("Pays", target.getCountry(), membre.getCountry(), target);
|
ls.logChange("Pays", target.getCountry(), membre.getCountry(), target);
|
||||||
target.setCountry(membre.getCountry());
|
target.setCountry(membre.getCountry());
|
||||||
if (!Objects.equals(target.getBirth_date().getTime(), membre.getBirth_date().getTime())) {
|
if (membre.getBirth_date() != null && (target.getBirth_date() == null || !Objects.equals(
|
||||||
|
target.getBirth_date().getTime(), membre.getBirth_date().getTime()))) {
|
||||||
ls.logChange("Date de naissance", target.getBirth_date(), membre.getBirth_date(), target);
|
ls.logChange("Date de naissance", target.getBirth_date(), membre.getBirth_date(), target);
|
||||||
target.setBirth_date(membre.getBirth_date());
|
target.setBirth_date(membre.getBirth_date());
|
||||||
target.setCategorie(Utils.getCategoryFormBirthDate(membre.getBirth_date(), new Date()));
|
target.setCategorie(Utils.getCategoryFormBirthDate(membre.getBirth_date(), new Date()));
|
||||||
|
|||||||
@ -101,14 +101,15 @@ export function MemberList({source}) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="card mb-4">
|
{source === "club" &&
|
||||||
<div className="card-header">Gestion groupée</div>
|
<div className="card mb-4">
|
||||||
<div className="card-body">
|
<div className="card-header">Gestion groupée</div>
|
||||||
<FileOutput/>
|
<div className="card-body">
|
||||||
<div style={{marginTop: "1.5em"}}></div>
|
<FileOutput/>
|
||||||
<FileInput/>
|
<div style={{marginTop: "1.5em"}}></div>
|
||||||
</div>
|
<FileInput/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -392,18 +393,28 @@ function FiltreBar({showLicenceState, setShowLicenceState, data, clubFilter, set
|
|||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<Checkbox value={showLicenceState} onChange={setShowLicenceState} label="Afficher l'état des licences"/>
|
<Checkbox value={showLicenceState} onChange={setShowLicenceState} label="Afficher l'état des licences"/>
|
||||||
</div>
|
</div>
|
||||||
{source !== "club" &&
|
{source !== "club" && <ClubSelectFilter clubFilter={clubFilter} setClubFilter={setClubFilter}/>}
|
||||||
<div className="mb-3">
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
function ClubSelectFilter({clubFilter, setClubFilter}) {
|
||||||
|
const setLoading = useLoadingSwitcher()
|
||||||
|
const {data, error} = useFetch(`/club/no_detail`, setLoading, 1)
|
||||||
|
|
||||||
|
return <>
|
||||||
|
{data
|
||||||
|
? <div className="mb-3">
|
||||||
<select className="form-select" value={clubFilter} onChange={event => setClubFilter(event.target.value)}>
|
<select className="form-select" value={clubFilter} onChange={event => setClubFilter(event.target.value)}>
|
||||||
<option value="">--- tout les clubs ---</option>
|
<option value="">--- tout les clubs ---</option>
|
||||||
{allClub && allClub.map((value, index) => {
|
<option value="null">--- sans club ---</option>
|
||||||
return <option key={index} value={value}>{value}</option>
|
{data.map(club => (<option key={club.id} value={club.name}>{club.name}</option>))}
|
||||||
})
|
|
||||||
}
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
: error
|
||||||
|
? <AxiosError error={error}/>
|
||||||
|
: <Def/>
|
||||||
}
|
}
|
||||||
</div>
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
function Def() {
|
function Def() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user