feat: add categorie info in CM
This commit is contained in:
parent
b1bcf75e56
commit
c9c8c8536d
@ -83,7 +83,7 @@ function CategoryHeader({cat, setCatId}) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (cats && cats.length > 0 && !cat) {
|
if (cats && cats.length > 0 && !cat) {
|
||||||
setCatId(cats[0].id);
|
setCatId(cats.sort((a, b) => a.name.localeCompare(b.name))[0].id);
|
||||||
}
|
}
|
||||||
}, [cats]);
|
}, [cats]);
|
||||||
|
|
||||||
@ -104,15 +104,18 @@ function CategoryHeader({cat, setCatId}) {
|
|||||||
<div className="input-group">
|
<div className="input-group">
|
||||||
<h5 style={{margin: "auto 0.5em auto 0"}}>Edition de la catégorie</h5>
|
<h5 style={{margin: "auto 0.5em auto 0"}}>Edition de la catégorie</h5>
|
||||||
<select className="form-select" onChange={handleCatChange}>
|
<select className="form-select" onChange={handleCatChange}>
|
||||||
{cats && cats.map(c => (
|
{cats && cats.sort((a, b) => a.name.localeCompare(b.name)).map(c => (
|
||||||
<option key={c.id} value={c.id}>{c.name}</option>))}
|
<option key={c.id} value={c.id}>{c.name}</option>))}
|
||||||
{cats && <option value={-1}>Nouvelle...</option>}
|
{cats && <option value={-1}>Nouvelle...</option>}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col">
|
<div className="col" style={{margin: "auto 0", textAlign: "center"}}>
|
||||||
|
{cat &&
|
||||||
|
<div>Type: {(cat.type & 1) !== 0 ? "Poule" : ""}{cat.type === 3 ? " & " : ""}{(cat.type & 2) !== 0 ? "Tournois" : ""} |
|
||||||
|
Lice: {cat.liceName}</div>}
|
||||||
</div>
|
</div>
|
||||||
<div className="col">
|
<div className="col-auto">
|
||||||
<button className="btn btn-primary float-end" onClick={() => {
|
<button className="btn btn-primary float-end" onClick={() => {
|
||||||
setModal(cat);
|
setModal(cat);
|
||||||
bthRef.current.click();
|
bthRef.current.click();
|
||||||
@ -266,7 +269,8 @@ function ModalContent({state, setCatId, setConfirm, confirmRef}) {
|
|||||||
title: "Changement de type de catégorie",
|
title: "Changement de type de catégorie",
|
||||||
message: `Voulez-vous vraiment enlever la partie ${typeStr} de la catégorie. Cela va supprimer les matchs contenus dans cette partie !`,
|
message: `Voulez-vous vraiment enlever la partie ${typeStr} de la catégorie. Cela va supprimer les matchs contenus dans cette partie !`,
|
||||||
confirm: () => {
|
confirm: () => {
|
||||||
applyChanges();
|
setTimeout(() =>
|
||||||
|
applyChanges(), 500);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
confirmRef.current.click();
|
confirmRef.current.click();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user