Skip to main content

Service Report #020 Done

Date: 2026-02-25


New Features — Auto-Sign, Training Tab, Co-Review Consolidation

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

#FeatureTypeStatus
1Auto-Sign on Document ApproveNew Feature Done
2Hide Training Approval Tab from AdminNew Feature Done
3Auto-Sign Clear on Un-approveBug Fix Done
4Co-Review Task ConsolidationEnhancement 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

StepBefore (5 steps)After (1 step)
1Click signature slot → opens dialogClick "อนุมัติเอกสาร" or "อนุมัติ JSA"
2Dialog pre-loads saved signature(auto-signed + approved)
3Confirm → signature applied
4Form becomes valid → button enables
5Click "อนุมัติเอกสาร"

Admin Setting

The feature is configurable via a toggle in System Settings:

Location: เครื่องมือ > ตั้งค่าระบบ > ตั้งค่าภูมิภาค

SettingDefaultDescription
ลงนามอัตโนมัติเมื่ออนุมัติเอกสารEnabled (ON)When ON, one-click approve with auto-sign. When OFF, current manual flow.

Behavior by Role

RoleAuto-Sign AvailableReason
Work Owner (เจ้าของงาน)YesInternal staff with saved signature
Safety Officer (จป.)YesInternal staff with saved signature
Workspace Owner (เจ้าของพื้นที่)YesInternal staff with saved signature
Contractor (ผู้รับเหมา)NoExternal — requires password verification

Conditions for Auto-Sign

ConditionRequired
Admin setting enabledYes
Internal staff role (WO/SO/WAO)Yes
Saved personal signature existsYes
Signature slot not already signedYes

If any condition is not met, the system falls back to the existing manual signing flow.

What to Test

#Test CaseStatus
1Setting ON + SO with saved signature → click "อนุมัติเอกสาร" on JSA → signature auto-applied + document approved Pending
2Setting ON + WO with saved signature → click "อนุมัติเอกสาร" on JSA → signature auto-applied + document approved Pending
3Setting ON + SO → click "อนุมัติ JSA" (workflow command) → all JSA forms auto-signed + approved Pending
4Setting ON + user without saved signature → approve button disabled, manual signing required Pending
5Setting ON + Contractor → approve button disabled, manual signing required (password verification) Pending
6Setting OFF + WO with saved signature → approve button disabled until manual signing (current behavior) Pending
7Toggle setting OFF → verify immediate effect on JSA approval flow Pending
8Multiple JSA forms → "อนุมัติ JSA" auto-signs all forms for current role Pending
9Signature already present → approve works normally without re-signing Pending
10No 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แผนการอบรมรอบอบรมอนุมัติผลอบรม
AdminVisibleVisibleHidden
Safety OfficerVisibleVisibleVisible

What to Test

#Test CaseStatus
1Login as Admin → เครื่องมือ > จัดการการอบรม → see only 2 tabs (แผนการอบรม, รอบอบรม) Pending
2Login as Safety Officer → จัดการการอบรม → see all 3 tabs including อนุมัติผลอบรม Pending
3Admin can still add/edit/delete training plans and sessions Pending
4Tab 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

ActionBefore (Bug)After (Fixed)
Auto-sign → Un-approveSignature remainsSignature cleared
Auto-sign timingCould appear before validation passesOnly appears after all validations pass
Save sequencingsetTimeout(fn, 300) — race conditionObservable chain — deterministic

What to Test

#Test CaseStatus
1SO with saved signature → "อนุมัติเอกสาร" → signature auto-fills → "อนุมัติแล้ว" (toggle off) → signature clears Pending
2WO with saved signature → same approve/un-approve flow → signature clears Pending
3Manually drawn signature → approve → un-approve → manual signature NOT cleared (only auto-signed cleared) Pending
4Refresh page after un-approve → signature stays cleared (persisted) Pending
5Click "อนุมัติ 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

ScenarioBeforeAfter
JSA co-review (WO + SO)2 separate task cards1 card with 2 reviewer names
Work Permit co-review (WO + SO + WAO)3 separate task cards1 card with 3 reviewer names
WO approved, SO pending2 cards (no status)1 card: WO green, SO orange
All approvedTask moves to completedTask moves to completed

Color Coding

StatusColorLabel
ApprovedGreen (text-green-600)(อนุมัติแล้ว)
PendingOrange (text-amber-600)(รออนุมัติ)

What to Test

#Test CaseStatus
1Contractor submits JSA for co-review → "รอผู้อื่นดำเนินการ" shows 1 card with WO + SO both in orange Pending
2WO approves JSA → Contractor sees WO in green, SO in orange on same card Pending
3Both WO + SO approve → Task moves to completed section Pending
4Section count shows actual task count (not inflated by reviewer count) Pending
5Non-co-review tasks still show single "รอ [name]" as before Pending
6Reviewer names display on separate lines (not running together on one line) Pending