2025-11-09 09:48:17 +00:00
|
|
|
import React, { useState, useEffect } from 'react';
|
2025-11-09 08:52:10 +00:00
|
|
|
import { WizardStep, WizardStepProps } from '../../../ui/WizardModal/WizardModal';
|
2025-11-09 09:48:17 +00:00
|
|
|
import { ChefHat, Package, ClipboardCheck, CheckCircle2, Loader2, Plus, X, Search } from 'lucide-react';
|
|
|
|
|
import { useTenant } from '../../../../stores/tenant.store';
|
|
|
|
|
import { recipesService } from '../../../../api/services/recipes';
|
|
|
|
|
import { inventoryService } from '../../../../api/services/inventory';
|
2025-11-09 21:40:07 +00:00
|
|
|
import { qualityTemplateService } from '../../../../api/services/qualityTemplates';
|
2025-11-09 09:48:17 +00:00
|
|
|
import { IngredientResponse } from '../../../../api/types/inventory';
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
import { RecipeCreate, RecipeIngredientCreate, MeasurementUnit, RecipeQualityConfiguration, RecipeStatus } from '../../../../api/types/recipes';
|
2025-11-09 21:40:07 +00:00
|
|
|
import { QualityCheckTemplateResponse } from '../../../../api/types/qualityTemplates';
|
2025-11-09 21:22:41 +00:00
|
|
|
import { showToast } from '../../../../utils/toast';
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
import { AdvancedOptionsSection } from '../../../ui/AdvancedOptionsSection';
|
|
|
|
|
import Tooltip from '../../../ui/Tooltip/Tooltip';
|
feat: Add JTBD-driven Unified Add Wizard system
Implemented a comprehensive unified wizard system to consolidate all "add new content"
actions into a single, intuitive, step-by-step guided experience based on Jobs To Be Done
(JTBD) methodology.
## What's New
### Core Components
- **UnifiedAddWizard**: Main orchestrator component that routes to specific wizards
- **ItemTypeSelector**: Beautiful visual card-based selection for 9 content types
- **9 Individual Wizards**: Step-by-step flows for each content type
### Priority Implementations (P0)
1. **SalesEntryWizard** ⭐ (MOST CRITICAL)
- Manual entry with dynamic product lists and auto-calculated totals
- File upload placeholder for CSV/Excel bulk import
- Critical for small bakeries without POS systems
2. **InventoryWizard**
- Type selection (ingredient vs finished product)
- Context-aware forms based on inventory type
- Optional initial lot entry
### Placeholder Wizards (P1/P2)
- Customer Order, Supplier, Recipe, Customer, Quality Template, Equipment, Team Member
- Proper structure in place for incremental enhancement
### Dashboard Integration
- Added prominent "Agregar" button in dashboard header
- Opens wizard modal with visual type selection
- Auto-refreshes dashboard after wizard completion
### Design Highlights
- Mobile-first responsive design (full-screen on mobile, modal on desktop)
- Touch-friendly with 44px+ touch targets
- Follows existing color system and design tokens
- Progressive disclosure to reduce cognitive load
- Accessibility-compliant (WCAG AA)
## Documentation
Created comprehensive documentation:
- `JTBD_UNIFIED_ADD_WIZARD.md` - Full JTBD analysis and research
- `WIZARD_ARCHITECTURE_DESIGN.md` - Technical design and specifications
- `UNIFIED_WIZARD_IMPLEMENTATION_SUMMARY.md` - Implementation guide
## Files Changed
- New: `frontend/src/components/domain/unified-wizard/` (15 new files)
- Modified: `frontend/src/pages/app/DashboardPage.tsx` (added wizard integration)
## Next Steps
- [ ] Connect wizards to real API endpoints (currently mock/placeholder)
- [ ] Implement full CSV upload for sales entry
- [ ] Add comprehensive form validation
- [ ] Enhance P1 priority wizards based on user feedback
## JTBD Alignment
Main Job: "When I need to expand or update my bakery operations, I want to quickly add
new resources to my management system, so I can keep my business running smoothly."
Key insights applied:
- Prioritized sales entry (most bakeries lack POS)
- Mobile-first (bakery owners are on their feet)
- Progressive disclosure (reduce overwhelm)
- Forgiving interactions (can go back, save drafts)
2025-11-09 08:40:01 +00:00
|
|
|
|
2025-11-09 08:52:10 +00:00
|
|
|
interface WizardDataProps extends WizardStepProps {
|
|
|
|
|
data: Record<string, any>;
|
|
|
|
|
onDataChange: (data: Record<string, any>) => void;
|
|
|
|
|
}
|
|
|
|
|
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
const RecipeDetailsStep: React.FC<WizardDataProps> = ({ data, onDataChange }) => {
|
2025-11-09 09:48:17 +00:00
|
|
|
const { currentTenant } = useTenant();
|
2025-11-09 08:52:10 +00:00
|
|
|
const [recipeData, setRecipeData] = useState({
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
// Required fields
|
2025-11-09 08:52:10 +00:00
|
|
|
name: data.name || '',
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
finishedProductId: data.finishedProductId || '',
|
2025-11-09 09:48:17 +00:00
|
|
|
yieldQuantity: data.yieldQuantity || '',
|
|
|
|
|
yieldUnit: data.yieldUnit || 'units',
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
|
|
|
|
|
// Optional basic fields
|
|
|
|
|
category: data.category || 'bread',
|
2025-11-09 09:48:17 +00:00
|
|
|
prepTime: data.prepTime || '',
|
2025-11-09 08:52:10 +00:00
|
|
|
instructions: data.instructions || '',
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
|
|
|
|
|
// Advanced optional fields
|
|
|
|
|
recipeCode: data.recipeCode || '',
|
|
|
|
|
version: data.version || '1.0',
|
|
|
|
|
difficultyLevel: data.difficultyLevel || 3,
|
|
|
|
|
cookTime: data.cookTime || '',
|
|
|
|
|
restTime: data.restTime || '',
|
|
|
|
|
totalTime: data.totalTime || '',
|
|
|
|
|
description: data.description || '',
|
|
|
|
|
preparationNotes: data.preparationNotes || '',
|
|
|
|
|
storageInstructions: data.storageInstructions || '',
|
|
|
|
|
servesCount: data.servesCount || '',
|
|
|
|
|
batchSizeMultiplier: data.batchSizeMultiplier || 1.0,
|
|
|
|
|
minBatchSize: data.minBatchSize || '',
|
|
|
|
|
maxBatchSize: data.maxBatchSize || '',
|
|
|
|
|
optimalProductionTemp: data.optimalProductionTemp || '',
|
|
|
|
|
optimalHumidity: data.optimalHumidity || '',
|
|
|
|
|
isSeasonal: data.isSeasonal || false,
|
|
|
|
|
isSignatureItem: data.isSignatureItem || false,
|
|
|
|
|
seasonStartMonth: data.seasonStartMonth || '',
|
|
|
|
|
seasonEndMonth: data.seasonEndMonth || '',
|
|
|
|
|
allergens: data.allergens || '',
|
|
|
|
|
dietaryTags: data.dietaryTags || '',
|
|
|
|
|
targetMargin: data.targetMargin || '',
|
2025-11-09 08:52:10 +00:00
|
|
|
});
|
2025-11-09 09:48:17 +00:00
|
|
|
const [finishedProducts, setFinishedProducts] = useState<IngredientResponse[]>([]);
|
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchFinishedProducts();
|
|
|
|
|
}, []);
|
|
|
|
|
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
onDataChange({ ...data, ...recipeData });
|
|
|
|
|
}, [recipeData]);
|
|
|
|
|
|
2025-11-09 09:48:17 +00:00
|
|
|
const fetchFinishedProducts = async () => {
|
|
|
|
|
if (!currentTenant?.id) return;
|
|
|
|
|
setLoading(true);
|
|
|
|
|
try {
|
|
|
|
|
const result = await inventoryService.getIngredients(currentTenant.id, {
|
|
|
|
|
category: 'finished_product'
|
|
|
|
|
});
|
|
|
|
|
setFinishedProducts(result);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Error loading finished products:', err);
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-11-09 08:52:10 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-6">
|
|
|
|
|
<div className="text-center pb-4 border-b border-[var(--border-primary)]">
|
|
|
|
|
<ChefHat className="w-12 h-12 mx-auto mb-3 text-[var(--color-primary)]" />
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<h3 className="text-lg font-semibold text-[var(--text-primary)] mb-2">Recipe Details</h3>
|
|
|
|
|
<p className="text-sm text-[var(--text-secondary)]">Essential information about your recipe</p>
|
feat: Add JTBD-driven Unified Add Wizard system
Implemented a comprehensive unified wizard system to consolidate all "add new content"
actions into a single, intuitive, step-by-step guided experience based on Jobs To Be Done
(JTBD) methodology.
## What's New
### Core Components
- **UnifiedAddWizard**: Main orchestrator component that routes to specific wizards
- **ItemTypeSelector**: Beautiful visual card-based selection for 9 content types
- **9 Individual Wizards**: Step-by-step flows for each content type
### Priority Implementations (P0)
1. **SalesEntryWizard** ⭐ (MOST CRITICAL)
- Manual entry with dynamic product lists and auto-calculated totals
- File upload placeholder for CSV/Excel bulk import
- Critical for small bakeries without POS systems
2. **InventoryWizard**
- Type selection (ingredient vs finished product)
- Context-aware forms based on inventory type
- Optional initial lot entry
### Placeholder Wizards (P1/P2)
- Customer Order, Supplier, Recipe, Customer, Quality Template, Equipment, Team Member
- Proper structure in place for incremental enhancement
### Dashboard Integration
- Added prominent "Agregar" button in dashboard header
- Opens wizard modal with visual type selection
- Auto-refreshes dashboard after wizard completion
### Design Highlights
- Mobile-first responsive design (full-screen on mobile, modal on desktop)
- Touch-friendly with 44px+ touch targets
- Follows existing color system and design tokens
- Progressive disclosure to reduce cognitive load
- Accessibility-compliant (WCAG AA)
## Documentation
Created comprehensive documentation:
- `JTBD_UNIFIED_ADD_WIZARD.md` - Full JTBD analysis and research
- `WIZARD_ARCHITECTURE_DESIGN.md` - Technical design and specifications
- `UNIFIED_WIZARD_IMPLEMENTATION_SUMMARY.md` - Implementation guide
## Files Changed
- New: `frontend/src/components/domain/unified-wizard/` (15 new files)
- Modified: `frontend/src/pages/app/DashboardPage.tsx` (added wizard integration)
## Next Steps
- [ ] Connect wizards to real API endpoints (currently mock/placeholder)
- [ ] Implement full CSV upload for sales entry
- [ ] Add comprehensive form validation
- [ ] Enhance P1 priority wizards based on user feedback
## JTBD Alignment
Main Job: "When I need to expand or update my bakery operations, I want to quickly add
new resources to my management system, so I can keep my business running smoothly."
Key insights applied:
- Prioritized sales entry (most bakeries lack POS)
- Mobile-first (bakery owners are on their feet)
- Progressive disclosure (reduce overwhelm)
- Forgiving interactions (can go back, save drafts)
2025-11-09 08:40:01 +00:00
|
|
|
</div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
|
|
|
|
|
{/* Required Fields */}
|
|
|
|
|
<div className="space-y-4">
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Recipe Name *
|
|
|
|
|
</label>
|
2025-11-09 09:48:17 +00:00
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
value={recipeData.name}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, name: e.target.value })}
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
placeholder="e.g., Traditional Baguette"
|
2025-11-09 21:25:36 +00:00
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
2025-11-09 09:48:17 +00:00
|
|
|
/>
|
2025-11-09 08:52:10 +00:00
|
|
|
</div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Category *
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
|
|
|
|
value={recipeData.category}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, category: e.target.value })}
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
>
|
|
|
|
|
<option value="bread">Bread</option>
|
|
|
|
|
<option value="pastries">Pastries</option>
|
|
|
|
|
<option value="cakes">Cakes</option>
|
|
|
|
|
<option value="cookies">Cookies</option>
|
|
|
|
|
<option value="muffins">Muffins</option>
|
|
|
|
|
<option value="sandwiches">Sandwiches</option>
|
|
|
|
|
<option value="seasonal">Seasonal</option>
|
|
|
|
|
<option value="other">Other</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2 inline-flex items-center gap-2">
|
|
|
|
|
Finished Product *
|
|
|
|
|
<Tooltip content="The final product this recipe produces. Must be created in inventory first.">
|
|
|
|
|
<span />
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
|
|
|
|
value={recipeData.finishedProductId}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, finishedProductId: e.target.value })}
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
disabled={loading}
|
|
|
|
|
>
|
|
|
|
|
<option value="">Select product...</option>
|
|
|
|
|
{finishedProducts.map(product => (
|
|
|
|
|
<option key={product.id} value={product.id}>{product.name}</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Yield Quantity *
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.yieldQuantity}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, yieldQuantity: e.target.value })}
|
|
|
|
|
placeholder="12"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
min="0.01"
|
|
|
|
|
step="0.01"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Yield Unit *
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
|
|
|
|
value={recipeData.yieldUnit}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, yieldUnit: e.target.value })}
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
>
|
|
|
|
|
<option value="units">Units</option>
|
|
|
|
|
<option value="pieces">Pieces</option>
|
|
|
|
|
<option value="kg">Kilograms (kg)</option>
|
|
|
|
|
<option value="g">Grams (g)</option>
|
|
|
|
|
<option value="l">Liters (l)</option>
|
|
|
|
|
<option value="ml">Milliliters (ml)</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-11-09 08:52:10 +00:00
|
|
|
<div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Preparation Time (minutes)
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.prepTime}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, prepTime: e.target.value })}
|
|
|
|
|
placeholder="60"
|
2025-11-09 21:25:36 +00:00
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
min="0"
|
|
|
|
|
/>
|
2025-11-09 09:48:17 +00:00
|
|
|
</div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
|
2025-11-09 09:48:17 +00:00
|
|
|
<div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Instructions
|
|
|
|
|
</label>
|
|
|
|
|
<textarea
|
|
|
|
|
value={recipeData.instructions}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, instructions: e.target.value })}
|
|
|
|
|
placeholder="Step-by-step preparation instructions..."
|
2025-11-09 21:25:36 +00:00
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
rows={4}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Advanced Options */}
|
|
|
|
|
<AdvancedOptionsSection
|
|
|
|
|
title="Advanced Options"
|
|
|
|
|
description="Optional fields for detailed recipe management"
|
|
|
|
|
>
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Recipe Code/SKU
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
value={recipeData.recipeCode}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, recipeCode: e.target.value })}
|
|
|
|
|
placeholder="RCP-001"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Version
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
value={recipeData.version}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, version: e.target.value })}
|
|
|
|
|
placeholder="1.0"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2 inline-flex items-center gap-2">
|
|
|
|
|
Difficulty Level (1-5)
|
|
|
|
|
<Tooltip content="1 = Very Easy, 5 = Expert Level">
|
|
|
|
|
<span />
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.difficultyLevel}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, difficultyLevel: parseInt(e.target.value) || 1 })}
|
|
|
|
|
min="1"
|
|
|
|
|
max="5"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Cook Time (minutes)
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.cookTime}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, cookTime: e.target.value })}
|
|
|
|
|
placeholder="30"
|
|
|
|
|
min="0"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2 inline-flex items-center gap-2">
|
|
|
|
|
Rest Time (minutes)
|
|
|
|
|
<Tooltip content="Time for rising, cooling, or resting">
|
|
|
|
|
<span />
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.restTime}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, restTime: e.target.value })}
|
|
|
|
|
placeholder="60"
|
|
|
|
|
min="0"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Total Time (minutes)
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.totalTime}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, totalTime: e.target.value })}
|
|
|
|
|
placeholder="90"
|
|
|
|
|
min="0"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Serves Count
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.servesCount}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, servesCount: e.target.value })}
|
|
|
|
|
placeholder="8"
|
|
|
|
|
min="0"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2 inline-flex items-center gap-2">
|
|
|
|
|
Batch Size Multiplier
|
|
|
|
|
<Tooltip content="Default scaling factor for batch production">
|
|
|
|
|
<span />
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.batchSizeMultiplier}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, batchSizeMultiplier: parseFloat(e.target.value) || 1 })}
|
|
|
|
|
placeholder="1.0"
|
|
|
|
|
min="0.1"
|
|
|
|
|
step="0.1"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Min Batch Size
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.minBatchSize}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, minBatchSize: e.target.value })}
|
|
|
|
|
placeholder="5"
|
|
|
|
|
min="0"
|
|
|
|
|
step="0.1"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Max Batch Size
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.maxBatchSize}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, maxBatchSize: e.target.value })}
|
|
|
|
|
placeholder="100"
|
|
|
|
|
min="0"
|
|
|
|
|
step="0.1"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Optimal Production Temp (°C)
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.optimalProductionTemp}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, optimalProductionTemp: e.target.value })}
|
|
|
|
|
placeholder="24"
|
|
|
|
|
step="0.1"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Optimal Humidity (%)
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.optimalHumidity}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, optimalHumidity: e.target.value })}
|
|
|
|
|
placeholder="65"
|
|
|
|
|
min="0"
|
|
|
|
|
max="100"
|
|
|
|
|
step="0.1"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Target Margin (%)
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={recipeData.targetMargin}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, targetMargin: e.target.value })}
|
|
|
|
|
placeholder="30"
|
|
|
|
|
min="0"
|
|
|
|
|
max="100"
|
|
|
|
|
step="0.1"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2025-11-09 08:52:10 +00:00
|
|
|
</div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
id="isSeasonal"
|
|
|
|
|
checked={recipeData.isSeasonal}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, isSeasonal: e.target.checked })}
|
|
|
|
|
className="w-4 h-4 text-[var(--color-primary)] border-[var(--border-secondary)] rounded focus:ring-2 focus:ring-[var(--color-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
<label htmlFor="isSeasonal" className="text-sm font-medium text-[var(--text-secondary)]">
|
|
|
|
|
Seasonal Item
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
id="isSignatureItem"
|
|
|
|
|
checked={recipeData.isSignatureItem}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, isSignatureItem: e.target.checked })}
|
|
|
|
|
className="w-4 h-4 text-[var(--color-primary)] border-[var(--border-secondary)] rounded focus:ring-2 focus:ring-[var(--color-primary)]"
|
|
|
|
|
/>
|
|
|
|
|
<label htmlFor="isSignatureItem" className="text-sm font-medium text-[var(--text-secondary)]">
|
|
|
|
|
Signature Item
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{recipeData.isSeasonal && (
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Season Start Month
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
|
|
|
|
value={recipeData.seasonStartMonth}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, seasonStartMonth: e.target.value })}
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
>
|
|
|
|
|
<option value="">Select month...</option>
|
|
|
|
|
{Array.from({ length: 12 }, (_, i) => i + 1).map(month => (
|
|
|
|
|
<option key={month} value={month}>
|
|
|
|
|
{new Date(2000, month - 1).toLocaleString('default', { month: 'long' })}
|
|
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Season End Month
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
|
|
|
|
value={recipeData.seasonEndMonth}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, seasonEndMonth: e.target.value })}
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
>
|
|
|
|
|
<option value="">Select month...</option>
|
|
|
|
|
{Array.from({ length: 12 }, (_, i) => i + 1).map(month => (
|
|
|
|
|
<option key={month} value={month}>
|
|
|
|
|
{new Date(2000, month - 1).toLocaleString('default', { month: 'long' })}
|
|
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
2025-11-09 08:52:10 +00:00
|
|
|
<div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Description
|
|
|
|
|
</label>
|
|
|
|
|
<textarea
|
|
|
|
|
value={recipeData.description}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, description: e.target.value })}
|
|
|
|
|
placeholder="Detailed description of the recipe..."
|
2025-11-09 21:25:36 +00:00
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
rows={3}
|
2025-11-09 09:48:17 +00:00
|
|
|
/>
|
|
|
|
|
</div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
|
2025-11-09 09:48:17 +00:00
|
|
|
<div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Preparation Notes
|
|
|
|
|
</label>
|
|
|
|
|
<textarea
|
|
|
|
|
value={recipeData.preparationNotes}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, preparationNotes: e.target.value })}
|
|
|
|
|
placeholder="Tips and notes for preparation..."
|
2025-11-09 21:25:36 +00:00
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
rows={3}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Storage Instructions
|
|
|
|
|
</label>
|
|
|
|
|
<textarea
|
|
|
|
|
value={recipeData.storageInstructions}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, storageInstructions: e.target.value })}
|
|
|
|
|
placeholder="How to store the finished product..."
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
|
|
|
|
rows={3}
|
|
|
|
|
/>
|
2025-11-09 09:48:17 +00:00
|
|
|
</div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
|
2025-11-09 09:48:17 +00:00
|
|
|
<div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Allergens
|
|
|
|
|
</label>
|
2025-11-09 09:48:17 +00:00
|
|
|
<input
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
type="text"
|
|
|
|
|
value={recipeData.allergens}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, allergens: e.target.value })}
|
|
|
|
|
placeholder="e.g., gluten, dairy, eggs (comma-separated)"
|
2025-11-09 21:25:36 +00:00
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
2025-11-09 09:48:17 +00:00
|
|
|
/>
|
|
|
|
|
</div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
|
|
|
|
Dietary Tags
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
value={recipeData.dietaryTags}
|
|
|
|
|
onChange={(e) => setRecipeData({ ...recipeData, dietaryTags: e.target.value })}
|
|
|
|
|
placeholder="e.g., vegan, gluten-free, organic (comma-separated)"
|
2025-11-09 21:25:36 +00:00
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
2025-11-09 09:48:17 +00:00
|
|
|
/>
|
2025-11-09 08:52:10 +00:00
|
|
|
</div>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
</AdvancedOptionsSection>
|
2025-11-09 08:52:10 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 09:48:17 +00:00
|
|
|
interface SelectedIngredient {
|
|
|
|
|
id: string;
|
|
|
|
|
ingredientId: string;
|
|
|
|
|
quantity: number;
|
|
|
|
|
unit: MeasurementUnit;
|
|
|
|
|
notes: string;
|
|
|
|
|
order: number;
|
|
|
|
|
}
|
|
|
|
|
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
const IngredientsStep: React.FC<WizardDataProps> = ({ data, onDataChange }) => {
|
2025-11-09 09:48:17 +00:00
|
|
|
const { currentTenant } = useTenant();
|
|
|
|
|
const [ingredients, setIngredients] = useState<IngredientResponse[]>([]);
|
|
|
|
|
const [selectedIngredients, setSelectedIngredients] = useState<SelectedIngredient[]>(data.ingredients || []);
|
|
|
|
|
const [loading, setLoading] = useState(true);
|
|
|
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
|
const [searchTerm, setSearchTerm] = useState('');
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchIngredients();
|
|
|
|
|
}, []);
|
|
|
|
|
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
onDataChange({ ...data, ingredients: selectedIngredients });
|
|
|
|
|
}, [selectedIngredients]);
|
|
|
|
|
|
2025-11-09 09:48:17 +00:00
|
|
|
const fetchIngredients = async () => {
|
|
|
|
|
if (!currentTenant?.id) return;
|
|
|
|
|
setLoading(true);
|
|
|
|
|
try {
|
|
|
|
|
const result = await inventoryService.getIngredients(currentTenant.id);
|
|
|
|
|
const rawIngredients = result.filter(ing => ing.category !== 'finished_product');
|
|
|
|
|
setIngredients(rawIngredients);
|
|
|
|
|
} catch (err) {
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
setError('Error loading ingredients');
|
2025-11-09 09:48:17 +00:00
|
|
|
console.error('Error loading ingredients:', err);
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleAddIngredient = () => {
|
|
|
|
|
const newIngredient: SelectedIngredient = {
|
|
|
|
|
id: Date.now().toString(),
|
|
|
|
|
ingredientId: '',
|
|
|
|
|
quantity: 0,
|
|
|
|
|
unit: MeasurementUnit.GRAMS,
|
|
|
|
|
notes: '',
|
|
|
|
|
order: selectedIngredients.length + 1,
|
|
|
|
|
};
|
|
|
|
|
setSelectedIngredients([...selectedIngredients, newIngredient]);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleUpdateIngredient = (id: string, field: keyof SelectedIngredient, value: any) => {
|
|
|
|
|
setSelectedIngredients(
|
|
|
|
|
selectedIngredients.map(ing =>
|
|
|
|
|
ing.id === id ? { ...ing, [field]: value } : ing
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleRemoveIngredient = (id: string) => {
|
|
|
|
|
setSelectedIngredients(selectedIngredients.filter(ing => ing.id !== id));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const filteredIngredients = ingredients.filter(ing =>
|
|
|
|
|
ing.name.toLowerCase().includes(searchTerm.toLowerCase())
|
|
|
|
|
);
|
|
|
|
|
|
2025-11-09 08:52:10 +00:00
|
|
|
return (
|
|
|
|
|
<div className="space-y-6">
|
|
|
|
|
<div className="text-center pb-4 border-b border-[var(--border-primary)]">
|
|
|
|
|
<Package className="w-12 h-12 mx-auto mb-3 text-[var(--color-primary)]" />
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<h3 className="text-lg font-semibold text-[var(--text-primary)] mb-2">Ingredients</h3>
|
2025-11-09 08:52:10 +00:00
|
|
|
<p className="text-sm text-[var(--text-secondary)]">{data.name}</p>
|
feat: Add JTBD-driven Unified Add Wizard system
Implemented a comprehensive unified wizard system to consolidate all "add new content"
actions into a single, intuitive, step-by-step guided experience based on Jobs To Be Done
(JTBD) methodology.
## What's New
### Core Components
- **UnifiedAddWizard**: Main orchestrator component that routes to specific wizards
- **ItemTypeSelector**: Beautiful visual card-based selection for 9 content types
- **9 Individual Wizards**: Step-by-step flows for each content type
### Priority Implementations (P0)
1. **SalesEntryWizard** ⭐ (MOST CRITICAL)
- Manual entry with dynamic product lists and auto-calculated totals
- File upload placeholder for CSV/Excel bulk import
- Critical for small bakeries without POS systems
2. **InventoryWizard**
- Type selection (ingredient vs finished product)
- Context-aware forms based on inventory type
- Optional initial lot entry
### Placeholder Wizards (P1/P2)
- Customer Order, Supplier, Recipe, Customer, Quality Template, Equipment, Team Member
- Proper structure in place for incremental enhancement
### Dashboard Integration
- Added prominent "Agregar" button in dashboard header
- Opens wizard modal with visual type selection
- Auto-refreshes dashboard after wizard completion
### Design Highlights
- Mobile-first responsive design (full-screen on mobile, modal on desktop)
- Touch-friendly with 44px+ touch targets
- Follows existing color system and design tokens
- Progressive disclosure to reduce cognitive load
- Accessibility-compliant (WCAG AA)
## Documentation
Created comprehensive documentation:
- `JTBD_UNIFIED_ADD_WIZARD.md` - Full JTBD analysis and research
- `WIZARD_ARCHITECTURE_DESIGN.md` - Technical design and specifications
- `UNIFIED_WIZARD_IMPLEMENTATION_SUMMARY.md` - Implementation guide
## Files Changed
- New: `frontend/src/components/domain/unified-wizard/` (15 new files)
- Modified: `frontend/src/pages/app/DashboardPage.tsx` (added wizard integration)
## Next Steps
- [ ] Connect wizards to real API endpoints (currently mock/placeholder)
- [ ] Implement full CSV upload for sales entry
- [ ] Add comprehensive form validation
- [ ] Enhance P1 priority wizards based on user feedback
## JTBD Alignment
Main Job: "When I need to expand or update my bakery operations, I want to quickly add
new resources to my management system, so I can keep my business running smoothly."
Key insights applied:
- Prioritized sales entry (most bakeries lack POS)
- Mobile-first (bakery owners are on their feet)
- Progressive disclosure (reduce overwhelm)
- Forgiving interactions (can go back, save drafts)
2025-11-09 08:40:01 +00:00
|
|
|
</div>
|
2025-11-09 09:48:17 +00:00
|
|
|
|
|
|
|
|
{error && (
|
|
|
|
|
<div className="p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm">
|
|
|
|
|
{error}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{loading ? (
|
|
|
|
|
<div className="flex items-center justify-center py-12">
|
|
|
|
|
<Loader2 className="w-8 h-8 animate-spin text-[var(--color-primary)]" />
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<span className="ml-3 text-[var(--text-secondary)]">Loading ingredients...</span>
|
2025-11-09 09:48:17 +00:00
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<div className="space-y-4">
|
|
|
|
|
{selectedIngredients.length === 0 ? (
|
|
|
|
|
<div className="text-center py-8 border-2 border-dashed border-[var(--border-secondary)] rounded-lg">
|
|
|
|
|
<Package className="w-12 h-12 mx-auto mb-3 text-[var(--text-tertiary)]" />
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<p className="text-[var(--text-secondary)] mb-2">No ingredients added</p>
|
|
|
|
|
<p className="text-sm text-[var(--text-tertiary)]">Click "Add Ingredient" to begin</p>
|
2025-11-09 09:48:17 +00:00
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
selectedIngredients.map((selectedIng) => (
|
|
|
|
|
<div key={selectedIng.id} className="p-4 border border-[var(--border-secondary)] rounded-lg bg-[var(--bg-secondary)]">
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-12 gap-3 items-start">
|
|
|
|
|
<div className="md:col-span-5">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<label className="block text-xs font-medium text-[var(--text-secondary)] mb-1">Ingredient *</label>
|
2025-11-09 09:48:17 +00:00
|
|
|
<div className="relative">
|
|
|
|
|
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-[var(--text-tertiary)]" />
|
|
|
|
|
<select
|
|
|
|
|
value={selectedIng.ingredientId}
|
|
|
|
|
onChange={(e) => handleUpdateIngredient(selectedIng.id, 'ingredientId', e.target.value)}
|
|
|
|
|
className="w-full pl-9 pr-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] text-sm"
|
|
|
|
|
>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<option value="">Select...</option>
|
2025-11-09 09:48:17 +00:00
|
|
|
{filteredIngredients.map(ing => (
|
|
|
|
|
<option key={ing.id} value={ing.id}>
|
|
|
|
|
{ing.name} {ing.category ? `(${ing.category})` : ''}
|
|
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="md:col-span-2">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<label className="block text-xs font-medium text-[var(--text-secondary)] mb-1">Quantity *</label>
|
2025-11-09 09:48:17 +00:00
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
value={selectedIng.quantity || ''}
|
|
|
|
|
onChange={(e) => handleUpdateIngredient(selectedIng.id, 'quantity', parseFloat(e.target.value) || 0)}
|
|
|
|
|
placeholder="0"
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] text-sm"
|
|
|
|
|
min="0"
|
|
|
|
|
step="0.01"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="md:col-span-2">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<label className="block text-xs font-medium text-[var(--text-secondary)] mb-1">Unit *</label>
|
2025-11-09 09:48:17 +00:00
|
|
|
<select
|
|
|
|
|
value={selectedIng.unit}
|
|
|
|
|
onChange={(e) => handleUpdateIngredient(selectedIng.id, 'unit', e.target.value as MeasurementUnit)}
|
|
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] text-sm"
|
|
|
|
|
>
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<option value={MeasurementUnit.GRAMS}>Grams (g)</option>
|
|
|
|
|
<option value={MeasurementUnit.KILOGRAMS}>Kilograms (kg)</option>
|
|
|
|
|
<option value={MeasurementUnit.MILLILITERS}>Milliliters (ml)</option>
|
|
|
|
|
<option value={MeasurementUnit.LITERS}>Liters (l)</option>
|
|
|
|
|
<option value={MeasurementUnit.UNITS}>Units</option>
|
|
|
|
|
<option value={MeasurementUnit.PIECES}>Pieces</option>
|
|
|
|
|
<option value={MeasurementUnit.CUPS}>Cups</option>
|
|
|
|
|
<option value={MeasurementUnit.TABLESPOONS}>Tablespoons</option>
|
|
|
|
|
<option value={MeasurementUnit.TEASPOONS}>Teaspoons</option>
|
2025-11-09 09:48:17 +00:00
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="md:col-span-2">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<label className="block text-xs font-medium text-[var(--text-secondary)] mb-1">Notes</label>
|
2025-11-09 09:48:17 +00:00
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
value={selectedIng.notes}
|
|
|
|
|
onChange={(e) => handleUpdateIngredient(selectedIng.id, 'notes', e.target.value)}
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
placeholder="Optional"
|
2025-11-09 09:48:17 +00:00
|
|
|
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] text-sm"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="md:col-span-1 flex items-end">
|
|
|
|
|
<button
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
type="button"
|
2025-11-09 09:48:17 +00:00
|
|
|
onClick={() => handleRemoveIngredient(selectedIng.id)}
|
|
|
|
|
className="p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors"
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
title="Remove ingredient"
|
2025-11-09 09:48:17 +00:00
|
|
|
>
|
|
|
|
|
<X className="w-5 h-5" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
))
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
type="button"
|
2025-11-09 09:48:17 +00:00
|
|
|
onClick={handleAddIngredient}
|
|
|
|
|
className="w-full py-3 border-2 border-dashed border-[var(--border-secondary)] rounded-lg text-[var(--text-secondary)] hover:border-[var(--color-primary)] hover:text-[var(--color-primary)] transition-colors inline-flex items-center justify-center gap-2"
|
|
|
|
|
>
|
|
|
|
|
<Plus className="w-5 h-5" />
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
Add Ingredient
|
2025-11-09 09:48:17 +00:00
|
|
|
</button>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
2025-11-09 21:40:07 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const QualityTemplatesStep: React.FC<WizardDataProps> = ({ data, onDataChange, onComplete }) => {
|
|
|
|
|
const { currentTenant } = useTenant();
|
|
|
|
|
const [templates, setTemplates] = useState<QualityCheckTemplateResponse[]>([]);
|
|
|
|
|
const [selectedTemplateIds, setSelectedTemplateIds] = useState<string[]>(data.selectedTemplates || []);
|
|
|
|
|
const [loading, setLoading] = useState(true);
|
|
|
|
|
const [saving, setSaving] = useState(false);
|
|
|
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchTemplates();
|
|
|
|
|
}, []);
|
|
|
|
|
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
onDataChange({ ...data, selectedTemplates: selectedTemplateIds });
|
|
|
|
|
}, [selectedTemplateIds]);
|
|
|
|
|
|
2025-11-09 21:40:07 +00:00
|
|
|
const fetchTemplates = async () => {
|
|
|
|
|
if (!currentTenant?.id) return;
|
|
|
|
|
setLoading(true);
|
|
|
|
|
try {
|
|
|
|
|
const result = await qualityTemplateService.getTemplates(currentTenant.id, { is_active: true });
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
setTemplates(result.templates || []);
|
2025-11-09 21:40:07 +00:00
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Error loading quality templates:', err);
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
setError('Error loading quality templates');
|
2025-11-09 21:40:07 +00:00
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const toggleTemplate = (templateId: string) => {
|
|
|
|
|
setSelectedTemplateIds(prev =>
|
|
|
|
|
prev.includes(templateId)
|
|
|
|
|
? prev.filter(id => id !== templateId)
|
|
|
|
|
: [...prev, templateId]
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleCreateRecipe = async () => {
|
|
|
|
|
if (!currentTenant?.id) {
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
setError('Could not obtain tenant information');
|
2025-11-09 21:40:07 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setSaving(true);
|
|
|
|
|
setError(null);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const recipeIngredients: RecipeIngredientCreate[] = data.ingredients.map((ing: any, index: number) => ({
|
|
|
|
|
ingredient_id: ing.ingredientId,
|
|
|
|
|
quantity: ing.quantity,
|
|
|
|
|
unit: ing.unit,
|
|
|
|
|
ingredient_notes: ing.notes || null,
|
|
|
|
|
is_optional: false,
|
|
|
|
|
ingredient_order: index + 1,
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
let qualityConfig: RecipeQualityConfiguration | undefined;
|
|
|
|
|
if (selectedTemplateIds.length > 0) {
|
|
|
|
|
qualityConfig = {
|
|
|
|
|
stages: {
|
|
|
|
|
production: {
|
|
|
|
|
template_ids: selectedTemplateIds,
|
|
|
|
|
required_checks: [],
|
|
|
|
|
optional_checks: [],
|
|
|
|
|
blocking_on_failure: true,
|
|
|
|
|
min_quality_score: 7.0,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
overall_quality_threshold: 7.0,
|
|
|
|
|
critical_stage_blocking: true,
|
|
|
|
|
auto_create_quality_checks: true,
|
|
|
|
|
quality_manager_approval_required: false,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const recipeData: RecipeCreate = {
|
|
|
|
|
name: data.name,
|
|
|
|
|
category: data.category,
|
|
|
|
|
finished_product_id: data.finishedProductId,
|
|
|
|
|
yield_quantity: parseFloat(data.yieldQuantity),
|
|
|
|
|
yield_unit: data.yieldUnit as MeasurementUnit,
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
version: data.version || '1.0',
|
|
|
|
|
difficulty_level: data.difficultyLevel || 3,
|
2025-11-09 21:40:07 +00:00
|
|
|
prep_time_minutes: data.prepTime ? parseInt(data.prepTime) : null,
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
cook_time_minutes: data.cookTime ? parseInt(data.cookTime) : null,
|
|
|
|
|
rest_time_minutes: data.restTime ? parseInt(data.restTime) : null,
|
|
|
|
|
total_time_minutes: data.totalTime ? parseInt(data.totalTime) : null,
|
|
|
|
|
recipe_code: data.recipeCode || null,
|
|
|
|
|
description: data.description || null,
|
|
|
|
|
preparation_notes: data.preparationNotes || null,
|
|
|
|
|
storage_instructions: data.storageInstructions || null,
|
|
|
|
|
serves_count: data.servesCount ? parseInt(data.servesCount) : null,
|
|
|
|
|
batch_size_multiplier: data.batchSizeMultiplier || 1.0,
|
|
|
|
|
minimum_batch_size: data.minBatchSize ? parseFloat(data.minBatchSize) : null,
|
|
|
|
|
maximum_batch_size: data.maxBatchSize ? parseFloat(data.maxBatchSize) : null,
|
|
|
|
|
optimal_production_temperature: data.optimalProductionTemp ? parseFloat(data.optimalProductionTemp) : null,
|
|
|
|
|
optimal_humidity: data.optimalHumidity ? parseFloat(data.optimalHumidity) : null,
|
|
|
|
|
target_margin_percentage: data.targetMargin ? parseFloat(data.targetMargin) : null,
|
|
|
|
|
is_seasonal: data.isSeasonal || false,
|
|
|
|
|
is_signature_item: data.isSignatureItem || false,
|
|
|
|
|
season_start_month: data.seasonStartMonth ? parseInt(data.seasonStartMonth) : null,
|
|
|
|
|
season_end_month: data.seasonEndMonth ? parseInt(data.seasonEndMonth) : null,
|
2025-11-09 21:40:07 +00:00
|
|
|
instructions: data.instructions ? { steps: data.instructions } : null,
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
allergen_info: data.allergens ? data.allergens.split(',').map((a: string) => a.trim()) : null,
|
|
|
|
|
dietary_tags: data.dietaryTags ? data.dietaryTags.split(',').map((t: string) => t.trim()) : null,
|
2025-11-09 21:40:07 +00:00
|
|
|
ingredients: recipeIngredients,
|
|
|
|
|
quality_check_configuration: qualityConfig,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await recipesService.createRecipe(currentTenant.id, recipeData);
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
showToast.success('Recipe created successfully');
|
2025-11-09 21:40:07 +00:00
|
|
|
onComplete();
|
|
|
|
|
} catch (err: any) {
|
|
|
|
|
console.error('Error creating recipe:', err);
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
const errorMessage = err.response?.data?.detail || 'Error creating recipe';
|
2025-11-09 21:40:07 +00:00
|
|
|
setError(errorMessage);
|
|
|
|
|
showToast.error(errorMessage);
|
|
|
|
|
} finally {
|
|
|
|
|
setSaving(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-6">
|
|
|
|
|
<div className="text-center pb-4 border-b border-[var(--border-primary)]">
|
|
|
|
|
<ClipboardCheck className="w-12 h-12 mx-auto mb-3 text-[var(--color-primary)]" />
|
|
|
|
|
<h3 className="text-lg font-semibold text-[var(--text-primary)] mb-2">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
Quality Templates (Optional)
|
2025-11-09 21:40:07 +00:00
|
|
|
</h3>
|
|
|
|
|
<p className="text-sm text-[var(--text-secondary)]">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
Select quality control templates to apply to this recipe
|
2025-11-09 21:40:07 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{error && (
|
|
|
|
|
<div className="p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm">
|
|
|
|
|
{error}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{loading ? (
|
|
|
|
|
<div className="flex items-center justify-center py-12">
|
|
|
|
|
<Loader2 className="w-8 h-8 animate-spin text-[var(--color-primary)]" />
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<span className="ml-3 text-[var(--text-secondary)]">Loading templates...</span>
|
2025-11-09 21:40:07 +00:00
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
{templates.length === 0 ? (
|
|
|
|
|
<div className="text-center py-12 border-2 border-dashed border-[var(--border-secondary)] rounded-lg">
|
|
|
|
|
<ClipboardCheck className="w-12 h-12 mx-auto mb-3 text-[var(--text-tertiary)]" />
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<p className="text-[var(--text-secondary)] mb-2">No quality templates available</p>
|
2025-11-09 21:40:07 +00:00
|
|
|
<p className="text-sm text-[var(--text-tertiary)]">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
You can create templates from the main wizard
|
2025-11-09 21:40:07 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="space-y-3 max-h-96 overflow-y-auto">
|
|
|
|
|
{templates.map((template) => (
|
|
|
|
|
<button
|
|
|
|
|
key={template.id}
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
type="button"
|
2025-11-09 21:40:07 +00:00
|
|
|
onClick={() => toggleTemplate(template.id)}
|
|
|
|
|
className={`w-full p-4 rounded-lg border-2 transition-all text-left ${
|
|
|
|
|
selectedTemplateIds.includes(template.id)
|
|
|
|
|
? 'border-[var(--color-primary)] bg-[var(--color-primary)]/5'
|
|
|
|
|
: 'border-[var(--border-secondary)] hover:border-[var(--color-primary)]/50'
|
|
|
|
|
}`}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex items-start justify-between">
|
|
|
|
|
<div className="flex-1">
|
|
|
|
|
<div className="flex items-center gap-2 mb-1">
|
|
|
|
|
<h4 className="font-semibold text-[var(--text-primary)]">{template.name}</h4>
|
|
|
|
|
{template.is_required && (
|
|
|
|
|
<span className="px-2 py-0.5 text-xs bg-orange-100 text-orange-700 rounded-full">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
Required
|
2025-11-09 21:40:07 +00:00
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
{template.description && (
|
|
|
|
|
<p className="text-sm text-[var(--text-secondary)] line-clamp-2">
|
|
|
|
|
{template.description}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
<div className="flex items-center gap-3 mt-2 text-xs text-[var(--text-tertiary)]">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<span>Type: {template.check_type}</span>
|
2025-11-09 21:40:07 +00:00
|
|
|
{template.frequency_days && (
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<span>• Every {template.frequency_days} days</span>
|
2025-11-09 21:40:07 +00:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{selectedTemplateIds.includes(template.id) && (
|
|
|
|
|
<CheckCircle2 className="w-5 h-5 text-[var(--color-primary)] flex-shrink-0 ml-3" />
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</button>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{selectedTemplateIds.length > 0 && (
|
|
|
|
|
<div className="p-4 bg-[var(--color-primary)]/5 rounded-lg border border-[var(--color-primary)]/20">
|
|
|
|
|
<p className="text-sm text-[var(--text-primary)]">
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<strong>{selectedTemplateIds.length}</strong> template(s) selected
|
2025-11-09 21:40:07 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
<div className="flex justify-center pt-4 border-t border-[var(--border-primary)]">
|
2025-11-09 21:40:07 +00:00
|
|
|
<button
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
type="button"
|
2025-11-09 21:40:07 +00:00
|
|
|
onClick={handleCreateRecipe}
|
|
|
|
|
disabled={saving || loading}
|
2025-11-09 09:48:17 +00:00
|
|
|
className="px-8 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 font-semibold inline-flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
|
|
|
>
|
|
|
|
|
{saving ? (
|
|
|
|
|
<>
|
|
|
|
|
<Loader2 className="w-5 h-5 animate-spin" />
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
Creating recipe...
|
2025-11-09 09:48:17 +00:00
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<CheckCircle2 className="w-5 h-5" />
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
Create Recipe
|
2025-11-09 09:48:17 +00:00
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</button>
|
2025-11-09 08:52:10 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const RecipeWizardSteps = (data: Record<string, any>, setData: (data: Record<string, any>) => void): WizardStep[] => [
|
feat: Completely rewrite RecipeWizard with comprehensive improvements
Major improvements:
1. Fixed 'a.map is not a function' error (line 387: result.templates)
2. Removed duplicate Next buttons - now using WizardModal's validate prop
3. Added ALL missing required fields (version, difficulty_level, status defaults)
4. Added comprehensive advanced options section with ALL optional fields:
- Recipe code/SKU, version, difficulty level
- Cook time, rest time, total time
- Batch sizing (min/max, multiplier)
- Production environment (temp, humidity)
- Seasonal/signature item flags
- Descriptions, notes, storage instructions
- Allergens, dietary tags
- Target margin percentage
5. Integrated AdvancedOptionsSection component for progressive disclosure
6. Added tooltips for complex fields using existing Tooltip component
7. Proper form validation on each step
8. Real-time data synchronization with useEffect
9. English labels (per project standards)
10. All fields map correctly to backend RecipeCreate schema
Technical changes:
- Created reusable AdvancedOptionsSection component
- Steps now validate using WizardModal's validate prop
- No internal "Continuar" buttons - cleaner UX
- Quality Templates step marked as optional (isOptional: true)
- Ingredients step validates all required data
- Seasonal month selectors conditional on isSeasonal checkbox
This implementation follows UX best practices for progressive disclosure and reduces cognitive load while maintaining access to all backend fields.
2025-11-10 07:28:20 +00:00
|
|
|
{
|
|
|
|
|
id: 'recipe-details',
|
|
|
|
|
title: 'Recipe Details',
|
|
|
|
|
description: 'Name, category, yield',
|
|
|
|
|
component: (props) => <RecipeDetailsStep {...props} data={data} onDataChange={setData} />,
|
|
|
|
|
validate: () => {
|
|
|
|
|
return !!(data.name && data.finishedProductId && data.yieldQuantity);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'recipe-ingredients',
|
|
|
|
|
title: 'Ingredients',
|
|
|
|
|
description: 'Selection and quantities',
|
|
|
|
|
component: (props) => <IngredientsStep {...props} data={data} onDataChange={setData} />,
|
|
|
|
|
validate: () => {
|
|
|
|
|
if (!data.ingredients || data.ingredients.length === 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const invalidIngredients = data.ingredients.filter(
|
|
|
|
|
(ing: any) => !ing.ingredientId || ing.quantity <= 0
|
|
|
|
|
);
|
|
|
|
|
return invalidIngredients.length === 0;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'recipe-quality-templates',
|
|
|
|
|
title: 'Quality Templates',
|
|
|
|
|
description: 'Applicable quality controls',
|
|
|
|
|
component: (props) => <QualityTemplatesStep {...props} data={data} onDataChange={setData} />,
|
|
|
|
|
isOptional: true,
|
|
|
|
|
},
|
feat: Add JTBD-driven Unified Add Wizard system
Implemented a comprehensive unified wizard system to consolidate all "add new content"
actions into a single, intuitive, step-by-step guided experience based on Jobs To Be Done
(JTBD) methodology.
## What's New
### Core Components
- **UnifiedAddWizard**: Main orchestrator component that routes to specific wizards
- **ItemTypeSelector**: Beautiful visual card-based selection for 9 content types
- **9 Individual Wizards**: Step-by-step flows for each content type
### Priority Implementations (P0)
1. **SalesEntryWizard** ⭐ (MOST CRITICAL)
- Manual entry with dynamic product lists and auto-calculated totals
- File upload placeholder for CSV/Excel bulk import
- Critical for small bakeries without POS systems
2. **InventoryWizard**
- Type selection (ingredient vs finished product)
- Context-aware forms based on inventory type
- Optional initial lot entry
### Placeholder Wizards (P1/P2)
- Customer Order, Supplier, Recipe, Customer, Quality Template, Equipment, Team Member
- Proper structure in place for incremental enhancement
### Dashboard Integration
- Added prominent "Agregar" button in dashboard header
- Opens wizard modal with visual type selection
- Auto-refreshes dashboard after wizard completion
### Design Highlights
- Mobile-first responsive design (full-screen on mobile, modal on desktop)
- Touch-friendly with 44px+ touch targets
- Follows existing color system and design tokens
- Progressive disclosure to reduce cognitive load
- Accessibility-compliant (WCAG AA)
## Documentation
Created comprehensive documentation:
- `JTBD_UNIFIED_ADD_WIZARD.md` - Full JTBD analysis and research
- `WIZARD_ARCHITECTURE_DESIGN.md` - Technical design and specifications
- `UNIFIED_WIZARD_IMPLEMENTATION_SUMMARY.md` - Implementation guide
## Files Changed
- New: `frontend/src/components/domain/unified-wizard/` (15 new files)
- Modified: `frontend/src/pages/app/DashboardPage.tsx` (added wizard integration)
## Next Steps
- [ ] Connect wizards to real API endpoints (currently mock/placeholder)
- [ ] Implement full CSV upload for sales entry
- [ ] Add comprehensive form validation
- [ ] Enhance P1 priority wizards based on user feedback
## JTBD Alignment
Main Job: "When I need to expand or update my bakery operations, I want to quickly add
new resources to my management system, so I can keep my business running smoothly."
Key insights applied:
- Prioritized sales entry (most bakeries lack POS)
- Mobile-first (bakery owners are on their feet)
- Progressive disclosure (reduce overwhelm)
- Forgiving interactions (can go back, save drafts)
2025-11-09 08:40:01 +00:00
|
|
|
];
|