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 isRestoringValue = false;
|
||||||
let isTarifImpactModalOpen = 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) {
|
function runWithRestoreGuard(callback) {
|
||||||
isRestoringValue = true;
|
isRestoringValue = true;
|
||||||
|
|
@ -773,7 +784,14 @@ window.initSubmenuForm = initSubmenuForm;// Module IIFE pour éviter la pollutio
|
||||||
|
|
||||||
function showTarifImpactModal(options = {}) {
|
function showTarifImpactModal(options = {}) {
|
||||||
const modal = document.getElementById('modalModif');
|
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);
|
let instance = M.Modal.getInstance(modal);
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
|
|
@ -782,7 +800,10 @@ window.initSubmenuForm = initSubmenuForm;// Module IIFE pour éviter la pollutio
|
||||||
|
|
||||||
const okBtn = document.getElementById('modif-OK');
|
const okBtn = document.getElementById('modif-OK');
|
||||||
const noBtn = document.getElementById('modif-NO');
|
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;
|
isTarifImpactModalOpen = true;
|
||||||
instance.options.onCloseEnd = () => {
|
instance.options.onCloseEnd = () => {
|
||||||
|
|
@ -810,7 +831,22 @@ window.initSubmenuForm = initSubmenuForm;// Module IIFE pour éviter la pollutio
|
||||||
}
|
}
|
||||||
|
|
||||||
function promptTarifImpactIfNeeded(context = {}) {
|
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'
|
const isImpacting = typeof context.isImpacting === 'function'
|
||||||
? Boolean(context.isImpacting())
|
? Boolean(context.isImpacting())
|
||||||
|
|
@ -842,10 +878,16 @@ window.initSubmenuForm = initSubmenuForm;// Module IIFE pour éviter la pollutio
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupTarifImpactListeners() {
|
function setupTarifImpactListeners() {
|
||||||
if (!hasTarifReference()) return;
|
if (!hasTarifReference()) {
|
||||||
|
logTarifImpactSkip('listeners non actives: aucune reference tarif');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
saveOriginalTarifData();
|
saveOriginalTarifData();
|
||||||
|
if (!tarifOriginalData) {
|
||||||
|
logTarifImpactSkip('saveOriginalTarifData n a pas initialise de snapshot');
|
||||||
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
const registerBeforeActionSnapshot = (element, captureSnapshot) => {
|
const registerBeforeActionSnapshot = (element, captureSnapshot) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue