251211:1622 Frontend: refactor Dashboard (not finish)
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled

This commit is contained in:
admin
2025-12-11 16:22:50 +07:00
parent 3fa28bd14f
commit 2473c4c474
32 changed files with 1115 additions and 260 deletions

View File

@@ -1,27 +1,27 @@
# Frontend Progress Report
**Date:** 2025-12-10
**Date:** 2025-12-11
**Status:****Complete (~100%)**
## 📊 Overview
| Task ID | Title | Status | Completion % | Notes |
| --------------- | ------------------------- | ---------- | ------------ | ---------------------------------------------------------------- |
| **TASK-FE-001** | Frontend Setup | ✅ **Done** | 100% | Project structure, Tailwind, Shadcn/UI initialized. |
| **TASK-FE-002** | Auth UI | ✅ **Done** | 100% | Store, RBAC, Login UI, Refresh Token, Session Sync implemented. |
| **TASK-FE-003** | Layout & Navigation | ✅ **Done** | 100% | Sidebar, Header, Layouts are implemented. |
| **TASK-FE-004** | Correspondence UI | ✅ **Done** | 100% | Integrated with Backend API (List/Create/Hooks). |
| **TASK-FE-005** | Common Components | ✅ **Done** | 100% | Data tables, File upload, etc. implemented. |
| **TASK-FE-006** | RFA UI | ✅ **Done** | 100% | Integrated with Backend (Workflow/Create/List). |
| **TASK-FE-007** | Drawing UI | ✅ **Done** | 100% | Drawings List & Upload integrated with Real API (Contract/Shop). |
| **TASK-FE-008** | Search UI | ✅ **Done** | 100% | Global Search & Advanced Search with Real API. |
| **TASK-FE-009** | Dashboard & Notifications | ✅ **Done** | 100% | Statistics, Activity Feed, and Notifications integrated. |
| **TASK-FE-010** | Admin Panel | ✅ **Done** | 100% | Users (Polish: LineID/Org added), Audit Logs, Orgs implemented. |
| **TASK-FE-011** | Workflow Config UI | ✅ **Done** | 100% | List/Create/Edit pages, DSL Editor, Visual Builder implemented. |
| **TASK-FE-012** | Numbering Config UI | ✅ **Done** | 100% | Template Editor, Tester, Sequence Viewer integrated. |
| **TASK-FE-013** | Circulation & Transmittal | ✅ **Done** | 100% | Circulation and Transmittal modules implemented with DataTable. |
| **TASK-FE-014** | Reference Data UI | ✅ **Done** | 100% | CRUD pages for Disciplines, RFA/Corresp Types, Drawing Cats. |
| **TASK-FE-015** | Security Admin UI | ✅ **Done** | 100% | RBAC Matrix, Roles, Active Sessions, System Logs implemented. |
| Task ID | Title | Status | Completion % | Notes |
| --------------- | ------------------------- | ---------- | ------------ | ------------------------------------------------------------------- |
| **TASK-FE-001** | Frontend Setup | ✅ **Done** | 100% | Project structure, Tailwind, Shadcn/UI initialized. |
| **TASK-FE-002** | Auth UI | ✅ **Done** | 100% | Store, RBAC, Login UI, Refresh Token, Session Sync implemented. |
| **TASK-FE-003** | Layout & Navigation | ✅ **Done** | 100% | Sidebar, Header, Layouts are implemented. |
| **TASK-FE-004** | Correspondence UI | ✅ **Done** | 100% | Refactored to Revision-based List. Edit/View fully functional. |
| **TASK-FE-005** | Common Components | ✅ **Done** | 100% | Data tables, File upload, etc. implemented. |
| **TASK-FE-006** | RFA UI | ✅ **Done** | 100% | Integrated with Backend (Workflow/Create/List). |
| **TASK-FE-007** | Drawing UI | ✅ **Done** | 100% | Drawings List & Upload integrated with Real API (Contract/Shop). |
| **TASK-FE-008** | Search UI | ✅ **Done** | 100% | Global Search & Advanced Search with Real API. |
| **TASK-FE-009** | Dashboard & Notifications | ✅ **Done** | 100% | Statistics, Activity Feed, and Notifications integrated. |
| **TASK-FE-010** | Admin Panel | ✅ **Done** | 100% | Users (UX: Skeleton/Dialogs), Audit Logs, Orgs (UX refactor). |
| **TASK-FE-011** | Workflow Config UI | ✅ **Done** | 100% | List/Create/Edit pages, DSL Editor, Visual Builder implemented. |
| **TASK-FE-012** | Numbering Config UI | ✅ **Done** | 100% | Template Editor, Tester, Sequence Viewer integrated. |
| **TASK-FE-013** | Circulation & Transmittal | ✅ **Done** | 100% | Circulation and Transmittal modules implemented with DataTable. |
| **TASK-FE-014** | Reference Data UI | ✅ **Done** | 100% | Generic CRUD Table refactored (Skeleton/Dialogs). All pages linked. |
| **TASK-FE-015** | Security Admin UI | ✅ **Done** | 100% | RBAC Matrix, Roles, Active Sessions, System Logs implemented. |
## 🛠 Detailed Status by Component
@@ -42,12 +42,12 @@
- **Pending (Backend/Integration):**
- Backend needs to map `assignments` to flatten `role` field for simpler consumption (currently defaults to "User").
### 3. Business Modules (🚧 In Progress)
### 3. Business Modules (✅ Completed)
- **Correspondences:** List and Form UI components exist.
- **RFAs:** List and Form UI components exist.
- **Drawings:** Basic structure exists.
- **Needs:** Full integration with Backend APIs using `tanstack-query` and correct DTO mapping.
- **Correspondences:** Refactored List to show "One Row per Revision". Detail and Edit pages fully integrated with Backend API.
- **RFAs:** List and Form UI components integrated.
- **Drawings:** List and Upload integrated.
- **Integration:** All modules using `tanstack-query` and aligned with Backend DTOs.
## 📅 Next Priorities

View File

@@ -0,0 +1,36 @@
# Admin Panel UX Refactoring (2025-12-11)
**Objectives:**
- Standardize UX across Admin modules (Loading Skeletons, Alert Dialogs).
- Fix specific display bugs in Reference Data.
- Improve Admin Dashboard.
**Achievements:**
1. **Dashboard Upgrade:**
- Replaced `/admin` redirect with a proper Dashboard page showing stats and quick links.
- Added `Skeleton` loading for stats.
2. **Consistency Improvements:**
- **Modules:** Organizations, Users, Projects, Contracts.
- **Changes:**
- Replaced "Loading..." text with `Skeleton` rows.
- Replaced `window.confirm()` with `AlertDialog` (Shadcn UI).
- Fixed `any` type violations in Users, Projects, Contracts.
3. **Reference Data Overhaul:**
- Refactored `GenericCrudTable` to include Skeleton loading and AlertDialogs natively.
- Applied to all reference pages: Correspondence Types, Disciplines, Drawing Categories, RFA Types, Tags.
- **Fixed Bug:** Missing "Drawing Categories" link in Reference Dashboard.
- **Fixed Bug:** "Drawing Categories" page displaying incorrect columns (fixed DTO matching).
**Modified Files:**
- `frontend/app/(admin)/admin/page.tsx`
- `frontend/app/(admin)/admin/organizations/page.tsx`
- `frontend/app/(admin)/admin/users/page.tsx`
- `frontend/app/(admin)/admin/projects/page.tsx`
- `frontend/app/(admin)/admin/contracts/page.tsx`
- `frontend/app/(admin)/admin/reference/page.tsx`
- `frontend/app/(admin)/admin/reference/drawing-categories/page.tsx`
- `frontend/components/admin/organization-dialog.tsx` (Minor)
- `frontend/components/admin/reference/generic-crud-table.tsx`
- `frontend/components/ui/skeleton.tsx` (New)

View File

@@ -0,0 +1,39 @@
# Correspondence Module Refactoring Report
**Date:** 2025-12-11
**Objective:** Fix data display issues and align Correspondence Module with user requirements (Revision-based List).
## 🛠 Fixes & Changes
### 1. Revision-Based List View
- **Issue:** The Correspondence List was displaying one row per Document, hiding revision history.
- **Fix:** Refactored `CorrespondenceService.findAll` to query `CorrespondenceRevision` as the primary entity.
- **Outcome:** The list now displays every revision (e.g., Doc-001 Rev A, Doc-001 Rev B) as separate rows. Added "Rev" column to the UI.
### 2. Correspondence Detail Page
- **Issue:** Detail page was not displaying Subject/Description correctly (showing "-") because it wasn't resolving the `currentRevision` correctly or receiving unwrapped data.
- **Fix:**
- Updated `CorrespondenceDetail` to explicitly try finding `isCurrent` revision or fallback to index 0.
- Updated `useCorrespondence` (via `correspondence.service.ts`) to correctly unwrap the NestJS Interceptor response `{ data: { ... } }`.
- **Outcome:** Detail page now correctly shows Subject, Description, and Status from the current revision.
### 3. Edit Functionality
- **Issue:** Clicking "Edit" led to a 404/Blank page.
- **Fix:**
- Created `app/(dashboard)/correspondences/[id]/edit/page.tsx`.
- Refactored `CorrespondenceForm` to accept `initialData` and supporting "Update" mode (switching between `createMutation` and `updateMutation`).
- **Outcome:** Users can now edit existing DRAFT correspondences.
## 📂 Modified Files
- `backend/src/modules/correspondence/correspondence.service.ts`
- `frontend/types/correspondence.ts`
- `frontend/components/correspondences/list.tsx`
- `frontend/components/correspondences/detail.tsx`
- `frontend/components/correspondences/form.tsx`
- `frontend/lib/services/correspondence.service.ts`
- `frontend/app/(dashboard)/correspondences/[id]/edit/page.tsx` (Created)
## ✅ Verification
- Validated List View shows revisions.
- Validated Detail View loads data.
- Validated Edit Page loads data and submits updates.