Training Enrollment - Implementation Overview
Last Updated: 2026-01-04 Status: Phase 3 Complete - Phase 4 Blocked
Feature Summary
Training Enrollment allows contractors to submit worker lists for safety training sessions. Safety Officers review and approve enrollments, creating training attendance records.
Related Features
- Worker Registry - Source of worker data for enrollment
- Training Settings - Training schedules, sessions, and approvals dashboard
Key Capabilities
- Select workers from contractor's Worker Registry
- Choose available training sessions with capacity tracking
- Safety Officer approval workflow
- Automatic attendance record creation on approval
Implementation Roadmap
Phase Details
Phase 1: Seed Data Enhancement ✅
Status: Completed Objective: Provide test data for development
| Deliverable | Description |
|---|---|
| Training Schedules | Added "Generic Safety Training" schedule |
| Training Sessions | 8 sessions for Jan-Feb 2026 |
| Waitlist Testing | 1 full session for waitlist scenario |
Phase 2: Session & Worker Data Integration ✅
Status: Complete Objective: Connect form to real backend data
| Sub-Phase | Status | Description |
|---|---|---|
| 2.1 Sessions Endpoint | ✅ | Enhanced DTO with schedule details |
| 2.2 Workers Endpoint | ✅ | GET /api/workers/contractor/{id}/enrollment |
| 2.3 Frontend Service | ✅ | training-enrollment.service.ts |
| 2.4 Form Component | ✅ | UI with session dropdown, worker table |
Phase 3: Pre-Approval Validation ✅
Status: Complete Objective: Validate enrollment before SO approval
| Validation Rule | Status | Description |
|---|---|---|
| Blacklist Check | ✅ | No blacklisted workers (shown with warning) |
| Document Check | ✅ | ID card + profile photo status visible |
| Duplicate Check | ✅ | System prevents duplicate enrollments |
| Session Check | ✅ | Session availability verified |
| Attachments View | ✅ | View all worker attachments from popup |
Phase 4: Change Request & Rejection Reasons ⚠️
Status: Blocked - Infinite Loop Issue Objective: Structured reasons for workflow actions
Adding reason dropdown causes infinite loop (1726 errors) due to Signal cascading with Zoneless Angular + Material Dialog. Commands work without reasons, but fail when dropdown is added.
| Action | Preset Reasons (Planned) |
|---|---|
| Request Change | Documents incomplete, Blacklisted worker, Session full, Duplicate enrollment |
| Reject | Not authorized, No project, Policy violations |
Phase 5: Database Integration ❌
Status: Pending Objective: Proper database updates on approval
Phase 6: Document Generation (PDF) ❌
Status: Pending Objective: Generate approval document with QuestPDF
| Document Element | Description |
|---|---|
| Header | Logo, reference number, date |
| Training Info | Schedule, date, time, location |
| Worker List | Name, ID card for each selected worker |
| Signature | Approver signature block |
| QR Code | Link to task for verification |
Phase 7: Testing & Documentation ❌
Status: Pending Objective: Comprehensive testing and documentation
| Test Type | Location |
|---|---|
| HTTP Tests | backend/tests/http/training-enrollment/ |
| E2E Tests | frontend/e2e/features/training-enrollment.spec.ts |
| Feature Docs | This page + workflow documentation |
Workflow Overview
Related Documentation
| Document | Description |
|---|---|
| Workflow Details | States, commands, form fields |
Detailed technical plan is in .claude/plans/training-enrollment-implementation.md (codebase only)
Progress Summary
| Phase | Description | Status |
|---|---|---|
| 1 | Seed Data Enhancement | ✅ Complete |
| 2 | Session & Worker Data Integration | ✅ Complete |
| 3 | Pre-Approval Validation | ✅ Complete |
| 4 | Change Request & Rejection Reasons | ⚠️ Blocked |
| 5 | Database Integration & Approval Processing | ❌ Pending |
| 6 | Document Generation (PDF) | ❌ Pending |
| 7 | Testing & Documentation | ❌ Pending |
Overall Progress: 3 / 7 phases (~43%) - Phase 4 blocked by infinite loop issue