feat+fix: Bring removal, multi-expiry batches, FIFO in cooking steps
BRING! REMOVAL FIX (latte/aglio not removed after shopping): - PHP addToInventory: replace exact strcasecmp with token-based fuzzy matching (same logic as _productOnBring) so custom Bring item names and translated catalog keys both match correctly - JS submitAdd: add client-side fallback — if PHP removal missed the item, use _findSimilarItem against the loaded shoppingItems and call bring_remove MULTI-EXPIRY BATCHES (when buying conf with different expiry dates): - Add form (unit=conf): shows '+ Lotto con scadenza diversa' button - Each extra batch has its own qty + expiry date input with +/- controls - On submitAdd, extra batches are submitted as additional inventory_add calls (separate DB rows, separate expiry dates) - Multi-batch section hidden in 'Ce l'avevo già' mode and for non-conf units - Re-shown/hidden when switching unit via onAddUnitChange RECIPE COOKING STEPS - FIFO ingredient display: - renderCookingStep: each ingredient row now shows brand chip, location chip, and expiry date chip (color-coded: red ≤3d, yellow ≤7d) - PHP already selected earliest-expiry inventory entry (ORDER BY days_left ASC with > not >= ensures first/earliest match wins) - CSS: .cooking-ing-meta, .cooking-ing-chip, .exp-soon, .exp-close, .multi-batch-row, .multi-batch-qty, .multi-batch-date, .btn-icon-sm
This commit is contained in:
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user