Files
bakery-ia/frontend/src/components/domain/unified-wizard/wizards/CustomerOrderWizard.tsx

1428 lines
64 KiB
TypeScript
Raw Normal View History

import React, { useState, useEffect } from 'react';
import { WizardStep, WizardStepProps } from '../../../ui/WizardModal/WizardModal';
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
import { AdvancedOptionsSection } from '../../../ui/AdvancedOptionsSection';
import Tooltip from '../../../ui/Tooltip/Tooltip';
import {
Users,
Plus,
Package,
Truck,
CreditCard,
Search,
Calendar,
MapPin,
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Info,
Loader2,
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
CheckCircle2,
} from 'lucide-react';
import { useTenant } from '../../../../stores/tenant.store';
import OrdersService from '../../../../api/services/orders';
import { inventoryService } from '../../../../api/services/inventory';
import { ProductType } from '../../../../api/types/inventory';
interface WizardDataProps extends WizardStepProps {
data: Record<string, any>;
onDataChange: (data: Record<string, any>) => void;
}
// Step 1: Customer Selection
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
const CustomerSelectionStep: React.FC<WizardDataProps> = ({ data, onDataChange }) => {
const { currentTenant } = useTenant();
const [searchQuery, setSearchQuery] = useState('');
const [showNewCustomerForm, setShowNewCustomerForm] = useState(false);
const [selectedCustomer, setSelectedCustomer] = useState(data.customer || null);
const [customers, setCustomers] = useState<any[]>([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [newCustomer, setNewCustomer] = useState({
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
name: data.newCustomerName || '',
type: data.newCustomerType || 'retail',
phone: data.newCustomerPhone || '',
email: data.newCustomerEmail || '',
});
useEffect(() => {
fetchCustomers();
}, []);
// Update parent whenever customer selection changes
const handleCustomerChange = (newCustomer: any, newShowForm: boolean) => {
setSelectedCustomer(newCustomer);
setShowNewCustomerForm(newShowForm);
onDataChange({
...data,
customer: newCustomer,
showNewCustomerForm: newShowForm,
});
};
// Update new customer data
const handleNewCustomerChange = (updates: any) => {
const updated = { ...newCustomer, ...updates };
setNewCustomer(updated);
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
onDataChange({
...data,
showNewCustomerForm,
newCustomerName: updated.name,
newCustomerType: updated.type,
newCustomerPhone: updated.phone,
newCustomerEmail: updated.email,
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
});
};
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
const fetchCustomers = async () => {
if (!currentTenant?.id) return;
setLoading(true);
setError(null);
try {
const result = await OrdersService.getCustomers({
tenant_id: currentTenant.id,
active_only: true,
});
setCustomers(result);
} catch (err: any) {
console.error('Error loading customers:', err);
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
setError('Error loading customers');
} finally {
setLoading(false);
}
};
const filteredCustomers = customers.filter((customer) =>
customer.name.toLowerCase().includes(searchQuery.toLowerCase())
);
const handleSelectCustomer = (customer: any) => {
handleCustomerChange(customer, false);
};
return (
<div className="space-y-6">
<div className="text-center pb-4 border-b border-[var(--border-primary)]">
<Users 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: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Select Customer
</h3>
<p className="text-sm text-[var(--text-secondary)]">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Search for an existing customer or create a new one
</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: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<span className="ml-3 text-[var(--text-secondary)]">Loading customers...</span>
</div>
) : !showNewCustomerForm ? (
<>
{/* Search Bar */}
<div className="relative">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]" />
<input
type="text"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Search customer by name..."
className="w-full pl-10 pr-4 py-3 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>
{/* Customer List */}
<div className="space-y-3 max-h-96 overflow-y-auto pr-2">
{filteredCustomers.length === 0 ? (
<div className="text-center py-8 border-2 border-dashed border-[var(--border-secondary)] rounded-lg">
<Users className="w-12 h-12 mx-auto mb-3 text-[var(--text-tertiary)]" />
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<p className="text-[var(--text-secondary)] mb-1">No customers found</p>
<p className="text-sm text-[var(--text-tertiary)]">Try a different search term</p>
</div>
) : (
filteredCustomers.map((customer) => (
<button
key={customer.id}
onClick={() => handleSelectCustomer(customer)}
className={`w-full p-4 rounded-xl border-2 transition-all text-left group hover:shadow-md ${
selectedCustomer?.id === customer.id
? 'border-[var(--color-primary)] bg-gradient-to-r from-[var(--color-primary)]/10 to-[var(--color-primary)]/5 shadow-sm'
: 'border-[var(--border-secondary)] hover:border-[var(--color-primary)]/50 hover:bg-[var(--bg-secondary)]/30'
}`}
>
<div className="flex items-start gap-3">
<div className={`w-12 h-12 rounded-full flex items-center justify-center flex-shrink-0 transition-colors ${
selectedCustomer?.id === customer.id
? 'bg-[var(--color-primary)] text-white'
: 'bg-[var(--bg-tertiary)] text-[var(--text-tertiary)] group-hover:bg-[var(--color-primary)]/20 group-hover:text-[var(--color-primary)]'
}`}>
<Users className="w-6 h-6" />
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2 mb-1">
<h4 className={`font-semibold truncate transition-colors ${
selectedCustomer?.id === customer.id
? 'text-[var(--color-primary)]'
: 'text-[var(--text-primary)]'
}`}>
{customer.name}
</h4>
{selectedCustomer?.id === customer.id && (
<CheckCircle2 className="w-5 h-5 text-[var(--color-primary)] flex-shrink-0" />
)}
</div>
<div className="flex flex-wrap items-center gap-2 text-sm text-[var(--text-secondary)]">
<span className={`px-2 py-0.5 rounded-full text-xs font-medium ${
customer.customer_type === 'wholesale'
? 'bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300'
: customer.customer_type === 'restaurant'
? 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-300'
: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300'
}`}>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{customer.customer_type}
</span>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{customer.phone && <span>📱 {customer.phone}</span>}
</div>
</div>
</div>
</button>
))
)}
</div>
{/* Create New Customer Button */}
<button
onClick={() => handleCustomerChange(null, true)}
className="w-full p-4 border-2 border-dashed border-[var(--border-secondary)] rounded-lg hover:border-[var(--color-primary)] transition-colors text-[var(--text-secondary)] hover:text-[var(--color-primary)] flex items-center justify-center gap-2"
>
<Plus className="w-5 h-5" />
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<span className="font-medium">Create new customer</span>
</button>
</>
) : (
<>
{/* New Customer Form */}
<div className="p-4 bg-[var(--bg-secondary)]/30 rounded-lg border border-[var(--border-secondary)]">
<h4 className="font-semibold text-[var(--text-primary)] mb-4 flex items-center gap-2">
<Plus className="w-5 h-5" />
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
New Customer
</h4>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="md:col-span-2">
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Customer Name *
</label>
<input
type="text"
value={newCustomer.name}
onChange={(e) => handleNewCustomerChange({ name: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="E.g., The Mill Restaurant"
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">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Customer Type *
</label>
<select
value={newCustomer.type}
onChange={(e) => handleNewCustomerChange({ type: 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)]"
>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<option value="retail">Retail</option>
<option value="wholesale">Wholesale</option>
<option value="event">Event</option>
<option value="restaurant">Restaurant</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Phone *
</label>
<input
type="tel"
value={newCustomer.phone}
onChange={(e) => handleNewCustomerChange({ phone: e.target.value })}
placeholder="+34 123 456 789"
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 className="md:col-span-2">
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Email (Optional)
</label>
<input
type="email"
value={newCustomer.email}
onChange={(e) => handleNewCustomerChange({ email: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="contact@restaurant.com"
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>
<button
onClick={() => handleCustomerChange(selectedCustomer, false)}
className="mt-4 text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]"
>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Back to customer list
</button>
</div>
</>
)}
</div>
);
};
// Step 2: Order Items
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
const OrderItemsStep: React.FC<WizardDataProps> = ({ data, onDataChange }) => {
const { currentTenant } = useTenant();
const [orderItems, setOrderItems] = useState(data.orderItems || []);
const [products, setProducts] = useState<any[]>([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
fetchProducts();
}, []);
// Update parent whenever order items change
const updateOrderItems = (newItems: any[]) => {
setOrderItems(newItems);
const totalAmount = newItems.reduce((sum: number, item: any) => sum + (item.subtotal || 0), 0);
onDataChange({ ...data, orderItems: newItems, totalAmount });
};
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
const fetchProducts = async () => {
if (!currentTenant?.id) return;
setLoading(true);
setError(null);
try {
const allIngredients = await inventoryService.getIngredients(currentTenant.id);
const finishedProducts = allIngredients.filter(
(ingredient) => ingredient.product_type === ProductType.FINISHED_PRODUCT
);
setProducts(finishedProducts);
} catch (err: any) {
console.error('Error loading products:', err);
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
setError('Error loading products');
} finally {
setLoading(false);
}
};
const handleAddItem = () => {
updateOrderItems([
...orderItems,
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{
id: Date.now(),
productId: '',
productName: '',
quantity: 1,
unitPrice: 0,
customRequirements: '',
subtotal: 0,
unitOfMeasure: 'units',
},
]);
};
const handleUpdateItem = (index: number, field: string, value: any) => {
const updated = orderItems.map((item: any, i: number) => {
if (i === index) {
const newItem = { ...item, [field]: value };
if (field === 'productId') {
const product = products.find((p) => p.id === value);
if (product) {
newItem.productName = product.name;
newItem.unitPrice = product.average_cost || product.last_purchase_price || 0;
newItem.unitOfMeasure = product.unit_of_measure;
}
}
if (field === 'quantity' || field === 'unitPrice' || field === 'productId') {
newItem.subtotal = (newItem.quantity || 0) * (newItem.unitPrice || 0);
}
return newItem;
}
return item;
});
updateOrderItems(updated);
};
const handleRemoveItem = (index: number) => {
updateOrderItems(orderItems.filter((_: any, i: number) => i !== index));
};
const calculateTotal = () => {
return orderItems.reduce((sum: number, item: any) => sum + (item.subtotal || 0), 0);
};
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)]" />
<h3 className="text-lg font-semibold text-[var(--text-primary)] mb-2">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Order Items
</h3>
<p className="text-sm text-[var(--text-secondary)]">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Customer: <span className="font-semibold">{data.customer?.name || 'New Customer'}</span>
</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: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<span className="ml-3 text-[var(--text-secondary)]">Loading products...</span>
</div>
) : (
<>
<div className="space-y-3">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<div className="flex items-center justify-between">
<label className="block text-sm font-medium text-[var(--text-secondary)]">
Order Products
</label>
<button
onClick={handleAddItem}
className="px-3 py-1.5 text-sm bg-[var(--color-primary)] text-white rounded-md hover:bg-[var(--color-primary)]/90 transition-colors flex items-center gap-1"
>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<Plus className="w-4 h-4" />
Add Product
</button>
</div>
{orderItems.length === 0 ? (
<div className="text-center py-12 border-2 border-dashed border-[var(--border-secondary)] rounded-lg text-[var(--text-tertiary)]">
<Package className="w-12 h-12 mx-auto mb-3 opacity-50" />
<p className="mb-2">No products in order</p>
<p className="text-sm">Click "Add Product" to start</p>
</div>
) : (
<div className="space-y-3">
{orderItems.map((item: any, index: number) => (
<div
key={item.id}
className="p-4 border border-[var(--border-secondary)] rounded-lg bg-[var(--bg-secondary)]/30 space-y-3"
>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<div className="flex items-center justify-between">
<span className="text-sm font-semibold text-[var(--text-primary)]">
Product #{index + 1}
</span>
<button
onClick={() => handleRemoveItem(index)}
className="p-1 text-red-500 hover:text-red-700 transition-colors"
>
</button>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
<div className="md:col-span-2">
<label className="block text-xs font-medium text-[var(--text-secondary)] mb-1">
Product *
</label>
<select
value={item.productId}
onChange={(e) => handleUpdateItem(index, 'productId', e.target.value)}
className="w-full px-3 py-2 text-sm 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 product...</option>
{products.map((product) => (
<option key={product.id} value={product.id}>
{product.name} - {(product.average_cost || product.last_purchase_price || 0).toFixed(2)} / {product.unit_of_measure}
</option>
))}
</select>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<div>
<label className="block text-xs font-medium text-[var(--text-secondary)] mb-1">
Quantity *
</label>
<input
type="number"
value={item.quantity}
onChange={(e) => handleUpdateItem(index, 'quantity', parseFloat(e.target.value) || 0)}
className="w-full px-3 py-2 text-sm 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"
step="1"
/>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<div>
<label className="block text-xs font-medium text-[var(--text-secondary)] mb-1">
Unit Price ()
</label>
<input
type="number"
value={item.unitPrice}
onChange={(e) => handleUpdateItem(index, 'unitPrice', parseFloat(e.target.value) || 0)}
className="w-full px-3 py-2 text-sm 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"
step="0.01"
/>
</div>
<div className="md:col-span-2">
<label className="block text-xs font-medium text-[var(--text-secondary)] mb-1">
Special Requirements (Optional)
</label>
<input
type="text"
value={item.customRequirements}
onChange={(e) => handleUpdateItem(index, 'customRequirements', e.target.value)}
placeholder="E.g., No nuts, extra chocolate..."
className="w-full px-3 py-2 text-sm 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>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<div className="pt-2 border-t border-[var(--border-primary)] text-sm">
<span className="font-semibold text-[var(--text-primary)]">
Subtotal: {item.subtotal.toFixed(2)}
</span>
</div>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
))}
</div>
)}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{orderItems.length > 0 && (
<div className="p-4 bg-gradient-to-r from-[var(--color-primary)]/5 to-[var(--color-primary)]/10 rounded-lg border-2 border-[var(--color-primary)]/20">
<div className="flex justify-between items-center">
<span className="text-lg font-semibold text-[var(--text-primary)]">Order Total:</span>
<span className="text-2xl font-bold text-[var(--color-primary)]">
{calculateTotal().toFixed(2)}
</span>
</div>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
)}
</div>
</>
)}
</div>
);
};
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
// Step 3: Delivery & Payment with ALL fields
const DeliveryPaymentStep: React.FC<WizardDataProps> = ({ data, onDataChange }) => {
const [orderData, setOrderData] = useState({
// Required fields
requestedDeliveryDate: data.requestedDeliveryDate || '',
orderNumber: data.orderNumber || '',
// Basic order info
orderType: data.orderType || 'standard',
priority: data.priority || 'normal',
status: data.status || 'pending',
// Delivery fields
deliveryMethod: data.deliveryMethod || 'pickup',
deliveryAddress: data.deliveryAddress || '',
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
deliveryInstructions: data.deliveryInstructions || '',
deliveryContactName: data.deliveryContactName || '',
deliveryContactPhone: data.deliveryContactPhone || '',
deliveryTimeWindow: data.deliveryTimeWindow || '',
deliveryFee: data.deliveryFee || '',
// Payment fields
paymentMethod: data.paymentMethod || 'invoice',
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
paymentTerms: data.paymentTerms || 'net_30',
paymentStatus: data.paymentStatus || 'pending',
paymentDueDate: data.paymentDueDate || '',
// Pricing fields
subtotalAmount: data.subtotalAmount || '',
taxAmount: data.taxAmount || '',
discountPercentage: data.discountPercentage || '',
discountAmount: data.discountAmount || '',
shippingCost: data.shippingCost || '',
// Production & scheduling
productionStartDate: data.productionStartDate || '',
productionDueDate: data.productionDueDate || '',
productionBatchNumber: data.productionBatchNumber || '',
productionNotes: data.productionNotes || '',
// Fulfillment
actualDeliveryDate: data.actualDeliveryDate || '',
pickupLocation: data.pickupLocation || '',
shippingTrackingNumber: data.shippingTrackingNumber || '',
shippingCarrier: data.shippingCarrier || '',
// Source & channel
orderSource: data.orderSource || 'manual',
salesChannel: data.salesChannel || 'direct',
salesRepId: data.salesRepId || '',
// Communication
customerPurchaseOrder: data.customerPurchaseOrder || '',
internalNotes: data.internalNotes || '',
customerNotes: data.customerNotes || '',
specialInstructions: data.specialInstructions || '',
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
// Notifications
notifyCustomerOnStatusChange: data.notifyCustomerOnStatusChange ?? true,
notifyCustomerOnDelivery: data.notifyCustomerOnDelivery ?? true,
customerNotificationEmail: data.customerNotificationEmail || '',
customerNotificationPhone: data.customerNotificationPhone || '',
// Quality & requirements
qualityCheckRequired: data.qualityCheckRequired ?? false,
qualityCheckStatus: data.qualityCheckStatus || '',
packagingInstructions: data.packagingInstructions || '',
labelingRequirements: data.labelingRequirements || '',
// Advanced options
isRecurring: data.isRecurring ?? false,
recurringSchedule: data.recurringSchedule || '',
parentOrderId: data.parentOrderId || '',
relatedOrderIds: data.relatedOrderIds || '',
tags: data.tags || '',
metadata: data.metadata || '',
});
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
// Auto-generate order number if not provided
useEffect(() => {
if (!orderData.orderNumber) {
const orderNum = `ORD-${Date.now().toString().slice(-8)}`;
const newData = { ...orderData, orderNumber: orderNum };
setOrderData(newData);
onDataChange({ ...data, ...newData });
}
}, [orderData.orderNumber]);
// Update parent whenever order data changes
const handleOrderDataChange = (newOrderData: any) => {
setOrderData(newOrderData);
onDataChange({ ...data, ...newOrderData });
};
return (
<div className="space-y-6">
<div className="text-center pb-4 border-b border-[var(--border-primary)]">
<Truck 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: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Delivery & Payment Details
</h3>
<p className="text-sm text-[var(--text-secondary)]">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Configure delivery, payment, and order details
</p>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{/* Required Fields */}
<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">
<Calendar className="w-4 h-4 inline mr-1.5" />
Requested Delivery Date *
</label>
<input
type="date"
value={orderData.requestedDeliveryDate}
onChange={(e) => handleOrderDataChange({ ...orderData, requestedDeliveryDate: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
min={new Date().toISOString().split('T')[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>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Order Number
<Tooltip content="Auto-generated order reference number">
<Info className="inline w-4 h-4 ml-1 text-[var(--text-tertiary)]" />
</Tooltip>
</label>
<input
type="text"
value={orderData.orderNumber}
onChange={(e) => handleOrderDataChange({ ...orderData, orderNumber: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="ORD-12345678"
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>
{/* Basic Order Info */}
<div className="border-t border-[var(--border-primary)] pt-4">
<h4 className="text-sm font-semibold text-[var(--text-primary)] mb-3">Basic Order Information</h4>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Order Type
</label>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<select
value={orderData.orderType}
onChange={(e) => handleOrderDataChange({ ...orderData, orderType: 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)]"
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
>
<option value="standard">Standard</option>
<option value="custom">Custom</option>
<option value="bulk">Bulk</option>
<option value="urgent">Urgent</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Priority
</label>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<select
value={orderData.priority}
onChange={(e) => handleOrderDataChange({ ...orderData, priority: 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)]"
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
>
<option value="low">Low</option>
<option value="normal">Normal</option>
<option value="high">High</option>
<option value="urgent">Urgent</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Status
</label>
<select
value={orderData.status}
onChange={(e) => handleOrderDataChange({ ...orderData, status: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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)]"
>
<option value="pending">Pending</option>
<option value="confirmed">Confirmed</option>
<option value="in_production">In Production</option>
<option value="ready">Ready</option>
<option value="delivered">Delivered</option>
</select>
</div>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{/* Delivery Details */}
<div className="border-t border-[var(--border-primary)] pt-4">
<h4 className="text-sm font-semibold text-[var(--text-primary)] mb-3">Delivery Details</h4>
<div className="space-y-4">
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
<Truck className="w-4 h-4 inline mr-1.5" />
Delivery Method
</label>
<div className="grid grid-cols-1 md:grid-cols-3 gap-3">
<button
type="button"
onClick={() => handleOrderDataChange({ ...orderData, deliveryMethod: 'pickup' })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
className={`p-3 rounded-lg border-2 transition-all ${
orderData.deliveryMethod === 'pickup'
? 'border-[var(--color-primary)] bg-[var(--color-primary)]/5'
: 'border-[var(--border-secondary)]'
}`}
>
<p className="font-semibold text-sm">Pickup</p>
<p className="text-xs text-[var(--text-tertiary)]">Customer pickup</p>
</button>
<button
type="button"
onClick={() => handleOrderDataChange({ ...orderData, deliveryMethod: 'delivery' })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
className={`p-3 rounded-lg border-2 transition-all ${
orderData.deliveryMethod === 'delivery'
? 'border-[var(--color-primary)] bg-[var(--color-primary)]/5'
: 'border-[var(--border-secondary)]'
}`}
>
<p className="font-semibold text-sm">Delivery</p>
<p className="text-xs text-[var(--text-tertiary)]">Home delivery</p>
</button>
<button
type="button"
onClick={() => handleOrderDataChange({ ...orderData, deliveryMethod: 'shipping' })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
className={`p-3 rounded-lg border-2 transition-all ${
orderData.deliveryMethod === 'shipping'
? 'border-[var(--color-primary)] bg-[var(--color-primary)]/5'
: 'border-[var(--border-secondary)]'
}`}
>
<p className="font-semibold text-sm">Shipping</p>
<p className="text-xs text-[var(--text-tertiary)]">Courier service</p>
</button>
</div>
</div>
{(orderData.deliveryMethod === 'delivery' || orderData.deliveryMethod === 'shipping') && (
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
<MapPin className="w-4 h-4 inline mr-1.5" />
Delivery Address *
</label>
<textarea
value={orderData.deliveryAddress}
onChange={(e) => handleOrderDataChange({ ...orderData, deliveryAddress: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Street, number, floor, postal code, city..."
rows={2}
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 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">
Delivery Contact Name
</label>
<input
type="text"
value={orderData.deliveryContactName}
onChange={(e) => handleOrderDataChange({ ...orderData, deliveryContactName: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Contact person"
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">
Delivery Contact Phone
</label>
<input
type="tel"
value={orderData.deliveryContactPhone}
onChange={(e) => handleOrderDataChange({ ...orderData, deliveryContactPhone: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="+34 123 456 789"
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>
</div>
</div>
{/* Payment Details */}
<div className="border-t border-[var(--border-primary)] pt-4">
<h4 className="text-sm font-semibold text-[var(--text-primary)] mb-3">Payment Details</h4>
<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">
<CreditCard className="w-4 h-4 inline mr-1.5" />
Payment Method
</label>
<select
value={orderData.paymentMethod}
onChange={(e) => handleOrderDataChange({ ...orderData, paymentMethod: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<option value="cash">Cash</option>
<option value="card">Card</option>
<option value="bank_transfer">Bank Transfer</option>
<option value="invoice">Invoice</option>
<option value="account">Account</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Payment Terms
</label>
<select
value={orderData.paymentTerms}
onChange={(e) => handleOrderDataChange({ ...orderData, paymentTerms: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<option value="immediate">Immediate</option>
<option value="net_30">Net 30</option>
<option value="net_60">Net 60</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Payment Status
</label>
<select
value={orderData.paymentStatus}
onChange={(e) => handleOrderDataChange({ ...orderData, paymentStatus: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<option value="pending">Pending</option>
<option value="partial">Partial</option>
<option value="paid">Paid</option>
<option value="overdue">Overdue</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
Payment Due Date
</label>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<input
type="date"
value={orderData.paymentDueDate}
onChange={(e) => handleOrderDataChange({ ...orderData, paymentDueDate: 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)]"
/>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
</div>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{/* Order Summary */}
<div className="p-4 bg-[var(--bg-secondary)]/50 rounded-lg border border-[var(--border-secondary)]">
<h4 className="font-semibold text-[var(--text-primary)] mb-3">Order Summary</h4>
<div className="space-y-2 text-sm">
<div className="flex justify-between">
<span className="text-[var(--text-secondary)]">Customer:</span>
<span className="font-medium">{data.customer?.name || 'New Customer'}</span>
</div>
<div className="flex justify-between">
<span className="text-[var(--text-secondary)]">Products:</span>
<span className="font-medium">{data.orderItems?.length || 0} items</span>
</div>
<div className="flex justify-between">
<span className="text-[var(--text-secondary)]">Total:</span>
<span className="font-semibold text-lg text-[var(--color-primary)]">
{data.totalAmount?.toFixed(2) || '0.00'}
</span>
</div>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{/* Advanced Options */}
<AdvancedOptionsSection
title="Advanced Options"
description="Optional fields for comprehensive order management"
>
{/* Pricing Details */}
<div className="space-y-4">
<h5 className="text-xs font-semibold text-[var(--text-secondary)] uppercase tracking-wider">
Pricing Details
</h5>
<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">
Discount (%)
</label>
<input
type="number"
value={orderData.discountPercentage}
onChange={(e) => handleOrderDataChange({ ...orderData, discountPercentage: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="0"
step="0.01"
min="0"
max="100"
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">
Delivery Fee ()
</label>
<input
type="number"
value={orderData.deliveryFee}
onChange={(e) => handleOrderDataChange({ ...orderData, deliveryFee: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="0.00"
step="0.01"
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>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{/* Production & Scheduling */}
<div className="space-y-4 border-t border-[var(--border-primary)] pt-4">
<h5 className="text-xs font-semibold text-[var(--text-secondary)] uppercase tracking-wider">
Production & Scheduling
</h5>
<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">
Production Start Date
</label>
<input
type="date"
value={orderData.productionStartDate}
onChange={(e) => handleOrderDataChange({ ...orderData, productionStartDate: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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)]"
/>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Production Due Date
</label>
<input
type="date"
value={orderData.productionDueDate}
onChange={(e) => handleOrderDataChange({ ...orderData, productionDueDate: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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)]"
/>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Production Batch Number
</label>
<input
type="text"
value={orderData.productionBatchNumber}
onChange={(e) => handleOrderDataChange({ ...orderData, productionBatchNumber: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="BATCH-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">
Delivery Time Window
</label>
<input
type="text"
value={orderData.deliveryTimeWindow}
onChange={(e) => handleOrderDataChange({ ...orderData, deliveryTimeWindow: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="E.g., 9:00 AM - 11:00 AM"
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 className="md:col-span-2">
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Production Notes
</label>
<textarea
value={orderData.productionNotes}
onChange={(e) => handleOrderDataChange({ ...orderData, productionNotes: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Special production requirements or notes"
rows={2}
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>
</div>
{/* Fulfillment & Tracking */}
<div className="space-y-4 border-t border-[var(--border-primary)] pt-4">
<h5 className="text-xs font-semibold text-[var(--text-secondary)] uppercase tracking-wider">
Fulfillment & Tracking
</h5>
<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">
Shipping Tracking Number
</label>
<input
type="text"
value={orderData.shippingTrackingNumber}
onChange={(e) => handleOrderDataChange({ ...orderData, shippingTrackingNumber: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Tracking number"
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">
Shipping Carrier
</label>
<input
type="text"
value={orderData.shippingCarrier}
onChange={(e) => handleOrderDataChange({ ...orderData, shippingCarrier: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="E.g., DHL, UPS, FedEx"
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">
Pickup Location
</label>
<input
type="text"
value={orderData.pickupLocation}
onChange={(e) => handleOrderDataChange({ ...orderData, pickupLocation: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Store location for pickup"
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">
Actual Delivery Date
</label>
<input
type="date"
value={orderData.actualDeliveryDate}
onChange={(e) => handleOrderDataChange({ ...orderData, actualDeliveryDate: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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)]"
/>
</div>
</div>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{/* Source & Channel */}
<div className="space-y-4 border-t border-[var(--border-primary)] pt-4">
<h5 className="text-xs font-semibold text-[var(--text-secondary)] uppercase tracking-wider">
Source & Channel
</h5>
<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">
Order Source
</label>
<select
value={orderData.orderSource}
onChange={(e) => handleOrderDataChange({ ...orderData, orderSource: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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)]"
>
<option value="manual">Manual</option>
<option value="phone">Phone</option>
<option value="email">Email</option>
<option value="website">Website</option>
<option value="app">Mobile App</option>
</select>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Sales Channel
</label>
<select
value={orderData.salesChannel}
onChange={(e) => handleOrderDataChange({ ...orderData, salesChannel: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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)]"
>
<option value="direct">Direct</option>
<option value="wholesale">Wholesale</option>
<option value="retail">Retail</option>
<option value="online">Online</option>
</select>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
<div className="md:col-span-2">
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Sales Representative ID
</label>
<input
type="text"
value={orderData.salesRepId}
onChange={(e) => handleOrderDataChange({ ...orderData, salesRepId: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Sales rep ID or 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)]"
/>
</div>
</div>
</div>
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
{/* Communication & Notes */}
<div className="space-y-4 border-t border-[var(--border-primary)] pt-4">
<h5 className="text-xs font-semibold text-[var(--text-secondary)] uppercase tracking-wider">
Communication & Notes
</h5>
<div className="grid grid-cols-1 gap-4">
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Customer Purchase Order #
</label>
<input
type="text"
value={orderData.customerPurchaseOrder}
onChange={(e) => handleOrderDataChange({ ...orderData, customerPurchaseOrder: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Customer's PO number"
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">
Delivery Instructions
</label>
<textarea
value={orderData.deliveryInstructions}
onChange={(e) => handleOrderDataChange({ ...orderData, deliveryInstructions: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Special delivery instructions"
rows={2}
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">
Special Instructions
</label>
<textarea
value={orderData.specialInstructions}
onChange={(e) => handleOrderDataChange({ ...orderData, specialInstructions: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Any special requirements or instructions"
rows={2}
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">
Internal Notes
</label>
<textarea
value={orderData.internalNotes}
onChange={(e) => handleOrderDataChange({ ...orderData, internalNotes: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Internal notes (not visible to customer)"
rows={2}
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">
Customer Notes
</label>
<textarea
value={orderData.customerNotes}
onChange={(e) => handleOrderDataChange({ ...orderData, customerNotes: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Notes from/for the customer"
rows={2}
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>
</div>
{/* Notifications */}
<div className="space-y-4 border-t border-[var(--border-primary)] pt-4">
<h5 className="text-xs font-semibold text-[var(--text-secondary)] uppercase tracking-wider">
Notifications
</h5>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="flex items-center gap-2">
<input
type="checkbox"
checked={orderData.notifyCustomerOnStatusChange}
onChange={(e) => handleOrderDataChange({ ...orderData, notifyCustomerOnStatusChange: e.target.checked })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
className="rounded border-[var(--border-secondary)] text-[var(--color-primary)] focus:ring-[var(--color-primary)]"
/>
<label className="text-sm text-[var(--text-secondary)]">
Notify on Status Change
</label>
</div>
<div className="flex items-center gap-2">
<input
type="checkbox"
checked={orderData.notifyCustomerOnDelivery}
onChange={(e) => handleOrderDataChange({ ...orderData, notifyCustomerOnDelivery: e.target.checked })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
className="rounded border-[var(--border-secondary)] text-[var(--color-primary)] focus:ring-[var(--color-primary)]"
/>
<label className="text-sm text-[var(--text-secondary)]">
Notify on Delivery
</label>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Notification Email
</label>
<input
type="email"
value={orderData.customerNotificationEmail}
onChange={(e) => handleOrderDataChange({ ...orderData, customerNotificationEmail: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="customer@email.com"
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">
Notification Phone
</label>
<input
type="tel"
value={orderData.customerNotificationPhone}
onChange={(e) => handleOrderDataChange({ ...orderData, customerNotificationPhone: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="+34 123 456 789"
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>
</div>
{/* Quality & Requirements */}
<div className="space-y-4 border-t border-[var(--border-primary)] pt-4">
<h5 className="text-xs font-semibold text-[var(--text-secondary)] uppercase tracking-wider">
Quality & Requirements
</h5>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="flex items-center gap-2">
<input
type="checkbox"
checked={orderData.qualityCheckRequired}
onChange={(e) => handleOrderDataChange({ ...orderData, qualityCheckRequired: e.target.checked })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
className="rounded border-[var(--border-secondary)] text-[var(--color-primary)] focus:ring-[var(--color-primary)]"
/>
<label className="text-sm text-[var(--text-secondary)]">
Quality Check Required
</label>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Quality Check Status
</label>
<select
value={orderData.qualityCheckStatus}
onChange={(e) => handleOrderDataChange({ ...orderData, qualityCheckStatus: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +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)]"
>
<option value="">Not Started</option>
<option value="pending">Pending</option>
<option value="passed">Passed</option>
<option value="failed">Failed</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Packaging Instructions
</label>
<input
type="text"
value={orderData.packagingInstructions}
onChange={(e) => handleOrderDataChange({ ...orderData, packagingInstructions: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Special packaging requirements"
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">
Labeling Requirements
</label>
<input
type="text"
value={orderData.labelingRequirements}
onChange={(e) => handleOrderDataChange({ ...orderData, labelingRequirements: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="Custom label requirements"
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>
</div>
{/* Additional Options */}
<div className="space-y-4 border-t border-[var(--border-primary)] pt-4">
<h5 className="text-xs font-semibold text-[var(--text-secondary)] uppercase tracking-wider">
Additional Options
</h5>
<div className="grid grid-cols-1 gap-4">
<div className="flex items-center gap-2">
<input
type="checkbox"
checked={orderData.isRecurring}
onChange={(e) => handleOrderDataChange({ ...orderData, isRecurring: e.target.checked })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
className="rounded border-[var(--border-secondary)] text-[var(--color-primary)] focus:ring-[var(--color-primary)]"
/>
<label className="text-sm text-[var(--text-secondary)]">
Recurring Order
</label>
</div>
{orderData.isRecurring && (
<div>
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
Recurring Schedule
</label>
<input
type="text"
value={orderData.recurringSchedule}
onChange={(e) => handleOrderDataChange({ ...orderData, recurringSchedule: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="E.g., Weekly on Mondays, Every 2 weeks"
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">
Tags
<Tooltip content="Comma-separated tags for easier search and filtering">
<Info className="inline w-4 h-4 ml-1 text-[var(--text-tertiary)]" />
</Tooltip>
</label>
<input
type="text"
value={orderData.tags}
onChange={(e) => handleOrderDataChange({ ...orderData, tags: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder="urgent, vip, wholesale"
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">
Metadata (JSON)
<Tooltip content="Additional custom data in JSON format">
<Info className="inline w-4 h-4 ml-1 text-[var(--text-tertiary)]" />
</Tooltip>
</label>
<textarea
value={orderData.metadata}
onChange={(e) => handleOrderDataChange({ ...orderData, metadata: e.target.value })}
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
placeholder='{"custom_field": "value"}'
rows={2}
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)] font-mono text-xs"
/>
</div>
</div>
</div>
</AdvancedOptionsSection>
</div>
);
};
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
export const CustomerOrderWizardSteps = (
data: Record<string, any>,
setData: (data: Record<string, any>) => void
): WizardStep[] => [
{
id: 'customer-selection',
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
title: 'Select Customer',
component: (props) => <CustomerSelectionStep {...props} data={data} onDataChange={setData} />,
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
validate: () => {
return !!(data.customer || (data.showNewCustomerForm && data.newCustomerName && data.newCustomerPhone));
},
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
},
{
id: 'order-items',
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
title: 'Order Items',
component: (props) => <OrderItemsStep {...props} data={data} onDataChange={setData} />,
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
validate: () => {
return !!(data.orderItems && data.orderItems.length > 0);
},
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
},
{
id: 'delivery-payment',
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
title: 'Delivery & Payment',
component: (props) => <DeliveryPaymentStep {...props} data={data} onDataChange={setData} />,
feat: Rewrite CustomerOrderWizard with all 72 fields and validate props Complete rewrite of the most complex wizard following the established pattern. Key improvements: - Kept multi-step structure (3 steps) due to complexity but modernized approach - Removed all internal "Continuar" and "Confirmar Pedido" buttons from steps - Removed API calls from wizard steps (should be handled by parent on completion) - Added validate prop to each step with appropriate validation logic: * Step 1: Customer selected OR new customer form filled * Step 2: At least one order item added * Step 3: Delivery date set AND address if delivery/shipping - Real-time data sync with parent wizard using useEffect in all steps - Auto-generation of order_number (ORD-12345678) - Added ALL 72 backend fields from research across 3 steps: Step 1 - Customer Selection: * Customer search and selection with full customer details * Inline new customer creation form * Customer type, phone, email fields Step 2 - Order Items: * Dynamic order item management * Product selection from finished products inventory * Quantity, unit price, special requirements per item * Real-time subtotal and total calculation Step 3 - Delivery & Payment (with Advanced Options): * Required: requestedDeliveryDate, orderNumber * Basic Order: orderType, priority, status * Delivery: deliveryMethod, deliveryAddress, deliveryContactName/Phone, deliveryTimeWindow, deliveryFee * Payment: paymentMethod, paymentTerms, paymentStatus, paymentDueDate * Pricing: discountPercentage, deliveryFee * Production: productionStartDate, productionDueDate, productionBatchNumber, productionNotes * Fulfillment: actualDeliveryDate, pickupLocation, shippingTrackingNumber, shippingCarrier * Source & Channel: orderSource, salesChannel, salesRepId * Communication: customerPurchaseOrder, deliveryInstructions, specialInstructions, internalNotes, customerNotes * Notifications: notifyCustomerOnStatusChange, notifyCustomerOnDelivery, customerNotificationEmail, customerNotificationPhone * Quality: qualityCheckRequired, qualityCheckStatus, packagingInstructions, labelingRequirements * Advanced: isRecurring, recurringSchedule, tags, metadata - Organized 50+ optional fields using AdvancedOptionsSection with logical grouping - Added tooltips for complex fields using existing Tooltip component - Comprehensive order summary before completion - Dynamic form behavior (address field shown only for delivery/shipping)
2025-11-10 09:37:22 +00:00
validate: () => {
return !!(
data.requestedDeliveryDate &&
(data.deliveryMethod === 'pickup' || data.deliveryAddress)
);
},
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
},
];