[CLAUDE] PurchaseEvaluation: cho người soạn xóa/tải lại file bảng so sánh khi phiếu bị Trả lại

Nút đính kèm 'Bảng so sánh giá' (GeneralAttachmentsSection) trước gate theo readOnly MÀN HÌNH: màn Danh sách mở phiếu readOnly=true nên ẩn nút xóa/tải ở MỌI phase, kể cả Trả lại (TraLai=98) vốn đã nằm trong isEditablePhase. Đổi gate sang (isAdmin || isDrafter) && isEditablePhase(phase), chỉ tách riêng khối đính kèm — HoSoLink + winner giữ theo readOnly màn hình (không mở nhầm); SupplierAttachmentsCell giữ nguyên carve-out approverEditMode (Mig 28 F3); BE không thêm guard (giữ S78 approver-upload). Mirror fe-user + fe-admin. tsc -b + vite build sạch 2 app.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-23 17:11:36 +07:00
parent 8b6df0a396
commit 7d39d8d61b
2 changed files with 24 additions and 2 deletions

View File

@ -1977,6 +1977,17 @@ function ThongTinChonThauSection({ ev, readOnly = false }: { ev: PeDetailBundle;
a => a.purchaseEvaluationSupplierId === null
&& a.purpose !== PeAttachmentPurpose.ApprovalAttachment,
)
// [Fix UAT — phiếu bị Trả lại: không xóa/tải lại được file "Bảng so sánh"]
// Nút xóa/tải file so sánh phải theo NGƯỜI-SOẠN (hoặc Admin) + TRẠNG-THÁI-được-sửa,
// KHÔNG theo readOnly của MÀN HÌNH: màn "Danh sách" mở phiếu readOnly=true nên ẩn
// nút ở MỌI phase — kể cả Trả lại, vốn nằm trong isEditablePhase. Chỉ tách RIÊNG
// khối đính kèm này; HoSoLink + winner bên dưới vẫn theo readOnly màn hình (không
// mở nhầm). Chỉ áp cho "Bảng so sánh" (GeneralAttachmentsSection) — file per-NCC
// (SupplierAttachmentsCell) giữ nguyên carve-out approverEditMode (Mig 28 F3).
const { user: currentUser } = useAuth()
const isAdmin = currentUser?.roles?.includes('Admin') ?? false
const isDrafter = currentUser?.id != null && ev.drafterUserId === currentUser.id
const attachEditable = (isAdmin || isDrafter) && isEditablePhase(ev.phase)
return (
<div className="overflow-hidden rounded-lg border border-slate-300">
<div className="bg-[#1F7DC1] px-3 py-2 text-[12px] font-bold uppercase tracking-wide text-white">
@ -2010,7 +2021,7 @@ function ThongTinChonThauSection({ ev, readOnly = false }: { ev: PeDetailBundle;
{/* 4. Bảng so sánh giá */}
<div>
<div className="mb-1 text-[12px] font-medium text-slate-600">4. Bảng so sánh giá</div>
<GeneralAttachmentsSection evaluationId={ev.id} attachments={banSoSanhAttachments} readOnly={readOnly} />
<GeneralAttachmentsSection evaluationId={ev.id} attachments={banSoSanhAttachments} readOnly={!attachEditable} />
</div>
{/* 5. Link hồ sơ */}

View File

@ -1977,6 +1977,17 @@ function ThongTinChonThauSection({ ev, readOnly = false }: { ev: PeDetailBundle;
a => a.purchaseEvaluationSupplierId === null
&& a.purpose !== PeAttachmentPurpose.ApprovalAttachment,
)
// [Fix UAT — phiếu bị Trả lại: không xóa/tải lại được file "Bảng so sánh"]
// Nút xóa/tải file so sánh phải theo NGƯỜI-SOẠN (hoặc Admin) + TRẠNG-THÁI-được-sửa,
// KHÔNG theo readOnly của MÀN HÌNH: màn "Danh sách" mở phiếu readOnly=true nên ẩn
// nút ở MỌI phase — kể cả Trả lại, vốn nằm trong isEditablePhase. Chỉ tách RIÊNG
// khối đính kèm này; HoSoLink + winner bên dưới vẫn theo readOnly màn hình (không
// mở nhầm). Chỉ áp cho "Bảng so sánh" (GeneralAttachmentsSection) — file per-NCC
// (SupplierAttachmentsCell) giữ nguyên carve-out approverEditMode (Mig 28 F3).
const { user: currentUser } = useAuth()
const isAdmin = currentUser?.roles?.includes('Admin') ?? false
const isDrafter = currentUser?.id != null && ev.drafterUserId === currentUser.id
const attachEditable = (isAdmin || isDrafter) && isEditablePhase(ev.phase)
return (
<div className="overflow-hidden rounded-lg border border-slate-300">
<div className="bg-[#1F7DC1] px-3 py-2 text-[12px] font-bold uppercase tracking-wide text-white">
@ -2010,7 +2021,7 @@ function ThongTinChonThauSection({ ev, readOnly = false }: { ev: PeDetailBundle;
{/* 4. Bảng so sánh giá */}
<div>
<div className="mb-1 text-[12px] font-medium text-slate-600">4. Bảng so sánh giá</div>
<GeneralAttachmentsSection evaluationId={ev.id} attachments={banSoSanhAttachments} readOnly={readOnly} />
<GeneralAttachmentsSection evaluationId={ev.id} attachments={banSoSanhAttachments} readOnly={!attachEditable} />
</div>
{/* 5. Link hồ sơ */}