Service Report #012 In Progress
Date: 2026-02-11
The Work Permit (WP) workflow has been refactored to comply with standard workflow patterns (PR #372). This report consolidates all outstanding WP-related issues from MoM sessions for systematic testing and implementation.
Feature Overview
| # | Feature | PR/Issue | Type | MoM Source | Status |
|---|---|---|---|---|---|
| 1 | Work Permit Workflow Testing | #309 | Bug Fix | 2026-01-20 | ⌛ Pending |
| 2 | Review Permit Type Selection Flow | #161 | Enhancement | 2025-12-16 | ⌛ Pending |
| 3 | Work Permit Missing Tabs (Tools, JSA, Project Info) | #162 | Enhancement | 2025-12-16 | ⌛ Pending |
| 4 | Worker Selection from Trained List | #163 | Enhancement | 2025-12-16 | ⌛ Pending |
| 5 | JSA Tab Listing with Tick Marks | #164 | Enhancement | 2025-12-16 | ⌛ Pending |
| 6 | Form Verification Against Original Documents | #165 | Enhancement | 2025-12-16 | ⌛ Pending |
| 7 | Work Permit Daily Closure Rules | #191 | Enhancement | 2025-12-29 | ⌛ Pending |
| 8 | System Isolate Completed Checkbox for WP Approval | #338 | Enhancement | 2026-01-27 | ⌛ Pending |
| 9 | Grouped Reference Documents | Internal | Enhancement | - | 🔍 In Review |
| 10 | Task Completion Timestamp Fix | Internal | Bug Fix | - | 🔍 In Review |
| 11 | Work Permit Stepper Fix (5 Steps) | Internal | Bug Fix | - | 🔍 In Review |
| 12 | Reference Document Ordering | Internal | Enhancement | - | 🔍 In Review |
| 13 | PTW Form Layout Refactoring | Internal | Enhancement | - | 🔍 In Review |
| 14 | Work Permit Template Setting | Internal | Enhancement | - | 🔍 In Review |
1. Work Permit Workflow Testing
Issue: #309 Thai Name: ผู้รับเหมา: ทดสอบ Work permit ไม่ได้
MoM Quote:
"ผู้รับเหมา: ทดสอบ Work permit ไม่ได้"
Description: Contractor was unable to test the Work Permit workflow. The WP workflow has since been refactored to comply with standard workflow patterns (PR #372). This item requires end-to-end testing of the full WP workflow to confirm it works correctly.
Location: My Tasks → + สร้างงาน → การขอใบอนุญาตทำงาน
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Contractor creates a new Work Permit task for an approved project | ⌛ Pending |
| 2 | Work Permit form loads correctly with document sections | ⌛ Pending |
| 3 | Contractor fills in the General Work Permit form | ⌛ Pending |
| 4 | Contractor submits Work Permit for review | ⌛ Pending |
| 5 | Work Owner receives and reviews the Work Permit | ⌛ Pending |
| 6 | Safety Officer receives and reviews the Work Permit | ⌛ Pending |
| 7 | Workspace Owner approves the Work Permit | ⌛ Pending |
| 8 | Full workflow completes without errors | ⌛ Pending |
2. Review Permit Type Selection Flow
Issue: #161 Thai Name: เรียงลำดับและตรวจสอบประเภทใบอนุญาต
MoM Quote:
"เนื่องจากมีการ เลือกประเภทใบอนุญาต ข้ามขึ้นตอนมา จึงพยายาม review ให้ก่อน"
Description: Review and fix the permit type selection flow:
- Reorder: put ใบอนุญาตปฏิบัติงานทั่วไป (General Work Permit) first (most frequently used)
- Fix typo: สะกด "อนุญาต" เป็น "อนุญาติ" ผิดหลายจุด
- Radiation work: use international radiation symbol
- Find standard icons for all permit types
Location: Work Permit form → Permit type selection
Requirements
| # | Requirement | Description |
|---|---|---|
| 1 | Reorder permit types | ใบอนุญาตปฏิบัติงานทั่วไป must be first |
| 2 | Fix spelling | "อนุญาติ" → "อนุญาต" (check all occurrences) |
| 3 | Radiation symbol | Use international radiation hazard symbol |
| 4 | Standard icons | Use proper safety icons for each permit type |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Open permit type selection → ใบอนุญาตปฏิบัติงานทั่วไป is listed first | ⌛ Pending |
| 2 | Check all labels → No "อนุญาติ" typo anywhere | ⌛ Pending |
| 3 | Radiation work type → Shows international radiation symbol | ⌛ Pending |
| 4 | All permit types → Have appropriate standard icons | ⌛ Pending |
3. Work Permit Missing Tabs (Tools, JSA, Project Info)
Issue: #162 Thai Name: การขอ Work Permit ขาด Tab เครื่องมือ, Tab JSA, และข้อมูลโครงการ
MoM Quote:
"การขอ Work Permit ขาด Tab เครื่องมือ, Tab JSA ที่ผ่านมา จาก flow ก่อนนี้ และขาด Tab ข้อมูลโครงการ (คล้ายตอน Task ลงทะเบียน)"
Description: The Work Permit task should display reference tabs/sections from prerequisite workflows:
- Tool List (from approved Tool List Preparation task)
- JSA (from approved JSA Preparation task)
- Project Info (like the Project Registration form)
These tabs show data from the prerequisite workflows as read-only reference.
Location: My Tasks → Open Work Permit task → Document sections
Requirements
| Tab | Source | Access |
|---|---|---|
| Project Info | Project Registration | Read-only reference |
| Tool List | Tool List Preparation | Read-only reference |
| JSA | JSA Preparation | Read-only reference |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Open WP task → See Project Info section with 9 standard fields | ⌛ Pending |
| 2 | Open WP task → See Tool List reference from approved Tool List task | ⌛ Pending |
| 3 | Open WP task → See JSA reference from approved JSA task | ⌛ Pending |
| 4 | All reference sections are read-only (no editing allowed) | ⌛ Pending |
4. Worker Selection from Trained List
Issue: #163 Thai Name: รายชื่อต้องเลือกจากรายชื่อที่ผ่านการอบรมแล้ว
MoM Quote:
"รายชื่อ ต้องเลือก จากรายชื่อที่ผ่านการอบรมแล้ว ใน project นี้ โดย JSA ผูกกับชนิดของงาน และ เอกสารของแต่ละคน จะต้องตามมาหากเลือกคนเข้ามาใน Work Permit วันนั้น ๆ"
Description: When creating a daily Work Permit, worker selection must be limited to workers who have completed training for this project. Key relationships:
- JSA is linked to the type of work
- Each worker's documents must follow when selected for a Work Permit day
Location: My Tasks → Open Work Permit task → Manpower/Worker selection
Requirements
| # | Requirement | Description |
|---|---|---|
| 1 | Filter by trained workers | Only show workers who passed training for this project |
| 2 | JSA-work type link | JSA is linked to the type of work being performed |
| 3 | Worker documents follow | When a worker is selected, their documents are included |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Select workers for WP → Only trained workers from this project appear | ⌛ Pending |
| 2 | Select a worker → Their documents are attached to the WP | ⌛ Pending |
| 3 | Try to add untrained worker → Not possible (filtered out) | ⌛ Pending |
5. JSA Tab Listing with Tick Marks
Issue: #164 Thai Name: Tab JSA แสดงเป็น Listing แล้ว Tick ได้
MoM Quote:
"Tab JSA ให้แสดงเป็น Listing ก่อน แล้ว Tick ได้ว่าใช้ หรือ ไม่ใช้ ใน Work Permit นี้ และสามารถ กดเข้าไปดูรายละเอียดของ JSA นั้นได้ [View only]"
Description: The JSA tab in Work Permit should show a list of available JSAs from the project. Users can tick which JSAs apply to this Work Permit and click to view JSA details (read-only).
Location: My Tasks → Open Work Permit task → JSA section
Requirements
| # | Requirement | Description |
|---|---|---|
| 1 | JSA listing | Show all approved JSAs from the project as a list |
| 2 | Tick selection | Allow checking/unchecking which JSAs apply to this WP |
| 3 | View details | Click a JSA to view its details (read-only) |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Open WP task → JSA section shows list of approved JSAs | ⌛ Pending |
| 2 | Tick a JSA → It is marked as applicable for this WP | ⌛ Pending |
| 3 | Untick a JSA → It is removed from this WP | ⌛ Pending |
| 4 | Click a JSA → View full JSA details (read-only) | ⌛ Pending |
6. Form Verification Against Original Documents
Issue: #165 Thai Name: ตรวจสอบแบบฟอร์มกับเอกสารต้นฉบับ
MoM Quote:
"ตรวจสอบเบื้องต้น แบบฟอร์มยังไม่ตรงกับ เอกสารต้นฉบับของแต่ละงาน จึงยังไม่ได้ตรวจสอบละเอียดในแต่ละ form"
Description: The Work Permit forms need to be verified against the original paper documents to ensure all fields and sections match. This requires a detailed comparison of each permit type form with its corresponding original document.
Location: My Tasks → Open Work Permit task → Each permit type form
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | General Work Permit form matches original document layout | ⌛ Pending |
| 2 | All required fields from original document are present | ⌛ Pending |
| 3 | Field labels match original document (Thai text) | ⌛ Pending |
| 4 | Form sections are in correct order per original document | ⌛ Pending |
7. Work Permit Daily Closure Rules
Issue: #191 Thai Name: การปิด Work Permit ต้องปิดทุกวัน
MoM Quote:
"การปิด Work Permit จะต้องปิดทุกวัน ส่วนการปิดงาน จะต้องไม่มี work permit ค้าง จึงจะปิดงานได้ จาก Diagram จะยังไม่เป็นการปิด work permit"
Description: Two business rules for Work Permit closure:
- Work Permits must be closed daily (every day's WP must be explicitly closed)
- Project closure is blocked if there are any open Work Permits remaining
Location: My Tasks → Work Permit task → Closure actions
Requirements
| # | Rule | Description |
|---|---|---|
| 1 | Daily closure | Each day's Work Permit must be explicitly closed at end of day |
| 2 | Project closure guard | Cannot close the project if any Work Permits remain open |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Open WP → End of day → Must close WP before next day | ⌛ Pending |
| 2 | Try to close project with open WP → Blocked with error message | ⌛ Pending |
| 3 | Close all WPs → Project closure allowed | ⌛ Pending |
8. System Isolate Completed Checkbox for WP Approval
Issue: #338 Thai Name: เจ้าของพื้นที่: เพิ่ม checkbox "System Isolate Completed" ตอนอนุมัติ Work Permit
MoM Quote:
"เจ้าของพื้นที่: ที่จะอนุมัติ WP ในแต่ละวัน ตอน อนุมัติ จะมี check box [ ] System Isolate Completed"
Description: When the Workspace Owner approves a daily Work Permit, a "System Isolate Completed" checkbox must be checked before approval can proceed. This confirms that system isolation has been completed before work begins.
Location: My Tasks → Open Work Permit task → Workspace Owner approval
Requirements
| # | Requirement | Description |
|---|---|---|
| 1 | Checkbox in approval | Add "System Isolate Completed" checkbox to WP approval dialog |
| 2 | Required for approval | Checkbox must be checked before Approve button is enabled |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Workspace Owner opens WP approval → See "System Isolate Completed" checkbox | ⌛ Pending |
| 2 | Checkbox unchecked → Approve button disabled | ⌛ Pending |
| 3 | Check the checkbox → Approve button enabled | ⌛ Pending |
The following improvements were made internally to improve system quality and maintainability.
9. Grouped Reference Documents
Thai Name: แสดงเอกสารอ้างอิงจาก Workflow อื่นแบบจัดกลุ่ม
Description: Work Permit, JSA Preparation, and Tool List Preparation tasks now show reference documents from prerequisite workflows in a grouped layout. Documents are grouped by source workflow type (e.g., "ขึ้นทะเบียนโครงการ", "จัดทำ JSA", "จัดทำรายการเครื่องมือ") with read-only access.
Location: My Tasks → Open any Work Permit / JSA / Tool List task → เอกสารอ้างอิง section
Behavior
| Workflow | Reference Documents Shown |
|---|---|
| Work Permit | Project Registration (2 docs), JSA forms (with name + area), Tool List |
| JSA Preparation | Project Registration (2 docs) |
| Tool List Preparation | Project Registration (2 docs) |
| Project Registration | None (no prerequisites) |
Key Features
| Feature | Description |
|---|---|
| Grouped by workflow | Documents grouped under source workflow name with count |
| JSA display | Shows JSA work type name and area code (same as JSA Preparation view) |
| Read-only | All reference documents shown with "อ่านอย่างเดียว" badge |
| Approved timestamp | Shows when the source task was completed |
| Click to view | Click any reference document to view full content (read-only) |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Open WP task → See "เอกสารอ้างอิง" section with grouped documents | 🔍 In Review |
| 2 | Project Registration group → Shows "แบบฟอร์มขึ้นทะเบียนโครงการ" and "ระเบียบปฏิบัติก่อนเข้ามาปฏิบัติงาน" | 🔍 In Review |
| 3 | JSA group → Shows JSA names (e.g., "Hot Work") with area codes | 🔍 In Review |
| 4 | Tool List group → Shows "รายการเครื่องมือ" | 🔍 In Review |
| 5 | Click Project Registration reference → Shows form content (read-only) | 🔍 In Review |
| 6 | Click JSA reference → Shows JSA content (read-only) | 🔍 In Review |
| 7 | Click Tool List reference → Shows tool list content (read-only) | 🔍 In Review |
| 8 | Approved timestamp shows on each reference document | 🔍 In Review |
10. Task Completion Timestamp Fix
Thai Name: แก้ไขการบันทึกเวลาเสร็จสิ้นของงาน
Description: The CompletedAtUtc field was never being set when tasks reached terminal status (Closed, Cancelled, Rejected). This caused the approved timestamp on reference documents to not appear. Fixed by setting CompletedAtUtc in UpdateTaskStatusAsync() for all terminal statuses.
Location: System-wide (all workflow task completions)
Behavior
| Task Status | CompletedAtUtc |
|---|---|
| Active | Not set |
| Closed | Set to current time |
| Cancelled | Set to current time |
| Rejected | Set to current time |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Complete a Project Registration → CompletedAtUtc is set | 🔍 In Review |
| 2 | Cancel a task → CompletedAtUtc is set | 🔍 In Review |
| 3 | Reference docs from completed tasks show approved timestamp | 🔍 In Review |
11. Work Permit Stepper Fix (5 Steps)
Thai Name: แก้ไข Stepper ใบขออนุญาตให้แสดงครบ 5 ขั้นตอน
Description: The workflow stepper (progress bar at the top of the task page) was only showing 3 steps (Fill Permit → SO Review → Done), which did not match the actual backend workflow with 7 active states. When the workflow reached states like Co-Review, Work In Progress, or Request Close, the stepper would incorrectly fall back to showing "Fill Permit" as the current step.
The stepper now correctly shows 5 steps matching the backend workflow:
Location: My Tasks → Open any Work Permit task → Stepper bar at top
Behavior
| Step | Thai Label | When Active |
|---|---|---|
| 1 | กรอกใบขออนุญาต | Contractor filling the permit form |
| 2 | ตรวจสอบร่วม | WO + SO + WAO co-review |
| 3 | ปฏิบัติงาน | Work is in progress |
| 4 | รอปิดงาน | Pending closure approval |
| 5 | เสร็จสิ้น | Workflow completed |
Extension Review appears as a branch state with a return arrow (↩) pointing back to step 3 (ปฏิบัติงาน).
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Open WP task at Fill Permit state → Stepper shows 5 steps, step 1 active (blue) | 🔍 In Review |
| 2 | WP at Co-Review state → Step 1 green, step 2 active (blue) | 🔍 In Review |
| 3 | WP at Work In Progress → Steps 1-2 green, step 3 active (blue) | 🔍 In Review |
| 4 | WP at Extension Review → Steps 1-2 green, step 3 active with return arrow (↩) | 🔍 In Review |
| 5 | WP at Request Close → Steps 1-3 green, step 4 active (blue) | 🔍 In Review |
| 6 | WP Approved/Completed → All 5 steps green | 🔍 In Review |
| 7 | WP Cancelled → Branch state indicator shown | 🔍 In Review |
| 8 | WP Rejected → Branch state indicator shown | 🔍 In Review |
12. Reference Document Ordering
Thai Name: เรียงลำดับเอกสารอ้างอิงโดย JSA และ Tool List แสดงก่อน Project Registration
Description: Reference documents in the Work Permit task were showing Project Registration first, followed by JSA and Tool List. Since JSA and Tool List documents are more directly relevant to the daily Work Permit, the ordering has been changed so they appear first. Project Registration (the foundation document) now appears last.
Location: My Tasks → Open Work Permit task → เอกสารอ้างอิง section
Behavior
| Before | After |
|---|---|
| 1. ขึ้นทะเบียนโครงการ (2) | 1. จัดทำ JSA (N) |
| 2. จัดทำ JSA (N) | 2. จัดทำรายการเครื่องมือ (1) |
| 3. จัดทำรายการเครื่องมือ (1) | 3. ขึ้นทะเบียนโครงการ (2) |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Open WP task → JSA section appears first in reference documents | 🔍 In Review |
| 2 | Tool List section appears second | 🔍 In Review |
| 3 | Project Registration section appears last | 🔍 In Review |
| 4 | All reference documents still clickable and viewable (read-only) | 🔍 In Review |
13. PTW Form Layout Refactoring
Thai Name: ปรับปรุงรูปแบบฟอร์มใบอนุญาตทำงานให้เป็นมาตรฐานเดียวกับ JSA
Description: All PTW (Permit to Work) form sections have been refactored from the legacy inline-edit/underline pattern to use Angular Material outlined form fields (mat-form-field appearance="outline"). This matches the JSA form standard. Project information section now shows data from the approved project (read-only), consistent with how JSA and Tool List display project data.
Location: My Tasks → Open Work Permit task → General Work Permit form (and all 8 permit types)
Changes
| Area | Before | After |
|---|---|---|
| Standalone text fields | Underline + pencil icon (inline-edit) | Material outlined input (mat-form-field) |
| Standalone date fields | inline-datepicker | Material date picker (mat-form-field + matDatepicker) |
| Read-only mode | Same underline style, disabled | Clean label + value span layout |
| Project info section | Empty (all dashes) | Populated from project data (same as JSA) |
| Table cell fields | No change | No change (still uses inline-edit in table cells) |
Affected Parts
| Part | Section | Fields Changed |
|---|---|---|
| Part 1: Contractor | Permit Details | Permit No., Date Issued, Supervisor, Email, Phone |
| Part 1: Contractor | Project Info | All 9 fields now from project context (read-only) |
| Part 2: Client (Check) | Checklist reviewer | Reviewer name, Review date |
| Part 2: Client (Check) | Work Description | Textarea |
| Part 3: Authorization | Per phase (3 phases) | Date, Start time, End time |
| Part 4: Extension | Per extension | Date, Original end, New end, Reason |
| Part 5: Completion | Inspection section | Inspection date, Inspector name, Remarks |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Open WP task as Contractor → Part 1 shows project info (all 9 fields populated) | 🔍 In Review |
| 2 | Part 1 editable fields (Permit No., Date Issued, Supervisor, Email, Phone) show as Material outlined inputs | 🔍 In Review |
| 3 | Part 2 checklist table → remarks column still uses inline-edit (no change) | 🔍 In Review |
| 4 | Part 2 Work Description → shows as Material outlined textarea | 🔍 In Review |
| 5 | Part 3 Authorization → date picker and time fields show as Material outlined inputs | 🔍 In Review |
| 6 | Part 4 Extension → date, time, reason fields show as Material outlined inputs | 🔍 In Review |
| 7 | Part 5 Completion → date/inspector as Material outlined inputs, table remarks still inline-edit | 🔍 In Review |
| 8 | Switch to read-only view (SO/WO) → all fields show as label + value (no input borders) | 🔍 In Review |
| 9 | Auto-save works: text changes trigger debounced save, date selections trigger immediate save | 🔍 In Review |
| 10 | Unsaved changes warning shows when navigating away with pending changes | 🔍 In Review |
14. Work Permit Template Setting
Thai Name: ตั้งค่าต้นแบบใบอนุญาตปฏิบัติงาน (Checklist + PPE + Icon)
Description: Admin and Safety Officer can now manage work permit templates through a settings page. Each template defines the pre-work checklist items, PPE requirements, and icon that appear when creating a new work permit. The icon is used in the template list, preview dialog, and permit type selection dialog. Previously, checklist/PPE were hardcoded in the frontend and icons used a hardcoded mapping.
Location: Tools > กำหนดค่า > ต้นแบบใบอนุญาตปฏิบัติงาน
Key Capabilities
| Capability | Description |
|---|---|
| Template management | Create, edit, delete work permit templates |
| Icon picker | Select Material Icon or Unicode/Emoji with live preview |
| Preview dialog | View template details (icon, checklist, PPE) in read-only dialog |
| Checklist items | Define pre-work checklist items (Thai/English) per template |
| PPE items | Define PPE requirements with default checked option |
| Active/Inactive | Control which templates are available when creating permits |
| Sort order | Control display order of templates |
| Validation | Dialog shows row-by-row errors on save (same pattern as JSA approval) |
| Dynamic icons | Permit type selection dialog uses icon from template (not hardcoded) |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Admin/SO can access the page from Tools menu | 🔍 In Review |
| 2 | Other roles cannot see the menu card | 🔍 In Review |
| 3 | Create new template with checklist and PPE items | 🔍 In Review |
| 4 | Edit existing template — changes persist after save | 🔍 In Review |
| 5 | Delete template with confirmation dialog | 🔍 In Review |
| 6 | Save with empty name shows validation error dialog | 🔍 In Review |
| 7 | Unsaved changes warning when navigating back | 🔍 In Review |
| 8 | Search by keyword filters the template list | 🔍 In Review |
| 9 | Select icon from Material Icon presets → Icon shows in list and preview | 🔍 In Review |
| 10 | Select icon from Emoji presets (e.g., ☢) → Displays as Unicode text | 🔍 In Review |
| 11 | Enter custom icon text → Live preview updates | 🔍 In Review |
| 12 | Click preview button → Dialog shows template icon, checklist, and PPE | 🔍 In Review |
| 13 | Permit type selection dialog → Uses icon from template setting | 🔍 In Review |
Summary
| # | Feature | Type | MoM | Status |
|---|---|---|---|---|
| 1 | Work Permit Workflow Testing | Bug Fix | 2026-01-20 | ⌛ Pending |
| 2 | Review Permit Type Selection Flow | Enhancement | 2025-12-16 | ⌛ Pending |
| 3 | Work Permit Missing Tabs | Enhancement | 2025-12-16 | ⌛ Pending |
| 4 | Worker Selection from Trained List | Enhancement | 2025-12-16 | ⌛ Pending |
| 5 | JSA Tab Listing with Tick Marks | Enhancement | 2025-12-16 | ⌛ Pending |
| 6 | Form Verification Against Original Documents | Enhancement | 2025-12-16 | ⌛ Pending |
| 7 | Work Permit Daily Closure Rules | Enhancement | 2025-12-29 | ⌛ Pending |
| 8 | System Isolate Completed Checkbox | Enhancement | 2026-01-27 | ⌛ Pending |
| 9 | Grouped Reference Documents | Enhancement | Internal | 🔍 In Review |
| 10 | Task Completion Timestamp Fix | Bug Fix | Internal | 🔍 In Review |
| 11 | Work Permit Stepper Fix (5 Steps) | Bug Fix | Internal | 🔍 In Review |
| 12 | Reference Document Ordering | Enhancement | Internal | 🔍 In Review |
| 13 | PTW Form Layout Refactoring | Enhancement | Internal | 🔍 In Review |
| 14 | Work Permit Template Setting | Enhancement | Internal | 🔍 In Review |