diff --git a/frontend/src/components/domain/unified-wizard/wizards/RecipeWizard.tsx b/frontend/src/components/domain/unified-wizard/wizards/RecipeWizard.tsx index 15cac73f..ecb0c605 100644 --- a/frontend/src/components/domain/unified-wizard/wizards/RecipeWizard.tsx +++ b/frontend/src/components/domain/unified-wizard/wizards/RecipeWizard.tsx @@ -6,25 +6,54 @@ import { recipesService } from '../../../../api/services/recipes'; import { inventoryService } from '../../../../api/services/inventory'; import { qualityTemplateService } from '../../../../api/services/qualityTemplates'; import { IngredientResponse } from '../../../../api/types/inventory'; -import { RecipeCreate, RecipeIngredientCreate, MeasurementUnit, RecipeQualityConfiguration } from '../../../../api/types/recipes'; +import { RecipeCreate, RecipeIngredientCreate, MeasurementUnit, RecipeQualityConfiguration, RecipeStatus } from '../../../../api/types/recipes'; import { QualityCheckTemplateResponse } from '../../../../api/types/qualityTemplates'; import { showToast } from '../../../../utils/toast'; +import { AdvancedOptionsSection } from '../../../ui/AdvancedOptionsSection'; +import Tooltip from '../../../ui/Tooltip/Tooltip'; interface WizardDataProps extends WizardStepProps { data: Record; onDataChange: (data: Record) => void; } -const RecipeDetailsStep: React.FC = ({ data, onDataChange, onNext }) => { +const RecipeDetailsStep: React.FC = ({ data, onDataChange }) => { const { currentTenant } = useTenant(); const [recipeData, setRecipeData] = useState({ + // Required fields name: data.name || '', - category: data.category || 'bread', + finishedProductId: data.finishedProductId || '', yieldQuantity: data.yieldQuantity || '', yieldUnit: data.yieldUnit || 'units', + + // Optional basic fields + category: data.category || 'bread', prepTime: data.prepTime || '', - finishedProductId: data.finishedProductId || '', instructions: data.instructions || '', + + // 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 || '', }); const [finishedProducts, setFinishedProducts] = useState([]); const [loading, setLoading] = useState(false); @@ -33,6 +62,10 @@ const RecipeDetailsStep: React.FC = ({ data, onDataChange, onNe fetchFinishedProducts(); }, []); + useEffect(() => { + onDataChange({ ...data, ...recipeData }); + }, [recipeData]); + const fetchFinishedProducts = async () => { if (!currentTenant?.id) return; setLoading(true); @@ -52,75 +85,106 @@ const RecipeDetailsStep: React.FC = ({ data, onDataChange, onNe
-

Detalles de la Receta

+

Recipe Details

+

Essential information about your recipe

-
-
- + + {/* Required Fields */} +
+
+ setRecipeData({ ...recipeData, name: e.target.value })} - placeholder="Ej: Baguette Tradicional" + placeholder="e.g., Traditional Baguette" 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)]" />
-
- - + +
+
+ + +
+ +
+ + +
-
- - + +
+
+ + 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" + /> +
+ +
+ + +
+
- - 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="1" - /> -
-
- - -
-
- + = ({ data, onDataChange, onNe min="0" />
-
- + +
+