251209:1453 Frontend: progress nest = UAT & Bug Fixing
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-09 14:53:42 +07:00
parent 8aceced902
commit aa96cd90e3
125 changed files with 11052 additions and 785 deletions

View File

@@ -2,8 +2,8 @@
**Project Name:** Laem Chabang Port Phase 3 - Document Management System (LCBP3-DMS)
**Version:** 1.5.1
**Status:** Planning & Specification Phase
**Last Updated:** 2025-12-02
**Status:** Active Development (~80% Complete)
**Last Updated:** 2025-12-09
---
@@ -182,12 +182,14 @@ lcbp3/
├── specs/ # Technical Specifications
│ ├── 00-overview/ # Project overview & glossary
│ ├── 01-requirements/ # Functional requirements
│ ├── 01-requirements/ # Functional requirements (21 docs)
│ ├── 02-architecture/ # System architecture
│ ├── 03-implementation/ # Implementation guidelines
│ ├── 04-operations/ # Deployment & operations
│ ├── 05-decisions/ # Architecture Decision Records (ADRs)
── 06-tasks/ # Development tasks
│ ├── 05-decisions/ # Architecture Decision Records (17 ADRs)
── 06-tasks/ # Development tasks & progress
│ ├── 07-database/ # Database schema v1.5.1 & seed data
│ └── 09-history/ # Archived implementations
├── docker-compose.yml # Docker services configuration
└── README.md # Project README
@@ -383,8 +385,8 @@ lcbp3/
## 📝 Document Control
- **Version:** 1.5.1
- **Status:** Active
- **Last Updated:** 2025-12-02
- **Status:** Active Development
- **Last Updated:** 2025-12-09
- **Next Review:** 2026-01-01
- **Owner:** System Architect
- **Classification:** Internal Use Only
@@ -395,6 +397,7 @@ lcbp3/
| Version | Date | Description |
| ------- | ---------- | ------------------------------------------ |
| 1.5.1 | 2025-12-09 | TASK-FE-011/012 completed, docs updated |
| 1.5.1 | 2025-12-02 | Reorganized documentation structure |
| 1.5.0 | 2025-12-01 | Complete specification with ADRs and tasks |
| 1.4.5 | 2025-11-30 | Updated architecture documents |

View File

@@ -502,4 +502,5 @@ export default function WorkflowEditPage() {
---
**Created:** 2025-12-01
**Status:** Ready
**Status:** ✅ Completed
**Completed Date:** 2025-12-09

View File

@@ -534,4 +534,5 @@ export function TemplateTester({ open, onOpenChange, template }: any) {
---
**Created:** 2025-12-01
**Status:** Ready
**Status:** ✅ Completed
**Completed Date:** 2025-12-09

View File

@@ -1,6 +1,6 @@
# Backend Progress Report
**Date:** 2025-12-07
**Date:** 2025-12-09
**Status:****Advanced / Nearly Complete (~90%)**
## 📊 Overview

View File

@@ -1,27 +1,27 @@
# Frontend Progress Report
**Date:** 2025-12-07
**Status:** In Progress (~65%)
**Date:** 2025-12-09
**Status:** In Progress (~80%)
## 📊 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% | Layout, Users, Audit Logs, Organizations implemented. |
| **TASK-FE-011** | Workflow Config UI | 🚧 **In Progress** | 30% | Workflow builder UI needed. |
| **TASK-FE-012** | Numbering Config UI | 🚧 **In Progress** | 30% | Configuration forms needed. |
| **TASK-FE-013** | Circulation & Transmittal | 🔴 **Not Started** | 0% | Pending implementation. |
| **TASK-FE-014** | Reference Data UI | 🔴 **Not Started** | 0% | Specs created. |
| **TASK-FE-015** | Security Admin UI | 🔴 **Not Started** | 0% | Specs created. |
| 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. |
## 🛠 Detailed Status by Component
@@ -51,6 +51,6 @@
## 📅 Next Priorities
1. **TASK-FE-002 (Auth):** Finalize Authentication flow with Refresh Token.
2. **API Integration:** Connect Correspondence and RFA modules to real Backend endpoints.
3. **Admin Modules:** Finish User and Master Data management screens.
1. **UAT & Bug Fixing:** Perform end-to-end testing of all modules.
2. **Deployment Prep:** Configure environments and build scripts for production.
3. **Backend Standardization (Optional):** Review API response casing (snake_case vs camelCase) for consistency.

View File

@@ -1008,10 +1008,9 @@ CREATE TABLE document_number_counters (
-- Foreign Keys
FOREIGN KEY (project_id) REFERENCES projects (id) ON DELETE CASCADE,
FOREIGN KEY (originator_organization_id) REFERENCES organizations (id) ON DELETE CASCADE,
FOREIGN KEY (recipient_organization_id) REFERENCES organizations (id) ON DELETE CASCADE,
-- NOTE: recipient_organization_id uses -1 as sentinel for "all organizations"
-- Therefore NO FK constraint is applied here (would fail for -1)
FOREIGN KEY (correspondence_type_id) REFERENCES correspondence_types (id) ON DELETE CASCADE,
-- ใช้ CHECK constraint เพื่อไม่ให้ตรวจสอบเมื่อเป็น -1
CONSTRAINT fk_recipient_when_not_all FOREIGN KEY (recipient_organization_id) REFERENCES organizations (id) ON DELETE CASCADE,
-- [v1.5.1 NEW] Performance Indexes
INDEX idx_counter_lookup (
project_id,

View File

@@ -1278,7 +1278,9 @@ VALUES -- Document
(4, 142),
-- Dashboard & Notification
(4, 153),
(4, 151);
(4, 151),
-- Workflow Actions (NEW for E2E test compatibility)
(4, 123);
-- ==========================================================
-- Role 5: Viewer (Organization Scope)
@@ -1367,9 +1369,13 @@ INSERT INTO user_assignments (
)
VALUES (1, 1, 1, NULL, NULL, NULL, NULL),
-- superadmin: Global scope (organization_id = NULL)
(2, 2, 2, 1, NULL, NULL, NULL);
(2, 2, 2, 1, NULL, NULL, NULL),
-- admin: Organization scope (org_id=1 = กทท.)
(3, 3, 4, 41, NULL, NULL, 1),
-- editor01: Editor role (role_id=4) at organization 41 (คคง.), assigned by superadmin
(4, 4, 5, 10, NULL, NULL, 1);
-- admin: Organization scope
-- viewer01: Viewer role (role_id=5) at organization 10 (สคฉ.03), assigned by superadmin
-- =====================================================
-- == 4. การเชื่อมโยงโครงการกับองค์กร (project_organizations) ==
-- =====================================================
@@ -2980,3 +2986,240 @@ VALUES (
NULL,
NULL
);
-- ==========================================================
-- 20. Workflow Definitions (Unified Workflow Engine)
-- ==========================================================
INSERT INTO `workflow_definitions` (
`id`,
`workflow_code`,
`version`,
`description`,
`dsl`,
`compiled`,
`is_active`,
`created_at`,
`updated_at`
)
VALUES (
-- CORRESPONDENCE_FLOW_V1
UUID(),
'CORRESPONDENCE_FLOW_V1',
1,
'Standard Correspondence Workflow - Draft → Submit → Review → Approve/Reject',
JSON_OBJECT(
'workflow',
'CORRESPONDENCE_FLOW_V1',
'version',
1,
'states',
JSON_ARRAY(
JSON_OBJECT(
'name',
'DRAFT',
'initial',
TRUE,
'on',
JSON_OBJECT(
'SUBMIT',
JSON_OBJECT('to', 'IN_REVIEW')
)
),
JSON_OBJECT(
'name',
'IN_REVIEW',
'on',
JSON_OBJECT(
'APPROVE',
JSON_OBJECT('to', 'APPROVED'),
'REJECT',
JSON_OBJECT('to', 'REJECTED'),
'RETURN',
JSON_OBJECT('to', 'DRAFT')
)
),
JSON_OBJECT('name', 'APPROVED', 'terminal', TRUE),
JSON_OBJECT('name', 'REJECTED', 'terminal', TRUE)
)
),
JSON_OBJECT(
'initialState',
'DRAFT',
'states',
JSON_OBJECT(
'DRAFT',
JSON_OBJECT(
'initial',
TRUE,
'terminal',
false,
'transitions',
JSON_OBJECT(
'SUBMIT',
JSON_OBJECT('to', 'IN_REVIEW', 'events', JSON_ARRAY())
)
),
'IN_REVIEW',
JSON_OBJECT(
'initial',
false,
'terminal',
false,
'transitions',
JSON_OBJECT(
'APPROVE',
JSON_OBJECT('to', 'APPROVED', 'events', JSON_ARRAY()),
'REJECT',
JSON_OBJECT('to', 'REJECTED', 'events', JSON_ARRAY()),
'RETURN',
JSON_OBJECT('to', 'DRAFT', 'events', JSON_ARRAY())
)
),
'APPROVED',
JSON_OBJECT(
'initial',
false,
'terminal',
TRUE,
'transitions',
JSON_OBJECT()
),
'REJECTED',
JSON_OBJECT(
'initial',
false,
'terminal',
TRUE,
'transitions',
JSON_OBJECT()
)
)
),
TRUE,
NOW(),
NOW()
),
(
-- RFA_APPROVAL
UUID(),
'RFA_APPROVAL',
1,
'Request for Approval Workflow - Contractor Submit → Consultant Review → Owner Review',
JSON_OBJECT(
'workflow',
'RFA_APPROVAL',
'version',
1,
'states',
JSON_ARRAY(
JSON_OBJECT(
'name',
'DRAFT',
'initial',
TRUE,
'on',
JSON_OBJECT(
'SUBMIT',
JSON_OBJECT(
'to',
'CONSULTANT_REVIEW',
'require',
JSON_OBJECT('role', 'CONTRACTOR')
)
)
),
JSON_OBJECT(
'name',
'CONSULTANT_REVIEW',
'on',
JSON_OBJECT(
'APPROVE',
JSON_OBJECT('to', 'OWNER_REVIEW'),
'REJECT',
JSON_OBJECT('to', 'DRAFT')
)
),
JSON_OBJECT(
'name',
'OWNER_REVIEW',
'on',
JSON_OBJECT(
'APPROVE',
JSON_OBJECT('to', 'APPROVED'),
'REJECT',
JSON_OBJECT('to', 'CONSULTANT_REVIEW')
)
),
JSON_OBJECT('name', 'APPROVED', 'terminal', TRUE)
)
),
JSON_OBJECT(
'initialState',
'DRAFT',
'states',
JSON_OBJECT(
'DRAFT',
JSON_OBJECT(
'initial',
TRUE,
'terminal',
false,
'transitions',
JSON_OBJECT(
'SUBMIT',
JSON_OBJECT(
'target',
'CONSULTANT_REVIEW',
'events',
JSON_ARRAY()
)
)
),
'CONSULTANT_REVIEW',
JSON_OBJECT(
'initial',
false,
'terminal',
false,
'transitions',
JSON_OBJECT(
'APPROVE',
JSON_OBJECT('target', 'OWNER_REVIEW', 'events', JSON_ARRAY()),
'REJECT',
JSON_OBJECT('target', 'DRAFT', 'events', JSON_ARRAY())
)
),
'OWNER_REVIEW',
JSON_OBJECT(
'initial',
false,
'terminal',
false,
'transitions',
JSON_OBJECT(
'APPROVE',
JSON_OBJECT('target', 'APPROVED', 'events', JSON_ARRAY()),
'REJECT',
JSON_OBJECT(
'target',
'CONSULTANT_REVIEW',
'events',
JSON_ARRAY()
)
)
),
'APPROVED',
JSON_OBJECT(
'initial',
false,
'terminal',
TRUE,
'transitions',
JSON_OBJECT()
)
)
),
TRUE,
NOW(),
NOW()
);

View File

@@ -0,0 +1,7 @@
-- Patch: Add workflow.action_review permission to Editor role
-- Required for E2E tests where editor01 needs to perform workflow actions
INSERT IGNORE INTO role_permissions (role_id, permission_id)
VALUES (4, 123);
-- permission_id 123 = workflow.action_review
-- role_id 4 = Editor

View File

@@ -0,0 +1,10 @@
-- Patch: Drop FK constraint for recipient_organization_id
-- Required because -1 is used as sentinel value for "all organizations"
-- Run this on lcbp3_dev database
-- Find and drop the FK constraint(s)
-- The constraint names may vary, check with:
-- SHOW CREATE TABLE document_number_counters;
-- Drop both FK constraints
ALTER TABLE document_number_counters DROP FOREIGN KEY document_number_counters_ibfk_3;
ALTER TABLE document_number_counters DROP FOREIGN KEY fk_recipient_when_not_all;

View File

@@ -0,0 +1,82 @@
-- Patch: Fix CORRESPONDENCE_FLOW_V1 compiled data
-- The compiled JSON used 'target' but code expects 'to'
-- Run this to update existing workflow_definitions
UPDATE workflow_definitions
SET compiled = JSON_OBJECT(
'workflow',
'CORRESPONDENCE_FLOW_V1',
'version',
1,
'initialState',
'DRAFT',
'states',
JSON_OBJECT(
'DRAFT',
JSON_OBJECT(
'terminal',
false,
'transitions',
JSON_OBJECT(
'SUBMIT',
JSON_OBJECT(
'to',
'IN_REVIEW',
'requirements',
JSON_OBJECT('roles', JSON_ARRAY()),
'events',
JSON_ARRAY()
)
)
),
'IN_REVIEW',
JSON_OBJECT(
'terminal',
false,
'transitions',
JSON_OBJECT(
'APPROVE',
JSON_OBJECT(
'to',
'APPROVED',
'requirements',
JSON_OBJECT('roles', JSON_ARRAY()),
'events',
JSON_ARRAY()
),
'REJECT',
JSON_OBJECT(
'to',
'REJECTED',
'requirements',
JSON_OBJECT('roles', JSON_ARRAY()),
'events',
JSON_ARRAY()
),
'RETURN',
JSON_OBJECT(
'to',
'DRAFT',
'requirements',
JSON_OBJECT('roles', JSON_ARRAY()),
'events',
JSON_ARRAY()
)
)
),
'APPROVED',
JSON_OBJECT(
'terminal',
TRUE,
'transitions',
JSON_OBJECT()
),
'REJECTED',
JSON_OBJECT(
'terminal',
TRUE,
'transitions',
JSON_OBJECT()
)
)
)
WHERE workflow_code = 'CORRESPONDENCE_FLOW_V1';