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:
@@ -19947,3 +19947,36 @@ async function _backgroundBringSync() {
|
||||
} catch (e) { /* silent — best effort */ }
|
||||
}
|
||||
|
||||
function switchToProductEditFromUse() {
|
||||
// 1. Tenter de récupérer le produit en cours d'utilisation
|
||||
let productToEdit = null;
|
||||
|
||||
if (typeof currentProduct !== 'undefined' && currentProduct) {
|
||||
productToEdit = currentProduct;
|
||||
} else if (typeof _currentProduct !== 'undefined' && _currentProduct) {
|
||||
productToEdit = _currentProduct;
|
||||
}
|
||||
|
||||
if (productToEdit) {
|
||||
// 2. Masquer la page de consommation actuelle
|
||||
document.getElementById('page-use').classList.remove('active');
|
||||
if (document.getElementById('page-use').style.display === 'block') {
|
||||
document.getElementById('page-use').style.display = 'none';
|
||||
}
|
||||
|
||||
// 3. Basculer sur la page d'édition du produit
|
||||
// On appelle la fonction native d'EverShelf (celle qu'on a trouvée à la ligne 9031)
|
||||
if (typeof editProduct === 'function') {
|
||||
editProduct(productToEdit.id || productToEdit._id || productToEdit.product_id);
|
||||
} else {
|
||||
// Sécurité si la fonction n'est pas exposée globalement : on affiche la page de force
|
||||
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 l'identifiant du produit depuis cet écran.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user