diff --git a/assets/js/app.js b/assets/js/app.js index d4d9fbb..4c19c81 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -9493,6 +9493,28 @@ function showAddForm() { ${currentProduct.weight_info ? `

${escapeHtml(currentProduct.weight_info)}

` : ''} `; + + // --- PATCH : Injection du bouton "Modifier la fiche produit" --- + // On vérifie si le bouton n'existe pas déjà pour éviter les doublons + if (!document.getElementById('btn-edit-product-shortcut')) { + // On cherche le bouton vert "Aggiungi" dans la page add + const submitBtn = document.querySelector('#page-add button[type="submit"]'); + if (submitBtn) { + const editBtn = document.createElement('button'); + editBtn.type = 'button'; + editBtn.id = 'btn-edit-product-shortcut'; + editBtn.className = 'btn btn-large'; + editBtn.innerText = '✏️ Modifier la fiche produit (Catégorie)'; + 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;'; + + // On lie le clic à notre fonction de bascule + editBtn.onclick = switchToProductEditFromStock; + + // Insérer le bouton juste au-dessus du bouton vert "Enregistrer/Aggiungi" + submitBtn.parentNode.insertBefore(editBtn, submitBtn); + } + } + // Set unit selector const unit = currentProduct.unit || 'pz'; const unitSelect = document.getElementById('add-unit');