log debug

This commit is contained in:
Jean-Philippe Staelen 2026-01-20 16:15:24 +01:00
parent bfdd9b10f1
commit 0b07a03925
2 changed files with 138 additions and 0 deletions

View File

@ -273,10 +273,50 @@ export function mapEventToFullCalendar(ev) {
// Priorité 1 : Couleur du département
const departementId = ev.id_departement ? parseInt(ev.id_departement) : null;
// 🔍 DEBUG pour événement 410
if (ev.id === 410 || ev.id === '410') {
console.log('🔍 [MAPPER DEBUG 410] Début analyse couleur département:', {
eventId: ev.id,
id_departement_brut: ev.id_departement,
departementId_parsed: departementId,
crviACFData_existe: !!window.crviACFData,
departements_existe: !!(window.crviACFData && window.crviACFData.departements),
departements_data: window.crviACFData ? window.crviACFData.departements : 'N/A'
});
}
if (departementId && !isNaN(departementId) && window.crviACFData && window.crviACFData.departements) {
// 🔍 DEBUG pour événement 410 - liste des départements
if (ev.id === 410 || ev.id === '410') {
console.log('🔍 [MAPPER DEBUG 410] Recherche département ID:', departementId);
console.log('🔍 [MAPPER DEBUG 410] Départements disponibles:',
Object.keys(window.crviACFData.departements).map(key => ({
key: key,
id: window.crviACFData.departements[key].id,
nom: window.crviACFData.departements[key].nom,
couleur: window.crviACFData.departements[key].couleur
}))
);
}
// Chercher le département par ID
for (const key in window.crviACFData.departements) {
const dept = window.crviACFData.departements[key];
// 🔍 DEBUG pour événement 410 - comparaison
if (ev.id === 410 || ev.id === '410') {
console.log('🔍 [MAPPER DEBUG 410] Comparaison:', {
key: key,
dept_id: dept.id,
dept_id_type: typeof dept.id,
recherche_id: departementId,
recherche_id_type: typeof departementId,
sont_egaux: dept.id === departementId,
dept_couleur: dept.couleur
});
}
if (dept.id === departementId && dept.couleur) {
backgroundColor = dept.couleur;
console.log('🎨 [COULEUR] Permanence assignée - département:', {
@ -286,9 +326,22 @@ export function mapEventToFullCalendar(ev) {
backgroundColor: backgroundColor,
source: 'departement'
});
// 🔍 DEBUG pour événement 410 - succès
if (ev.id === 410 || ev.id === '410') {
console.log('✅ [MAPPER DEBUG 410] Couleur département appliquée:', {
departementNom: dept.nom,
couleurAppliquee: backgroundColor
});
}
break;
}
}
// 🔍 DEBUG pour événement 410 - échec de recherche
if ((ev.id === 410 || ev.id === '410') && !backgroundColor) {
console.warn('⚠️ [MAPPER DEBUG 410] Aucun département correspondant trouvé!');
}
}
// Priorité 2 : Couleur du local (type de local)
@ -342,6 +395,19 @@ export function mapEventToFullCalendar(ev) {
});
}
// 🔍 DEBUG FINAL pour événement 410
if (ev.id === 410 || ev.id === '410') {
console.log('🔍 [MAPPER DEBUG 410] COULEUR FINALE avant return:', {
eventId: ev.id,
backgroundColor: backgroundColor,
textColor: textColor,
type: ev.type,
id_departement: ev.id_departement,
isPermanenceAssigned: ev.assign === 1 || (ev.id_beneficiaire && ev.id_local),
ev_complet: ev
});
}
// Log final de la couleur appliquée
console.log('🎨 [COULEUR FINALE] Événement:', {
eventId: ev.id,

View File

@ -562,10 +562,50 @@ export function initializeCalendar() {
// Priorité 1 : Couleur du département
const departementId = eventProps.id_departement ? parseInt(eventProps.id_departement) : null;
// 🔍 DEBUG pour événement 410
if (event.id === '410') {
console.log('🔍 [DEBUG 410] Début analyse couleur département:', {
eventId: event.id,
id_departement_brut: eventProps.id_departement,
departementId_parsed: departementId,
crviACFData_existe: !!crviACFData,
departements_existe: !!(crviACFData && crviACFData.departements),
departements_data: crviACFData ? crviACFData.departements : 'N/A'
});
}
if (departementId && !isNaN(departementId) && crviACFData && crviACFData.departements) {
// 🔍 DEBUG pour événement 410 - liste des départements
if (event.id === '410') {
console.log('🔍 [DEBUG 410] Recherche département ID:', departementId);
console.log('🔍 [DEBUG 410] Départements disponibles:',
Object.keys(crviACFData.departements).map(key => ({
key: key,
id: crviACFData.departements[key].id,
nom: crviACFData.departements[key].nom,
couleur: crviACFData.departements[key].couleur
}))
);
}
// Chercher le département par ID
for (const key in crviACFData.departements) {
const dept = crviACFData.departements[key];
// 🔍 DEBUG pour événement 410 - comparaison
if (event.id === '410') {
console.log('🔍 [DEBUG 410] Comparaison:', {
key: key,
dept_id: dept.id,
dept_id_type: typeof dept.id,
recherche_id: departementId,
recherche_id_type: typeof departementId,
sont_egaux: dept.id === departementId,
dept_couleur: dept.couleur
});
}
if (dept.id === departementId && dept.couleur) {
bgColor = dept.couleur;
console.log('🎨 [COULEUR] Département trouvé:', {
@ -574,9 +614,22 @@ export function initializeCalendar() {
departementNom: dept.nom,
couleur: bgColor
});
// 🔍 DEBUG pour événement 410 - succès
if (event.id === '410') {
console.log('✅ [DEBUG 410] Couleur département appliquée:', {
departementNom: dept.nom,
couleurAppliquee: bgColor
});
}
break;
}
}
// 🔍 DEBUG pour événement 410 - échec de recherche
if (event.id === '410' && !bgColor) {
console.warn('⚠️ [DEBUG 410] Aucun département correspondant trouvé!');
}
}
// Priorité 2 : Couleur du local (type de local)
@ -630,6 +683,16 @@ export function initializeCalendar() {
// Déterminer la couleur
let { bgColor, txtColor } = determineEventColor();
// 🔍 DEBUG FINAL pour événement 410
if (event.id === '410') {
console.log('🔍 [DEBUG 410] COULEUR FINALE après determineEventColor:', {
eventId: event.id,
bgColor: bgColor,
txtColor: txtColor,
eventProps_complet: eventProps
});
}
// Vérifier que les couleurs sont valides et utiliser des valeurs par défaut si nécessaire
if (!bgColor || !txtColor) {
console.warn('⚠️ [eventDidMount] Couleurs invalides détectées:', { bgColor, txtColor, eventId: event.id });
@ -645,6 +708,15 @@ export function initializeCalendar() {
textColor: txtColor
});
// 🔍 DEBUG FINAL pour événement 410 - après validation
if (event.id === '410') {
console.log('🔍 [DEBUG 410] COULEUR APPLIQUÉE (après validation):', {
eventId: event.id,
bgColor_final: bgColor,
txtColor_final: txtColor
});
}
// Fonction pour appliquer les styles
function applyEventStyles() {
try {