feat: Add toast notifications to all wizards

- Imported showToast utility from react-hot-toast wrapper
- Added success toast after successful API calls in all 7 wizards
- Added error toast on API failures for better user feedback
- Replaced silent errors with user-visible toast notifications

Wizards updated:
- CustomerWizard: Toast on customer creation
- EquipmentWizard: Toast on equipment creation
- QualityTemplateWizard: Toast on template creation
- SupplierWizard: Toast on supplier + price list creation
- RecipeWizard: Toast on recipe creation
- SalesEntryWizard: Toast on sales record creation
- CustomerOrderWizard: Toast on customer + order creation

This completes the toast notification implementation (High Priority item).
Users now get immediate visual feedback on success/failure instead of
relying on console.log or error state alone.
This commit is contained in:
Claude
2025-11-09 21:22:41 +00:00
parent c3a580905f
commit 9adc9725fd
8 changed files with 418 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ import { Building2, Package, Euro, CheckCircle2, Phone, Mail, Loader2, AlertCirc
import { useTenant } from '../../../../stores/tenant.store';
import { suppliersService } from '../../../../api/services/suppliers';
import { inventoryService } from '../../../../api/services/inventory';
import { showToast } from '../../../../utils/toast';
interface WizardDataProps extends WizardStepProps {
data: Record<string, any>;
@@ -260,11 +261,14 @@ const ProductsPricingStep: React.FC<WizardDataProps> = ({ data, onDataChange, on
});
}
showToast.success('Proveedor creado exitosamente');
onDataChange({ ...data, products });
onComplete();
} catch (err: any) {
console.error('Error saving supplier:', err);
setError(err.response?.data?.detail || 'Error al guardar el proveedor');
const errorMessage = err.response?.data?.detail || 'Error al guardar el proveedor';
setError(errorMessage);
showToast.error(errorMessage);
} finally {
setSaving(false);
}