log debug
This commit is contained in:
parent
bfdd9b10f1
commit
0b07a03925
@ -273,10 +273,50 @@ export function mapEventToFullCalendar(ev) {
|
|||||||
|
|
||||||
// Priorité 1 : Couleur du département
|
// Priorité 1 : Couleur du département
|
||||||
const departementId = ev.id_departement ? parseInt(ev.id_departement) : null;
|
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) {
|
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
|
// Chercher le département par ID
|
||||||
for (const key in window.crviACFData.departements) {
|
for (const key in window.crviACFData.departements) {
|
||||||
const dept = window.crviACFData.departements[key];
|
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) {
|
if (dept.id === departementId && dept.couleur) {
|
||||||
backgroundColor = dept.couleur;
|
backgroundColor = dept.couleur;
|
||||||
console.log('🎨 [COULEUR] Permanence assignée - département:', {
|
console.log('🎨 [COULEUR] Permanence assignée - département:', {
|
||||||
@ -286,9 +326,22 @@ export function mapEventToFullCalendar(ev) {
|
|||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
source: 'departement'
|
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;
|
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)
|
// 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
|
// Log final de la couleur appliquée
|
||||||
console.log('🎨 [COULEUR FINALE] Événement:', {
|
console.log('🎨 [COULEUR FINALE] Événement:', {
|
||||||
eventId: ev.id,
|
eventId: ev.id,
|
||||||
|
|||||||
@ -562,10 +562,50 @@ export function initializeCalendar() {
|
|||||||
|
|
||||||
// Priorité 1 : Couleur du département
|
// Priorité 1 : Couleur du département
|
||||||
const departementId = eventProps.id_departement ? parseInt(eventProps.id_departement) : null;
|
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) {
|
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
|
// Chercher le département par ID
|
||||||
for (const key in crviACFData.departements) {
|
for (const key in crviACFData.departements) {
|
||||||
const dept = crviACFData.departements[key];
|
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) {
|
if (dept.id === departementId && dept.couleur) {
|
||||||
bgColor = dept.couleur;
|
bgColor = dept.couleur;
|
||||||
console.log('🎨 [COULEUR] Département trouvé:', {
|
console.log('🎨 [COULEUR] Département trouvé:', {
|
||||||
@ -574,9 +614,22 @@ export function initializeCalendar() {
|
|||||||
departementNom: dept.nom,
|
departementNom: dept.nom,
|
||||||
couleur: bgColor
|
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;
|
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)
|
// Priorité 2 : Couleur du local (type de local)
|
||||||
@ -630,6 +683,16 @@ export function initializeCalendar() {
|
|||||||
// Déterminer la couleur
|
// Déterminer la couleur
|
||||||
let { bgColor, txtColor } = determineEventColor();
|
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
|
// Vérifier que les couleurs sont valides et utiliser des valeurs par défaut si nécessaire
|
||||||
if (!bgColor || !txtColor) {
|
if (!bgColor || !txtColor) {
|
||||||
console.warn('⚠️ [eventDidMount] Couleurs invalides détectées:', { bgColor, txtColor, eventId: event.id });
|
console.warn('⚠️ [eventDidMount] Couleurs invalides détectées:', { bgColor, txtColor, eventId: event.id });
|
||||||
@ -645,6 +708,15 @@ export function initializeCalendar() {
|
|||||||
textColor: txtColor
|
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
|
// Fonction pour appliquer les styles
|
||||||
function applyEventStyles() {
|
function applyEventStyles() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user