Skip to content

[FE-53] Build Department management page — create departments, manage members, view department assets #1041

Description

@yusuftomilola

Overview

Admins need a dedicated page to create and manage departments — organisational units that group users and assets. Currently there is no frontend UI for department CRUD even though the backend endpoints exist (from BE-32 or later). Without this page, admins cannot set up the organisational structure required for scoped asset tracking.

Context

  • Route: frontend/app/(dashboard)/departments/page.tsx (needs to be created)
  • Add "Departments" to the sidebar navigation under an "Organisation" section
  • API endpoints: GET /departments, POST /departments, PATCH /departments/:id, DELETE /departments/:id, GET /departments/:id/users, GET /departments/:id/assets
  • React Query hooks: create in frontend/lib/query/hooks/useDepartments.ts

Acceptance Criteria

  • Create frontend/app/(dashboard)/departments/page.tsx
  • Table view with columns: Department Name, Manager (name), Member Count, Asset Count, Created Date, actions (Edit, Delete)
  • "Add Department" button opens a modal with: name (required), description (optional), manager selector (user search dropdown)
  • Clicking a department row opens a detail drawer with two tabs: "Members" (list of users with their roles) and "Assets" (list of department assets with status badges)
  • Edit button pre-fills the modal; Delete requires confirmation and warns if the department has members
  • Create React Query hooks: useDepartments(), useCreateDepartment(), useUpdateDepartment(), useDeleteDepartment(), useDepartmentUsers(id), useDepartmentAssets(id)
  • Add "Departments" link to the sidebar

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions