Skip to main content

Bug #411 — WO/SO: JSA approve and return buttons disappeared

Issue: #411 Reporter: Kang-Supreeya Date: 2026-02-16 Version: Preview33 Severity: Medium Frequency: Always


Description

Work Owner and Safety Officer no longer have the "Approve JSA" and "Return for Edit" (ส่งกลับแก้ไข) buttons when reviewing JSA tasks. These buttons existed in previous versions.

Related: #412 (Contractor incorrectly gained these same buttons) Service Report: SR #014

Location

Tasks > จัดเตรียม JSA > งาน (JSA Preparation task)

Bug Details

RoleExpectedActual
Work OwnerHas "อนุมัติ JSA" and "ส่งกลับแก้ไข" buttonsButtons missing
Safety OfficerHas "อนุมัติ JSA" and "ส่งกลับแก้ไข" buttonsButtons missing

Screenshot

Bug #411 Screenshot

Steps to Reproduce

  1. Login as Work Owner or Safety Officer
  2. Go to Tasks > จัดเตรียม JSA
  3. Open a JSA task in review state
  4. Observe toolbar — approve and return buttons are missing

Root Cause

Backend sends workflowState.en = "Co-Review" for the JSA review state. The frontend normalizes this to "co-review", but the state label mapping only recognized "review-by-safety-officer" and "so-review". The unrecognized label defaulted to the Started state, which expects the Contractor role — causing WO/SO commands to be hidden.

Fix Applied

LayerChange
BackendAdded VisibleToRoleIds property to TaskCommand — set to [WorkOwner, SafetyOfficer] for review commands
FrontendAdded "co-review" to state label mapping; toolbar now checks visibleToRoleIds from backend first

PR: #414 Version: Preview34

What to Test

#Test CaseStatus
1WO opens JSA task in review → "อนุมัติ JSA" button visible🔍 In Review
2WO opens JSA task in review → "ส่งกลับแก้ไข" button visible🔍 In Review
3SO opens JSA task in review → Same buttons visible🔍 In Review
4Buttons work correctly when clicked🔍 In Review