4.3 KiB
4.3 KiB
Summary
Added a new HRD-only submenu รายชื่อพนักงานทั้งหมด under ข้อมูลหลัก while keeping the existing พนักงาน menu and route unchanged. The new page provides a searchable employee directory and a protected employee detail page with training-hour and K/S/A summaries.
Files Changed
src/config/nav-config.tssrc/hooks/use-breadcrumbs.tsxsrc/app/dashboard/employee-directory/page.tsxsrc/app/dashboard/employee-directory/[id]/page.tsxsrc/features/employee-directory/components/employee-directory-action-menu.tsxsrc/features/employee-directory/components/employee-directory-columns.tsxsrc/features/employee-directory/components/employee-directory-table.tsxsrc/features/employee-directory/components/employee-directory-listing.tsxsrc/features/employee-directory/components/employee-directory-detail-page.tsxsrc/features/employee-directory/server/employee-directory-data.tsdocs/management-change-add-employee-directory-menu-review.md
Sidebar Changes
- Kept the existing
พนักงานsubmenu underข้อมูลหลัก - Added a new submenu:
รายชื่อพนักงานทั้งหมด- route:
/dashboard/employee-directory
- Visibility is limited to HRD/Admin via existing role-based navigation rules
New Routes
/dashboard/employee-directory/dashboard/employee-directory/[id]
Existing Employee Menu Kept
- The existing
พนักงานmenu remains unchanged - Existing route
/dashboard/usersremains unchanged - Existing users page behavior is untouched
Employee Directory Page
- Reuses the existing users data source for minimal-impact implementation
- Search supports the existing backend search across:
- employee code
- employee name
- department
- position
- Table columns:
- รหัสพนักงาน
- ชื่อพนักงาน
- ฝ่าย
- ตำแหน่ง
- Action
- Action uses a compact three-dot menu with
ดูข้อมูลพนักงาน
Employee Detail Page
- Protected server-rendered detail page for HRD/Admin only
- Sections included:
- ข้อมูลทั่วไปพนักงาน
- ข้อมูลชั่วโมงอบรม
- K / S / A Summary
- รายการอบรม
- Training summary uses current-year targets and current-year approved/pending/rejected hours
- Training records list links back to the existing training record detail pages
Permission Rules
- HRD/Admin:
- can see the new menu
- can access the directory list
- can open employee detail pages
- Employee:
- does not see the menu
- cannot access the routes directly because the pages use
requireHRDDashboardAccess()
Responsive Notes
- The directory table uses the existing scrollable table container
- The action column is compact and pinned-friendly
- Detail sections stack into single-column layouts on smaller screens
- Training records in the detail page use horizontal scrolling inside the section instead of expanding page width
Manual Test Checklist
- Existing
พนักงานmenu remains - New
รายชื่อพนักงานทั้งหมดmenu appears underข้อมูลหลัก - HRD/Admin can open employee directory
- Employee cannot see employee directory menu
- Employee cannot access employee directory by URL
- Employee directory table shows employee code
- Employee directory table shows employee name
- Employee directory table shows department/faction
- Employee directory table shows position
- Action opens employee detail
- Detail page shows general employee data
- Detail page shows training hour summary
- Detail page shows K/S/A summary
- Detail page shows training records
- Mobile layout works
- Existing
พนักงานpage still works
Known Limitations
- The current schema does not have a separate dedicated
ฝ่ายfield, so this page displays the available department data in that slot. - The summary cards use the current year for target and hour progress calculations.
- Certificate status in the training-record list is shown as file count with a link to the existing training record detail page.