9162fc32a54a0ffb05e7610662bcb92ad3132931
2 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9162fc32a5 |
Implement inline ingredient creation pattern (JTBD-driven UX improvement)
🎯 PROBLEM SOLVED: Users were blocked when needing ingredients that weren't in inventory during: - Recipe creation (couldn't add missing ingredients) - Supplier setup (couldn't associate missing products) This broke the user flow and forced context switching, resulting in lost progress and frustration. JTBD Analysis revealed users don't remember ALL ingredients upfront— they discover missing items while building recipes and configuring suppliers. ✨ SOLUTION: Inline Quick-Add Pattern Never block the user—allow adding missing data inline without losing context. 📦 NEW COMPONENT: QuickAddIngredientModal (438 lines) Lightweight modal for fast ingredient creation with minimal friction: **Minimum Required Fields** (3 fields to unblock): - Name (required) - Category (required) - Unit of Measure (required) **Optional Fields** (collapsible section): - Stock Quantity, Cost Per Unit, Shelf Life Days - Low Stock Threshold, Reorder Point - Refrigeration/Freezing/Seasonal checkboxes - Notes **Smart Features**: - Context-aware messaging (recipe vs supplier) - Auto-closes and auto-selects created ingredient - Tracks creation context (metadata for incomplete items) - Beautiful animations (fadeIn, slideUp, slideDown) - Full validation with error messages - Loading states with spinner 🔧 RECIPES STEP INTEGRATION: - Added "+ Add New Ingredient" option in BOTH dropdowns: * Finished Product selector * Recipe ingredient selectors - On selection → Modal opens - On create → Ingredient auto-selected in form - Handles both finished products (index -1) and ingredients (index N) 🔧 SUPPLIERS STEP INTEGRATION: - Added "+ Add New Product" button in product picker - Below existing product checkboxes - On create → Product auto-selected for supplier - Price entry form appears immediately 📊 UX FLOW COMPARISON: **BEFORE (Blocked)**: ``` User adding recipe → Needs "French Butter" → Not in list → STUCK 🚫 → Must exit recipe form → Go to inventory → Add ingredient → Return to recipes → Lose form context ``` **AFTER (Inline)**: ``` User adding recipe → Needs "French Butter" → Click "+ Add New Ingredient" ⚡ → Modal: Fill 3 fields (10 seconds) → Click "Add and Use in Recipe" → ✅ Created + Auto-selected → Continue recipe seamlessly ``` 🎨 UI/UX FEATURES: - Smooth modal animations - Semi-transparent backdrop (context visible) - Auto-focus on name field - Collapsible optional fields - Info box: "Complete details later in inventory management" - Context-specific CTAs ("Add and Use in Recipe" vs "Add and Associate") - Error handling with icons - Loading states - Cancel button 💾 DATA INTEGRITY: - Tracks creation context in metadata - Marks items as potentially incomplete (needs_review flag) - Future: Dashboard alert for incomplete items - Smart duplicate detection (future enhancement) 📁 FILES: - QuickAddIngredientModal.tsx: NEW (438 lines) - RecipesSetupStep.tsx: +50 lines (modal integration) - SupplierProductManager.tsx: +29 lines (modal integration) Build: ✅ Success (21.10s) Pattern: Follows best practices for inline creation UX: Zero context loss, minimal friction, instant gratification |
||
|
|
2974ff3dbf |
Implement supplier product/price association & unify onboarding UI
MAJOR FEATURES IMPLEMENTED: 1. ✅ CRITICAL: Supplier Product/Price Association - Created SupplierProductManager component (438 lines) - Multi-select product picker from inventory - Price entry with unit of measure and min quantity - Expandable UI per supplier (collapsed by default) - Full CRUD operations via existing API hooks - Required for automatic Purchase Order (PO) creation - Warning shown if supplier has no products 2. ✅ Step Re-Ordering: Inventory Before Suppliers - Manual path: inventory-setup now comes BEFORE suppliers-setup - AI path: Already has inventory from sales data upload - Ensures products exist before supplier association - Critical workflow fix identified by user 3. ✅ UI/UX Unification - Unified badge styles across AI suggestions - Changed hardcoded colors to CSS variables - Consistent rounded-full badge design - Added flex-wrap for responsive badges IMPLEMENTATION DETAILS: SupplierProductManager.tsx (NEW - 438 lines): - useSupplierPriceLists() - Fetch existing products for supplier - useIngredients() - Fetch all available inventory items - useCreate/Update/DeleteSupplierPriceList() mutations - Expandable UI: Collapsed shows count, expanded shows management - Product selection: Checkboxes with inline price forms - Form fields: unit_price (required), unit_of_measure, min_order_quantity - Validation: Price must be > 0, unit required - Warning: Shows if no products added (blocks PO creation) UnifiedOnboardingWizard.tsx: - inventory-setup moved before suppliers-setup - inventory-setup condition: dataSource === 'manual' - suppliers-setup condition: Inventory exists (AI stockEntryCompleted OR manual inventoryCompleted) - Ensures products always exist before supplier association SuppliersSetupStep.tsx: - Added SupplierProductManager import - Changed supplier card layout from flex items-center to block - Integrated ProductManager component into each supplier card - Product management appears below contact info, above edit/delete UploadSalesDataStep.tsx: - Updated badge colors: blue-100/blue-800 → CSS variables - Changed bg-[var(--bg-tertiary)] → bg-[var(--bg-primary)] - Added flex-wrap to badge container - Consistent rounded-full design FLOW IMPROVEMENTS: AI-Assisted Path: Registration → Bakery Type → Data Source → Tenant Setup → Upload Sales → Categorize → Enter Stock → **Suppliers (with products)** → ML Training → Complete Manual Path: Registration → Bakery Type → Data Source → Tenant Setup → **Inventory Setup → Suppliers (with products)** → Recipes → Processes → ML Training → Complete BENEFITS: ✅ Automatic PO creation now possible ✅ System knows supplier-product relationships ✅ Prices tracked for cost analysis ✅ Logical workflow (products before suppliers) ✅ Unified, consistent UI across onboarding ✅ Critical missing feature implemented Build: Successful (21.73s) Files: 4 changed (3 modified, 1 new) Lines: +438 new component, ~50 lines modified |