diff --git a/assets/js/app.js b/assets/js/app.js index 6793ec2..d46e7aa 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -6679,9 +6679,6 @@ function renderInventoryItem(item) { const subBadge = (item.subcategory && SUBCATEGORY_LABELS[item.subcategory]) ? `${SUBCATEGORY_LABELS[item.subcategory]}` : ''; - const subBadge = (catKey === 'bevande' && item.subcategory && SUBCATEGORY_LABELS[item.subcategory]) - ? `${SUBCATEGORY_LABELS[item.subcategory]}` - : ''; const locInfo = LOCATIONS[item.location] || { icon: '📦', label: item.location }; const days = daysUntilExpiry(item.expiry_date); const isExpired = days < 0; @@ -8509,12 +8506,6 @@ function autoDetectCategory() { function onCategoryChange(fromAutoDetect = false) { const cat = document.getElementById('pf-category').value; - const subGroup = document.getElementById('pf-subcategory-group'); - if (subGroup) subGroup.style.display = (cat === 'bevande') ? 'block' : 'none'; - if (cat !== 'bevande') { - const subSel = document.getElementById('pf-subcategory'); - if (subSel) subSel.value = ''; - } const unitSelect = document.getElementById('pf-unit'); const qtyInput = document.getElementById('pf-defqty'); @@ -8689,7 +8680,7 @@ async function submitProduct(e) { name: document.getElementById('pf-name').value, brand: document.getElementById('pf-brand').value, category: pfCategory, - subcategory: pfCategory === 'bevande' ? pfSubcategory : null, + subcategory: pfSubcategory || null, unit: pfUnit, default_quantity: pfUnit === 'conf' ? (parseFloat(document.getElementById('pf-conf-size')?.value) || 1) : (parseFloat(document.getElementById('pf-defqty').value) || 1), package_unit: pfUnit === 'conf' ? (document.getElementById('pf-conf-unit')?.value || '') : '', @@ -9078,12 +9069,6 @@ function editProductFromAction() { } document.getElementById('pf-category').disabled = false; document.getElementById('pf-subcategory').value = currentProduct.subcategory || ''; - // Set subcategory (boisson uniquement) - const editSubGroup = document.getElementById('pf-subcategory-group'); - if (editSubGroup) editSubGroup.style.display = (cat === 'bevande') ? 'block' : 'none'; - const editSubSel = document.getElementById('pf-subcategory'); - if (editSubSel) editSubSel.value = (cat === 'bevande') ? (currentProduct.subcategory || '') : ''; - document.getElementById('pf-defqty').dataset.manuallySet = 'true'; // Image preview - not shown in edit mode