Actualiser assets/js/app.js
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
This commit is contained in:
+48
-1
@@ -20044,4 +20044,51 @@ function switchToProductEditFromStock() {
|
|||||||
} else {
|
} else {
|
||||||
alert("Erreur : Impossible de lier ce lot à un produit du catalogue.");
|
alert("Erreur : Impossible de lier ce lot à un produit du catalogue.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- FORCE INJECTION SHORTCUT BUTTON ---
|
||||||
|
setInterval(() => {
|
||||||
|
// 1. Vérifier si la page d'ajout est active et visible à l'écran
|
||||||
|
const pageAdd = document.getElementById('page-add');
|
||||||
|
if (pageAdd && (pageAdd.classList.contains('active') || pageAdd.style.display === 'block')) {
|
||||||
|
|
||||||
|
// 2. Vérifier si notre bouton n'est pas déjà présent
|
||||||
|
if (!document.getElementById('btn-edit-product-shortcut')) {
|
||||||
|
|
||||||
|
// 3. Trouver le bouton submit vert (on cherche par sa classe et son type)
|
||||||
|
const submitBtn = pageAdd.querySelector('button[type="submit"]') || pageAdd.querySelector('.btn-success');
|
||||||
|
|
||||||
|
if (submitBtn) {
|
||||||
|
const editBtn = document.createElement('button');
|
||||||
|
editBtn.type = 'button';
|
||||||
|
editBtn.id = 'btn-edit-product-shortcut';
|
||||||
|
editBtn.innerText = '✏️ Modifier la fiche produit';
|
||||||
|
editBtn.style.cssText = 'margin-bottom: 15px; background-color: #1976d2; color: white; width: 100%; border: none; border-radius: 8px; padding: 12px; font-size: 16px; font-weight: bold; cursor: pointer; display: block;';
|
||||||
|
|
||||||
|
// Associer l'action de clic
|
||||||
|
editBtn.onclick = function() {
|
||||||
|
let productId = null;
|
||||||
|
if (typeof currentProduct !== 'undefined' && currentProduct) productId = currentProduct.id || currentProduct._id;
|
||||||
|
if (typeof _currentProduct !== 'undefined' && _currentProduct) productId = _currentProduct.id || _currentProduct._id;
|
||||||
|
|
||||||
|
if (productId) {
|
||||||
|
pageAdd.classList.remove('active');
|
||||||
|
pageAdd.style.display = 'none';
|
||||||
|
if (typeof editProduct === 'function') {
|
||||||
|
editProduct(productId);
|
||||||
|
} else {
|
||||||
|
const prodPage = document.getElementById('page-product-form');
|
||||||
|
if (prodPage) { prodPage.classList.add('active'); prodPage.style.display = 'block'; }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert("Erreur: Impossible de récupérer le produit.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Injection physique dans le DOM
|
||||||
|
submitBtn.parentNode.insertBefore(editBtn, submitBtn);
|
||||||
|
console.log("=> Bouton de modification injecté avec succès par le gardien temporel !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 500); // Vérifie toutes les demi-secondes
|
||||||
Reference in New Issue
Block a user