Skip to main content

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:

  1. Purchasing creates project → Sets PR.No, PO.No, Contractor
  2. Work Owner searches by PR.No → Creates workflow task
  3. Workflow progresses through 8 states
  4. Project status: Draft → Started → Completed

Role Matrix

Revision 1.0 (2026-01-13) - Initial version

Feature-Level Access

ActionAdminPurchasingWork OwnerSafety OfficerWorkspace OwnerContractor
View all projects
Create project
Edit projectOwn only
Delete project
Generate PR Number
Preview documentOwn only

Field-Level Access

FieldAdminPurchasingWork 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:

CapabilityPurchasingWork 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:

  1. No Create Button - Cannot initiate new projects
  2. Edit Own Projects Only - Can only edit projects where assigned as Work Owner
  3. No Delete Option - Delete menu item hidden for Work Owner
  4. PO Fields Disabled - PO.No, Duration, and Period fields are read-only
  5. View-Only for Others - Shows "ดูข้อมูล" (View) instead of "กำหนดค่า" (Configure) for other users' projects

Backend Test Report

Location: backend/tests/http/projects.http Total Tests: 56 tests

API Endpoints

MethodEndpointDescriptionAuthorization
POST/api/projects/searchSearch projects by keywordProjectMgmt
GET/api/projects/createGet blank project formProjectMgmt
GET/api/projects/get/{id}Get project details with lookupsProjectMgmt
POST/api/projects/saveCreate or update projectProjectMgmt
POST/api/projects/removeDelete projectProjectMgmt
GET/api/projects/preCreateValidate staff before creationProjectMgmt
POST/api/projects/searchByPrNoSearch by PR.No for workflowProjectMgmt
POST/api/projects/notifyContractorSend notification to contractorProjectMgmt
GET/api/projects/generatePrNumberGenerate unique PR numberAnonymous
GET/api/projects/previewDocument/{id}Generate PDF previewProjectMgmt

Test Coverage

PartSectionTestsDescription
APreCreate5Validate staff configuration
ACreate6Initialize new project with lookups
AGet7Retrieve project by ID
ASave10Create/update project
ARemove6Delete project
ASearch4List all projects
BSearchByPrNo6PR number search with task status
CTask Creation6Project via workflow
CRelationship6Project-Task FK constraints

Test Results by Role

EndpointAdminPurchasingWork OwnerContractor
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

ComponentDescription
project-setting.component.tsSmart component (parent)
project-setting.service.tsState management
project-setting-list.component.tsProject list table
project-setting-list-toolbar.component.tsSearch and actions toolbar
project-setting-form.component.tsEdit form with tabs
project-setting-form-purchasing.component.tsTab 1: Purchasing info
project-setting-form-general.component.tsTab 2: Project info
project-setting-form-contractor.component.tsTab 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

RoleEmailPasswordAccess Level
Admintn@thaiscada.comTest1234*Full access
Purchasingsafety-purchasing@outlook.comTest1234*Full access
Work Ownersafety-owner@outlook.comTest1234*Edit own projects
Contractorsafety-contractor1-0@outlook.comTest1234*No access (403)

URL: /tools/settings/project

Menu Path: เครื่องมือ (Tools) → กำหนดค่าโครงการ (Project Settings) → โครงการ (Projects)

Test Summary

See Frontend Project Settings Test Cases for detailed manual test cases.

CategoryTotal
1. Navigation & Access4
2. View Project List3
3. Create Project4
4. Edit Project3
5. Delete Project3
6. Tab Navigation3
Total20

Project Statuses

StatusValueDescription
Initiated0Project created, not yet in workflow
Started1Workflow approved, project active
Completed2Workflow finished
Canceled3Workflow canceled

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)