Skip to main content

Bug #412 — Contractor should not have JSA approve/return buttons

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


Description

Contractor sees "Approve JSA" (อนุมัติ JSA) and "Return for Edit" (ส่งกลับแก้ไข) buttons on JSA documents. Contractors should never have these buttons — they are reviewer-only actions for WO/SO.

Related: #411 (WO/SO lost these same buttons — same root cause) Service Report: SR #014

Location

ผู้รับเหมา > Tasks > สร้างงาน > จัดเตรียม JSA

Bug Details

RoleExpectedActual
ContractorNo "อนุมัติ JSA" or "ส่งกลับแก้ไข" buttonsBoth buttons visible

Screenshot

Bug #412 Screenshot

Steps to Reproduce

  1. Login as Contractor
  2. Go to Tasks > สร้างงาน
  3. Select จัดเตรียม JSA and pick a project
  4. Open a JSA document
  5. Observe toolbar — approve and return buttons appear (should not)

Root Cause

Same as #411. The state label "co-review" was not recognized by the frontend, causing it to default to the Contractor-expected state — so the Contractor role incorrectly passed the role check and saw reviewer commands.

Fix Applied

LayerChange
BackendAdded VisibleToRoleIds = [WorkOwner, SafetyOfficer] on review commands, [Contractor] on preparation commands
FrontendToolbar checks visibleToRoleIds from backend commands, blocking Contractor from seeing review commands

PR: #414 Version: Preview34

What to Test

#Test CaseStatus
1Contractor opens JSA task → No "อนุมัติ JSA" button🔍 In Review
2Contractor opens JSA task → No "ส่งกลับแก้ไข" button🔍 In Review
3Contractor only sees Submit and Cancel buttons during preparation🔍 In Review