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) {
|
||||
if (Objects.equals(o1, o2))
|
||||
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) {
|
||||
|
||||
@ -96,10 +96,17 @@ public class MembreService {
|
||||
if (club == null || club.isBlank()) {
|
||||
query = repository.find(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));
|
||||
} else {
|
||||
if (club.equals("null")) {
|
||||
query = repository.find(
|
||||
"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);
|
||||
}
|
||||
|
||||
@ -202,7 +209,8 @@ public class MembreService {
|
||||
}
|
||||
model.setGenre(Genre.fromString(dataIn.getGenre()));
|
||||
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);
|
||||
model.setBirth_date(dataIn.getBirthdate());
|
||||
model.setCategorie(Utils.getCategoryFormBirthDate(model.getBirth_date(), new Date()));
|
||||
@ -301,7 +309,8 @@ public class MembreService {
|
||||
target.setLname(membre.getLname().toUpperCase());
|
||||
ls.logChange("Pays", target.getCountry(), membre.getCountry(), target);
|
||||
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);
|
||||
target.setBirth_date(membre.getBirth_date());
|
||||
target.setCategorie(Utils.getCategoryFormBirthDate(membre.getBirth_date(), new Date()));
|
||||
|
||||
@ -101,14 +101,15 @@ export function MemberList({source}) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="card mb-4">
|
||||
<div className="card-header">Gestion groupée</div>
|
||||
<div className="card-body">
|
||||
<FileOutput/>
|
||||
<div style={{marginTop: "1.5em"}}></div>
|
||||
<FileInput/>
|
||||
</div>
|
||||
</div>
|
||||
{source === "club" &&
|
||||
<div className="card mb-4">
|
||||
<div className="card-header">Gestion groupée</div>
|
||||
<div className="card-body">
|
||||
<FileOutput/>
|
||||
<div style={{marginTop: "1.5em"}}></div>
|
||||
<FileInput/>
|
||||
</div>
|
||||
</div>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -392,18 +393,28 @@ function FiltreBar({showLicenceState, setShowLicenceState, data, clubFilter, set
|
||||
<div className="mb-3">
|
||||
<Checkbox value={showLicenceState} onChange={setShowLicenceState} label="Afficher l'état des licences"/>
|
||||
</div>
|
||||
{source !== "club" &&
|
||||
<div className="mb-3">
|
||||
{source !== "club" && <ClubSelectFilter clubFilter={clubFilter} setClubFilter={setClubFilter}/>}
|
||||
</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)}>
|
||||
<option value="">--- tout les clubs ---</option>
|
||||
{allClub && allClub.map((value, index) => {
|
||||
return <option key={index} value={value}>{value}</option>
|
||||
})
|
||||
}
|
||||
<option value="null">--- sans club ---</option>
|
||||
{data.map(club => (<option key={club.id} value={club.name}>{club.name}</option>))}
|
||||
</select>
|
||||
</div>
|
||||
: error
|
||||
? <AxiosError error={error}/>
|
||||
: <Def/>
|
||||
}
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
|
||||
function Def() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user