diff --git a/fe-admin/src/components/khkk/KhkkWorkflowPanel.tsx b/fe-admin/src/components/khkk/KhkkWorkflowPanel.tsx index 2296ff0..5601048 100644 --- a/fe-admin/src/components/khkk/KhkkWorkflowPanel.tsx +++ b/fe-admin/src/components/khkk/KhkkWorkflowPanel.tsx @@ -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 `` TRẦN. + // 🔴 JWT chỉ được gắn bởi interceptor axios (`lib/api.ts:18`); thẻ `` 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 (
{/* ── 1. Header + meta {code} v{NN} · {name} ───────────────────────────── */} @@ -453,18 +476,12 @@ export function KhkkWorkflowPanel({ > Trả lại - + {/* 🧊 [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({
{a.fileName}
{formatSize(a.fileSize)} · {formatDateTime(a.createdAt)}
-
downloadAttachment(a)} className="shrink-0 text-[11px] font-medium text-brand-600 hover:underline" > Tải xuống - + ))} diff --git a/fe-admin/src/components/pipeline/PipelineStageFolders.tsx b/fe-admin/src/components/pipeline/PipelineStageFolders.tsx index 7db2447..3da59e1 100644 --- a/fe-admin/src/components/pipeline/PipelineStageFolders.tsx +++ b/fe-admin/src/components/pipeline/PipelineStageFolders.tsx @@ -96,15 +96,11 @@ function stageCount(stage: PipelineStage): number { return stage.content !== undefined ? (stage.count ?? 0) : stage.leaves.length } -function SoonChip() { - // Token lấy verbatim từ dải strip (PePipelineStrip.tsx:50-52) — uppercase CSS - // nên chữ "Sắp" hiển thị "SẮP" đúng như owner gõ. - return ( - - Sắp - - ) -} +// 🧊 [S174 owner O2] `SoonChip()` ĐÃ GỠ — owner: "Bỏ hết đi đổi thành 0". Lane L4 đo được +// KHÔNG giai đoạn nào còn đúng nghĩa "sắp" (cả 4 đều fetch API thật), và `SoonChip` KHÔNG +// export (8 hit nội bộ) ⇒ 0 host ngoài phụ thuộc, gỡ an toàn. +// 🔴 Gỡ KHÔNG đồng nghĩa "thay hết bằng 0": 2 ca đếm-được thì in số, ca KHOÁ-QUYỀN thì bỏ +// trắng (xem chú thích tại chỗ) — in 0 cho ca khoá là nói dối về dữ-liệu. type StageStyle = (typeof STAGE_STYLE)[PipelineStageNo] @@ -189,11 +185,10 @@ function GroupFolder({ group, style }: { group: PipelineGroup; style: StageStyle {group.label} )} - {count > 0 ? ( - {count} - ) : ( - - )} + {/* [S174 owner O2] "Bỏ hết đi đổi thành 0" — luôn in SỐ, kể cả 0. Chữ "SẮP" cũ nói + "giai đoạn chưa xây"; nay CẢ 4 giai đoạn đều gọi API thật (lane L4 đo) ⇒ 0 nghĩa + là "chưa có phiếu", không phải "chưa có tính năng". */} + {count}
{empty ? ( @@ -229,8 +224,11 @@ function StageFolder({ stage, currentStage }: { stage: PipelineStage; currentSta + {/* [S174 owner O2] KHÔNG in "0" ở đây. Đây là ca "chưa có QUYỀN xem", không phải + "có 0 phiếu" — in 0 là NÓI DỐI về dữ-liệu (thực tế có thể đầy phiếu, chỉ là mình + không được xem, và cũng không được phép gọi API để biết). Ổ khoá + `title` đã + mang trọn nghĩa; bỏ chip là đúng, không thay bằng số. */} {label} -
) } @@ -267,10 +265,10 @@ function StageFolder({ stage, currentStage }: { stage: PipelineStage; currentSta > — - ) : count > 0 ? ( - {count} ) : ( - + /* [S174 owner O2] luôn in SỐ (kể cả 0). Nhánh `—` ở trên GIỮ: đó là ca + "không tải được dữ-liệu", khác hẳn "có 0 phiếu" — đừng gộp hai thứ. */ + {count} )} diff --git a/fe-admin/src/pages/khkk/KhkkCreatePage.tsx b/fe-admin/src/pages/khkk/KhkkCreatePage.tsx index b893b22..3284aa6 100644 --- a/fe-admin/src/pages/khkk/KhkkCreatePage.tsx +++ b/fe-admin/src/pages/khkk/KhkkCreatePage.tsx @@ -176,7 +176,15 @@ export function KhkkCreatePage() { -
+ {/* [S174 · B4] Bề ngang cột về ĐÚNG số của Duyệt NCC (`PurchaseEvaluationWorkspacePage.tsx:80` + `260px` / `xl:320px`) — trước đó lead tự đặt 300/340, lệch chuẩn không lý do. + [S174 · A2 — VÁ REGRESSION DO CHÍNH LEAD GÂY RA TRONG PHIÊN NÀY] `
` từng mang + `hidden … lg:block` ⇒ dưới `lg` chỉ còn panel-1, KHÔNG có form ⇒ **mobile không tạo + được phiếu**: bấm phiếu ở cột trái xong thì không có chỗ nào để bấm "Tạo kế hoạch". + 🔴 Vá bằng 2 vế, thiếu vế nào cũng hỏng: (1) `
` bỏ `hidden`, hiện mọi khổ; + (2) mobile xếp DỌC với panel-1 chốt trần `14rem` — không chốt thì panel-1 (danh sách + dài) đẩy form rơi khỏi màn, đúng cái ngõ cụt vừa vá. Từ `lg` trở lên về 1 hàng như cũ. */} +
-
+
{/* (a) Đang XEM một kế hoạch — read-only, có đường quay về form tạo. */} {viewPlanId && (
diff --git a/fe-admin/src/pages/khkk/KhkkDetailPage.tsx b/fe-admin/src/pages/khkk/KhkkDetailPage.tsx index 76723cb..aa05a08 100644 --- a/fe-admin/src/pages/khkk/KhkkDetailPage.tsx +++ b/fe-admin/src/pages/khkk/KhkkDetailPage.tsx @@ -19,6 +19,7 @@ import { Input } from '@/components/ui/Input' import { Label } from '@/components/ui/Label' import { Select } from '@/components/ui/Select' import { KhkkDetailContent } from '@/components/khkk/KhkkDetailContent' +import { KhkkWorkflowPanel } from '@/components/khkk/KhkkWorkflowPanel' import { useAuth } from '@/contexts/AuthContext' import { usePermission } from '@/hooks/usePermission' import { api } from '@/lib/api' @@ -158,13 +159,17 @@ export function KhkkDetailPage() { } /> - {/* [S174 owner] Khối "Quy trình duyệt" (sơ-đồ Bước/Cấp + HÀNH ĐỘNG + 2 lịch sử) ĐÃ GỠ - khỏi trang này — anh chốt "bỏ hết, nó sẽ hiển thị ở Menu duyệt". Nhà của nó nay là - Panel-3 của màn danh sách (`KhkkListPage.tsx:196` — cùng `KhkkWorkflowPanel`), nên - gỡ ở đây là bỏ BẢN SAO THỨ HAI, không phải bỏ tính năng. - 🔴 Hệ quả CÒN LẠI phải biết: ``. */} + {/* [S174 owner] Khối "Quy trình duyệt" GỠ khỏi bản DESKTOP của trang này — anh chốt + "bỏ hết, nó sẽ hiển thị ở Menu duyệt". Nhà của nó ở desktop là Panel-3 màn danh sách + (`KhkkListPage.tsx:196`), nên gỡ = bỏ BẢN SAO THỨ HAI, không phải bỏ tính năng. + 🔴 [A3] NHƯNG ` + navigate(backToList)} /> +
+ {bridgeOpen && setBridgeOpen(false)} />} diff --git a/fe-user/src/components/khkk/KhkkWorkflowPanel.tsx b/fe-user/src/components/khkk/KhkkWorkflowPanel.tsx index 2296ff0..5601048 100644 --- a/fe-user/src/components/khkk/KhkkWorkflowPanel.tsx +++ b/fe-user/src/components/khkk/KhkkWorkflowPanel.tsx @@ -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 `` TRẦN. + // 🔴 JWT chỉ được gắn bởi interceptor axios (`lib/api.ts:18`); thẻ `` 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 (
{/* ── 1. Header + meta {code} v{NN} · {name} ───────────────────────────── */} @@ -453,18 +476,12 @@ export function KhkkWorkflowPanel({ > Trả lại - + {/* 🧊 [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({
{a.fileName}
{formatSize(a.fileSize)} · {formatDateTime(a.createdAt)}
- downloadAttachment(a)} className="shrink-0 text-[11px] font-medium text-brand-600 hover:underline" > Tải xuống - + ))} diff --git a/fe-user/src/components/pipeline/PipelineStageFolders.tsx b/fe-user/src/components/pipeline/PipelineStageFolders.tsx index 7db2447..3da59e1 100644 --- a/fe-user/src/components/pipeline/PipelineStageFolders.tsx +++ b/fe-user/src/components/pipeline/PipelineStageFolders.tsx @@ -96,15 +96,11 @@ function stageCount(stage: PipelineStage): number { return stage.content !== undefined ? (stage.count ?? 0) : stage.leaves.length } -function SoonChip() { - // Token lấy verbatim từ dải strip (PePipelineStrip.tsx:50-52) — uppercase CSS - // nên chữ "Sắp" hiển thị "SẮP" đúng như owner gõ. - return ( - - Sắp - - ) -} +// 🧊 [S174 owner O2] `SoonChip()` ĐÃ GỠ — owner: "Bỏ hết đi đổi thành 0". Lane L4 đo được +// KHÔNG giai đoạn nào còn đúng nghĩa "sắp" (cả 4 đều fetch API thật), và `SoonChip` KHÔNG +// export (8 hit nội bộ) ⇒ 0 host ngoài phụ thuộc, gỡ an toàn. +// 🔴 Gỡ KHÔNG đồng nghĩa "thay hết bằng 0": 2 ca đếm-được thì in số, ca KHOÁ-QUYỀN thì bỏ +// trắng (xem chú thích tại chỗ) — in 0 cho ca khoá là nói dối về dữ-liệu. type StageStyle = (typeof STAGE_STYLE)[PipelineStageNo] @@ -189,11 +185,10 @@ function GroupFolder({ group, style }: { group: PipelineGroup; style: StageStyle {group.label} )} - {count > 0 ? ( - {count} - ) : ( - - )} + {/* [S174 owner O2] "Bỏ hết đi đổi thành 0" — luôn in SỐ, kể cả 0. Chữ "SẮP" cũ nói + "giai đoạn chưa xây"; nay CẢ 4 giai đoạn đều gọi API thật (lane L4 đo) ⇒ 0 nghĩa + là "chưa có phiếu", không phải "chưa có tính năng". */} + {count}
{empty ? ( @@ -229,8 +224,11 @@ function StageFolder({ stage, currentStage }: { stage: PipelineStage; currentSta + {/* [S174 owner O2] KHÔNG in "0" ở đây. Đây là ca "chưa có QUYỀN xem", không phải + "có 0 phiếu" — in 0 là NÓI DỐI về dữ-liệu (thực tế có thể đầy phiếu, chỉ là mình + không được xem, và cũng không được phép gọi API để biết). Ổ khoá + `title` đã + mang trọn nghĩa; bỏ chip là đúng, không thay bằng số. */} {label} -
) } @@ -267,10 +265,10 @@ function StageFolder({ stage, currentStage }: { stage: PipelineStage; currentSta > — - ) : count > 0 ? ( - {count} ) : ( - + /* [S174 owner O2] luôn in SỐ (kể cả 0). Nhánh `—` ở trên GIỮ: đó là ca + "không tải được dữ-liệu", khác hẳn "có 0 phiếu" — đừng gộp hai thứ. */ + {count} )} diff --git a/fe-user/src/pages/khkk/KhkkCreatePage.tsx b/fe-user/src/pages/khkk/KhkkCreatePage.tsx index b893b22..3284aa6 100644 --- a/fe-user/src/pages/khkk/KhkkCreatePage.tsx +++ b/fe-user/src/pages/khkk/KhkkCreatePage.tsx @@ -176,7 +176,15 @@ export function KhkkCreatePage() {
-
+ {/* [S174 · B4] Bề ngang cột về ĐÚNG số của Duyệt NCC (`PurchaseEvaluationWorkspacePage.tsx:80` + `260px` / `xl:320px`) — trước đó lead tự đặt 300/340, lệch chuẩn không lý do. + [S174 · A2 — VÁ REGRESSION DO CHÍNH LEAD GÂY RA TRONG PHIÊN NÀY] `
` từng mang + `hidden … lg:block` ⇒ dưới `lg` chỉ còn panel-1, KHÔNG có form ⇒ **mobile không tạo + được phiếu**: bấm phiếu ở cột trái xong thì không có chỗ nào để bấm "Tạo kế hoạch". + 🔴 Vá bằng 2 vế, thiếu vế nào cũng hỏng: (1) `
` bỏ `hidden`, hiện mọi khổ; + (2) mobile xếp DỌC với panel-1 chốt trần `14rem` — không chốt thì panel-1 (danh sách + dài) đẩy form rơi khỏi màn, đúng cái ngõ cụt vừa vá. Từ `lg` trở lên về 1 hàng như cũ. */} +
-
+
{/* (a) Đang XEM một kế hoạch — read-only, có đường quay về form tạo. */} {viewPlanId && (
diff --git a/fe-user/src/pages/khkk/KhkkDetailPage.tsx b/fe-user/src/pages/khkk/KhkkDetailPage.tsx index 76723cb..aa05a08 100644 --- a/fe-user/src/pages/khkk/KhkkDetailPage.tsx +++ b/fe-user/src/pages/khkk/KhkkDetailPage.tsx @@ -19,6 +19,7 @@ import { Input } from '@/components/ui/Input' import { Label } from '@/components/ui/Label' import { Select } from '@/components/ui/Select' import { KhkkDetailContent } from '@/components/khkk/KhkkDetailContent' +import { KhkkWorkflowPanel } from '@/components/khkk/KhkkWorkflowPanel' import { useAuth } from '@/contexts/AuthContext' import { usePermission } from '@/hooks/usePermission' import { api } from '@/lib/api' @@ -158,13 +159,17 @@ export function KhkkDetailPage() { } /> - {/* [S174 owner] Khối "Quy trình duyệt" (sơ-đồ Bước/Cấp + HÀNH ĐỘNG + 2 lịch sử) ĐÃ GỠ - khỏi trang này — anh chốt "bỏ hết, nó sẽ hiển thị ở Menu duyệt". Nhà của nó nay là - Panel-3 của màn danh sách (`KhkkListPage.tsx:196` — cùng `KhkkWorkflowPanel`), nên - gỡ ở đây là bỏ BẢN SAO THỨ HAI, không phải bỏ tính năng. - 🔴 Hệ quả CÒN LẠI phải biết: ``. */} + {/* [S174 owner] Khối "Quy trình duyệt" GỠ khỏi bản DESKTOP của trang này — anh chốt + "bỏ hết, nó sẽ hiển thị ở Menu duyệt". Nhà của nó ở desktop là Panel-3 màn danh sách + (`KhkkListPage.tsx:196`), nên gỡ = bỏ BẢN SAO THỨ HAI, không phải bỏ tính năng. + 🔴 [A3] NHƯNG ` + navigate(backToList)} /> +
+ {bridgeOpen && setBridgeOpen(false)} />}