diff --git a/frontend/src/components/domain/unified-wizard/wizards/CustomerOrderWizard.tsx b/frontend/src/components/domain/unified-wizard/wizards/CustomerOrderWizard.tsx index dc81cf57..d69c77b7 100644 --- a/frontend/src/components/domain/unified-wizard/wizards/CustomerOrderWizard.tsx +++ b/frontend/src/components/domain/unified-wizard/wizards/CustomerOrderWizard.tsx @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; +import { useTranslation } from 'react-i18next'; import { WizardStep, WizardStepProps } from '../../../ui/WizardModal/WizardModal'; import { AdvancedOptionsSection } from '../../../ui/AdvancedOptionsSection'; import Tooltip from '../../../ui/Tooltip/Tooltip'; @@ -27,6 +28,7 @@ interface WizardDataProps extends WizardStepProps { // Step 1: Customer Selection const CustomerSelectionStep: React.FC = ({ data, onDataChange }) => { + const { t } = useTranslation('wizards'); const { currentTenant } = useTenant(); const [searchQuery, setSearchQuery] = useState(''); const [showNewCustomerForm, setShowNewCustomerForm] = useState(false); @@ -85,7 +87,7 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange } setCustomers(result); } catch (err: any) { console.error('Error loading customers:', err); - setError('Error loading customers'); + setError(t('customerOrder.messages.errorLoadingCustomers')); } finally { setLoading(false); } @@ -104,10 +106,10 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange }

- Select Customer + {t('customerOrder.customerSelection.title')}

- Search for an existing customer or create a new one + {t('customerOrder.customerSelection.subtitle')}

@@ -120,7 +122,7 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange } {loading ? (
- Loading customers... + {t('customerOrder.messages.loadingCustomers')}
) : !showNewCustomerForm ? ( <> @@ -131,7 +133,7 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange } type="text" value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} - placeholder="Search customer by name..." + placeholder={t('customerOrder.customerSelection.searchPlaceholder')} 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)]" /> @@ -141,8 +143,8 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange } {filteredCustomers.length === 0 ? (
-

No customers found

-

Try a different search term

+

{t('customerOrder.messages.noCustomersFound')}

+

{t('customerOrder.messages.tryDifferentSearch')}

) : ( filteredCustomers.map((customer) => ( @@ -186,7 +188,7 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange } ? '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' }`}> - {customer.customer_type} + {t(`customerOrder.customerTypes.${customer.customer_type}`)} {customer.phone && 📱 {customer.phone}} @@ -203,7 +205,7 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange } 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" > - Create new customer + {t('customerOrder.customerSelection.createNew')} ) : ( @@ -212,61 +214,61 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange }

- New Customer + {t('customerOrder.messages.newCustomerHeader')}

handleNewCustomerChange({ name: e.target.value })} - placeholder="E.g., The Mill Restaurant" + placeholder={t('customerOrder.customerSelection.customerNamePlaceholder')} 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)]" />
handleNewCustomerChange({ phone: e.target.value })} - placeholder="+34 123 456 789" + placeholder={t('customerOrder.customerSelection.phonePlaceholder')} 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)]" />
handleNewCustomerChange({ email: e.target.value })} - placeholder="contact@restaurant.com" + placeholder={t('customerOrder.customerSelection.emailPlaceholder')} 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)]" />
@@ -276,7 +278,7 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange } onClick={() => handleCustomerChange(selectedCustomer, false)} className="mt-4 text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]" > - ← Back to customer list + ← {t('customerOrder.customerSelection.backToList')}
@@ -287,6 +289,7 @@ const CustomerSelectionStep: React.FC = ({ data, onDataChange } // Step 2: Order Items const OrderItemsStep: React.FC = ({ data, onDataChange }) => { + const { t } = useTranslation('wizards'); const { currentTenant } = useTenant(); const [orderItems, setOrderItems] = useState(data.orderItems || []); const [products, setProducts] = useState([]); @@ -318,7 +321,7 @@ const OrderItemsStep: React.FC = ({ data, onDataChange }) => { setProducts(finishedProducts); } catch (err: any) { console.error('Error loading products:', err); - setError('Error loading products'); + setError(t('customerOrder.messages.errorLoadingProducts')); } finally { setLoading(false); } @@ -377,10 +380,10 @@ const OrderItemsStep: React.FC = ({ data, onDataChange }) => {

- Order Items + {t('customerOrder.orderItems.title')}

- Customer: {data.customer?.name || 'New Customer'} + {t('customerOrder.orderItems.customer')}: {data.customer?.name || t('customerOrder.messages.newCustomer')}

@@ -393,29 +396,29 @@ const OrderItemsStep: React.FC = ({ data, onDataChange }) => { {loading ? (
- Loading products... + {t('customerOrder.messages.loadingProducts')}
) : ( <>
{orderItems.length === 0 ? (
-

No products in order

-

Click "Add Product" to start

+

{t('customerOrder.messages.noProductsInOrder')}

+

{t('customerOrder.messages.clickAddProduct')}

) : (
@@ -426,7 +429,7 @@ const OrderItemsStep: React.FC = ({ data, onDataChange }) => { >
- Product #{index + 1} + {t('customerOrder.orderItems.productNumber', { number: index + 1 })}
@@ -762,12 +766,12 @@ const DeliveryPaymentStep: React.FC = ({ data, onDataChange })