Smart Library Docs

Admin Portal

Complete documentation of the Admin dashboard — all 10 pages including overview, circulation, books, users, fines, inventory, reports, settings, notifications, and profile.

Admin Portal

Route prefix: /admin/* Layout: frontend/src/app/admin/layout.tsx Required role: ROLE_ADMIN

The Admin portal provides full system access — dashboard statistics, user management, catalogue CRUD, circulation desk operations, fine management, and system settings.

Layout Structure

The admin layout wraps all admin pages with:

┌─────────────────────────────────────────────┐
│  AppSidebar (role="admin")  │   TopNav      │
│                             │               │
│  • Overview                 │  ┌──────────┐ │
│  • Circulation              │  │  Page    │ │
│  • Inventory                │  │ Content  │ │
│  • Catalogue Mgmt           │  │          │ │
│  • Users                    │  │          │ │
│  • Notifications            │  └──────────┘ │
│  • Profile                  │               │
└─────────────────────────────────────────────┘

Components used: SidebarProvider, AppSidebar, TopNav


Pages

1. Overview (/admin/overview)

File: admin/overview/page.tsx

The system-wide dashboard providing at-a-glance operational intelligence.

Features:

  • Stats Grid (4 cards):

    • Total Book Copies — GET /dashboard/stats
    • Active Loans — highlighted in destructive color
    • Active Users — students and staff
    • Unpaid Fines — outstanding penalties
  • System Health panel:

    • Database Load indicator (progress bar)
    • API Latency metric
    • Background Workers status
  • System Activity Log:

    • Real-time event feed with timestamps
    • Shows librarian actions, system dispatches, admin changes, and backup status

API Integration: GET /api/v1/dashboard/stats


2. Circulation Desk (/admin/circulation)

File: admin/circulation/page.tsx

Split-panel interface for rapid book issuance and returns.

Issue Book Panel:

  • User ID input (MongoDB ObjectId)
  • Book Copy ID input
  • "Process Issue" button with loading state
  • API: POST /api/v1/circulation/issue

Return Book Panel:

  • Transaction ID input
  • "Process Return" button with loading state
  • API: POST /api/v1/circulation/return

Feedback: Success/error toast notifications via Sonner.


3. Catalogue Management (/admin/books)

File: admin/books/page.tsx

Full CRUD interface for managing the book catalogue.

Features:

  • Data Table with columns: ISBN, Title, Author, Category, Actions
  • Add New Title button → opens Dialog modal
  • Edit Metadata button per row → opens Dialog modal
  • Delete button per row → confirmation prompt
  • Manage Categories button (placeholder)

Add/Edit Form Fields:

  • ISBN (text input)
  • Title (text input)
  • Author (text input)
  • Category (Select dropdown, populated from API)

API Integration:

  • List: GET /api/v1/books
  • Create: POST /api/v1/books
  • Update: PATCH /api/v1/books/:id
  • Delete: DELETE /api/v1/books/:id
  • Categories: GET /api/v1/categories

4. User Management (/admin/users)

File: admin/users/page.tsx

Full CRUD interface for managing system users.

Features:

  • Data Table with columns: ID (truncated), Name, Email, Role (badge), Status (Active/Inactive badge), Actions
  • Add User button → Dialog modal
  • Edit button per row → Dialog modal (with optional password update)
  • Activate/Deactivate toggle per row

Add User Form Fields:

  • First Name, Last Name (grid)
  • Email
  • Contact Number
  • Role (Select: Student, Librarian, Admin)
  • Password

API Integration:

  • List: GET /api/v1/users
  • Create: POST /api/v1/users
  • Update: PUT /api/v1/users/:id
  • Toggle active: PUT /api/v1/users/:id with { isActive: !current }

5. Fines & Penalties (/admin/fines)

File: admin/fines/page.tsx

Fine management interface with collect/waive actions.

Features:

  • Search bar for filtering by User ID or Name
  • Filter Unpaid button
  • Data Table with columns: Fine ID, User, Amount (destructive color), Reason, Status (badge), Actions
  • Waive/Collect buttons for unpaid fines

API Integration:

  • List: GET /api/v1/fines
  • Resolve: PUT /api/v1/fines/:id

6. Inventory (/admin/inventory)

File: admin/inventory/page.tsx Physical copy management page for tracking barcodes, locations, and copy statuses.

7. Reports (/admin/reports)

File: admin/reports/page.tsx Reporting and analytics interface for circulation statistics and data exports.

8. Settings (/admin/settings)

File: admin/settings/page.tsx System configuration page for fine policies, loan periods, and operational settings.

9. Notifications (/admin/notifications)

File: admin/notifications/page.tsx System-wide notification management and dispatch interface.

10. Profile (/admin/profile)

File: admin/profile/page.tsx Admin user profile view and account settings.

On this page