4.2 KiB
4.2 KiB
You are a Senior Full Stack Engineer.
Project: Training Management System (TMS)
Current status:
- Sprint 4 is completed.
- Auth.js role mapping is completed.
- Sidebar displays menu by role.
- Employee Training Records module is completed.
- HRD Review Workflow is completed.
Current task: Implement Sprint 5: Employee Import, Master Review, and Thai UI Localization.
Important constraints:
- Do NOT change folder structure.
- Do NOT migrate ORM.
- Do NOT rename database tables.
- Do NOT rename database columns.
- Do NOT rename routes.
- Do NOT rename enum values.
- Use existing Drizzle ORM.
- Use existing Auth.js.
- Reuse existing UI components.
- Make minimal-impact changes only.
Part 1: Employee Import
Route:
- /dashboard/import-employees
Requirements:
- HRD can upload Excel (.xlsx).
- HRD can download import template.
- Validate imported rows.
- Import employee records.
- Show import result summary.
Import fields:
- Employee Code
- Employee Name
- Company
- Department
- Position
- Status
Thai template headers:
- รหัสพนักงาน
- ชื่อพนักงาน
- อีเมล
- บริษัท
- แผนก
- ตำแหน่ง
- สถานะ
Part 2: Master Review
Route:
- /dashboard/master-review
Requirements:
- Show pending companies.
- Show pending departments.
- Show pending positions.
- HRD can approve or reject pending master records.
- Approved records become active master data.
Thai labels:
- รอตรวจสอบข้อมูลหลัก
- บริษัท
- แผนก
- ตำแหน่ง
- อนุมัติ
- ไม่อนุมัติ
Part 3: Thai UI Localization
Convert all visible UI text to Thai across the existing TMS system.
Scope:
- Sidebar menu labels
- Page titles
- Form labels
- Table headers
- Buttons
- Status badges
- Toast messages
- Validation messages
- Empty states
- Loading states
- Error states
- Dashboard cards
- Export headers
- Import template headers
Important: Keep internal values in English.
Examples:
- PENDING_REVIEW should display as "รอตรวจสอบ"
- APPROVED should display as "อนุมัติแล้ว"
- REJECTED should display as "ไม่อนุมัติ"
- ONLINE should display as "ออนไลน์"
- ONSITE should display as "อบรม ณ สถานที่"
- INTERNAL should display as "ภายในองค์กร"
- EXTERNAL should display as "ภายนอกองค์กร"
- K should display as "Knowledge (ความรู้)"
- S should display as "Skill (ทักษะ)"
- A should display as "Attitude (ทัศนคติ)"
Recommended approach:
- Create or update a central label mapping file, for example: src/constants/thai-labels.ts
- Reuse label helper functions across modules:
- getTrainingStatusLabel()
- getTrainingTypeLabel()
- getTrainingCategoryLabel()
- getRoleLabel()
- Avoid hardcoding repeated Thai labels in multiple files.
Part 4: Output Review File
Create:
docs/sprint-5-employee-import-master-review-thai-localization.md
The review file must include:
- Summary
- Files changed
- Database changes
- Routes added
- Thai localization changes
- Label mapping added
- Import template format
- Validation rules
- Permission rules
- Manual test checklist
- Known limitations
- Next recommended sprint
Manual test checklist must include:
- HRD can open Employee Import page.
- Employee cannot open Employee Import page.
- HRD can download Thai Excel template.
- HRD can upload employee Excel.
- System validates required fields.
- System shows import result in Thai.
- New company/department/position becomes pending master review.
- HRD can open Master Review page.
- HRD can approve pending master data.
- HRD can reject pending master data.
- Sidebar menu is displayed in Thai.
- Training status badges are displayed in Thai.
- Training type labels are displayed in Thai.
- Form validation messages are displayed in Thai.
- Toast messages are displayed in Thai.
- Dashboard labels are displayed in Thai.
- Existing routes still work.
Return:
- Complete code changes with file paths.
- Content of docs/sprint-5-employee-import-master-review-thai-localization.md.
- Any migration command if required.