Training Enrollments (التسجيلات)
Enroll employees in training sessions and track attendance, completion, scores, and feedback.
Attributes
| Field | Type | Description |
|---|---|---|
id | integer | Primary key |
training_session_id | integer | Session FK |
employee_id | integer | Employee FK |
status | enum | enrolled, attended, completed, cancelled, no_show |
attendance_confirmed | boolean | Attendance confirmed |
score | decimal | Assessment score (nullable) |
feedback | text | Employee feedback (nullable) |
enrolled_at | datetime | Enrollment timestamp |
completed_at | datetime | Completion timestamp (nullable) |
API Endpoints
| Method | URL | Description |
|---|---|---|
GET | /api/hr/training-enrollments | List enrollments |
POST | /api/hr/training-enrollments | Enroll employee |
PUT | /api/hr/training-enrollments/{id} | Update enrollment (mark attended, score, etc.) |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
training_session_id | integer | Filter by session |
employee_id | integer | Filter by employee |
status | string | Filter by status |
Examples
bash
# Enroll employee
curl -X POST "https://moon-erp.elbaset.com/api/hr/training-enrollments" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"training_session_id": 1,
"employee_id": 5
}'
# Mark as completed with score
curl -X PUT "https://moon-erp.elbaset.com/api/hr/training-enrollments/1" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"status": "completed",
"attendance_confirmed": true,
"score": 92.5,
"feedback": "Excellent training program"
}'dart
// Enroll
final response = await dio.post('/api/hr/training-enrollments', data: {
'training_session_id': 1,
'employee_id': 5,
});
// Mark completed
await dio.put('/api/hr/training-enrollments/1', data: {
'status': 'completed',
'attendance_confirmed': true,
'score': 92.5,
});Business Rules
- Cannot enroll the same employee in the same session twice
- Enrollment respects
max_participantson the session enrolled_atis auto-set on creationcompleted_atis auto-set when status transitions tocompleted