Actualiser index.html
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:
+69
@@ -2011,4 +2011,73 @@
|
|||||||
|
|
||||||
<script src="assets/js/app.js?v=20260606z"></script>
|
<script src="assets/js/app.js?v=20260606z"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
console.log("=> Patch de l'injecteur de bouton initialisé !");
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
// 1. On cherche la modale de modification ou le formulaire actif
|
||||||
|
// On cible le bouton d'action principal qui contient "Aggiungi" ou l'icône de sauvegarde
|
||||||
|
const buttons = document.querySelectorAll('button');
|
||||||
|
|
||||||
|
buttons.forEach(submitBtn => {
|
||||||
|
// On repère le bouton vert de validation (Aggiungi ou Salva)
|
||||||
|
if (submitBtn.offsetWidth > 0 &&
|
||||||
|
submitBtn.offsetHeight > 0 &&
|
||||||
|
(submitBtn.textContent.includes('Aggiungi') || submitBtn.textContent.includes('Salva')) &&
|
||||||
|
!submitBtn.classList.contains('btn-edit-catalog-shortcut')) {
|
||||||
|
|
||||||
|
const parentForm = submitBtn.parentNode;
|
||||||
|
|
||||||
|
// 2. Si le bouton bleu n'est pas encore présent dans ce bloc
|
||||||
|
if (parentForm && !parentForm.querySelector('.btn-edit-catalog-shortcut')) {
|
||||||
|
|
||||||
|
const editBtn = document.createElement('button');
|
||||||
|
editBtn.type = 'button';
|
||||||
|
editBtn.className = 'btn btn-large btn-edit-catalog-shortcut';
|
||||||
|
editBtn.innerText = '✏️ Modifier la fiche produit (Catégorie)';
|
||||||
|
|
||||||
|
// Style calqué sur la charte graphique
|
||||||
|
editBtn.style.cssText = 'margin-bottom: 12px; background-color: #1976d2; color: white; width: 100%; border: none; border-radius: 8px; padding: 14px; font-size: 16px; font-weight: bold; cursor: pointer; display: block; text-align: center;';
|
||||||
|
|
||||||
|
// Action lors du clic : on tente de basculer sur l'éditeur global
|
||||||
|
editBtn.onclick = function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
let productId = null;
|
||||||
|
|
||||||
|
// Extraction de l'ID via les variables globales disponibles de l'application
|
||||||
|
if (typeof currentProduct !== 'undefined' && currentProduct) productId = currentProduct.id || currentProduct._id;
|
||||||
|
if (typeof _currentProduct !== 'undefined' && _currentProduct) productId = _currentProduct.id || _currentProduct._id;
|
||||||
|
if (typeof currentItem !== 'undefined' && currentItem) productId = currentItem.product_id || currentItem.productId;
|
||||||
|
|
||||||
|
if (productId) {
|
||||||
|
// On masque la modale de stock actuelle
|
||||||
|
document.querySelectorAll('.page, .modal').forEach(el => {
|
||||||
|
el.classList.remove('active');
|
||||||
|
el.style.display = 'none';
|
||||||
|
});
|
||||||
|
|
||||||
|
// On ouvre la fonction d'édition de produit
|
||||||
|
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("Identifiant du produit introuvable dans le contexte actuel.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Insertion immédiate juste au-dessus du bouton de validation
|
||||||
|
parentForm.insertBefore(editBtn, submitBtn);
|
||||||
|
console.log("=> Bouton injecté avec succès au-dessus de :", submitBtn.textContent.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 500); // Scan toutes les 500ms
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user