From 835cc7f17fbf7e416b9265febdaccfe37f04d4ca Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Thu, 7 May 2026 20:35:08 +0700 Subject: [PATCH] =?UTF-8?q?[CLAUDE]=20FE-Admin+FE-User:=20PE=20diagnose=20?= =?UTF-8?q?"L=C6=B0u=20&=20G=E1=BB=ADi=20Duy=E1=BB=87t"=20=E2=80=94=20tool?= =?UTF-8?q?tip=20+=20confirm=20r=C3=B5=20phase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User báo button "Lưu & Gửi Duyệt" KHÔNG hoạt động + suy đoán "trùng ID". Phân tích: button disabled khi `evaluation.workflow.nextPhases` không có forward phase (chỉ TuChoi/TraLai). Hiện FE silent — không cách nào biết. Improvement (cả 2 app, mirror): - Compute `forwardPhase` once thay vì 2 lần (.find / .some). - Add `submitDisabledReason` string giải thích reason: * canEditPhase=false → "Phiếu đã ở phase X — chỉ Bản nháp / Trả lại mới sửa + gửi được" * readOnly → "Chế độ chỉ đọc" * !forwardPhase → "Workflow không có phase tiếp theo từ X. Liên hệ admin kiểm tra cấu hình quy trình" - Button title attribute show reason (hover tooltip) hoặc forward phase label khi enabled: "Gửi phiếu sang 'Chờ Purchasing'" - Confirm dialog show forward phase explicit: 'Gửi phiếu vào quy trình duyệt? Sẽ chuyển sang "Chờ Purchasing". Sau khi gửi sẽ KHÔNG sửa được nữa (trừ khi approver Trả lại).' Note "trùng ID" KHÔNG phải bug FE: PurchaseEvaluationWorkspacePage URL state đúng (`+ Thêm mới` clear `id`, save set new). Mỗi PE row unique GUID + MaPhieu. User feedback có thể due to button silent disabled — tooltip giờ rõ reason. Verify: npm build fe-admin + fe-user pass. Co-Authored-By: Claude Opus 4.7 (1M context) --- fe-admin/src/components/pe/PeDetailTabs.tsx | 18 ++++++++++++++++-- fe-user/src/components/pe/PeDetailTabs.tsx | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/fe-admin/src/components/pe/PeDetailTabs.tsx b/fe-admin/src/components/pe/PeDetailTabs.tsx index c2a6775..568eb51 100644 --- a/fe-admin/src/components/pe/PeDetailTabs.tsx +++ b/fe-admin/src/components/pe/PeDetailTabs.tsx @@ -98,10 +98,22 @@ export function PeDetailTabs({ onError: e => toast.error(getErrorMessage(e)), }) + const forwardPhase = evaluation.workflow.nextPhases.find(p => + p !== PurchaseEvaluationPhase.TuChoi && p !== PurchaseEvaluationPhase.TraLai) const canSubmitForApproval = mode === 'workspace' && canEditPhase && !readOnly - && evaluation.workflow.nextPhases.some(p => p !== PurchaseEvaluationPhase.TuChoi && p !== PurchaseEvaluationPhase.TraLai) + && forwardPhase != null + + // Tooltip reason cho button disabled (giúp diagnose tại sao "Lưu & Gửi Duyệt" + // không bấm được — user feedback 2026-05-07). + const submitDisabledReason = !canEditPhase + ? `Phiếu đã ở phase ${PurchaseEvaluationPhaseLabel[evaluation.phase]} — chỉ Bản nháp / Trả lại mới sửa + gửi được.` + : readOnly + ? 'Chế độ chỉ đọc.' + : !forwardPhase + ? `Workflow không có phase tiếp theo từ ${PurchaseEvaluationPhaseLabel[evaluation.phase]}. Liên hệ admin kiểm tra cấu hình quy trình.` + : null return (
@@ -213,11 +225,13 @@ export function PeDetailTabs({