import React, { useState, useEffect } from 'react'; import { WizardStep, WizardStepProps } from '../../../ui/WizardModal/WizardModal'; import { AdvancedOptionsSection } from '../../../ui/AdvancedOptionsSection'; import Tooltip from '../../../ui/Tooltip/Tooltip'; import { Info } from 'lucide-react'; interface WizardDataProps extends WizardStepProps { data: Record; onDataChange: (data: Record) => void; } // Single comprehensive step with all fields const InventoryDetailsStep: React.FC = ({ data, onDataChange }) => { const [inventoryData, setInventoryData] = useState({ // Required fields name: data.name || '', unitOfMeasure: data.unitOfMeasure || '', productType: data.productType || 'ingredient', // Basic fields sku: data.sku || '', barcode: data.barcode || '', ingredientCategory: data.ingredientCategory || '', productCategory: data.productCategory || '', description: data.description || '', brand: data.brand || '', // Pricing fields averageCost: data.averageCost || '', lastPurchasePrice: data.lastPurchasePrice || '', standardCost: data.standardCost || '', sellingPrice: data.sellingPrice || '', minimumPrice: data.minimumPrice || '', // Inventory management lowStockThreshold: data.lowStockThreshold || '', reorderPoint: data.reorderPoint || '', reorderQuantity: data.reorderQuantity || '', maxStockLevel: data.maxStockLevel || '', leadTimeDays: data.leadTimeDays || '', // Product information packageSize: data.packageSize || '', shelfLifeDays: data.shelfLifeDays || '', displayLifeHours: data.displayLifeHours || '', storageTempMin: data.storageTempMin || '', storageTempMax: data.storageTempMax || '', // Storage and handling storageInstructions: data.storageInstructions || '', isPerishable: data.isPerishable ?? true, handlingInstructions: data.handlingInstructions || '', // Supplier information preferredSupplierId: data.preferredSupplierId || '', supplierProductCode: data.supplierProductCode || '', // Quality and compliance allergenInfo: data.allergenInfo || '', nutritionalInfo: data.nutritionalInfo || '', certifications: data.certifications || '', // Physical properties weight: data.weight || '', volume: data.volume || '', dimensions: data.dimensions || '', color: data.color || '', // Status and tracking isActive: data.isActive ?? true, trackByLot: data.trackByLot ?? false, trackByExpiry: data.trackByExpiry ?? true, allowNegativeStock: data.allowNegativeStock ?? false, // Metadata notes: data.notes || '', tags: data.tags || '', customFields: data.customFields || '', }); // Auto-generate SKU from name if not provided useEffect(() => { if (!inventoryData.sku && inventoryData.name) { const sku = `SKU-${inventoryData.name.substring(0, 3).toUpperCase()}-${Date.now().toString().slice(-4)}`; setInventoryData(prev => ({ ...prev, sku })); } }, [inventoryData.name]); // Sync with parent wizard state in real-time useEffect(() => { onDataChange({ ...data, ...inventoryData }); }, [inventoryData]); return (

Inventory Item Details

Fill in the required information to create an inventory item

{/* Required Fields */}
setInventoryData({ ...inventoryData, name: e.target.value })} placeholder="E.g., All-Purpose Flour, Sourdough Bread" 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)]" />
{/* Basic Information */}

Basic Information

setInventoryData({ ...inventoryData, sku: e.target.value })} placeholder="SKU-XXX-1234" 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)]" />
setInventoryData({ ...inventoryData, barcode: e.target.value })} placeholder="Barcode/UPC/EAN" 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)]" />
setInventoryData({ ...inventoryData, brand: e.target.value })} placeholder="Brand name" 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)]" />