commit
This commit is contained in:
233
plans/change-employee-training-overview.md
Normal file
233
plans/change-employee-training-overview.md
Normal file
@@ -0,0 +1,233 @@
|
||||
You are a Senior Full Stack Engineer.
|
||||
|
||||
Project:
|
||||
Training Management System (TMS)
|
||||
|
||||
Current task:
|
||||
Transform the Employees/Users page into an employee training overview page.
|
||||
|
||||
Requirement:
|
||||
The "พนักงาน" menu should be used to view employee information, training history summary, and training hour progress, not only user account management.
|
||||
|
||||
Important constraints:
|
||||
|
||||
- Do NOT delete existing users route unless necessary.
|
||||
- Do NOT remove user management permissions.
|
||||
- Do NOT change database schema unless absolutely necessary.
|
||||
- Reuse existing users/employees page.
|
||||
- Reuse existing training records queries.
|
||||
- Reuse existing Training Policy and employee-specific K/S/A target logic if available.
|
||||
- Keep Thai UI.
|
||||
- Keep responsive/mobile behavior.
|
||||
- Minimal-impact changes only.
|
||||
|
||||
Part 1: Page Purpose
|
||||
|
||||
Update the Employees/Users page to show employee training overview.
|
||||
|
||||
Page title:
|
||||
|
||||
- พนักงาน
|
||||
|
||||
Description:
|
||||
|
||||
- ดูข้อมูลพนักงาน ประวัติการอบรม และจำนวนชั่วโมงการอบรม
|
||||
|
||||
Part 2: Table Columns
|
||||
|
||||
Replace or adjust current table columns to:
|
||||
|
||||
1. รหัสพนักงาน
|
||||
2. ชื่อพนักงาน
|
||||
3. แผนก
|
||||
4. ตำแหน่ง
|
||||
5. ชั่วโมงอนุมัติ
|
||||
6. ชั่วโมงรอตรวจสอบ
|
||||
7. ชั่วโมงไม่อนุมัติ
|
||||
8. เป้าหมายชั่วโมง
|
||||
9. ความคืบหน้า
|
||||
10. สถานะ
|
||||
|
||||
Status logic:
|
||||
|
||||
- ผ่านเกณฑ์
|
||||
- ยังไม่ผ่านเกณฑ์
|
||||
|
||||
Progress logic:
|
||||
approvedHours / targetHours \* 100
|
||||
|
||||
If target is missing:
|
||||
|
||||
- use Training Policy default
|
||||
|
||||
If both employee target and policy missing:
|
||||
|
||||
- show "-"
|
||||
|
||||
Part 3: Search
|
||||
|
||||
Search should support:
|
||||
|
||||
- employeeCode
|
||||
- employeeName
|
||||
- email
|
||||
- department
|
||||
- position
|
||||
|
||||
Search placeholder:
|
||||
|
||||
- ค้นหาด้วยรหัสพนักงาน ชื่อ แผนก หรือตำแหน่ง...
|
||||
|
||||
Part 4: Filters
|
||||
|
||||
Add filters if existing pattern supports:
|
||||
|
||||
- แผนก
|
||||
- สถานะผ่านเกณฑ์
|
||||
- ปี
|
||||
|
||||
Part 5: Employee Detail
|
||||
|
||||
When HRD clicks an employee row or action button:
|
||||
|
||||
Route:
|
||||
|
||||
- /dashboard/users/[id]
|
||||
or existing detail route
|
||||
|
||||
Show employee detail page with:
|
||||
|
||||
1. Employee profile summary
|
||||
|
||||
- รหัสพนักงาน
|
||||
- ชื่อพนักงาน
|
||||
- อีเมล
|
||||
- แผนก
|
||||
- ตำแหน่ง
|
||||
- สถานะ
|
||||
|
||||
2. Training summary
|
||||
|
||||
- ชั่วโมงอนุมัติ
|
||||
- ชั่วโมงรอตรวจสอบ
|
||||
- ชั่วโมงไม่อนุมัติ
|
||||
- เป้าหมายรวม
|
||||
- ความคืบหน้า
|
||||
|
||||
3. K/S/A summary
|
||||
|
||||
- K approved / K target
|
||||
- S approved / S target
|
||||
- A approved / A target
|
||||
|
||||
4. Training history table
|
||||
|
||||
- วันที่อบรม
|
||||
- ชื่อหลักสูตร
|
||||
- ประเภทการอบรม
|
||||
- ชั่วโมง
|
||||
- สถานะ
|
||||
- ไฟล์เกียรติบัตร
|
||||
|
||||
Part 6: Actions
|
||||
|
||||
Keep existing buttons:
|
||||
|
||||
- เพิ่มพนักงาน
|
||||
- นำเข้าพนักงาน
|
||||
|
||||
But page should feel like HRD employee training overview.
|
||||
|
||||
Part 7: Permissions
|
||||
|
||||
HRD/Admin:
|
||||
|
||||
- can view all employees
|
||||
- can view employee training summary
|
||||
- can access employee detail
|
||||
|
||||
Employee:
|
||||
|
||||
- should not access all employee list
|
||||
- employee uses own dashboard/training records instead
|
||||
|
||||
Part 8: Performance
|
||||
|
||||
Use database aggregation:
|
||||
|
||||
- SUM approved hours
|
||||
- SUM pending hours
|
||||
- SUM rejected hours
|
||||
- GROUP BY employee
|
||||
|
||||
Avoid loading all training records and reducing in memory.
|
||||
|
||||
Part 9: Responsive
|
||||
|
||||
Desktop:
|
||||
|
||||
- Table can show all columns.
|
||||
|
||||
Mobile/tablet:
|
||||
|
||||
- Table must stay inside horizontal scroll container.
|
||||
- No page-level overflow.
|
||||
- Keep employee code/name/progress visible.
|
||||
|
||||
Part 10: Files likely involved
|
||||
|
||||
- src/app/dashboard/users/page.tsx
|
||||
- src/app/dashboard/users/[id]/page.tsx if exists
|
||||
- src/features/users/server/user-data.ts
|
||||
- src/features/users/components/users-table.tsx
|
||||
- src/features/users/components/users-columns.tsx
|
||||
- src/features/users/api/types.ts
|
||||
- src/features/training-records/server/training-record-data.ts
|
||||
- src/features/overview/server/overview-data.ts if reusable target logic exists
|
||||
- src/features/reports/server/report-data.ts if reusable aggregation exists
|
||||
|
||||
Part 11: Output Review File
|
||||
|
||||
Create:
|
||||
docs/management-change-employee-training-overview-review.md
|
||||
|
||||
Include:
|
||||
|
||||
1. Summary
|
||||
2. Files Changed
|
||||
3. Page Purpose Changes
|
||||
4. Table Columns Changed
|
||||
5. Search/Filter Changes
|
||||
6. Employee Detail Changes
|
||||
7. Training Hours Calculation
|
||||
8. Target/Progress Logic
|
||||
9. Permission Rules
|
||||
10. Responsive Notes
|
||||
11. Manual Test Checklist
|
||||
12. Known Limitations
|
||||
|
||||
Manual Test Checklist:
|
||||
|
||||
- HRD opens พนักงาน page.
|
||||
- Page shows employee training overview.
|
||||
- Employee code displays.
|
||||
- Approved hours display correctly.
|
||||
- Pending hours display correctly.
|
||||
- Rejected hours display correctly.
|
||||
- Target hours display correctly.
|
||||
- Progress percentage displays correctly.
|
||||
- Pass/fail status displays correctly.
|
||||
- Search by employee code works.
|
||||
- Search by name works.
|
||||
- Search by department works.
|
||||
- Import employee button still works.
|
||||
- Add user button still works if required.
|
||||
- Employee detail page shows training history.
|
||||
- Employee user cannot access all employee list.
|
||||
- Table does not break responsive layout.
|
||||
- Mobile layout works.
|
||||
|
||||
Return:
|
||||
|
||||
- Complete code changes with file paths.
|
||||
- Content of docs/management-change-employee-training-overview-review.md.
|
||||
Reference in New Issue
Block a user