20260317e: Persist recipe ingredient used state to DB

This commit is contained in:
dadaloop82
2026-03-17 14:18:25 +00:00
parent 66e175e863
commit 9517225d32
2 changed files with 5 additions and 2 deletions
+3
View File
@@ -4986,6 +4986,7 @@ async function loadRecipeArchive() {
function viewArchivedRecipe(idx) { function viewArchivedRecipe(idx) {
const entry = _recipeArchiveEntries[idx]; const entry = _recipeArchiveEntries[idx];
if (!entry) return; if (!entry) return;
_cachedRecipe = { meal: entry.meal, recipe: entry.recipe };
renderRecipe(entry.recipe); renderRecipe(entry.recipe);
document.getElementById('recipe-overlay').style.display = 'flex'; document.getElementById('recipe-overlay').style.display = 'flex';
document.getElementById('recipe-ask').style.display = 'none'; document.getElementById('recipe-ask').style.display = 'none';
@@ -5262,6 +5263,8 @@ async function submitRecipeUse(useAll) {
if (_cachedRecipe && _cachedRecipe.recipe && _cachedRecipe.recipe.ingredients && _cachedRecipe.recipe.ingredients[idx]) { if (_cachedRecipe && _cachedRecipe.recipe && _cachedRecipe.recipe.ingredients && _cachedRecipe.recipe.ingredients[idx]) {
_cachedRecipe.recipe.ingredients[idx].used = true; _cachedRecipe.recipe.ingredients[idx].used = true;
// Persist used state to DB
saveRecipeToArchive(_cachedRecipe.recipe);
} }
showToast('📦 Ingrediente scalato dalla dispensa!', 'success'); showToast('📦 Ingrediente scalato dalla dispensa!', 'success');
+2 -2
View File
@@ -9,7 +9,7 @@
<title>Dispensa Manager</title> <title>Dispensa Manager</title>
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🏠</text></svg>"> <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🏠</text></svg>">
<link rel="stylesheet" href="assets/css/style.css?v=20260317d"> <link rel="stylesheet" href="assets/css/style.css?v=20260317e">
<!-- QuaggaJS for barcode scanning --> <!-- QuaggaJS for barcode scanning -->
<script src="https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.4/dist/quagga.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.4/dist/quagga.min.js"></script>
</head> </head>
@@ -911,6 +911,6 @@
</div> </div>
</div> </div>
<script src="assets/js/app.js?v=20260317d"></script> <script src="assets/js/app.js?v=20260317e"></script>
</body> </body>
</html> </html>