chore(rc): tracer raisons de non-ouverture du modal impact
This commit is contained in:
parent
b35d64a241
commit
f57855d143
|
|
@ -537,6 +537,17 @@ window.initSubmenuForm = initSubmenuForm;// Module IIFE pour éviter la pollutio
|
|||
|
||||
let isRestoringValue = false;
|
||||
let isTarifImpactModalOpen = false;
|
||||
const tarifImpactDebugReasons = new Set();
|
||||
|
||||
function logTarifImpactSkip(reason, details = null) {
|
||||
if (tarifImpactDebugReasons.has(reason)) return;
|
||||
tarifImpactDebugReasons.add(reason);
|
||||
if (details) {
|
||||
console.warn(`[RC modal impact] ${reason}`, details);
|
||||
return;
|
||||
}
|
||||
console.warn(`[RC modal impact] ${reason}`);
|
||||
}
|
||||
|
||||
function runWithRestoreGuard(callback) {
|
||||
isRestoringValue = true;
|
||||
|
|
@ -773,7 +784,14 @@ window.initSubmenuForm = initSubmenuForm;// Module IIFE pour éviter la pollutio
|
|||
|
||||
function showTarifImpactModal(options = {}) {
|
||||
const modal = document.getElementById('modalModif');
|
||||
if (!modal || isTarifImpactModalOpen) return false;
|
||||
if (!modal) {
|
||||
logTarifImpactSkip('modalModif introuvable dans le DOM');
|
||||
return false;
|
||||
}
|
||||
if (isTarifImpactModalOpen) {
|
||||
logTarifImpactSkip('modal deja ouverte');
|
||||
return false;
|
||||
}
|
||||
|
||||
let instance = M.Modal.getInstance(modal);
|
||||
if (!instance) {
|
||||
|
|
@ -782,7 +800,10 @@ window.initSubmenuForm = initSubmenuForm;// Module IIFE pour éviter la pollutio
|
|||
|
||||
const okBtn = document.getElementById('modif-OK');
|
||||
const noBtn = document.getElementById('modif-NO');
|
||||
if (!okBtn || !noBtn) return false;
|
||||
if (!okBtn || !noBtn) {
|
||||
logTarifImpactSkip('boutons modif-OK/modif-NO introuvables');
|
||||
return false;
|
||||
}
|
||||
|
||||
isTarifImpactModalOpen = true;
|
||||
instance.options.onCloseEnd = () => {
|
||||
|
|
@ -810,7 +831,22 @@ window.initSubmenuForm = initSubmenuForm;// Module IIFE pour éviter la pollutio
|
|||
}
|
||||
|
||||
function promptTarifImpactIfNeeded(context = {}) {
|
||||
if (isRestoringValue || isTarifImpactModalOpen || !hasTarifReference() || !tarifOriginalData) return false;
|
||||
if (isRestoringValue) {
|
||||
logTarifImpactSkip('ignore pendant restauration');
|
||||
return false;
|
||||
}
|
||||
if (isTarifImpactModalOpen) {
|
||||
logTarifImpactSkip('ignore car modal deja ouverte');
|
||||
return false;
|
||||
}
|
||||
if (!hasTarifReference()) {
|
||||
logTarifImpactSkip('aucune reference tarif detectee', { tarif, rcTarifRC: rc?.tarifRC, rcTarif: rc?.tarif });
|
||||
return false;
|
||||
}
|
||||
if (!tarifOriginalData) {
|
||||
logTarifImpactSkip('snapshot tarifOriginalData absent');
|
||||
return false;
|
||||
}
|
||||
|
||||
const isImpacting = typeof context.isImpacting === 'function'
|
||||
? Boolean(context.isImpacting())
|
||||
|
|
@ -842,10 +878,16 @@ window.initSubmenuForm = initSubmenuForm;// Module IIFE pour éviter la pollutio
|
|||
}
|
||||
|
||||
function setupTarifImpactListeners() {
|
||||
if (!hasTarifReference()) return;
|
||||
if (!hasTarifReference()) {
|
||||
logTarifImpactSkip('listeners non actives: aucune reference tarif');
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
saveOriginalTarifData();
|
||||
if (!tarifOriginalData) {
|
||||
logTarifImpactSkip('saveOriginalTarifData n a pas initialise de snapshot');
|
||||
}
|
||||
}, 500);
|
||||
|
||||
const registerBeforeActionSnapshot = (element, captureSnapshot) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue