From a5e3ac9a071a7e5654ac9d6c7fe4e27b62afa986 Mon Sep 17 00:00:00 2001 From: Mic Date: Thu, 16 Apr 2026 22:26:31 +0200 Subject: [PATCH] disabled prompts are not visible. see #680 --- pages/menu_order/mzta-menu-order.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pages/menu_order/mzta-menu-order.js b/pages/menu_order/mzta-menu-order.js index b3d74027..9669cfed 100644 --- a/pages/menu_order/mzta-menu-order.js +++ b/pages/menu_order/mzta-menu-order.js @@ -21,6 +21,7 @@ import { i18nConditionalGet } from '../../js/mzta-utils.js'; let allPrompts = []; let allExcludedSpecialPrompts = []; // special prompts excluded from UI (hidden + inactive features), preserved on save +let allDisabledPrompts = []; // default/custom prompts disabled (enabled=0), excluded from UI, preserved on save let currentPopupView = 'display'; // 'display' or 'compose' let hasUnsavedChanges = false; @@ -37,6 +38,10 @@ document.addEventListener('DOMContentLoaded', async () => { ); allPrompts = allPrompts.filter(p => !allExcludedSpecialPrompts.some(e => e.id === p.id)); + // Exclude disabled prompts (enabled=0) from the UI, preserve them for save + allDisabledPrompts = allPrompts.filter(p => String(p.enabled) === '0'); + allPrompts = allPrompts.filter(p => String(p.enabled) !== '0'); + // Resolve i18n names and assign initial position_context if missing let contextPos = 1; const sortedForContext = [...allPrompts].sort((a, b) => { @@ -305,9 +310,13 @@ async function saveAll() { const msgDisplay = document.getElementById('msgDisplay'); btnSaveAll.disabled = true; - const defaultPromptsToSave = allPrompts.filter(p => String(p.is_default) === '1' && String(p.is_special) !== '1'); - const customPromptsToSave = allPrompts.filter(p => String(p.is_default) === '0' && String(p.is_special) !== '1'); - const specialPromptsToSave = allPrompts.filter(p => String(p.is_special) === '1').concat(allExcludedSpecialPrompts); + const disabledDefaults = allDisabledPrompts.filter(p => String(p.is_default) === '1' && String(p.is_special) !== '1'); + const disabledCustoms = allDisabledPrompts.filter(p => String(p.is_default) === '0' && String(p.is_special) !== '1'); + const disabledSpecials = allDisabledPrompts.filter(p => String(p.is_special) === '1'); + + const defaultPromptsToSave = allPrompts.filter(p => String(p.is_default) === '1' && String(p.is_special) !== '1').concat(disabledDefaults); + const customPromptsToSave = allPrompts.filter(p => String(p.is_default) === '0' && String(p.is_special) !== '1').concat(disabledCustoms); + const specialPromptsToSave = allPrompts.filter(p => String(p.is_special) === '1').concat(disabledSpecials).concat(allExcludedSpecialPrompts); await setDefaultPromptsProperties(defaultPromptsToSave); await setCustomPrompts(customPromptsToSave);