[CLAUDE] Contract: UAT S174 dot-A — 3 LOI THAT + O2 bo chu SAP + bo nut Tu choi (FE-only, 0-mig)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 6m41s

Nguon: /fable-clone frontend-designer ensemble 5 lane (wf_016b1bed-b85, 5/5 xong, 0 chet,
755K tok). Spec day du: runs/2026-08-05-S174-khkk-style-audit/spec-khkk-style-dong-bo-05-08-2026.md

=== DOT A — LOI THAT (khong phai style) ===

A1 🔴 Nut "Tai xuong" file dinh kem KHKK BI 401 — lane L1 bat, lead verify.
  Cu: <a href="/api/contract-signing-plans/.../download"> TRAN.
  JWT chi gan boi interceptor axios (lib/api.ts:18); the <a> KHONG di qua axios => request
  toi [Authorize(Policy="KeHoachKyKet.Read")] (ContractSigningPlansController.cs:222-223)
  di TAY KHONG => 401, nut khong tai duoc.
  Moi: ham downloadAttachment() dung khuon PE (PeWorkflowPanel.tsx:327-342) —
  api.get(responseType:'blob') -> createObjectURL -> click ngam -> revoke.

A2 🔴 REGRESSION DO CHINH LEAD GAY RA TRONG PHIEN NAY (lane L3 bat).
  Man Thao tac dung <main className="hidden ... lg:block"> => duoi lg chi con panel-1,
  KHONG co form => MOBILE KHONG TAO DUOC PHIEU (bam phieu xong khong co cho bam "Tao").
  Va 2 ve: (1) <main> bo hidden, hien moi kho; (2) mobile xep DOC voi panel-1 chot tran
  14rem — khong chot thi danh sach dai day form roi khoi man, dung cai ngo cut vua va.

A3 Tra no da khai voi owner: trang chi tiet KHKK tren mobile mat nut Gui duyet / Xoa phieu.
  Giu KhkkWorkflowPanel o DUNG lg:hidden — desktop van sach (panel-3 lo), mobile thao tac duoc.

=== OWNER CHOT VONG NAY ===

O2 "Dung bo chu sap di" — go SoonChip().
  Lane L4 do: KHONG giai doan nao con dung nghia "sap" (ca 4 deu fetch API that);
  SoonChip KHONG export, 8 hit noi bo => 0 host ngoai phu thuoc.
  🔴 Go != "thay het bang 0". BA ca, BA cach xu dung nghia:
    · 2 ca dem-duoc      -> luon in SO (ke ca 0)
    · ca KHOA-QUYEN      -> BO TRANG (in 0 la NOI DOI: co the day phieu, chi la khong duoc
                            xem, va cung khong duoc phep goi API de biet). O khoa + title du.
    · ca FAILED (dau —)  -> GIU NGUYEN ("khong tai duoc" khac "co 0 phieu", dung gop)

Cau-4 "vay thi bo luon tu choi ~ tuong tu PE" — go nut TU CHOI khoi KhkkWorkflowPanel.
  PE co code tu-choi nhung THUC TE khong hien (BE go khoi nextPhases + FE loc, UAT S60).
  🔴 Chi go DUONG BAM o UI. May BE (KhkkTransitionAction.Reject, phase TuChoi=99) GIU
  NGUYEN: phieu cu da tu-choi van hien dung, mo lai sau chi la them nut.

B4 Grid man Thao tac 300/340 -> 260/320 dung so cua PE (PurchaseEvaluationWorkspacePage:80).

=== HAI GIA-DINH CUA LEAD BI LANE BAC (lead da tu verify, lane DUNG) ===
- O3 hang-muc N-dong KHONG can migration. ContractSigningPlanLineConfiguration.cs:37-38
  unique index 3 COT (PlanId, SupplierId, CatalogEntryId) => 1 NCC DA duoc phep N dong x
  N hang muc tu Mig 71. May rong san, chi UI hep. Lead tung bao owner "nang nhat, can
  migration" — SAI, da dinh chinh.
- O4 shopdrawing dinh kem = FE-only 0-BE (rail dossierItemId da land du 6 tang tu Mig 69).

Verify: build 2 app PASS; mirror SHA256 4/4 cap KHOP; control-am: <SoonChip=0 · "> Tu choi"=0
· a-href=0; control-duong: responseType=2 + downloadAttachment=2 CA HAI app.
🔴 CHUA co screenshot — ca 5 lane deu khong chup duoc (dev-rig chan: chi :8080 LISTENING,
API :5443 khong co, trang sau ProtectedRoute — gotcha #3). Phai soi that 375/1366/1440 tren
prod sau deploy truoc khi tuyen PASS.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-08-05 16:52:12 +07:00
parent c97b5795c6
commit a1b9cbb175
8 changed files with 144 additions and 86 deletions

View File

@ -33,7 +33,7 @@
import { useMemo, useRef, useState } from 'react'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
import { Check, History, Paperclip, Send, Trash2, Undo2, Workflow, X } from 'lucide-react'
import { Check, History, Paperclip, Send, Trash2, Undo2, Workflow } from 'lucide-react'
import { Button } from '@/components/ui/Button'
import { Dialog } from '@/components/ui/Dialog'
import { Label } from '@/components/ui/Label'
@ -243,6 +243,29 @@ export function KhkkWorkflowPanel({
action === KhkkTransitionAction.Return || action === KhkkTransitionAction.Reject
const confirmDisabled = transition.isPending || (commentRequired && !comment.trim())
// [S174 · A1 — LỖI THẬT, không phải style] Trước đây tải file bằng `<a href="/api/…">` TRẦN.
// 🔴 JWT chỉ được gắn bởi interceptor axios (`lib/api.ts:18`); thẻ `<a>` KHÔNG đi qua axios
// ⇒ request tới `[Authorize(Policy="KeHoachKyKet.Read")]`
// (`ContractSigningPlansController.cs:222-223`) đi TAY KHÔNG ⇒ **401, nút không tải được**.
// Bê đúng khuôn PE (`PeWorkflowPanel.tsx:327-342`): axios lấy blob → objectURL → click ngầm.
// Phát hiện bởi lane L1 của ensemble; lead verify bằng đối chứng `responseType:'blob'` ở PE.
async function downloadAttachment(a: KhkkAttachmentDto) {
try {
const r = await api.get(
`/contract-signing-plans/${plan.id}/attachments/${a.id}/download`,
{ responseType: 'blob' },
)
const url = window.URL.createObjectURL(r.data as Blob)
const link = document.createElement('a')
link.href = url
link.download = a.fileName
link.click()
window.URL.revokeObjectURL(url)
} catch (e) {
toast.error(getErrorMessage(e))
}
}
return (
<section className="card-accent" style={{ ['--accent' as string]: 'var(--color-emerald-500)' }}>
{/* ── 1. Header + meta {code} v{NN} · {name} ───────────────────────────── */}
@ -453,18 +476,12 @@ export function KhkkWorkflowPanel({
>
<Undo2 className="h-3 w-3" /> Trả lại
</button>
<button
type="button"
disabled={blockedByLevel}
onClick={() => { if (!blockedByLevel) { setComment(''); setPendingFiles([]); setAction(KhkkTransitionAction.Reject) } }}
title={blockedByLevel ? 'Cấp hiện tại chỉ người được phân công mới thao tác được.' : 'Từ chối kế hoạch (khoá phiếu)'}
className={cn(
'inline-flex items-center gap-1 rounded border px-2 py-1 text-[11px] font-bold transition',
blockedByLevel ? 'cursor-not-allowed border-slate-200 bg-slate-50 text-slate-400' : 'border-red-300 text-red-700 hover:bg-red-50',
)}
>
<X className="h-3 w-3" /> Từ chối
</button>
{/* 🧊 [S174 owner] Nút "TỪ CHỐI" ĐÃ GỠ — anh chốt "vậy thì bỏ luôn từ chối
~ tương tự PE". Duyệt NCC có code từ-chối nhưng THỰC TẾ không hiện
(BE gỡ khỏi `nextPhases` + FE lọc, UAT S60) ⇒ KHKK còn hiện là lệch.
🔴 Chỉ gỡ ĐƯỜNG BẤM ở UI. Máy BE (`KhkkTransitionAction.Reject`,
phase `TuChoi=99`) GIỮ NGUYÊN: phiếu cũ đã từ-chối vẫn hiển thị đúng,
và mở lại sau này chỉ là thêm nút. Gỡ cả máy = mất dữ-liệu lịch sử. */}
</>
)}
{canDeletePlan && (
@ -497,12 +514,13 @@ export function KhkkWorkflowPanel({
<div className="truncate font-medium text-slate-700">{a.fileName}</div>
<div className="text-slate-500">{formatSize(a.fileSize)} · {formatDateTime(a.createdAt)}</div>
</div>
<a
href={`/api/contract-signing-plans/${plan.id}/attachments/${a.id}/download`}
<button
type="button"
onClick={() => downloadAttachment(a)}
className="shrink-0 text-[11px] font-medium text-brand-600 hover:underline"
>
Tải xuống
</a>
</button>
</li>
))}
</ul>