Files
alla-tms/docs/management-change-sidebar-master-data-group-review.md
2026-07-16 09:53:14 +07:00

3.4 KiB

Management Change Sidebar Master Data Group Review

1. Summary

Refactored the HRD/Admin sidebar so employee-related management links are grouped under a single collapsible parent menu named ข้อมูลหลัก, while keeping all existing routes, APIs, and role-based visibility intact.

2. Files Changed

  • src/config/nav-config.ts
  • src/components/layout/app-sidebar.tsx
  • docs/management-change-sidebar-master-data-group-review.md

3. Navigation Before

HRD/Admin root-level sidebar included these separate items:

  • พนักงาน
  • หลักสูตร
  • นโยบายการอบรม
  • ประกาศ

These were shown alongside the rest of the main sidebar items.

4. Navigation After

HRD/Admin now sees a parent menu:

  • ข้อมูลหลัก

Inside that menu:

  • พนักงาน -> /dashboard/users
  • หลักสูตร -> /dashboard/courses
  • นโยบาย -> /dashboard/training-policy
  • ประกาศ -> /dashboard/announcements

Other root-level HRD/Admin menus remain unchanged:

  • แดชบอร์ด
  • รอตรวจสอบ
  • ประวัติการอบรม
  • นำเข้าพนักงาน
  • รายงาน
  • บันทึกการใช้งาน

5. Role Impact

  • HRD/Admin keeps access to the same management routes as before.
  • Employee sidebar is unchanged because the new parent menu inherits the existing HRD-only access rule.
  • Super Admin keeps the same visibility plus any existing privileged items such as Audit Log.

6. Active Route Behavior

  • Parent menu ข้อมูลหลัก appears active when any child route is active.
  • Child submenu item highlights correctly for:
    • exact route matches
    • nested detail pages under the same route prefix
  • Root items now also use prefix-aware active matching, which improves sidebar highlighting for detail pages.

7. Mobile Sidebar Behavior

  • Nested menu continues to use the existing collapsible sidebar pattern.
  • Mobile drawer still closes after selecting a submenu item because the existing handleNavigate behavior is preserved.
  • Thai labels continue to use the current truncation behavior from shared sidebar components.

8. Manual Test Checklist

  • HRD/Admin sees ข้อมูลหลัก parent menu.
  • ข้อมูลหลัก contains พนักงาน.
  • ข้อมูลหลัก contains หลักสูตร.
  • ข้อมูลหลัก contains นโยบาย.
  • ข้อมูลหลัก contains ประกาศ.
  • Root-level พนักงาน menu is removed.
  • Root-level หลักสูตร menu is removed.
  • Root-level นโยบาย menu is removed.
  • Root-level ประกาศ menu is removed.
  • Other HRD/Admin menus still work structurally.
  • Employee sidebar is unchanged by access rules.
  • Active submenu is highlighted.
  • Parent menu opens when child route is active.
  • Mobile sidebar nested menu keeps existing behavior.
  • No route or API was deleted.

9. Known Limitations

  • Visual QA in the browser is still recommended to confirm final spacing and open-state behavior on both desktop and mobile.
  • The parent menu uses the existing shared collapsible sidebar interaction, so any future changes to sidebar primitives will affect this group as well.