feat(admin): suivi des candidatures recues, suppression de code et compteur d utilisations
Cette révision appartient à :
1 Parent
3420ebee3d
révision
6dc0f6c296
4 fichiers modifiés
+312
-36
Aucun fichier ne correspond à votre recherche
@@ -382,3 +382,102 @@ footer{max-width:1080px;margin:0 auto;padding:0 16px 32px;color:var(--doux);font
|
|||||||
padding: 12px 0;
|
padding: 12px 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Badges d'utilisations & actions */
|
||||||
|
.badge-usages {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 3px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--filet);
|
||||||
|
color: var(--texte);
|
||||||
|
}
|
||||||
|
.badge-usages.actif {
|
||||||
|
background: #D8E0DA;
|
||||||
|
color: #2F4D35;
|
||||||
|
}
|
||||||
|
.date-derniere {
|
||||||
|
display: block;
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--doux);
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
.btn-action-suppr {
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
background: transparent;
|
||||||
|
color: #A0554B;
|
||||||
|
border: 1px solid #F5D6D1;
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.btn-action-suppr:hover {
|
||||||
|
background: #A0554B;
|
||||||
|
color: #FFFFFF;
|
||||||
|
border-color: #A0554B;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bloc Candidatures */
|
||||||
|
.candidatures-bloc {
|
||||||
|
margin-top: 32px;
|
||||||
|
border-top: 1.5px solid var(--filet);
|
||||||
|
padding-top: 24px;
|
||||||
|
}
|
||||||
|
.btn-remplir-code {
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
background: var(--sauge);
|
||||||
|
color: #FFFFFF;
|
||||||
|
border: none;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.btn-remplir-code:hover {
|
||||||
|
background: #6E8173;
|
||||||
|
}
|
||||||
|
.contact-ligne {
|
||||||
|
font-size: 12.5px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
.contact-ligne a {
|
||||||
|
color: var(--texte);
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 2px;
|
||||||
|
}
|
||||||
|
.contact-ligne a:hover {
|
||||||
|
color: var(--sauge);
|
||||||
|
}
|
||||||
|
.badge-age {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 2px 7px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #EAE8E2;
|
||||||
|
color: var(--texte);
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
.badge-age.mineur {
|
||||||
|
background: #F8E3D8;
|
||||||
|
color: #8C4824;
|
||||||
|
}
|
||||||
|
.parent-info {
|
||||||
|
display: block;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #8C4824;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
@@ -71,6 +71,7 @@ LIMITES_POST = {
|
|||||||
"/__beta/api/tester": 8000,
|
"/__beta/api/tester": 8000,
|
||||||
"/__beta/api/feedback": 2_600_000,
|
"/__beta/api/feedback": 2_600_000,
|
||||||
"/_admin/api/codes/creer": 4000,
|
"/_admin/api/codes/creer": 4000,
|
||||||
|
"/_admin/api/codes/supprimer": 1000,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -276,6 +277,8 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
return self.fichier(RACINE / "assets" / "img", p[len("/assets/img/"):])
|
return self.fichier(RACINE / "assets" / "img", p[len("/assets/img/"):])
|
||||||
if p == "/_admin/api/codes/liste":
|
if p == "/_admin/api/codes/liste":
|
||||||
return self.admin_liste_codes()
|
return self.admin_liste_codes()
|
||||||
|
if p == "/_admin/api/candidatures/liste":
|
||||||
|
return self.admin_liste_candidatures()
|
||||||
s = self.session()
|
s = self.session()
|
||||||
if not s:
|
if not s:
|
||||||
if p.endswith(".html") or p == "/":
|
if p.endswith(".html") or p == "/":
|
||||||
@@ -305,6 +308,8 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
return self.formulaire_testeur()
|
return self.formulaire_testeur()
|
||||||
if p == "/_admin/api/codes/creer":
|
if p == "/_admin/api/codes/creer":
|
||||||
return self.admin_creer_code()
|
return self.admin_creer_code()
|
||||||
|
if p == "/_admin/api/codes/supprimer":
|
||||||
|
return self.admin_supprimer_code()
|
||||||
s = self.session()
|
s = self.session()
|
||||||
if not s:
|
if not s:
|
||||||
return self.json(401, {"erreur": "session expirée, ressaisir le code"})
|
return self.json(401, {"erreur": "session expirée, ressaisir le code"})
|
||||||
@@ -534,6 +539,43 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
"created_at": time.time()
|
"created_at": time.time()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def admin_supprimer_code(self):
|
||||||
|
if self.headers.get("X-Admin") != "1":
|
||||||
|
return self.json(403, {"erreur": "accès réservé à l'administration"})
|
||||||
|
try:
|
||||||
|
d = json.loads(self._corps.decode("utf-8"))
|
||||||
|
code_id = int(d.get("id"))
|
||||||
|
except Exception:
|
||||||
|
return self.json(400, {"erreur": "ID de code invalide"})
|
||||||
|
|
||||||
|
self.c.execute("DELETE FROM sessions WHERE code_id=?", (code_id,))
|
||||||
|
self.c.execute("DELETE FROM codes WHERE id=?", (code_id,))
|
||||||
|
self.c.execute("UPDATE audit SET code_id=NULL WHERE code_id=?", (code_id,))
|
||||||
|
self.c.commit()
|
||||||
|
db.journal(self.c, "code_supprime", None, None, f"id={code_id}")
|
||||||
|
return self.json(200, {"ok": True, "id": code_id})
|
||||||
|
|
||||||
|
def admin_liste_candidatures(self):
|
||||||
|
if self.headers.get("X-Admin") != "1":
|
||||||
|
return self.json(403, {"erreur": "accès réservé à l'administration"})
|
||||||
|
|
||||||
|
lignes = []
|
||||||
|
for r in self.c.execute("SELECT id, ts, nom, prenom, email, tel, naissance, mineur, parent_nom, parent_email, suivi_reseaux FROM testers ORDER BY id DESC LIMIT 100"):
|
||||||
|
lignes.append({
|
||||||
|
"id": r["id"],
|
||||||
|
"ts": r["ts"],
|
||||||
|
"nom": r["nom"],
|
||||||
|
"prenom": r["prenom"],
|
||||||
|
"email": r["email"],
|
||||||
|
"tel": r["tel"],
|
||||||
|
"naissance": r["naissance"],
|
||||||
|
"mineur": bool(r["mineur"]),
|
||||||
|
"parent_nom": r["parent_nom"],
|
||||||
|
"parent_email": r["parent_email"],
|
||||||
|
"suivi_reseaux": bool(r["suivi_reseaux"]),
|
||||||
|
})
|
||||||
|
return self.json(200, {"ok": True, "candidatures": lignes})
|
||||||
|
|
||||||
def admin_liste_codes(self):
|
def admin_liste_codes(self):
|
||||||
if self.headers.get("X-Admin") != "1":
|
if self.headers.get("X-Admin") != "1":
|
||||||
return self.json(403, {"erreur": "accès réservé à l'administration"})
|
return self.json(403, {"erreur": "accès réservé à l'administration"})
|
||||||
|
|||||||
@@ -236,6 +236,28 @@ class T(unittest.TestCase):
|
|||||||
self.assertTrue(res.get("ok"))
|
self.assertTrue(res.get("ok"))
|
||||||
labels = [c["label"] for c in res.get("codes", [])]
|
labels = [c["label"] for c in res.get("codes", [])]
|
||||||
self.assertIn("Testeur Admin", labels)
|
self.assertIn("Testeur Admin", labels)
|
||||||
|
code_id = res["codes"][0]["id"]
|
||||||
|
|
||||||
|
# 4. Supprimer le code
|
||||||
|
s, _, d = self.req("POST", "/_admin/api/codes/supprimer", {"id": code_id}, headers={"X-Admin": "1"})
|
||||||
|
self.assertEqual(s, 200)
|
||||||
|
res = json.loads(d.decode())
|
||||||
|
self.assertTrue(res.get("ok"))
|
||||||
|
self.assertEqual(res.get("id"), code_id)
|
||||||
|
|
||||||
|
# Vérification qu'il n'est plus dans la liste
|
||||||
|
s, _, d = self.req("GET", "/_admin/api/codes/liste", headers={"X-Admin": "1"})
|
||||||
|
self.assertEqual(s, 200)
|
||||||
|
res = json.loads(d.decode())
|
||||||
|
labels_after = [c["label"] for c in res.get("codes", [])]
|
||||||
|
self.assertNotIn("Testeur Admin", labels_after)
|
||||||
|
|
||||||
|
# 5. Liste des candidatures
|
||||||
|
s, _, d = self.req("GET", "/_admin/api/candidatures/liste", headers={"X-Admin": "1"})
|
||||||
|
self.assertEqual(s, 200)
|
||||||
|
res = json.loads(d.decode())
|
||||||
|
self.assertTrue(res.get("ok"))
|
||||||
|
self.assertIsInstance(res.get("candidatures"), list)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
+149
-36
@@ -113,13 +113,24 @@
|
|||||||
<!-- Historique des codes récents -->
|
<!-- Historique des codes récents -->
|
||||||
<div class="historique-codes">
|
<div class="historique-codes">
|
||||||
<div class="liste-codes-entete">
|
<div class="liste-codes-entete">
|
||||||
<h4>Codes testeurs récents</h4>
|
<h4>Codes testeurs émis <span class="compte" id="compte-codes">0</span></h4>
|
||||||
<button type="button" id="btn-rafraichir-codes" class="btn-rafraichir" title="Actualiser">↻ Actualiser</button>
|
<button type="button" id="btn-rafraichir-codes" class="btn-rafraichir" title="Actualiser">↻ Actualiser</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="conteneur-tableau-codes" class="tableau-scroll">
|
<div id="conteneur-tableau-codes" class="tableau-scroll">
|
||||||
<p class="chargement">Chargement des codes en cours...</p>
|
<p class="chargement">Chargement des codes en cours...</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Candidatures reçues -->
|
||||||
|
<div class="candidatures-bloc">
|
||||||
|
<div class="liste-codes-entete">
|
||||||
|
<h4>📬 Candidatures reçues via le formulaire <span class="compte" id="compte-candidatures">0</span></h4>
|
||||||
|
<button type="button" id="btn-rafraichir-candidatures" class="btn-rafraichir" title="Actualiser">↻ Actualiser</button>
|
||||||
|
</div>
|
||||||
|
<div id="conteneur-tableau-candidatures" class="tableau-scroll">
|
||||||
|
<p class="chargement">Chargement des candidatures...</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -178,8 +189,13 @@
|
|||||||
const btnCopierMsg = document.getElementById('btn-copier-msg');
|
const btnCopierMsg = document.getElementById('btn-copier-msg');
|
||||||
const whatsappTexte = document.getElementById('texte-msg-whatsapp');
|
const whatsappTexte = document.getElementById('texte-msg-whatsapp');
|
||||||
|
|
||||||
const conteneurTableau = document.getElementById('conteneur-tableau-codes');
|
const conteneurTableauCodes = document.getElementById('conteneur-tableau-codes');
|
||||||
const btnRafraichir = document.getElementById('btn-rafraichir-codes');
|
const btnRafraichirCodes = document.getElementById('btn-rafraichir-codes');
|
||||||
|
const compteCodesEl = document.getElementById('compte-codes');
|
||||||
|
|
||||||
|
const conteneurTableauCandidatures = document.getElementById('conteneur-tableau-candidatures');
|
||||||
|
const btnRafraichirCandidatures = document.getElementById('btn-rafraichir-candidatures');
|
||||||
|
const compteCandidaturesEl = document.getElementById('compte-candidatures');
|
||||||
|
|
||||||
let dernierCode = '';
|
let dernierCode = '';
|
||||||
|
|
||||||
@@ -189,38 +205,11 @@
|
|||||||
return d.toLocaleDateString('fr-FR', { day: '2-digit', month: '2-digit', year: 'numeric' });
|
return d.toLocaleDateString('fr-FR', { day: '2-digit', month: '2-digit', year: 'numeric' });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function chargerCodes() {
|
function fmtDateHeure(ts) {
|
||||||
try {
|
if (!ts) return '-';
|
||||||
const res = await fetch('/_admin/api/codes/liste');
|
const d = new Date(ts * 1000);
|
||||||
if (!res.ok) {
|
return d.toLocaleDateString('fr-FR', { day: '2-digit', month: '2-digit', year: 'numeric' }) +
|
||||||
conteneurTableau.innerHTML = '<p class="chargement" style="color:#A0554B;">Impossible de charger les codes (' + res.status + ').</p>';
|
' à ' + d.toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' });
|
||||||
return;
|
|
||||||
}
|
|
||||||
const data = await res.json();
|
|
||||||
afficherTableau(data.codes || []);
|
|
||||||
} catch (e) {
|
|
||||||
conteneurTableau.innerHTML = '<p class="chargement">Impossible de contacter le serveur.</p>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function afficherTableau(codes) {
|
|
||||||
if (!codes.length) {
|
|
||||||
conteneurTableau.innerHTML = '<p class="chargement">Aucun code émis pour le moment.</p>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let html = '<table class="table-codes"><thead><tr><th>ID</th><th>Testeur</th><th>Créé le</th><th>Expire</th><th>Usages</th><th>Statut</th></tr></thead><tbody>';
|
|
||||||
for (const c of codes) {
|
|
||||||
html += '<tr>' +
|
|
||||||
'<td>#' + c.id + '</td>' +
|
|
||||||
'<td><strong>' + escapeHtml(c.label) + '</strong></td>' +
|
|
||||||
'<td>' + fmtDate(c.created_at) + '</td>' +
|
|
||||||
'<td>' + (c.expires_at ? fmtDate(c.expires_at) : 'Illimité') + '</td>' +
|
|
||||||
'<td>' + (c.uses || 0) + '</td>' +
|
|
||||||
'<td><span class="badge-statut ' + (c.status === 'actif' ? 'actif' : (c.status === 'révoqué' ? 'revoque' : 'expire')) + '">' + escapeHtml(c.status) + '</span></td>' +
|
|
||||||
'</tr>';
|
|
||||||
}
|
|
||||||
html += '</tbody></table>';
|
|
||||||
conteneurTableau.innerHTML = html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeHtml(str) {
|
function escapeHtml(str) {
|
||||||
@@ -229,6 +218,127 @@
|
|||||||
return div.innerHTML;
|
return div.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeJs(str) {
|
||||||
|
return (str || '').replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Gestion des codes ---
|
||||||
|
async function chargerCodes() {
|
||||||
|
try {
|
||||||
|
const res = await fetch('/_admin/api/codes/liste');
|
||||||
|
if (!res.ok) {
|
||||||
|
conteneurTableauCodes.innerHTML = '<p class="chargement" style="color:#A0554B;">Impossible de charger les codes (' + res.status + ').</p>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = await res.json();
|
||||||
|
afficherTableauCodes(data.codes || []);
|
||||||
|
} catch (e) {
|
||||||
|
conteneurTableauCodes.innerHTML = '<p class="chargement">Impossible de contacter le serveur.</p>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function afficherTableauCodes(codes) {
|
||||||
|
if (compteCodesEl) compteCodesEl.textContent = codes.length;
|
||||||
|
if (!codes.length) {
|
||||||
|
conteneurTableauCodes.innerHTML = '<p class="chargement">Aucun code émis pour le moment.</p>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let html = '<table class="table-codes"><thead><tr><th>ID</th><th>Testeur</th><th>Créé le</th><th>Expire</th><th>Utilisations</th><th>Statut</th><th>Action</th></tr></thead><tbody>';
|
||||||
|
for (const c of codes) {
|
||||||
|
const usesHtml = c.uses > 0
|
||||||
|
? '<span class="badge-usages actif">' + c.uses + ' connexion' + (c.uses > 1 ? 's' : '') + '</span>' +
|
||||||
|
(c.last_used_at ? '<span class="date-derniere">Dernière : ' + fmtDateHeure(c.last_used_at) + '</span>' : '')
|
||||||
|
: '<span class="badge-usages">0 connexion</span>';
|
||||||
|
|
||||||
|
html += '<tr>' +
|
||||||
|
'<td>#' + c.id + '</td>' +
|
||||||
|
'<td><strong>' + escapeHtml(c.label) + '</strong></td>' +
|
||||||
|
'<td>' + fmtDate(c.created_at) + '</td>' +
|
||||||
|
'<td>' + (c.expires_at ? fmtDate(c.expires_at) : 'Illimité') + '</td>' +
|
||||||
|
'<td>' + usesHtml + '</td>' +
|
||||||
|
'<td><span class="badge-statut ' + (c.status === 'actif' ? 'actif' : (c.status === 'révoqué' ? 'revoque' : 'expire')) + '">' + escapeHtml(c.status) + '</span></td>' +
|
||||||
|
'<td><button type="button" class="btn-action-suppr" onclick="window.jobrunnerBeta.supprimerCode(' + c.id + ', \'' + escapeJs(c.label) + '\')">Supprimer</button></td>' +
|
||||||
|
'</tr>';
|
||||||
|
}
|
||||||
|
html += '</tbody></table>';
|
||||||
|
conteneurTableauCodes.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Gestion des candidatures ---
|
||||||
|
async function chargerCandidatures() {
|
||||||
|
try {
|
||||||
|
const res = await fetch('/_admin/api/candidatures/liste');
|
||||||
|
if (!res.ok) {
|
||||||
|
conteneurTableauCandidatures.innerHTML = '<p class="chargement" style="color:#A0554B;">Impossible de charger les candidatures (' + res.status + ').</p>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = await res.json();
|
||||||
|
afficherTableauCandidatures(data.candidatures || []);
|
||||||
|
} catch (e) {
|
||||||
|
conteneurTableauCandidatures.innerHTML = '<p class="chargement">Impossible de contacter le serveur.</p>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function afficherTableauCandidatures(liste) {
|
||||||
|
if (compteCandidaturesEl) compteCandidaturesEl.textContent = liste.length;
|
||||||
|
if (!liste.length) {
|
||||||
|
conteneurTableauCandidatures.innerHTML = '<p class="chargement">Aucune candidature reçue via le formulaire pour le moment.</p>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let html = '<table class="table-codes"><thead><tr><th>Date</th><th>Candidat</th><th>Contact</th><th>Réseaux</th><th>Action</th></tr></thead><tbody>';
|
||||||
|
for (const item of liste) {
|
||||||
|
const ageBadge = item.mineur
|
||||||
|
? '<span class="badge-age mineur">15-17 ans (mineur)</span>'
|
||||||
|
: '<span class="badge-age">Majeur</span>';
|
||||||
|
const parentHtml = (item.mineur && item.parent_nom)
|
||||||
|
? '<span class="parent-info">Resp. légal : ' + escapeHtml(item.parent_nom) + ' (' + escapeHtml(item.parent_email || '') + ')</span>'
|
||||||
|
: '';
|
||||||
|
|
||||||
|
html += '<tr>' +
|
||||||
|
'<td>' + fmtDateHeure(item.ts) + '</td>' +
|
||||||
|
'<td><strong>' + escapeHtml(item.prenom) + ' ' + escapeHtml(item.nom) + '</strong> ' + ageBadge + parentHtml + '</td>' +
|
||||||
|
'<td><div class="contact-ligne">' +
|
||||||
|
'<a href="mailto:' + escapeHtml(item.email) + '">' + escapeHtml(item.email) + '</a>' +
|
||||||
|
'<a href="tel:' + escapeHtml(item.tel) + '">' + escapeHtml(item.tel) + '</a>' +
|
||||||
|
'</div></td>' +
|
||||||
|
'<td>' + (item.suivi_reseaux ? '<span style="color:#3E5A44;font-weight:700;">✓ Insta</span>' : '-') + '</td>' +
|
||||||
|
'<td><button type="button" class="btn-remplir-code" onclick="window.jobrunnerBeta.preparerCodePour(\'' + escapeJs(item.prenom + ' ' + item.nom) + '\')">⚡ Créer code</button></td>' +
|
||||||
|
'</tr>';
|
||||||
|
}
|
||||||
|
html += '</tbody></table>';
|
||||||
|
conteneurTableauCandidatures.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Actions globales exposées ---
|
||||||
|
window.jobrunnerBeta = {
|
||||||
|
supprimerCode: async function(id, label) {
|
||||||
|
if (!confirm('Supprimer définitivement le code de "' + label + '" ?\nSes sessions éventuelles seront immédiatement coupées.')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res = await fetch('/_admin/api/codes/supprimer', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ id: id })
|
||||||
|
});
|
||||||
|
const data = await res.json().catch(() => ({}));
|
||||||
|
if (res.ok && data.ok) {
|
||||||
|
chargerCodes();
|
||||||
|
} else {
|
||||||
|
alert(data.erreur || 'Erreur lors de la suppression.');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Erreur réseau lors de la suppression.');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
preparerCodePour: function(nomComplet) {
|
||||||
|
inputLabel.value = nomComplet;
|
||||||
|
inputLabel.focus();
|
||||||
|
inputLabel.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// --- Formulaire de création ---
|
||||||
form.addEventListener('submit', async function(e) {
|
form.addEventListener('submit', async function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
errBox.style.display = 'none';
|
errBox.style.display = 'none';
|
||||||
@@ -295,8 +405,11 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
btnRafraichir.addEventListener('click', chargerCodes);
|
btnRafraichirCodes.addEventListener('click', chargerCodes);
|
||||||
|
btnRafraichirCandidatures.addEventListener('click', chargerCandidatures);
|
||||||
|
|
||||||
chargerCodes();
|
chargerCodes();
|
||||||
|
chargerCandidatures();
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Référencer dans un nouveau ticket
Bloquer un utilisateur