Skip to content

feat: Case Management — Refactor, Validation, Toast, Responsive & UX Improvements#42

Open
Shoaib96978 wants to merge 3 commits into
mainfrom
feat/case-management-refactor
Open

feat: Case Management — Refactor, Validation, Toast, Responsive & UX Improvements#42
Shoaib96978 wants to merge 3 commits into
mainfrom
feat/case-management-refactor

Conversation

@Shoaib96978

Copy link
Copy Markdown
Collaborator

📋 Overview

Major refactor and feature additions across Case, Follow-up, and Document modules.


✅ Changes

🗂️ Case List

  • Refactored CasesList.tsx into proper component sections
  • Added Refresh button on table header
  • Added Page size selector (5, 10, 15, 30, 50)
  • Added Stats collapse/expand toggle
  • Fixed pending & finalized counts — now fetched from backend (not current page)
  • Added pendingCount & finalizedCount to PagedResult<T> backend response
  • Full responsive design — mobile, tablet, desktop

🗃️ Filter Tabs

  • Redesigned tabs — each tab has its own color (All=gold, Pending=amber, Finalized=green)
  • Counts now reflect entire database, not just current page

➕ Create Case Modal

  • Split into 5 section components under create-case/sections/
  • Added frontend field validation (useCaseValidation.ts)
  • Validation messages match backend FluentValidation messages
  • Submit & Cancel buttons disabled during API call
  • Petitioner dropdown now shows Name + CNIC for unique identification
  • alert() replaced with toastService
  • Fixed char count display (was hardcoded 0)

🔔 Toast Notifications

  • Installed react-hot-toast
  • Created reusable toastService at src/lib/toast.service.ts
  • Wired onSuccess & onError in case & document mutation hooks
  • Fixed toastService.error() to accept both string and unknown (Axios error)

📁 Case Drawer

  • Refactored into component folder CaseDrawer/
    • tabs/FollowUpsTab.tsx
    • tabs/DocumentsTab.tsx
    • shared/DrawerLoader.tsx
    • shared/DrawerEmpty.tsx
    • shared/case-drawer.helpers.ts (removed duplicate helpers)
  • CaseDetailsModal moved inside case-list/ folder

📅 Follow-up Form

  • Removed all inline styles — now uses followUps-form.css
  • Extracted FuField into separate component
  • Replaced error state with toastService

🗑️ Cleanup

  • Removed duplicate helper functions (fmtDate, getFileIcon, formatFileSize, getHearingStatus)
  • Unnecessary components in follow-up module temporarily commented out (pending team review before deletion)

⚙️ Setup

npm install

react-hot-toast package added — run install after pulling.


🔍 Review Notes

  • Follow-up unused components are commented out, not deleted — will remove after team approval
  • Backend changes: PagedResult<T> has 2 new fields (PendingCount, FinalizedCount)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants