3.4 KiB
3.4 KiB
You are a Senior Full Stack Engineer.
Project: Training Management System (TMS)
Current task: Update Training Type options in Create/Edit Training Record form.
Requirement: Change the training type dropdown options to the approved list below.
New Training Type options:
- อบรมภายใน (Internal Training)
- อบรมภายนอก (Public Training)
- e-Learning / Online Course
- On the Job Training (OJT)
Important constraints:
- Do NOT change folder structure.
- Do NOT migrate ORM unless absolutely necessary.
- Do NOT break existing training records.
- Keep Thai UI.
- Keep responsive/mobile behavior.
- Minimal-impact changes only.
Implementation rules:
- Update training type options used in:
- Create Training Record form
- Edit Training Record form
- Training Record Detail
- HRD Review page
- Training Record table
- Reports export if training type is displayed
- Filter dropdown if training type filter exists
- Internal values should stay in English-friendly constants.
Recommended internal values:
- INTERNAL_TRAINING
- EXTERNAL_TRAINING
- ONLINE_COURSE
- OJT
Display labels:
- อบรมภายใน (Internal Training)
- อบรมภายนอก (Public Training)
- e-Learning / Online Course
- On the Job Training (OJT)
- Backward compatibility:
If old values exist in database, map them safely:
Old value -> New display/value:
- INTERNAL -> INTERNAL_TRAINING
- EXTERNAL -> EXTERNAL_TRAINING
- ONLINE -> ONLINE_COURSE
- ONSITE -> EXTERNAL_TRAINING or keep display as "อบรมภายนอก (Public Training)" unless business rule says otherwise
Do not break old records.
- Validation:
Update Zod schema to allow only the new training type values.
If old records are edited:
- normalize old value to new value before saving if appropriate.
Thai validation message:
- กรุณาเลือกประเภทการอบรม
- Files likely involved:
- src/features/training-records/constants/training-record-options.ts
- src/features/training-records/schemas/training-record.ts
- src/features/training-records/components/training-record-form.tsx
- src/features/training-records/components/training-record-view-page.tsx
- src/features/training-records/components/training-record-review-page.tsx
- src/features/training-records/components/training-record-tables/columns.tsx
- src/constants/thai-labels.ts
- src/features/reports/server/report-data.ts
- src/app/api/training-records/route.ts
- src/app/api/training-records/[id]/route.ts
- Output Review File
Create: docs/management-change-training-type-options-review.md
Include:
- Summary
- Files Changed
- Training Type Options Updated
- Backward Compatibility Mapping
- Validation Rules
- UI Changes
- Report/Filter Impact
- Manual Test Checklist
- Known Limitations
Manual Test Checklist:
- Create form shows only 4 new training type options.
- Edit form shows only 4 new training type options.
- Training detail displays Thai/English label correctly.
- HRD review displays training type correctly.
- Training table displays training type correctly.
- Reports display training type correctly.
- Old INTERNAL value still displays safely.
- Old EXTERNAL value still displays safely.
- Old ONLINE value maps to e-Learning / Online Course.
- Old ONSITE value maps safely.
- Validation blocks empty training type.
- Mobile dropdown works.
Return:
- Complete code changes with file paths.
- Content of docs/management-change-training-type-options-review.md.