Training Enrollment
Revision 2.0 (2026-01-23) - Complete feature (all phases implemented, MoM 2026-01-16 improvements)
Feature Summary
Training Enrollment (ส่งรายชื่อผู้อบรม) allows contractors to submit worker lists for safety training sessions. Safety Officers review, optionally partially approve, and finalize enrollments — creating training attendance records automatically.
Related Features
- Worker Registry - Source of worker data for enrollment
- Training Settings - Training schedules, sessions, and approvals dashboard
- Training Info - Contractor view for browsing sessions and initiating enrollment
Key Capabilities
- Select workers from contractor's Worker Registry via dedicated dialog
- Choose available training sessions with capacity tracking
- Form validation with clear error messages before submission
- Worker eligibility checks (blacklist, documents, duplicate enrollment, training status)
- Safety Officer partial approval (can deselect ineligible workers)
- Automatic attendance record creation on approval
- Duplicate enrollment blocking (one pending task per contractor)
- Quick Enroll shortcut from Training Info page
- Auto-navigation to document form based on user role
- Inbox notifications on state transitions
Role Matrix
Revision 2.0 (2026-01-23)
| Action | Admin | Safety Officer | Contractor |
|---|---|---|---|
| Create enrollment task | ❌ | ❌ | ✅ |
| Fill worker list | ❌ | ❌ | ✅ (own tasks) |
| Submit for review | ❌ | ❌ | ✅ (own tasks) |
| Review enrollment | ❌ | ✅ | ❌ |
| Approve (full/partial) | ❌ | ✅ | ❌ |
| Request change | ❌ | ✅ | ❌ |
| Reject enrollment | ❌ | ✅ | ❌ |
| Cancel enrollment | ❌ | ❌ | ✅ (own tasks) |
| Quick Enroll (Training Info) | ❌ | ❌ | ✅ |
Quick Enroll Flow (Training Info)
Contractors can create enrollment tasks directly from the Training Info page:
- Open Training Info (เครื่องมือ > ข้อมูลการอบรม)
- Find an open session with available seats
- Click "ลงทะเบียน" button
- System creates task and redirects to Task Review page
- Fill in worker list and submit
Worker Selection Dialog
When adding workers to the enrollment, a dedicated dialog provides:
| Feature | Description |
|---|---|
| Search | Filter by worker name or ID card number |
| Training Status Chips | Quick filter: ผ่าน, รอการอบรม, ยังไม่ได้อบรม, หมดอายุ, ไม่ผ่าน |
| Multi-Select | Checkboxes for selecting multiple workers |
| Select All | Selects only eligible workers (skips disabled) |
| Auto-Disable | Workers with ผ่าน/รอการอบรม/Blacklisted/Pending status are grayed out |
| Default Filter | Opens with "ยังไม่ได้อบรม" chip selected |
Worker Eligibility
| Training Status | Can Select | Visual |
|---|---|---|
| ยังไม่ได้อบรม (Not trained) | ✅ | Normal row |
| หมดอายุ (Expired) | ✅ | Normal row |
| ไม่ผ่าน (Failed) | ✅ | Normal row |
| ผ่าน (Passed) | ❌ | Grayed out (opacity-50) |
| รอการอบรม (Pending) | ❌ | Grayed out (opacity-50) |
| Blacklisted | ❌ | Red badge, grayed out |
| Pending Approval | ❌ | Orange badge, grayed out |
Validation & Blocking Rules
Form Validation (Contractor Submit)
| Field | Rule | Error Message |
|---|---|---|
| Training Session | Must be selected | "รอบอบรม" |
| Workers | At least 1 selected | "ผู้อบรม (อย่างน้อย 1 คน)" |
Worker Validation (SO Review)
| Check | Severity | Description |
|---|---|---|
| Blacklisted | ❌ Blocking | Worker on blacklist — cannot be approved |
| Already Enrolled | ❌ Blocking | Worker already enrolled in this session |
| Booking Conflict | ❌ Blocking | Worker has enrollment on same day |
| Missing ID Card | ⚠️ Warning | No ID card document uploaded |
| Missing Profile Photo | ⚠️ Warning | No profile photo uploaded |
| Passed Training | ✅ OK | Can enroll for refresher (green background) |
Duplicate Enrollment Block
Only one pending Training Enrollment task is allowed per contractor. Creating a second while one is awaiting approval shows an error message.
Partial Approval (Safety Officer)
Safety Officers can partially approve worker lists during review:
- Open enrollment task in "Review" state
- Workers with validation issues shown with red background (auto-blocked)
- Workers with passed training shown with green background (eligible for refresher)
- SO can deselect additional workers if needed
- Click "อนุมัติ" → Only selected workers are enrolled
Minimum requirement: At least 1 worker must remain selected to approve.
Inbox Notifications
| Trigger | Recipient | Message |
|---|---|---|
| Task submitted for review | Safety Officer | New training enrollment to review |
| Task approved | Contractor | Training enrollment approved |
| Task rejected | Contractor | Training enrollment rejected |
| Task sent back for changes | Contractor | Training enrollment needs changes |
Frontend Architecture
Related Documentation
| Document | Description |
|---|---|
| Workflow Details | States, commands, form permissions |
| Test Cases | Frontend test cases (MoM 2026-01-16) |
| Service Report #008 | Implementation details and test status |
| Training Management | Schedule/session management |