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

This commit is contained in:
2026-06-17 12:59:46 +00:00
parent 662c27d7b4
commit 6ecb881d9f
+11 -1
View File
@@ -1352,7 +1352,16 @@ async function loadCustomLocations() {
console.warn('[EverShelf] Could not load custom locations:', e); console.warn('[EverShelf] Could not load custom locations:', e);
} }
} }
function renderLocationButtons(containerId, activeKey, onClickFnName) {
const container = document.getElementById(containerId);
if (!container) return;
const keys = Object.keys(LOCATIONS);
container.innerHTML = keys.map(key => {
const info = LOCATIONS[key];
const isActive = key === activeKey ? 'active' : '';
return `<button type="button" class="loc-btn ${isActive}" onclick="${onClickFnName}(this, '${key}')">${info.icon} <span>${escapeHtml(info.label)}</span></button>`;
}).join('');
}
/** /**
* Render location selector buttons dynamically into a container. * Render location selector buttons dynamically into a container.
* @param {string} containerId - DOM id of the container holding the buttons * @param {string} containerId - DOM id of the container holding the buttons
@@ -9345,6 +9354,7 @@ async function saveEditedProductInfo() {
// ===== ADD TO INVENTORY ===== // ===== ADD TO INVENTORY =====
function showAddForm() { function showAddForm() {
renderLocationButtons('location-selector-add', document.getElementById('add-location')?.value || 'dispensa', 'selectLocation');
const catIcon = CATEGORY_ICONS[mapToLocalCategory(currentProduct.category, currentProduct.name)] || '📦'; const catIcon = CATEGORY_ICONS[mapToLocalCategory(currentProduct.category, currentProduct.name)] || '📦';
document.getElementById('add-product-preview').innerHTML = ` document.getElementById('add-product-preview').innerHTML = `
${currentProduct.image_url ? ${currentProduct.image_url ?