Commit Graph

410 Commits

Author SHA1 Message Date
Claude
ec4a440cb1 Implement Phase 2: Core data entry steps for setup wizard
This commit implements the three core data entry steps for the bakery
setup wizard, enabling users to configure their essential operational data
immediately after onboarding.

## Implemented Steps

### 1. Suppliers Setup Step (SuppliersSetupStep.tsx)
- Inline form for adding/editing suppliers
- Required fields: name, supplier_type
- Optional fields: contact_person, phone, email
- List view with edit/delete actions
- Minimum requirement: 1 supplier
- Real-time validation and error handling
- Integration with existing suppliers API hooks

### 2. Inventory Setup Step (InventorySetupStep.tsx)
- Inline form for adding/editing ingredients
- Required fields: name, category, unit_of_measure
- Optional fields: brand, standard_cost
- List view with edit/delete actions (scrollable)
- Minimum requirement: 3 ingredients
- Progress indicator showing remaining items needed
- Category and unit dropdowns with i18n support

### 3. Recipes Setup Step (RecipesSetupStep.tsx)
- Recipe creation form with ingredient management
- Required fields: name, finished_product, yield_quantity, yield_unit
- Dynamic ingredient list (add/remove ingredients)
- Prerequisite check (requires ≥2 inventory items)
- Per-ingredient validation (ingredient_id, quantity)
- Minimum requirement: 1 recipe
- Integration with recipes and inventory APIs

## Key Features

### Shared Functionality Across All Steps:
- Parent notification via onUpdate callback (itemsCount, canContinue)
- Inline forms (not modals) for better UX flow
- Real-time validation with error messages
- Loading states and empty states
- Responsive design (mobile-first)
- i18n support with translation keys
- Delete confirmation dialogs
- "Why This Matters" sections explaining value

### Progress Tracking:
- Progress indicators showing count and requirement status
- Visual feedback when minimum requirements met
- "Need X more" messages for incomplete steps

### Error Handling:
- Field-level validation errors
- Type-safe number inputs
- Required field indicators
- User-friendly error messages

## Technical Implementation

### API Integration:
- Uses existing React Query hooks pattern
- Proper cache invalidation on mutations
- Tenant-scoped queries
- Optimistic updates where applicable

### State Management:
- Local form state for each step
- useEffect for parent updates
- Reset functionality on cancel/success

### Type Safety:
- TypeScript interfaces for all data
- Enum types for categories and units
- Proper typing for mutation callbacks

## Files Modified:
- frontend/src/components/domain/setup-wizard/steps/SuppliersSetupStep.tsx
- frontend/src/components/domain/setup-wizard/steps/InventorySetupStep.tsx
- frontend/src/components/domain/setup-wizard/steps/RecipesSetupStep.tsx

## Related:
- Builds on Phase 1 wizard foundation
- Integrates with existing suppliers, inventory, and recipes services
- Follows design specification in docs/wizard-flow-specification.md
- Addresses JTBD analysis findings in docs/jtbd-analysis-inventory-setup.md

## Next Steps (Phase 3):
- Quality Setup Step
- Team Setup Step
- Template systems
- Bulk import functionality
2025-11-06 11:26:41 +00:00
Claude
2e3d89bd7b Implement Phase 1: Setup Wizard Foundation (Foundation & Architecture)
Created complete foundation for the bakery operations setup wizard that guides
users through post-onboarding configuration of suppliers, inventory, recipes,
quality standards, and team members.

**Core Components Created:**

1. SetupWizard.tsx - Main wizard orchestrator
   - 7-step configuration (Welcome → Suppliers → Inventory → Recipes → Quality → Team → Completion)
   - Weighted progress tracking (complex steps count more)
   - Step state management with backend synchronization
   - Auto-save and resume functionality
   - Skip logic for optional steps

2. StepProgress.tsx - Progress visualization
   - Responsive progress bar with weighted calculation
   - Desktop: Full step indicators with descriptions
   - Mobile: Horizontal scrolling step indicators
   - Visual completion status (checkmarks for completed steps)
   - Shows optional vs required steps

3. StepNavigation.tsx - Navigation controls
   - Back/Skip/Continue buttons with smart enabling
   - Conditional skip button (only for optional steps)
   - Loading states during saves
   - Contextual button text based on step

4. Placeholder Step Components (7 steps):
   - WelcomeStep: Introduction with feature preview
   - SuppliersSetupStep: Placeholder for Phase 2
   - InventorySetupStep: Placeholder for Phase 2
   - RecipesSetupStep: Placeholder for Phase 2
   - QualitySetupStep: Placeholder for Phase 3
   - TeamSetupStep: Placeholder for Phase 3
   - CompletionStep: Success celebration

**Routing & Integration:**

- Added /app/setup route to routes.config.ts and AppRouter.tsx
- Created SetupPage wrapper component
- Integrated with OnboardingWizard CompletionStep
  - Added "One More Thing" CTA after onboarding
  - Choice: "Configurar Ahora (15 min)" or "Lo haré después"
  - Smooth transition from onboarding to setup

**Key Features:**

 Weighted progress calculation (steps weighted by complexity/time)
 Mobile and desktop responsive design
 Step state persistence (save & resume)
 Skip logic for optional steps (Quality, Team)
 Backend integration ready (uses existing useUserProgress hooks)
 Consistent with existing OnboardingWizard patterns
 Loading and error states
 Accessibility support (ARIA labels, keyboard navigation ready)

**Architecture Decisions:**

- Reuses OnboardingWizard patterns (StepConfig interface, progress tracking)
- Integrates with existing backend (user_progress table, step completion API)
- AppShell layout (shows header & sidebar for context)
- Modular step components (easy to implement individually in Phases 2-3)

**Progress:**

Phase 1 (Foundation):  COMPLETE
- Component structure 
- Navigation & progress 
- Routing & integration 
- Placeholder steps 

Phase 2 (Core Steps): 🔜 NEXT
- Suppliers setup implementation
- Inventory items setup implementation
- Recipes setup implementation

Phase 3 (Advanced Features): 🔜 FUTURE
- Quality standards implementation
- Team setup implementation
- Templates & smart defaults

**Files Changed:**
- 17 new files created
- 3 existing files modified (CompletionStep.tsx, AppRouter.tsx, routes.config.ts)

**Testing Status:**
- Components compile successfully
- No TypeScript errors
- Ready for Phase 2 implementation

Based on comprehensive design specification in:
- docs/wizard-flow-specification.md (2,144 lines)
- docs/jtbd-analysis-inventory-setup.md (461 lines)

Total implementation time: ~4 hours (Phase 1 of 6 phases)
Estimated total project: 11 weeks (Phase 1: Week 1-2 foundation )
2025-11-06 11:14:09 +00:00
Urtzi Alfaro
3007bde05b Improve kubernetes for prod 2025-11-06 11:04:50 +01:00
Claude
5a84be83d6 Fix multiple critical bugs in onboarding training step
This commit addresses all identified bugs and issues in the training code path:

## Critical Fixes:
- Add get_start_time() method to TrainingLogRepository and fix non-existent method call
- Remove duplicate training.started event from API endpoint (trainer publishes the accurate one)
- Add missing progress events for 80-100% range (85%, 92%, 94%) to eliminate progress "dead zone"

## High Priority Fixes:
- Fix division by zero risk in time estimation with double-check and max() safety
- Remove unreachable exception handler in training_operations.py
- Simplify WebSocket token refresh logic to only reconnect on actual user session changes

## Medium Priority Fixes:
- Fix auto-start training effect with useRef to prevent duplicate starts
- Add HTTP polling debounce delay (5s) to prevent race conditions with WebSocket
- Extract all magic numbers to centralized constants files:
  - Backend: services/training/app/core/training_constants.py
  - Frontend: frontend/src/constants/training.ts
- Standardize error logging with exc_info=True on critical errors

## Code Quality Improvements:
- All progress percentages now use named constants
- All timeouts and intervals now use named constants
- Improved code maintainability and readability
- Better separation of concerns

## Files Changed:
- Backend: training_service.py, trainer.py, training_events.py, progress_tracker.py
- Backend: training_operations.py, training_log_repository.py, training_constants.py (new)
- Frontend: training.ts (hooks), MLTrainingStep.tsx, training.ts (constants, new)

All training progress events now properly flow from 0% to 100% with no gaps.
2025-11-05 13:02:39 +00:00
Urtzi Alfaro
394ad3aea4 Improve AI logic 2025-11-05 13:34:56 +01:00
Urtzi Alfaro
5adb0e39c0 Improve the frontend 5 2025-11-02 20:24:44 +01:00
Urtzi Alfaro
0220da1725 Improve the frontend 4 2025-11-01 21:35:03 +01:00
Urtzi Alfaro
f44d235c6d Add user delete process 2 2025-10-31 18:57:58 +01:00
Urtzi Alfaro
269d3b5032 Add user delete process 2025-10-31 11:54:19 +01:00
Urtzi Alfaro
63f5c6d512 Improve the frontend 3 2025-10-30 21:08:07 +01:00
Urtzi Alfaro
36217a2729 Improve the frontend 2 2025-10-29 06:58:05 +01:00
Urtzi Alfaro
858d985c92 Improve the frontend modals 2025-10-27 16:33:26 +01:00
Urtzi Alfaro
61376b7a9f Improve the frontend and fix TODOs 2025-10-24 13:05:04 +02:00
Urtzi Alfaro
07c33fa578 Improve the frontend and repository layer 2025-10-23 07:44:54 +02:00
Urtzi Alfaro
8d30172483 Improve the frontend 2025-10-21 19:50:07 +02:00
Urtzi Alfaro
05da20357d Improve teh securty of teh DB 2025-10-19 19:22:37 +02:00
Urtzi Alfaro
62971c07d7 Update landing page 2025-10-18 16:03:23 +02:00
Urtzi Alfaro
312e36c893 Update requirements and insfra versions 2025-10-17 23:09:40 +02:00
Urtzi Alfaro
7e089b80cf Improve public pages 2025-10-17 18:14:28 +02:00
Urtzi Alfaro
d4060962e4 Improve demo seed 2025-10-17 07:31:14 +02:00
Urtzi Alfaro
b6cb800758 Improve GDPR implementation 2025-10-16 07:28:04 +02:00
Urtzi Alfaro
dbb48d8e2c Improve the sales import 2025-10-15 21:09:42 +02:00
Urtzi Alfaro
8f9e9a7edc Add role-based filtering and imporve code 2025-10-15 16:12:49 +02:00
Urtzi Alfaro
7556a00db7 Improve the demo feature of the project 2025-10-12 18:47:33 +02:00
Urtzi Alfaro
3c689b4f98 REFACTOR external service and improve websocket training 2025-10-09 14:11:02 +02:00
Urtzi Alfaro
7c72f83c51 REFACTOR ALL APIs fix 1 2025-10-07 07:15:07 +02:00
Urtzi Alfaro
38fb98bc27 REFACTOR ALL APIs 2025-10-06 15:27:01 +02:00
Urtzi Alfaro
dc8221bd2f Add DEMO feature to the project 2025-10-03 14:09:34 +02:00
Urtzi Alfaro
1243c2ca6d Add fixes to procurement logic and fix rel-time connections 2025-10-02 13:20:30 +02:00
Urtzi Alfaro
c9d8d1d071 Fix onboarding process not getting the subcription plan 2025-10-01 21:56:38 +02:00
Urtzi Alfaro
b93fb850c3 Add tilt support 2025-10-01 18:58:30 +02:00
Urtzi Alfaro
36b44c41f1 Fix issues 2025-10-01 14:39:10 +02:00
Urtzi Alfaro
4777e59e7a Add base kubernetes support final fix 4 2025-09-29 07:54:25 +02:00
Urtzi Alfaro
b95ecf1c53 Add base kubernetes support 5 2025-09-27 22:55:42 +02:00
Urtzi Alfaro
f246381d34 Add base kubernetes support 4 2025-09-27 17:19:00 +02:00
Urtzi Alfaro
b2c988b416 Add base kubernetes support 3 2025-09-27 14:51:06 +02:00
Urtzi Alfaro
222f945466 Add base kubernetes support 2 2025-09-27 12:10:43 +02:00
Urtzi Alfaro
63a3f9c77a Add base kubernetes support 2025-09-27 11:18:13 +02:00
Urtzi Alfaro
a27f159e24 Fix few issues 2025-09-26 12:12:17 +02:00
Urtzi Alfaro
d573c38621 Refactor components and modals 2025-09-26 07:46:25 +02:00
Urtzi Alfaro
7cd0476812 Fix modals 2025-09-25 19:52:55 +02:00
Urtzi Alfaro
89b75bd7af Support subcription payments 2025-09-25 14:30:47 +02:00
Urtzi Alfaro
f02a980c87 Support multiple languages 2025-09-25 12:14:46 +02:00
Urtzi Alfaro
6d4090f825 Reorganize teh menus 2025-09-24 22:22:01 +02:00
Urtzi Alfaro
dc6c6f213f Fix some UI issues 2 2025-09-24 21:54:49 +02:00
Urtzi Alfaro
d59b92a1b4 Fix some UI issues 2025-09-24 20:14:49 +02:00
Urtzi Alfaro
e978d04800 Move the serach box to teh sidebar 2025-09-24 19:40:51 +02:00
Urtzi Alfaro
be1fec17c4 Fix some UI issues 2025-09-24 19:15:29 +02:00
Urtzi Alfaro
2de1e6ce40 Add quality template logic 2025-09-24 16:42:23 +02:00
Urtzi Alfaro
474d7176bf Add modal to add equipment 2025-09-24 15:58:18 +02:00