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:
@@ -17,6 +17,7 @@ import {
|
||||
import { useTenant } from '../../../../stores/tenant.store';
|
||||
import { salesService } from '../../../../api/services/sales';
|
||||
import { inventoryService } from '../../../../api/services/inventory';
|
||||
import { showToast } from '../../../../utils/toast';
|
||||
|
||||
// ========================================
|
||||
// STEP 1: Entry Method Selection
|
||||
@@ -735,10 +736,13 @@ const ReviewStep: React.FC<EntryMethodStepProps> = ({ data, onComplete }) => {
|
||||
}
|
||||
}
|
||||
|
||||
showToast.success('Registro de ventas guardado exitosamente');
|
||||
onComplete();
|
||||
} catch (err: any) {
|
||||
console.error('Error saving sales data:', err);
|
||||
setError(err.response?.data?.detail || 'Error al guardar los datos de ventas');
|
||||
const errorMessage = err.response?.data?.detail || 'Error al guardar los datos de ventas';
|
||||
setError(errorMessage);
|
||||
showToast.error(errorMessage);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user