Service Report #020 Done
Date: 2026-02-25
This report covers two new features, one enhancement, and one bug fix: (1) Auto-Sign on Document Approve — automatically applies personal signature when approving JSA documents, (2) Hide Training Approval Tab from Admin — Admin no longer sees the training approval tab reserved for Safety Officers, (3) Co-Review Task Consolidation — consolidated co-review task cards with color-coded reviewer status, and (4) Auto-Sign Clear on Un-approve — un-approving a document now properly clears the auto-signed signature.
Feature Overview
| # | Feature | Type | Status |
|---|---|---|---|
| 1 | Auto-Sign on Document Approve | New Feature | ✅ Done |
| 2 | Hide Training Approval Tab from Admin | New Feature | ✅ Done |
| 3 | Auto-Sign Clear on Un-approve | Bug Fix | ✅ Done |
| 4 | Co-Review Task Consolidation | Enhancement | ✅ Done |
1. Auto-Sign on Document Approve
Issue: #477 Thai Name: ลงนามอัตโนมัติเมื่ออนุมัติเอกสาร JSA
Description: When internal staff (Work Owner / Safety Officer / Workspace Owner) click "อนุมัติเอกสาร" or "อนุมัติ JSA", the system automatically applies their saved personal signature to the JSA form's signature slot. This eliminates the need to manually open the signature dialog and confirm before approving.
Location: เครื่องมือ > จัดเตรียม JSA > เอกสาร JSA
Before vs After
| Step | Before (5 steps) | After (1 step) |
|---|---|---|
| 1 | Click signature slot → opens dialog | Click "อนุมัติเอกสาร" or "อนุมัติ JSA" |
| 2 | Dialog pre-loads saved signature | (auto-signed + approved) |
| 3 | Confirm → signature applied | |
| 4 | Form becomes valid → button enables | |
| 5 | Click "อนุมัติเอกสาร" |
Admin Setting
The feature is configurable via a toggle in System Settings:
Location: เครื่องมือ > ตั้งค่าระบบ > ตั้งค่าภูมิภาค
| Setting | Default | Description |
|---|---|---|
| ลงนามอัตโนมัติเมื่ออนุมัติเอกสาร | Enabled (ON) | When ON, one-click approve with auto-sign. When OFF, current manual flow. |
Behavior by Role
| Role | Auto-Sign Available | Reason |
|---|---|---|
| Work Owner (เจ้าของงาน) | Yes | Internal staff with saved signature |
| Safety Officer (จป.) | Yes | Internal staff with saved signature |
| Workspace Owner (เจ้าของพื้นที่) | Yes | Internal staff with saved signature |
| Contractor (ผู้รับเหมา) | No | External — requires password verification |
Conditions for Auto-Sign
| Condition | Required |
|---|---|
| Admin setting enabled | Yes |
| Internal staff role (WO/SO/WAO) | Yes |
| Saved personal signature exists | Yes |
| Signature slot not already signed | Yes |
If any condition is not met, the system falls back to the existing manual signing flow.
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Setting ON + SO with saved signature → click "อนุมัติเอกสาร" on JSA → signature auto-applied + document approved | ⌛ Pending |
| 2 | Setting ON + WO with saved signature → click "อนุมัติเอกสาร" on JSA → signature auto-applied + document approved | ⌛ Pending |
| 3 | Setting ON + SO → click "อนุมัติ JSA" (workflow command) → all JSA forms auto-signed + approved | ⌛ Pending |
| 4 | Setting ON + user without saved signature → approve button disabled, manual signing required | ⌛ Pending |
| 5 | Setting ON + Contractor → approve button disabled, manual signing required (password verification) | ⌛ Pending |
| 6 | Setting OFF + WO with saved signature → approve button disabled until manual signing (current behavior) | ⌛ Pending |
| 7 | Toggle setting OFF → verify immediate effect on JSA approval flow | ⌛ Pending |
| 8 | Multiple JSA forms → "อนุมัติ JSA" auto-signs all forms for current role | ⌛ Pending |
| 9 | Signature already present → approve works normally without re-signing | ⌛ Pending |
| 10 | No orange validation banner when auto-sign is available (signature error suppressed) | ⌛ Pending |
2. Hide Training Approval Tab from Admin
Issue: #476 Thai Name: ซ่อนแท็บอนุมัติผลการอบรมจาก Admin
Description: The "อนุมัติผลอบรม" (Training Approval) tab in Training Management is now hidden from Admin users. This tab is only relevant for Safety Officers who approve training results. Admin can still manage training plans and sessions.
Location: Admin > เครื่องมือ > จัดการการอบรม
Behavior by Role
| Role | แผนการอบรม | รอบอบรม | อนุมัติผลอบรม |
|---|---|---|---|
| Admin | Visible | Visible | Hidden |
| Safety Officer | Visible | Visible | Visible |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Login as Admin → เครื่องมือ > จัดการการอบรม → see only 2 tabs (แผนการอบรม, รอบอบรม) | ⌛ Pending |
| 2 | Login as Safety Officer → จัดการการอบรม → see all 3 tabs including อนุมัติผลอบรม | ⌛ Pending |
| 3 | Admin can still add/edit/delete training plans and sessions | ⌛ Pending |
| 4 | Tab switching works correctly with only 2 tabs (no index mismatch) | ⌛ Pending |
3. Auto-Sign Clear on Un-approve
Issue: #484 Thai Name: ลบลายเซ็นอัตโนมัติเมื่อยกเลิกการอนุมัติเอกสาร
Description: When a user un-approves a document that was auto-signed, the system now properly clears the auto-signed signature. Previously, the signature remained even after un-approving. Also replaced setTimeout with Observable chain to eliminate race conditions.
Location: เครื่องมือ > จัดเตรียม JSA > เอกสาร JSA > ปุ่ม "อนุมัติเอกสาร" / "อนุมัติแล้ว"
Behavior
| Action | Before (Bug) | After (Fixed) |
|---|---|---|
| Auto-sign → Un-approve | Signature remains | Signature cleared |
| Auto-sign timing | Could appear before validation passes | Only appears after all validations pass |
| Save sequencing | setTimeout(fn, 300) — race condition | Observable chain — deterministic |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | SO with saved signature → "อนุมัติเอกสาร" → signature auto-fills → "อนุมัติแล้ว" (toggle off) → signature clears | ⌛ Pending |
| 2 | WO with saved signature → same approve/un-approve flow → signature clears | ⌛ Pending |
| 3 | Manually drawn signature → approve → un-approve → manual signature NOT cleared (only auto-signed cleared) | ⌛ Pending |
| 4 | Refresh page after un-approve → signature stays cleared (persisted) | ⌛ Pending |
| 5 | Click "อนุมัติ JSA" (workflow command) without approving documents first → signature does NOT appear prematurely | ⌛ Pending |
4. Co-Review Task Consolidation
Issue: #489 Thai Name: รวมการ์ดงานที่รอ Co-Review เป็นใบเดียว
Description: When a contractor submits a JSA or Work Permit for co-review, the "รอผู้อื่นดำเนินการ" section now shows a single consolidated card instead of separate cards per reviewer. Each reviewer is displayed with a color-coded approval status.
Location: งานของฉัน > รอผู้อื่นดำเนินการ
Behavior
| Scenario | Before | After |
|---|---|---|
| JSA co-review (WO + SO) | 2 separate task cards | 1 card with 2 reviewer names |
| Work Permit co-review (WO + SO + WAO) | 3 separate task cards | 1 card with 3 reviewer names |
| WO approved, SO pending | 2 cards (no status) | 1 card: WO green, SO orange |
| All approved | Task moves to completed | Task moves to completed |
Color Coding
| Status | Color | Label |
|---|---|---|
| Approved | Green (text-green-600) | (อนุมัติแล้ว) |
| Pending | Orange (text-amber-600) | (รออนุมัติ) |
What to Test
| # | Test Case | Status |
|---|---|---|
| 1 | Contractor submits JSA for co-review → "รอผู้อื่นดำเนินการ" shows 1 card with WO + SO both in orange | ⌛ Pending |
| 2 | WO approves JSA → Contractor sees WO in green, SO in orange on same card | ⌛ Pending |
| 3 | Both WO + SO approve → Task moves to completed section | ⌛ Pending |
| 4 | Section count shows actual task count (not inflated by reviewer count) | ⌛ Pending |
| 5 | Non-co-review tasks still show single "รอ [name]" as before | ⌛ Pending |
| 6 | Reviewer names display on separate lines (not running together on one line) | ⌛ Pending |