Project Registration
Revision 1.0 (2026-01-14) - Complete documentation with workflow integration
Feature Summary
Project Registration (การลงทะเบียนโครงการ) is a workflow feature that manages the approval process for new projects. It coordinates between Work Owner, Purchasing, and Contractor roles to complete project setup before work permits can be issued.
Key Capabilities:
- Create and track project registration tasks
- Multi-role workflow: Work Owner → Purchasing → Contractor → Approval
- Document form management (Project Registration Form, Pre-Work Procedures Form)
- Form edit permissions based on workflow state
- Task assignment with email notifications
- Workflow history and audit trail
- Optional command support (planned) - Skip Purchasing if project has PO No.
Workflow Relationship:
Project Registration is the first workflow in the Safety App process:
- Work Owner searches project by PR.No → Creates registration task
- Workflow progresses through 8 states (see Workflow Documentation)
- Upon approval, project can proceed to Work Permit Workflow
Prerequisites:
- Project must exist in Project Settings with PR.No assigned
- Contractor must be configured with coordinator and supervisor
Role Matrix
Revision 1.0 (2026-01-14) - Initial version
Feature-Level Access
| Action | Admin | Purchasing | Work Owner | Safety Officer | Workspace Owner | Contractor |
|---|---|---|---|---|---|---|
| View all tasks | ✅ | ❌ | Own only | ✅ | ❌ | Assigned only |
| Create task | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
| Execute commands | ❌ | Own only | Own only | ❌ | ❌ | Own only |
| View task history | ✅ | Own only | Own only | ✅ | ❌ | Own only |
| Add notes | ❌ | Own only | Own only | ❌ | ❌ | Own only |
| Delete task | ✅ | ❌ | Own only | ❌ | ❌ | ❌ |
Workflow State Access
| State | Who Can Act | Available Commands |
|---|---|---|
| FillInProjectInfo | Work Owner | Send to Purchasing, Cancel |
| FillInPurchasingInfo | Purchasing | Submit Back |
| ReviewPurchasingInfo | Work Owner | Send to Purchasing, Send to Contractor, Cancel |
| FillInPreWorkProceduresForm | Contractor | Acknowledge Procedures |
| ReviewPreWorkProceduresForm | Work Owner | Approve, Send to Purchasing, Send to Contractor, Cancel |
Form Edit Permissions by State
| State | ProjectRegistrationForm | PreWorkProceduresForm |
|---|---|---|
| FillInProjectInfo | ✅ WorkOwner | - |
| FillInPurchasingInfo | ✅ Purchasing | - |
| ReviewPurchasingInfo | ✅ WorkOwner | - |
| FillInPreWorkProceduresForm | 🔒 Locked | ✅ Contractor |
| ReviewPreWorkProceduresForm | 🔒 Locked | 🔒 Locked |
| Approved/Canceled | 🔒 Locked | 🔒 Locked |
Legend:
- ✅ = Can edit
- 🔒 = Read-only (locked)
- Own only = Can only access tasks where user is current assignee
- Assigned only = Can only see tasks assigned to them
Backend Test Report
Location:
backend/tests/http/project-registration/(planned) Status: Test files to be created in Phase 6
API Endpoints
| Method | Endpoint | Description | Authorization |
|---|---|---|---|
| POST | /api/tasks/search | Search tasks by type, status | RealmBasic |
| GET | /api/tasks/get/{id} | Get task details with workflow state | RealmBasic |
| POST | /api/tasks/createTask | Create new workflow task | RealmBasic |
| POST | /api/tasks/preExecuteCommand | Validate and prepare command | RealmBasic |
| POST | /api/tasks/executeCommand | Execute workflow state transition | RealmBasic |
| POST | /api/tasks/upload/formAttachment | Upload form attachment | RealmBasic |
| POST | /api/tasks/remove/formAttachment | Remove form attachment | RealmBasic |
| POST | /api/tasks/saveDocumentForm | Auto-save form data | RealmBasic |
| POST | /api/tasks/notes/create | Create task note | RealmBasic |
| PUT | /api/tasks/notes/{noteId} | Update task note | RealmBasic |
| DELETE | /api/tasks/notes/{noteId} | Delete task note | RealmBasic |
| POST | /api/tasks/remove | Delete task (Admin/Owner only) | RealmBasic |
Workflow-Specific Endpoints
| Method | Endpoint | Description | Authorization |
|---|---|---|---|
| GET | /api/projects/searchByPrNo | Search project by PR.No for task creation | ProjectMgmt |
Test Coverage (Planned)
| Part | Section | Tests | Description |
|---|---|---|---|
| A | Task Creation | 6 | Create task with project link |
| A | Task Get | 4 | Retrieve task with workflow state |
| B | Standard Path | 8 | Full workflow: WO → Purchasing → WO → Contractor → WO → Approve |
| B | Skip Path | 6 | Optional: WO → Contractor (skip Purchasing) |
| C | Commands | 12 | All 6 commands with role validation |
| D | Form Attachments | 4 | Upload/download/remove attachments |
| E | Notes | 4 | Create/update/delete notes |
Frontend Test Report
Location:
frontend/e2e/features/project-registration/(planned) Status: E2E tests to be created in Phase 6
Components
| Component | Type | Description |
|---|---|---|
review-task.component.ts | Smart | Main container component |
review-task.service.ts | Service | State management (to be migrated to rxResource) |
review-task-toolbar.component.ts | Dumb | Command buttons and actions |
review-task-form.component.ts | Dumb | Form wrapper with tabs |
review-task-workflow.component.ts | Dumb | Workflow visualization (stepper + diagram) |
review-task-stepper.component.ts | Dumb | Horizontal workflow stepper |
review-task-transaction.component.ts | Dumb | Task history/log table |
review-task-note.component.ts | Dumb | Notes section |
workflow-svg-viewer.component.ts | Dumb | SVG diagram viewer |
Workflow Visualization Components
| Component | Purpose |
|---|---|
| Stepper | Shows workflow progress with circular step indicators |
| Full Diagram | SVG visualization of complete workflow |
| State Info Cards | Current state and branch target information |
E2E Test Plan (Phase 6)
| Test ID | Description |
|---|---|
| TC-PR-E2E-001 | Work Owner creates task from project |
| TC-PR-E2E-002 | Work Owner sends to Purchasing |
| TC-PR-E2E-003 | Purchasing fills PO info and submits |
| TC-PR-E2E-004 | Work Owner reviews and sends to Contractor |
| TC-PR-E2E-005 | Contractor acknowledges procedures |
| TC-PR-E2E-006 | Work Owner approves registration |
| TC-PR-E2E-007 | Work Owner skips Purchasing (when has PO No.) |
| TC-PR-E2E-008 | Stepper shows correct state transitions |
| TC-PR-E2E-009 | Optional step shows dashed border |
| TC-PR-E2E-010 | Transaction log shows all state changes |
Manual Test Cases
For comprehensive manual testing documentation, see: Project Registration Test Cases
Test Summary:
- Standard Workflow Path (31 test cases)
- Optional Path - Skip Purchasing (9 test cases)
- Total: 40 test cases
Workflow States Reference
For complete workflow documentation including:
- All 9 workflow states with Thai names
- State transition diagram
- Document form mappings
- Form edit permissions matrix
See: Project Registration Workflow
Related Documentation
- Project Settings - Prerequisite: Create projects here first
- Project Registration Workflow - Technical workflow specification
- Work Permit Workflow - Next step after project approval
Labels verified against:
review-task-toolbar.component.ts(command button labels)review-task-stepper.component.ts(step labels)review-task-transaction.component.ts(log table headers)review-task-note.component.ts(notes section)project-registration-state-metadata.config.ts(state names)