Project Setting
Revision 1.0 (2026-01-13) - Initial documentation
Feature Summary
Project Setting (การตั้งค่าโครงการ) manages project records that serve as the foundation for the Project Registration Workflow. Purchasing creates projects with PR.No/PO.No, and Work Owner initiates workflows by linking to existing projects.
Key Capabilities:
- Create, edit, and delete projects
- Manage purchasing information (PR.No, PO.No, dates)
- Assign workspace areas and staff roles (Work Owner, Safety Officer, Workspace Owner)
- Link contractors with coordinators and supervisors
- Generate unique PR numbers
- Preview project documents
Workflow Relationship:
Project Setting is the entry point for Project Registration Workflow:
- Purchasing creates project → Sets PR.No, PO.No, Contractor
- Work Owner searches by PR.No → Creates workflow task
- Workflow progresses through 8 states
- Project status: Draft → Started → Completed
Role Matrix
Revision 1.0 (2026-01-13) - Initial version
Feature-Level Access
| Action | Admin | Purchasing | Work Owner | Safety Officer | Workspace Owner | Contractor |
|---|---|---|---|---|---|---|
| View all projects | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Create project | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Edit project | ✅ | ✅ | Own only | ❌ | ❌ | ❌ |
| Delete project | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Generate PR Number | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Preview document | ✅ | ✅ | Own only | ❌ | ❌ | ❌ |
Field-Level Access
| Field | Admin | Purchasing | Work Owner |
|---|---|---|---|
| PR.No (เลขที่ใบขอซื้อ) | ✅ | ✅ | ✅ |
| PO.No (เลขที่ใบสั่งซื้อ) | ✅ | ✅ | ❌ |
| PO Duration (จำนวนวันตามใบสั่งซื้อ) | ✅ | ✅ | ❌ |
| PO Period (ระยะเวลาตามใบสั่งซื้อ) | ✅ | ✅ | ❌ |
| Workspace Area (พื้นที่ทำงาน) | ✅ | ❌ | ✅ |
| Work Owner (เจ้าของงาน) | ✅ | ✅ | ✅ |
| Safety Officer (เจ้าหน้าที่ความปลอดภัย) | ✅ | ✅ | ✅ |
| Workspace Owner (เจ้าของพื้นที่) | ✅ | ✅ | ✅ |
| Contractor (ผู้รับเหมา) | ✅ | ✅ | ✅ |
Legend:
- ✅ = Can edit
- ❌ = Read-only or hidden
- Own only = Can only edit projects where user is assigned as Work Owner
Role Comparison: Purchasing vs Work Owner
The key difference between Purchasing and Work Owner roles:
| Capability | Purchasing | Work Owner |
|---|---|---|
| View all projects | ✅ | ✅ |
| Create new projects | ✅ | ❌ |
| Edit all projects | ✅ | ❌ (own only) |
| Delete projects | ✅ | ❌ |
| Edit PO fields (PO.No, Duration, Period) | ✅ | ❌ (read-only) |
| Edit PR.No | ✅ | ✅ |
Work Owner Restrictions:
- No Create Button - Cannot initiate new projects
- Edit Own Projects Only - Can only edit projects where assigned as Work Owner
- No Delete Option - Delete menu item hidden for Work Owner
- PO Fields Disabled - PO.No, Duration, and Period fields are read-only
- View-Only for Others - Shows "ดูข้อมูล" (View) instead of "กำหนดค่า" (Configure) for other users' projects
Backend Test Report
Location:
backend/tests/http/projects.httpTotal Tests: 56 tests
API Endpoints
| Method | Endpoint | Description | Authorization |
|---|---|---|---|
| POST | /api/projects/search | Search projects by keyword | ProjectMgmt |
| GET | /api/projects/create | Get blank project form | ProjectMgmt |
| GET | /api/projects/get/{id} | Get project details with lookups | ProjectMgmt |
| POST | /api/projects/save | Create or update project | ProjectMgmt |
| POST | /api/projects/remove | Delete project | ProjectMgmt |
| GET | /api/projects/preCreate | Validate staff before creation | ProjectMgmt |
| POST | /api/projects/searchByPrNo | Search by PR.No for workflow | ProjectMgmt |
| POST | /api/projects/notifyContractor | Send notification to contractor | ProjectMgmt |
| GET | /api/projects/generatePrNumber | Generate unique PR number | Anonymous |
| GET | /api/projects/previewDocument/{id} | Generate PDF preview | ProjectMgmt |
Test Coverage
| Part | Section | Tests | Description |
|---|---|---|---|
| A | PreCreate | 5 | Validate staff configuration |
| A | Create | 6 | Initialize new project with lookups |
| A | Get | 7 | Retrieve project by ID |
| A | Save | 10 | Create/update project |
| A | Remove | 6 | Delete project |
| A | Search | 4 | List all projects |
| B | SearchByPrNo | 6 | PR number search with task status |
| C | Task Creation | 6 | Project via workflow |
| C | Relationship | 6 | Project-Task FK constraints |
Test Results by Role
| Endpoint | Admin | Purchasing | Work Owner | Contractor |
|---|---|---|---|---|
| PreCreate | ✅ 200 | ✅ 200 | ✅ 200 | ❌ 403 |
| Create | ✅ 200 | ✅ 200 | ✅ 200 | ❌ 403 |
| Get | ✅ 200 | ✅ 200 | ✅ 200 | ❌ 403 |
| Save | ✅ 200 | ✅ 200 | ✅ 200 | ❌ 403 |
| Remove | ✅ 200 | ✅ 200 | ✅ 200 | ❌ 403 |
| Search | ✅ 200 | ✅ 200 | ✅ 200 | ❌ 403 |
| SearchByPrNo | ✅ 200 | ✅ 200 | ✅ 200 | ❌ 403 |
Legend: ✅ = Success, ❌ = Forbidden
Frontend Test Report
Location:
frontend/e2e/project-setting.spec.ts(to be created) Manual Test Cases: Project Settings Test Cases Tested: Pending
Components
| Component | Description |
|---|---|
project-setting.component.ts | Smart component (parent) |
project-setting.service.ts | State management |
project-setting-list.component.ts | Project list table |
project-setting-list-toolbar.component.ts | Search and actions toolbar |
project-setting-form.component.ts | Edit form with tabs |
project-setting-form-purchasing.component.ts | Tab 1: Purchasing info |
project-setting-form-general.component.ts | Tab 2: Project info |
project-setting-form-contractor.component.ts | Tab 3: Contractor info |
Manual Test Cases
Prerequisites
- Backend server running on
http://localhost:5000 - Frontend running on
http://localhost:4200 - Test accounts available (see below)
- At least one contractor exists in the system
Test Users
| Role | Password | Access Level | |
|---|---|---|---|
| Admin | tn@thaiscada.com | Test1234* | Full access |
| Purchasing | safety-purchasing@outlook.com | Test1234* | Full access |
| Work Owner | safety-owner@outlook.com | Test1234* | Edit own projects |
| Contractor | safety-contractor1-0@outlook.com | Test1234* | No access (403) |
Navigation Path
URL: /tools/settings/project
Menu Path: เครื่องมือ (Tools) → กำหนดค่าโครงการ (Project Settings) → โครงการ (Projects)
Test Summary
See Frontend Project Settings Test Cases for detailed manual test cases.
| Category | Total |
|---|---|
| 1. Navigation & Access | 4 |
| 2. View Project List | 3 |
| 3. Create Project | 4 |
| 4. Edit Project | 3 |
| 5. Delete Project | 3 |
| 6. Tab Navigation | 3 |
| Total | 20 |
Project Statuses
| Status | Value | Description |
|---|---|---|
| Initiated | 0 | Project created, not yet in workflow |
| Started | 1 | Workflow approved, project active |
| Completed | 2 | Workflow finished |
| Canceled | 3 | Workflow canceled |
Related Documentation
- Project Registration Workflow - Workflow that uses projects
- Frontend Project Settings Test Cases - Detailed manual test steps
Labels verified against:
project-setting-list.component.ts(table headers, menu actions)project-setting-form-purchasing.component.ts(Purchasing tab fields)project-setting-form-general.component.ts(Project Info tab fields)project-setting-form-contractor.component.ts(Contractor tab fields)