# HR Dashboard Tree View Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Replace the external OrgChart dependency on the HR dashboard with a static local hierarchical tree view.

**Architecture:** Keep the dashboard route and cards unchanged, reshape department data in `HrController` into a nested tree structure with employee summaries, and render it through a recursive Blade partial plus local CSS. Cover the change with a focused feature test that proves the dashboard renders the tree without `balkan.app` or `OrgChart`.

**Tech Stack:** Laravel 12, Blade, Pest 3, local CSS

---

### Task 1: Lock behavior with a failing feature test

**Files:**
- Modify: `tests/Feature/HrDashboardTreeViewTest.php`

- [ ] Write a Pest feature test that signs in a user, creates a small department hierarchy with employees, opens `route('hr.dashboard')`, and asserts the page shows department and employee names while not containing `balkan.app` or `OrgChart`.
- [ ] Run `php artisan test --compact tests/Feature/HrDashboardTreeViewTest.php` and confirm it fails for the expected reason.

### Task 2: Replace the external chart implementation

**Files:**
- Modify: `Modules/Hr/app/Http/Controllers/HrController.php`
- Modify: `Modules/Hr/resources/views/dashboard.blade.php`
- Create: `Modules/Hr/resources/views/partials/department-tree-node.blade.php`

- [ ] Update the controller to build a nested department tree tailored for static Blade rendering.
- [ ] Replace the remote script-based chart in the dashboard view with local recursive markup and CSS.
- [ ] Keep the existing summary cards and route behavior unchanged.

### Task 3: Verify and format

**Files:**
- Modify: `Modules/Hr/app/Http/Controllers/HrController.php`
- Modify: `Modules/Hr/resources/views/dashboard.blade.php`
- Create: `Modules/Hr/resources/views/partials/department-tree-node.blade.php`
- Modify: `tests/Feature/HrDashboardTreeViewTest.php`

- [ ] Run `php artisan test --compact tests/Feature/HrDashboardTreeViewTest.php` and confirm it passes.
- [ ] Run `vendor/bin/pint --dirty --format agent`.
