Skip to content

Generate Shopping List from Event Menu

As a Host, I want to automatically generate a shopping list based on my event’s menu and current inventory, So that I know exactly what ingredients and products I need to purchase for the event.

IMPLEMENTED (January 2025)

Recent Enhancements (January 2025):

  • ✅ Inventory comparison fully implemented
  • ✅ Unit conversion fixes for discrete vs liquid items
  • ✅ Empty shopping list handling when all items in stock
  • ✅ Visual inventory status indicators in shopping list UI
  • ✅ Quantity filtering to show only items needing purchase
  • ✅ Given I have created an event with a menu containing multiple drink items
  • ✅ When I request to generate a shopping list
  • ✅ Then the system calculates required quantities for each ingredient based on:
    • ✅ Number of expected guests
    • ✅ Estimated drinks per guest (default: 3 per guest)
    • ✅ Recipe ingredient quantities
    • ✅ Safety margin (default: 20%)
  • ✅ And the system aggregates duplicate ingredients across recipes
  • ✅ And the system creates a shopping list containing all needed items
  • ✅ And each shopping list item shows:
    • ✅ Ingredient/product name
    • ✅ Required quantity and unit
    • ✅ Category (Spirits, Mixers, Garnishes, Wine & Beer, Other)
    • ✅ Notes indicating which recipes use the ingredient
  • ✅ And the system includes beer and wine from the menu
  • ✅ And optional ingredients are excluded from the shopping list
  • ✅ When I choose to compare with inventory
  • ✅ Then the system compares each ingredient against my current inventory
  • ✅ And adjusts quantities for items partially in stock (shows only shortfall)
  • ✅ And filters out items fully in stock (0 needed quantity)
  • ✅ And displays inventory comparison summary (in-stock, partial, out-of-stock counts)
  • ✅ And calculates estimated savings from items I already have

Files Created:

  • shaker/utils/shoppingListGeneration.ts - Core generation logic
  • shaker/utils/inventoryComparison.ts - Inventory comparison utility
  • shaker/utils/__tests__/shoppingListGeneration.test.ts - Unit tests (4 tests passing)
  • shaker/utils/__tests__/inventoryComparison.test.ts - Inventory comparison tests

Files Modified:

  • shaker/app/(tabs)/events/[id].tsx - Added “Generate from Menu” button with inventory comparison option
  • shaker/app/(tabs)/inventory/shopping/index.tsx - Added visual inventory status indicators

Features:

  • Configurable drinks per guest (default: 3)
  • Configurable safety margin (default: 20%)
  • Intelligent ingredient aggregation across recipes
  • Automatic categorization (Spirits, Mixers, Garnishes, Wine & Beer)
  • Beer and wine quantity estimation based on guest count
  • Recipe notes showing which drinks use each ingredient
  • Quantity rounding based on unit type (oz, ml, count, etc.)
  • Inventory comparison - Compare against current inventory to show only needed items
  • Automatic quantity adjustment - Adjusts quantities for items partially in stock
  • Inventory status determination - Identifies in-stock, partial, and out-of-stock items
  • Unit conversion support - Handles both liquid (ml, oz) and discrete (count, bottle) units
  • Dual tracking mode support - Works with both LEVEL_TRACKED and QUANTITY_ONLY products
  • Inventory comparison summary - Shows counts and estimated savings
  • Empty list handling - Provides helpful messages when all items are in stock
  • Visual status indicators - Color-coded badges in shopping list UI

Algorithm:

  1. Extract all recipes from event menu cocktails
  2. Calculate total drinks needed (guests × drinks per guest)
  3. Distribute drinks evenly across recipes
  4. Aggregate ingredient quantities across all recipes
  5. Apply safety margin to all quantities
  6. Round quantities to reasonable precision
  7. Add beer and wine items based on guest count estimates
  8. If compareWithInventory is enabled:
    • Compare each item against current inventory (supports both LEVEL_TRACKED and QUANTITY_ONLY products)
    • Determine inventory status: in-stock, partial, out-of-stock
    • Adjust quantities for items partially in stock (show only shortfall)
    • Filter out items fully in stock (0 needed quantity)
    • Generate inventory comparison summary with counts and estimated savings
  9. Sort items by category for efficient shopping

Configuration Options:

{
drinksPerGuest: 3, // Estimated drinks per guest (default: 3)
safetyMargin: 20, // Safety margin percentage (default: 20%)
includeGarnishes: true, // Include garnishes in list (default: true)
includeBeerWine: true, // Include beer and wine (default: true)
compareWithInventory: false, // Compare with inventory and adjust quantities (default: false)
}

Inventory Comparison: When compareWithInventory is true, the system:

  • Compares each shopping list item against current inventory
  • Supports both LEVEL_TRACKED (liquid) and QUANTITY_ONLY (discrete) products
  • Handles unit conversions (ml, oz, count, bottle, etc.)
  • Adjusts quantities for partial stock (e.g., need 500ml, have 200ml → shows 300ml needed)
  • Filters out items fully in stock (0 needed quantity)
  • Returns inventory comparison summary with:
    • Count of items in-stock, partially in-stock, and out-of-stock
    • Estimated savings from items already owned

UI Integration:

  • Alert dialog with “With Inventory” and “Without Inventory” options
  • Success message displays inventory comparison summary when enabled
  • Shows helpful message when all items are in stock: “All ingredients are in stock! No shopping needed.”
  • Visual status badges in shopping list: green (in-stock), yellow (partial), red (out-of-stock)
  • Displays inventory notes on shopping list items (e.g., “You have 200ml, need 300ml more”)

Future Enhancements:

  • Compare against current inventory to show only needed items (IMPLEMENTED)
  • ⚠️ Estimate costs based on product pricing data (function exists but returns 0 - needs product pricing data integration)
  • ⚠️ Suggest product substitutions based on availability (substitution logic exists but not integrated with shopping list generation)
  • Configuration UI for drinks per guest and safety margin (currently hard-coded in UI)
  • Export shopping list to external apps (Notes, Reminders)
  • Barcode scanning integration for quick check-off

High - Core functionality for event planning

  • Event, Menu, DrinkItem, Recipe, RecipeIngredient, Ingredient, Product, ShoppingList, ShoppingListItem, Inventory
  • GenerateShoppingList (C5)