Clean docs

This commit is contained in:
Urtzi Alfaro
2025-11-07 14:53:36 +01:00
parent 980bbd4b61
commit 41d3998f53
8 changed files with 0 additions and 4101 deletions

View File

@@ -1,461 +0,0 @@
# JTBD Analysis: Bakery Inventory Setup After Onboarding
**Date**: 2025-11-06
**Context**: Post-onboarding manual data entry for "Mi Panadería" section
**Target User**: Bakery owner or employee with limited time and basic computer skills
---
## 🎯 PRIMARY FUNCTIONAL JOB
### Main Job Statement
**"When I've just registered my bakery system, I want to set up all my foundational data correctly and efficiently, so that the system can start helping me manage my operations and provide value immediately."**
### Job Story Format
- **When**: I complete the initial registration and onboarding wizard
- **I want to**: Add all my bakery's operational data (inventory, suppliers, recipes, quality standards)
- **So I can**: Start using the system to manage daily operations, track inventory, and get AI-powered insights
- **Without**: Getting overwhelmed, making errors, or spending hours figuring out what to do next
### Success Criteria (from user's perspective)
- ✅ I know exactly what data I need to add and in what order
- ✅ I understand why each piece of data matters to my bakery
- ✅ I can complete the setup in one or two focused sessions
- ✅ The system validates my data and prevents mistakes
- ✅ I can see my progress and come back later if needed
- ✅ The system works correctly once I'm done (no missing critical data)
---
## 💭 RELATED EMOTIONAL & SOCIAL JOBS
### Emotional Jobs (How the user wants to feel)
1. **"I want to feel confident"**
- That I'm doing this right the first time
- That I won't break anything or lose data
- That the system will guide me if I make a mistake
2. **"I want to feel in control"**
- Of my time (can save and come back later)
- Of the process (can skip optional items)
- Of my data (can edit or undo if needed)
3. **"I want to feel competent"**
- Not stupid or confused by technical jargon
- Capable of managing my own business systems
- Proud when I complete the setup
4. **"I want to feel efficient"**
- Not wasting time figuring out what comes next
- Making progress, not going in circles
- Getting value from the system quickly
### Social Jobs (How the user wants to be perceived)
1. **"I want to be seen as a modern bakery owner"**
- Who adopts technology to improve operations
- Who keeps accurate records and data
2. **"I want my employees to see me as organized"**
- With clear standards and processes
- Who provides them with good tools
3. **"I don't want to appear incompetent"**
- To my staff if they see me struggling
- To myself (internal self-image)
---
## 🔄 SUB-JOBS & TASK BREAKDOWN
### Phase 1: Understanding What's Needed
**Job**: *"Help me understand what I need to set up and why"*
#### Sub-jobs:
1. **Learn what the system needs from me**
- What categories of data exist (inventory, suppliers, recipes, etc.)
- Why each category matters to my operations
- What's required vs. optional
2. **Assess what information I have available**
- Do I have supplier contact information handy?
- Do I have my recipe measurements documented?
- Do I know my current inventory counts?
3. **Plan my data entry approach**
- Should I do everything now or come back later?
- What order makes sense?
- Who else might need to help (e.g., chef for recipes)?
### Phase 2: Setting Up Core Dependencies
**Job**: *"Set up foundational data that other things depend on"*
#### Sub-jobs:
1. **Add my suppliers** (dependency for inventory)
- Who do I buy from?
- How do I contact them?
- What payment terms do we have?
2. **Add inventory items/ingredients** (dependency for recipes)
- What raw materials do I use?
- How do I measure them (kg, units, etc.)?
- What do they cost?
- When should I reorder?
3. **Configure quality standards** (dependency for production monitoring)
- What quality checks do I perform?
- At what stages of production?
- What are acceptable ranges?
### Phase 3: Setting Up Operational Data
**Job**: *"Add the data that represents how I actually work"*
#### Sub-jobs:
1. **Create my recipes**
- What do I bake?
- What ingredients go into each product?
- How much of each ingredient?
- What's the process?
2. **Set up equipment/machinery**
- What equipment do I have?
- When does it need maintenance?
3. **Add my team members**
- Who works here?
- What are their roles?
- How do I contact them?
### Phase 4: Verifying & Starting Operations
**Job**: *"Make sure everything is correct before I rely on this system"*
#### Sub-jobs:
1. **Review what I've entered**
- Are all recipes complete?
- Did I miss any key suppliers?
- Are inventory levels accurate?
2. **Test the system with real work**
- Can I create a production order?
- Can I record a sale?
- Does the inventory update correctly?
3. **Get confirmation I'm ready to go**
- Is there anything critical missing?
- What features are now available to me?
---
## ⚖️ FORCES OF PROGRESS
### Push Forces (Pushing user away from current state - not using the system)
1. **Manual tracking is unreliable**
- Paper notes get lost
- Excel sheets become outdated
- Memory fails ("Did I order flour last week?")
2. **Waste and inefficiency**
- Overordering leads to spoilage
- Underordering leads to stockouts
- No visibility into costs
3. **Growth constraints**
- Can't scale without systems
- Hiring requires documentation
- Investors/partners expect professionalism
4. **Competitive pressure**
- Other bakeries are modernizing
- Customers expect consistency
### Pull Forces (Pulling user toward the new system)
1. **Automation promises**
- AI-powered demand forecasting
- Automatic reorder suggestions
- Real-time inventory tracking
2. **Time savings**
- Less time counting inventory
- Less time making production decisions
- More time baking and serving customers
3. **Better decision making**
- Data-driven insights
- Cost analysis per recipe
- Supplier performance tracking
4. **Peace of mind**
- Always know what's in stock
- Never run out of key ingredients
- Quality standards documented
### Anxiety Forces (Holding user back - against new system)
1. **Fear of complexity**
- *"This looks complicated"*
- *"I'm not good with computers"*
- *"What if I enter something wrong?"*
2. **Time pressure**
- *"I don't have hours to sit and enter data"*
- *"I need to be in the kitchen, not at a computer"*
- *"What if I start and don't finish? Will it work partially?"*
3. **Uncertainty about requirements**
- *"Do I need ALL my recipes in here?"*
- *"What if I don't know the exact cost of an ingredient?"*
- *"Can I skip things and add them later?"*
4. **Fear of mistakes**
- *"What if I delete something important?"*
- *"What if incorrect data messes up my inventory?"*
- *"I don't want to start over if I get it wrong"*
5. **Investment fear**
- *"Will I actually use all these features?"*
- *"Is this worth the time to set up?"*
- *"What if the system doesn't work for my bakery?"*
### Habit Forces (Keeping user in old ways)
1. **Existing workflows are familiar**
- "I've always managed inventory by walking around and looking"
- "I know my recipes by heart, don't need them written down"
- "I just call my supplier when I need something"
2. **Low-tech comfort**
- "Paper checklists have always worked"
- "My notebook system is simpler"
- "I prefer talking to people, not typing into a computer"
3. **Team habits**
- "My staff is used to the old way"
- "Training everyone on new software is a hassle"
---
## 🚧 BARRIERS & PAIN POINTS (Current System)
### Discovery Barriers
**Problem**: *Users don't know what exists or where to start*
- ❌ No post-onboarding guidance (wizard ends, user is on their own)
- ❌ No "Getting Started" checklist or dashboard
- ❌ No indication of what's required vs. optional
- ❌ No explanation of dependencies ("need ingredients before recipes")
**Evidence from code**:
- Onboarding wizard ends at CompletionStep (line 51, OnboardingWizard.tsx)
- No handoff to guided data entry
- User lands on dashboard with empty state and must explore sidebar
### Cognitive Load Barriers
**Problem**: *Too much to remember and figure out simultaneously*
- ❌ Must remember to add ingredients before recipes (dependency not enforced or explained)
- ❌ Must learn different modal patterns for different entities
- ❌ Must understand bakery terminology + system terminology
- ❌ No contextual help or tooltips in forms
**Evidence from code**:
- CreateRecipeModal allows selecting ingredients (line 218) but doesn't prompt to add ingredients first if none exist
- Inconsistent field patterns across modals
- Only placeholder text for guidance
### Navigation Barriers
**Problem**: *Users get lost in the sidebar menu structure*
- ❌ 10 menu items under "Mi Panadería" - overwhelming
- ❌ No indication of completion status (which sections are empty/done)
- ❌ No suggested order (user must guess)
- ❌ Must repeatedly open sidebar, navigate to section, click add button
**Evidence from code**:
```
Mi Panadería (10 subsections):
├── Ajustes, Proveedores, Inventario, Recetas, Pedidos,
└── Maquinaria, Quality Templates, Team, AI Models, Sustainability
```
All presented equally, no priority or grouping by setup phase
### Validation & Error Barriers
**Problem**: *Users make mistakes but only discover them later*
- ❌ No pre-validation (only after submit)
- ❌ No cross-field validation (e.g., reorder_point should be > low_stock_threshold)
- ❌ No prevention of incomplete data (can save recipe with no ingredients in some flows)
**Evidence from code**:
- AddModal validation only on submit (handleSave, line 159-171)
- No real-time field validation shown
- Errors cleared on change but no proactive checking
### Data Entry Efficiency Barriers
**Problem**: *Repetitive, tedious work with no shortcuts*
- ❌ No bulk import option for multiple ingredients
- ❌ No templates for common items ("French bread" recipe template)
- ❌ No copy/duplicate for similar recipes
- ❌ Must re-enter supplier info if same supplier provides multiple ingredients
### Progress & Motivation Barriers
**Problem**: *Users can't see progress and lose motivation*
- ❌ No completion indicator ("3 of 5 critical sections complete")
- ❌ No celebration of milestones
- ❌ No "minimum viable setup" guidance ("Here's the bare minimum to get started")
- ❌ Can't easily resume if interrupted
### Technical Barriers
**Problem**: *System assumes too much technical proficiency*
- ❌ Form fields use technical language (SKU, barcode, "reorder point")
- ❌ No plain-language explanations
- ❌ Dropdown options assume knowledge (e.g., MeasurementUnit enum)
- ❌ No examples or common values suggested
---
## 🎯 UNMET NEEDS & OPPORTUNITIES
### High Priority Unmet Needs
1. **"Show me the path forward"**
- Need: Clear, step-by-step guidance on what to set up first
- Opportunity: Post-onboarding wizard that continues into data entry
- Success metric: 90% of users complete critical data setup
2. **"Tell me if I'm doing it right"**
- Need: Real-time validation and helpful error messages
- Opportunity: Progressive validation with contextual tips
- Success metric: 50% reduction in data entry errors
3. **"Don't make me think"**
- Need: Smart defaults, suggested values, autofill where possible
- Opportunity: Templates, common recipes, supplier databases
- Success metric: 40% faster data entry
4. **"Let me do this in chunks"**
- Need: Save progress, resume later, skip optional sections
- Opportunity: Progress tracking with clear save states
- Success metric: 80% completion rate even with interruptions
5. **"Help me understand dependencies"**
- Need: Know what I need before I can do something else
- Opportunity: Guided flows that handle dependencies automatically
- Success metric: Zero "missing dependency" errors
### Medium Priority Unmet Needs
6. **"Make it feel less overwhelming"**
- Need: Break down big tasks into small wins
- Opportunity: Progressive disclosure, celebrate small completions
- Success metric: User sentiment scores improve
7. **"Speak my language"**
- Need: Plain language, bakery terminology, not software jargon
- Opportunity: Context-aware help, glossary, examples
- Success metric: Support tickets for "how do I" decrease
8. **"Show me what's possible"**
- Need: Understand what value I'll get from each section
- Opportunity: Preview of features unlocked by completing setup
- Success metric: Increased feature adoption post-setup
### Lower Priority (Nice to Have)
9. **"Let me work my way"**
- Need: Flexibility in approach (top-down vs. bottom-up)
- Opportunity: Multiple entry paths while maintaining guidance
- Success metric: User control satisfaction
10. **"Import my existing data"**
- Need: Bulk import from spreadsheets or previous systems
- Opportunity: CSV/Excel import with mapping wizard
- Success metric: Time to value reduced by 60%
---
## ✅ JTBD VALIDATION CHECKLIST
### Are the jobs goal-oriented (not solution-oriented)?
**Yes**
- Main job: "set up all my foundational data correctly and efficiently"
- Not: "use a wizard" or "click through modals"
- Focused on desired outcome, not implementation
### Are sub-jobs specific steps toward the main job?
**Yes**
- Phase 1: Understanding → Phase 2: Dependencies → Phase 3: Operations → Phase 4: Verification
- Each sub-job is a necessary step in the progression
- Clear hierarchy and flow
### Are emotional/social jobs captured?
**Yes**
- Emotional: confidence, control, competence, efficiency
- Social: modern bakery owner, organized, not appearing incompetent
- These drive behavior as much as functional needs
### Are user struggles and unmet needs listed?
**Yes**
- Barriers section: 6 major categories with specific pain points
- Unmet needs: 10 prioritized opportunities
- Evidence-based (code analysis supports each claim)
---
## 🎬 RECOMMENDED SOLUTION APPROACH
Based on this JTBD analysis, here's a high-level recommendation (not detailed implementation):
### Core Concept: "Guided Bakery Setup Journey"
Transform the post-onboarding experience from **scattered modals** to a **continuous, guided journey** that:
1. **Starts immediately after onboarding** (Step 5 of wizard)
2. **Groups related tasks** (Dependencies → Operations → Quality)
3. **Shows clear progress** (visual indicator, percentage, milestones)
4. **Allows flexibility** (save/resume, skip optional, reorder)
5. **Provides context** (why this matters, what's next, examples)
6. **Validates progressively** (before moving on, not after errors)
7. **Celebrates completion** (milestones, "you're ready to bake!")
### Phased Implementation
- **Phase 1**: Add progress tracking and "Setup Checklist" dashboard
- **Phase 2**: Convert critical paths (Suppliers → Inventory → Recipes) to guided wizards
- **Phase 3**: Add templates, smart defaults, bulk import
- **Phase 4**: Polish with animations, contextual help, advanced features
---
## 📊 SUCCESS METRICS
### Leading Indicators (During Setup)
- **Setup completion rate**: % of users who finish critical data entry
- **Time to first value**: Days from registration to first production order created
- **Data quality score**: % of records with complete, valid data
- **Drop-off points**: Where users abandon the setup process
### Lagging Indicators (Post-Setup)
- **Feature adoption**: % of users actively using inventory, recipes, forecasting
- **System reliance**: Frequency of use (daily, weekly, monthly)
- **User satisfaction**: NPS, support tickets, sentiment analysis
- **Business outcomes**: Waste reduction, time saved, cost visibility
---
## 🔄 NEXT STEPS
1. **Validate with users**: Interview 5-8 bakery owners to confirm jobs, forces, and barriers
2. **Prioritize sub-jobs**: Which jobs are most critical? Which provide quick wins?
3. **Design prototype**: Sketch out the guided journey (low-fidelity wireframes)
4. **Test with users**: Usability testing to refine approach
5. **Implement incrementally**: Start with highest-value, lowest-effort improvements
---
**Document Owner**: Product & UX Team
**Review Date**: To be scheduled after user validation
**Status**: Draft for review

View File

@@ -1,564 +0,0 @@
# Proposal: Add Product Lots with Expiration Dates to Inventory Onboarding
**Date**: 2025-11-06
**Status**: Proposal for Review
**Context**: Enhance InventorySetupStep in onboarding to support lot/batch management with expiration tracking
---
## 📋 Executive Summary
**Problem**: Current inventory onboarding only creates ingredient definitions (master data) without actual stock quantities or expiration tracking. This creates a critical gap for bakeries managing perishable ingredients.
**Solution**: Enhance the InventorySetupStep to allow users to add one or more stock lots per ingredient, including quantities and expiration dates, using a simplified version of the existing AddStockModal pattern.
**Impact**:
- ✅ Immediate inventory visibility from day one
- ✅ FIFO (First-In-First-Out) management ready
- ✅ Expiration alerts functional immediately
- ✅ Waste prevention starts on day one
- ✅ Better data quality for AI forecasting
---
## 🔍 Current State Analysis
### What Exists Today
1. **InventorySetupStep** (Onboarding):
- Creates ingredient definitions (master data)
- No stock quantities
- No expiration dates
- Users define WHAT they have, not HOW MUCH
2. **InitialStockEntryStep** (AI-Assisted Path Only):
- Simple quantity entry
- No expiration dates
- No lot/batch numbers
- No multi-lot support
3. **AddStockModal** (Post-Onboarding):
- Comprehensive lot management
- Expiration dates, batch numbers, storage requirements
- Used after onboarding is complete
### The Gap
**Users complete onboarding with:**
- ✅ Ingredients defined (master data)
- ❌ Zero actual stock in system
- ❌ No expiration tracking
- ❌ Cannot use FIFO/waste alerts
- ❌ Must manually add stock post-onboarding
**Impact of Gap:**
- System shows "0 stock" for everything
- No expiration alerts for weeks/months
- Forecasting starts with no data
- Poor first impression ("Why is everything empty?")
---
## 🎯 JTBD Alignment
### Primary Jobs Addressed
From JTBD Analysis (docs/jtbd-analysis-inventory-setup.md):
1. **"Help me understand dependencies"** (Line 347-349)
- Need: Know what I need before I can do something else
- **Solution**: Add stock immediately after defining ingredients
2. **"Tell me if I'm doing it right"** (Line 331-334)
- Need: Real-time validation and helpful error messages
- **Solution**: Validate expiration dates, warn about near-expiry stock
3. **"Don't make me think"** (Line 336-339)
- Need: Smart defaults, suggested values
- **Solution**: Auto-suggest expiration based on ingredient type
4. **"Set up foundational data correctly"** (Line 100-104)
- Sub-job: Add inventory items - *"What do they cost? When should I reorder?"*
- **Solution**: Add actual quantities with dates during setup
### Forces of Progress
**Push Forces** (Lines 153-172):
- **Waste and inefficiency**: Overordering leads to spoilage ✅ *Directly addressed*
- **Manual tracking unreliable**: No visibility into stock levels ✅ *Directly addressed*
**Pull Forces** (Lines 173-194):
- **Real-time inventory tracking**: Start from day one ✅ *Enabled*
- **Peace of mind**: Always know what's in stock ✅ *Enabled*
**Anxiety Forces to Mitigate** (Lines 195-220):
- **Fear of complexity**: Keep it simple, optional ✅ *Simplified form*
- **Time pressure**: Make it quick and skipable ✅ *Optional step*
- **Uncertainty about requirements**: Clear guidance ✅ *Contextual help*
---
## 💡 Proposed Solution
### Approach: "Quick Stock Entry" After Each Ingredient
**Core Concept**: After adding an ingredient in InventorySetupStep, immediately prompt to add initial stock (optional but encouraged).
### User Flow
```
1. User adds ingredient (e.g., "All-Purpose Flour")
└─> Ingredient created ✓
2. System shows inline prompt:
"Add initial stock for Flour?"
[Add Stock] [Skip for Now]
3. If user clicks [Add Stock]:
└─> Simplified stock entry form appears inline
└─> User enters:
- Quantity (required)
- Expiration date (optional but recommended)
- Supplier (optional, dropdown from existing)
- Batch/Lot number (optional)
└─> [Save Stock] [Add Another Lot] [Cancel]
4. Stock saved ✓
└─> Shows summary: "20 kg expires on 2025-12-15"
└─> Option to [Add Another Lot] for same ingredient
5. User continues to next ingredient or completes step
```
### Alternative: Dedicated "Stock Entry" Sub-Step
**Two-phase approach within InventorySetupStep:**
**Phase 1**: Add Ingredients (current behavior)
**Phase 2**: Add Stock Lots (new)
```
┌─────────────────────────────────────────┐
│ Inventory Setup │
│ │
│ [✓ Add Ingredients] [→ Add Stock] │
│ │
│ You've added 8 ingredients │
│ │
│ Would you like to add initial stock │
│ quantities and expiration dates? │
│ │
│ ○ Yes, add stock now (recommended) │
│ Track quantities and prevent waste │
│ │
│ ○ Skip for now │
│ Add stock later from inventory page │
│ │
│ [Continue →] │
└─────────────────────────────────────────┘
```
If user selects "Yes":
- Shows list of ingredients
- Each ingredient has [+ Add Stock] button
- Inline form appears per ingredient
- Can add multiple lots per ingredient
---
## 🎨 UI/UX Design Recommendations
### Option 1: Inline Stock Entry (Recommended)
**Advantages:**
- ✅ Contextual - add stock right after defining ingredient
- ✅ Minimal cognitive load
- ✅ Clear cause-and-effect relationship
- ✅ Natural flow
**Design:**
```
┌─────────────────────────────────────────────────────────┐
│ All-Purpose Flour [Edit] │
│ Category: Flour | Unit: kg | Cost: $1.50/kg │
├─────────────────────────────────────────────────────────┤
│ │
│ 📦 Add Initial Stock (Optional) │
│ │
│ Quantity (kg) * Expiration Date │
│ [ 25.0 ] [ 2025-12-15 ] 📅 │
│ │
│ Supplier Batch/Lot Number │
│ [Mill Brothers ▼] [ LOT-2024-11 ] │
│ │
│ [✓ Save Stock] [+ Add Another Lot] [Skip] │
│ │
Expiration tracking helps prevent waste and enables │
│ First-In-First-Out (FIFO) inventory management │
└─────────────────────────────────────────────────────────┘
```
### Option 2: Separate Stock Entry Screen
**Advantages:**
- ✅ Clearer separation of concerns
- ✅ Can see all ingredients at once
- ✅ Bulk actions possible
- ✅ Better for users with many items
**Design:**
```
┌─────────────────────────────────────────────────────────┐
│ Step 2/2: Add Initial Stock Quantities │
│ │
│ Add stock for the ingredients you just created. │
│ This is optional but recommended for accurate tracking. │
│ │
│ Progress: 3 of 8 ingredients have stock │
│ [████░░░░░░] 38% │
│ │
├─────────────────────────────────────────────────────────┤
│ All-Purpose Flour [Add Stock] │
│ Quantity: 25 kg | Expires: 2025-12-15 [✓ Added] │
│ │
│ Bread Flour [Add Stock] │
│ No stock added yet [+ Add] │
│ │
│ Active Dry Yeast [Add Stock] │
│ Quantity: 2 kg | Expires: 2025-11-30 [✓ Added] │
│ │
│ ... (5 more ingredients) │
│ │
│ │
│ [Skip All] [Continue →] │
└─────────────────────────────────────────────────────────┘
```
### Option 3: Simplified "Quick Add" Modal (Hybrid)
**Advantages:**
- ✅ Focused attention on stock entry
- ✅ Can reuse existing AddStockModal design
- ✅ Familiar pattern for users
- ✅ Easy to implement
**Design:**
```
┌─────────────────────────────────────────┐
│ Add Stock: All-Purpose Flour │
├─────────────────────────────────────────┤
│ │
│ Current Quantity * │
│ [ 25.0 ] kg │
│ │
│ Expiration Date │
│ [ 2025-12-15 ] 📅 │
│ ⚠️ This ingredient expires in 40 days │
│ │
│ Supplier (Optional) │
│ [ Mill Brothers ▼ ] │
│ │
│ Batch/Lot Number (Optional) │
│ [ LOT-2024-11 ] │
│ │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ │
│ [Save & Add Another Lot] │
│ [Save & Close] │
│ [Cancel] │
└─────────────────────────────────────────┘
```
---
## 🏗️ Implementation Recommendations
### Recommended Approach: **Option 1 - Inline Stock Entry**
**Why:**
1. Most aligned with JTBD principle "Don't make me think"
2. Natural flow - no context switching
3. Progressive disclosure - only shows when relevant
4. Maintains momentum in onboarding
5. Optional but visible - encourages action without forcing it
### Form Fields (Simplified)
**Required:**
- `current_quantity` (number)
**Recommended (show by default):**
- `expiration_date` (date picker)
- `supplier_id` (select from existing suppliers)
**Optional (collapsed/advanced):**
- `batch_number` (text)
- `lot_number` (text)
- `received_date` (date, default: today)
- `storage_location` (text/select)
- `unit_cost` (number, default from ingredient)
**Not included (use ingredient defaults):**
- Storage requirements (refrigeration, etc.) - use from ingredient
- Production stage - default to RAW_INGREDIENT
- Quality status - default to "good"
### Smart Defaults & Auto-Suggestions
1. **Expiration Date Suggestions**:
```
If ingredient.is_perishable && ingredient.shelf_life_days:
Suggest: today + shelf_life_days
Show: "Typical shelf life: 30 days → Expires: 2025-12-06"
```
2. **Supplier Pre-Selection**:
```
If only 1 supplier exists:
Auto-select it
If ingredient previously purchased from supplier:
Pre-select that supplier
```
3. **Batch Number Generation**:
```
Offer to auto-generate: "BATCH-[DATE]-[INCREMENT]"
Example: "BATCH-20251106-001"
```
### Validation Rules
```typescript
// Frontend validation
if (currentQuantity <= 0) {
error("Quantity must be greater than zero")
}
if (expirationDate && expirationDate < today) {
warning("This date is in the past. Is this correct?")
}
if (expirationDate && expirationDate < today + 3 days) {
alert("⚠️ This ingredient expires very soon!")
}
if (expirationDate && expirationDate > today + 365 days) {
warning("Unusual expiration date (> 1 year). Please verify.")
}
// Suggest storage requirements
if (ingredient.category === 'dairy' && !storage_location) {
suggest("Consider adding storage location: Refrigerator")
}
```
### User Guidance
**Contextual Help Text:**
- "Expiration tracking helps prevent waste and enables First-In-First-Out (FIFO) management"
- "Add multiple lots if you have ingredients with different expiration dates"
- "You can always add more stock later from the Inventory page"
**Empty State:**
- "No stock added yet. The system will show 0 available until you add stock."
**Success Feedback:**
- "✓ Stock added: 25 kg expires on 2025-12-15"
- "You can add another lot if you have more with a different expiration date"
---
## 📊 Success Metrics
### Leading Indicators
1. **Stock Entry Rate**: % of ingredients with at least one stock lot added during onboarding
- Target: 60%+ (users add stock for most ingredients)
2. **Expiration Date Completeness**: % of stock lots with expiration dates
- Target: 80%+ for perishable items, 40%+ overall
3. **Multi-Lot Usage**: % of ingredients with 2+ stock lots
- Target: 20%+ (shows understanding of lot concept)
4. **Time to Complete**: Average time spent on stock entry
- Target: < 2 minutes per ingredient
5. **Skip Rate**: % of users who skip stock entry
- Target: < 40% (most users add at least some stock)
### Lagging Indicators
1. **Expiration Alert Effectiveness**: % of expired items caught before use
- Target: 90%+ (shows system is working)
2. **Waste Reduction**: Compare waste rates pre/post implementation
- Target: 15% reduction in expired ingredient waste
3. **System Usage**: % of users actively using inventory tracking
- Target: 85%+ weekly active users
4. **User Satisfaction**: NPS score for inventory setup
- Target: +40 or higher
### Data Quality Metrics
1. **Stock Accuracy**: % of stock records with complete data
- Measure: quantity, expiration date, supplier filled out
2. **FIFO Compliance**: % of stock consumption following FIFO
- Measure via stock movement logs
---
## 🚀 Implementation Phases
### Phase 1: MVP - Basic Lot Entry (Week 1-2)
**Scope:**
- Inline stock entry form after ingredient creation
- Fields: quantity, expiration date, supplier
- Single lot per ingredient
- Skip option clearly visible
**Success Criteria:**
- Users can add at least one stock lot per ingredient
- Expiration dates are captured
- Can skip if desired
### Phase 2: Enhanced - Multi-Lot Support (Week 3)
**Scope:**
- "Add Another Lot" button
- Support multiple lots per ingredient with different expiration dates
- Visual list of lots added
- Edit/delete lots before completing step
**Success Criteria:**
- Users can add 2+ lots for same ingredient
- Clear visual feedback of lots added
- Easy to manage multiple lots
### Phase 3: Smart Features (Week 4-5)
**Scope:**
- Auto-suggest expiration dates based on shelf life
- Batch number auto-generation
- Supplier pre-selection logic
- Advanced validation warnings
- Contextual help tooltips
**Success Criteria:**
- 50%+ of users use at least one smart feature
- Reduced data entry errors
- Faster completion times
### Phase 4: Bulk & Import (Future)
**Scope:**
- Bulk stock entry (CSV import)
- Copy from previous orders
- Templates for common stock patterns
**Success Criteria:**
- Power users can import dozens of lots quickly
- Support for large-scale bakeries
---
## 🎯 Recommended Next Steps
1. **Validate with Users** (2-3 days)
- Interview 3-5 bakery owners
- Show mockups of Option 1, 2, 3
- Ask: "Which feels most natural? What's confusing?"
2. **Create Detailed Designs** (1 week)
- High-fidelity mockups of chosen option
- Mobile responsive designs
- Interaction specifications
- Error state designs
3. **Technical Spike** (2-3 days)
- Verify API support for batch stock creation
- Test performance with multiple lots
- Identify any backend changes needed
4. **Implement Phase 1** (2 weeks)
- Build MVP inline stock entry
- Unit tests for validation
- Integration with existing inventory hooks
5. **User Testing** (3-5 days)
- Usability testing with 5-8 users
- Measure completion time, skip rate
- Collect qualitative feedback
6. **Iterate & Launch Phase 2** (1-2 weeks)
- Address feedback from testing
- Add multi-lot support
- Launch to production
---
## 🔒 Risk Mitigation
### Risk 1: Users Feel Overwhelmed
**Mitigation:**
- Make stock entry optional but recommended
- Progressive disclosure - show advanced fields only if needed
- Clear "Skip" option with explanation
- Celebrate small wins ("3 of 8 done!")
### Risk 2: Takes Too Long
**Mitigation:**
- Simplify form to essential fields only
- Smart defaults reduce typing
- Allow saving and resuming later
- Bulk actions in Phase 4
### Risk 3: Poor Data Quality
**Mitigation:**
- Real-time validation
- Contextual warnings
- Educational tooltips
- Show impact: "Expiration tracking helps prevent $X waste/month"
### Risk 4: Technical Complexity
**Mitigation:**
- Reuse existing AddStockModal logic
- Build incrementally (MVP first)
- Leverage existing API endpoints
- Thorough testing before launch
---
## 📚 References
- JTBD Analysis: `docs/jtbd-analysis-inventory-setup.md`
- Inventory API Types: `frontend/src/api/types/inventory.ts` (lines 179-308)
- Existing Components:
- `AddStockModal.tsx` - Full stock entry modal
- `InitialStockEntryStep.tsx` - Simple quantity entry
- `InventorySetupStep.tsx` - Current ingredient creation
---
## ✅ Conclusion
Adding lot/batch management with expiration tracking to the inventory onboarding step directly addresses critical JTBD needs, reduces waste, and enables immediate system value. The recommended inline approach balances simplicity with power, making it easy for users while capturing essential data for bakery operations.
**Recommendation**: Proceed with **Option 1 (Inline Stock Entry)** → Phase 1 MVP → User Validation → Iterate based on feedback.
---
**Document Owner**: Product & Engineering Team
**Status**: Awaiting Approval
**Next Review**: After user validation interviews