From 778fc98b2f54fc74933bb21048fbd055f9f199fb Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Mon, 6 Jul 2026 16:06:11 +0700 Subject: [PATCH] [CLAUDE] Supplier: Mig 62 expand 30-field + seed 4 NCC + FE form 2-app Phase A of the NCC/TP Excel-import backlog (anh Kiet FDC). Supplier entity 9 -> 27 fields to hold the 30-column supplier database. Backend: - Supplier +18 nullable cols; SupplierType +CaHai=6 (append-only); new nullable SupplierStatus enum. - Mig 62 ExpandSupplierFields (3-file): AddColumn x18 + guarded un-cram Sql (clear legacy crammed Note on the 4 seeded rows, exact-match). No new table (89), reversible Down. - Seed fill-nulls-if-exists: populate 30 fields for TRUONGGIANG/TANPHU/ TGN/DONGDUONG from Excel; idempotent, never clobbers existing cols. - DTO + Create/Update commands + validators (MaximumLength-only, no NotEmpty so open-auth Create minimal payload stays valid) + 2 query projections. Frontend (fe-admin + fe-user, byte-identical SHA-mirror): - types/master.ts +18 fields +SupplierStatus; SuppliersPage form 4 section groups + Status select + 3 NAS links via new shared PathLink (extracted from PE HoSoLink render+Copy). All new fields optional. Excel upload auto-map = Phase B (deferred). Tests test-after (UAT mode). Co-Authored-By: Claude Opus 4.8 --- .../investigator-codebase/MEMORY.md | 15 +- .../investigator-codebase/archive/2026-07.md | 11 + fe-admin/src/components/ui/PathLink.tsx | 68 + fe-admin/src/pages/master/SuppliersPage.tsx | 167 +- fe-admin/src/types/master.ts | 38 + fe-user/src/components/ui/PathLink.tsx | 68 + fe-user/src/pages/master/SuppliersPage.tsx | 167 +- fe-user/src/types/master.ts | 38 + .../CreateSupplier/CreateSupplierCommand.cs | 58 +- .../UpdateSupplier/UpdateSupplierCommand.cs | 57 +- .../Master/Suppliers/Dtos/SupplierDto.cs | 18 + .../Queries/GetSupplier/GetSupplierQuery.cs | 6 +- .../ListSuppliers/ListSuppliersQuery.cs | 3 + .../SolutionErp.Domain/Master/Supplier.cs | 26 +- .../Master/SupplierStatus.cs | 8 + .../SolutionErp.Domain/Master/SupplierType.cs | 1 + .../Configurations/SupplierConfiguration.cs | 20 + .../Persistence/DbInitializer.cs | 52 +- ...706084342_ExpandSupplierFields.Designer.cs | 6348 +++++++++++++++++ .../20260706084342_ExpandSupplierFields.cs | 223 + .../ApplicationDbContextModelSnapshot.cs | 71 + 21 files changed, 7440 insertions(+), 23 deletions(-) create mode 100644 .claude/agent-memory/investigator-codebase/archive/2026-07.md create mode 100644 fe-admin/src/components/ui/PathLink.tsx create mode 100644 fe-user/src/components/ui/PathLink.tsx create mode 100644 src/Backend/SolutionErp.Domain/Master/SupplierStatus.cs create mode 100644 src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/20260706084342_ExpandSupplierFields.Designer.cs create mode 100644 src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/20260706084342_ExpandSupplierFields.cs diff --git a/.claude/agent-memory/investigator-codebase/MEMORY.md b/.claude/agent-memory/investigator-codebase/MEMORY.md index ecade88..38136ee 100644 --- a/.claude/agent-memory/investigator-codebase/MEMORY.md +++ b/.claude/agent-memory/investigator-codebase/MEMORY.md @@ -70,12 +70,13 @@ Bearer từ `POST api.solutions.com.vn/api/auth/login` → status matrix expecte ## 📅 Recent activity (compressed — full verbatim → `archive/2026-06.md` via `archive/_INDEX.md`) -- **2026-07-03 S101 H19-adopt Lane-2 (mapping + model-tier compliance, WF1 investigate — VERDICT SOUND):** ⭐ Mapping CORRECT: reviewer=final-review-gate (Category 1-6 adversarial + Smart-Friend anti-rubberstamp `reviewer.md:268-276` + live-curl deploy-verify = H19 §3a "cổng rà-soát cuối" exact) · investigator-codebase=ground-truth-lane (`investigator-codebase.md:23-26` file:line-evidence + sqlcmd + grep + "if uncertain say uncertain" = H19 §3b "xác-minh sự-thật chống bịa-số/dẫn-chứng"). NO better-fit: investigator-api=EXTERNAL-docs (WebFetch, out-of-scope internal-truth) · database-agent=narrow DB-lens (subset không phải general fact-verify). **Model-tier checklist 12-pt: SE meets A1✅(settings pin `claude-fable-5[1m]` — `[1m]` VALID in settings.json ≠ frontmatter; Fable-down→Opus 1M H5-fallback = A1/A2 frontier-1M allowed) A2✅ A3✅(all-inherit=all-top, 5-fn map) A4/A5/A6 N/A-by-form(no tier-2/helper layer) B1✅ B2✅ B3✅(11 role-names SE-own, 0 copied) C1✅(11/11 `model: inherit` grep) C2✅(hmw.js `tier` field) C3✅(0 `[1m]` in FRONTMATTER model: line — 4 grep hits ALL prose: README:9/12/16 Upgrade-notes + database-agent:46 checklist).** ⚠️ Toggle-marker template EXACT-exists: `.claude/hmw-mode.on` gitignored AFTER `!.claude/**` last-match-wins (`.gitignore:87`); new `.claude/model-real-mode.on` MUST copy placement or gets un-ignored. ⚠️ Ảo-ensemble reuse: hmw.js `parallel()` :97 + synthesis machinery PRESENT (grep 10 hits) — but "S101 WF2 3-lane" is LIVE-mechanism NOT persisted artifact (runs/ = old 06-18 only, HMW-ephemeral S94+ pattern). VACUOUS-MET nuance TRUE: under all-inherit+Fable, 2 positions ALREADY top → H19 §4 "allow reach top-model" adds 0 runtime-delta; new value = toggle depth-control + Fable-outage multi-Opus>single-Opus. Tag `[s101-h19-lane2, mapping-sound, 12pt-compliance, marker-template, vacuous-met]`. -- **2026-07-02 (S100 H18-adopt WF1 `wf_50a817ce-a69` — 3 lane ∥, on-behalf em main APPEND B3, return-only 0-residual):** L1 measurer-coverage: 3/3 script (`mfe-eval:216`/`selfimprove:133-137`/`archive-gate:106`) **GLOB-LIVE 0-hardcode** — agent thứ 12 tự-cử; ⭐ ghost-wire-class MỚI: **config-key defined-but-unread** (`memory-budget.json:54-55` `role_file_glob`/`diary_path_pattern` — script re-hardcode giá trị TRÙNG → không detector nào flag vì cả 2 phía "đúng"; catch = grep key-name across scripts/) + latent skip-if-no-`tools:` (`selfimprove:147`, 0 affected 11/11 có). L2 ghost-wire+taxonomy: MAST=0 repo-wide (grep PHẢI case-sensitive `\bMAST\b` — insensitive dính "Master" noise); cron monthly = ghost-wire THẬT (CronList=0 + scheduler RỖNG 05-04 log + S96 chạy 13:04 em-main in-session); convention "auto = step em-main kích, no-OS-hook" nhất quán 5 nơi. L3 ledger-đo: `_ledger.md` true-orphan-catch **0/15 lifetime** (single-day artifact 06-18, 15 row/14 folder — mig54-R2 share) · mode-A coverage 0/8 S93+ · ⭐ "S71 `harvest/` rỗng" = **criterion-wording KHÔNG phải incident** (đính chính claim em-main) · repo có 5 "ledger" khác tên → sweep grep `_ledger` EXACT · hmw.js 0-touch. Tag `[s100-h18-wf1, 3-lane, ghostwire-configkey-class, ledger-0-15, on-behalf]`. -- **2026-07-02 S98 verify-lane V2 post-flush (VERDICT PASS):** detector 28→25 (derived-stale 11→8; wikilink 14 + vocab-fork 3 giữ by-design). **8 derived-stale còn = 100% FP-class count-token soft-net:** CLAUDE.md:84 tests-tree "(6 test…)" · ef-core SKILL :94/:95 ("2/1 migration tách/GỘP" history) + :103/:111/:114 ("4/3/1 bảng" Budget-defer/Mig-15 module-local) + :162/:179 (heading "Revert 1 migration" + comment "Script từ 1 migration") — 0 genuine drift vs canonical 61/89/440/79; SKILL edit sáng (+rows 60/61 @:82-83) chỉ shift line-number FP cũ, 0 flag MỚI. ⭐ Grep gotcha: **"Fable RESTORED" exact-string CHỈ STATUS:24 + session-start:29; agents/README dùng biến-thể "Fable 5 1M RESTORED" (:3) + "Fable-restore" (:12)** — exact-phrase grep miss README dù substance đủ. HANDOFF:5 mega-line: bundle mEGqlNWc/Dnrp4PU1=#484, CeTA7Z82 chỉ trong note "= #483" (1 line match duy nhất cả file). 3 on-behalf append đúng-chỗ: database-agent :36 (cuối Log = EOF) · reviewer addendum TRONG-entry S97-bis :68 (câu cuối + marker on-behalf @S98) · impl-fe S97-Part2 :16 giữa badge:9/S97:19. cicd "S98" = 2× "(curate S98)" stub :73/:74, 0 material-tag. Ledger :7 Mode-A ephemeral note (wf mode-A vắng ledger-row ≠ orphan) + bảng 15 row :11-25 nguyên. -- **2026-07-01 S97 session-end feedback-audit (VERDICT CLEAN):** Grep-verified capture readiness pre-close. ✅ gotcha #77/#78/#79 present `docs/gotchas.md:1301/1317/1325` (format `### N.` count=79 = STATUS header — no self-count drift; all 3 have Triệu-chứng+Cơ-chế+Fix+**Quy-tắc** root-cause). ✅ #53 return-garble **x6 (cicd 5/6)** in BOTH `feedback_agent_return_garble_recover.md` (Why-line ×5→×6 + **structural root-cause: cicd MEMORY self-target ~17.1KB→curate-at-return→thinking-step=message-cuối=return-value**; fix=archive-cicd-sớm NOT instruction) AND S97-log Parts 1/2/4 (lần-4/5/6). cicd MEMORY LIVE=17.5KB (confirms self-target). ✅ Mig 60 wrong-table BUG = 2-fix present: code (Mig 61 `20260701142752` query Changelogs) + guard (gotcha #79 "xác định ĐÚNG bảng writer" + "verify marker-count prod trước"). Mig 60 code `:29-31` confirmed `PurchaseEvaluationApprovals a...a.Comment LIKE` = wrong. Both Mig 60/61 have 3-file rule. ✅ git status CLEAN, 0 stray `.claude` misland, 0 `git add -A` in log, S97 workflows HMW-ephemeral (NOT persisted run-folders — consistent S94+ pattern, runs/ only old 06-18). ✅ Product decisions captured (STATUS/HANDOFF/log + commit-msg): "duyệt là fix"→#480 price-lock, "fix trọn"→Mig 60 endsBeforeCeo-runtime, "hiện luôn CEO duyệt"→#483 badge, Supplier-backlog "15-18 field"→STATUS Next-up. **MINOR only:** S97-log per-Part State footers show progression (Part-1 `:47` "88 bảng gotcha 77" stale vs session-end "89/79" Part-4 `:113`) — intentional per-part snapshot but mid-log reader sees stale count. No BLOCKING/MAJOR gaps. -- **2026-07-01 Supplier Excel-import GAP audit (anh Kiệt FDC — 30-col "Database NCC & Nhà thầu phụ" cho bên Pro):** ⭐ **Entity CỰC LEAN 9 domain-prop** (`Domain/Master/Supplier.cs:5-16`: Code·Name·Type·TaxCode·Phone·Email·Address·ContactPerson·Note) + 8 audit inherited (Base/AuditableEntity). EF `SupplierConfiguration.cs`: Code len50 UNIQUE-filtered `[IsDeleted]=0`(:24, Mig47 #57), Name200, TaxCode20, Phone30, Email100, Address500, ContactPerson200, Note1000. **enum `SupplierType.cs:3-10` = NhaCungCap1/NhaThauPhu2/ToDoi3/DonViDichVu4/ChuDauTu5 — KHÔNG có "Cả hai/Both"** (FE mirror `fe-admin/types/master.ts:11-16` identical). **GAP 30→entity: 6✅ · 7⚠️collision · 17❌ no-home** — Excel splits Address×2(invoice/office), Phone×2(company/contact), ContactPerson+role; ❌ Fax·Bank-acct×2·Legal-rep+role·GUQ+3-NAS-links·Status/blacklist·Referral·PMH-owner. ⚠️ **S55 seed `SeedRealMasterDataAsync` (`DbInitializer.cs:2768-2787`) crams NĐD/bank/status/category vào free-text `Note`** (:2771-73 TRUONGGIANG/TANPHU/TGN) — proof entity thiếu home. Seed **UNGATED** (called :128, idempotent-key=`Code` :2780) — KHÁC demo-master (`SeedDemoMasterDataAsync` GATED `DemoSeed:Disabled` :117, #75). POST any-auth (`SuppliersController.cs:37-42` S59). FE SHA-identical 2-app (`c1760788`, 253L, 9 fields). **Prod 20 NCC** (Type1×3+Type2×17; type3/4/5 wiped go-live S91 → "Cả hai" enum genuinely-needed). Precedent NAS-link = `PE.HoSoLink nvarchar(1000)` Mig52. Fork→em-main: core-widen ~15col+CaHai=6 vs satellite `SupplierDetail`. → _INDEX pending. -- **2026-06-29 S93 Harness-16 MFE ground-truth (WF1 `wf_4c63e1bd`):** ⭐ MFE denominator extraction (deterministic, status-field KHÔNG grep): marks Active(-High) (`ACTIVE-MARKS.md`) + AS-class + Active-Guards (`error-ledger.md` Verified✅) + recurring-gotcha (`gotchas.md`); **dedup-by-AS-cross-reference** (gotcha/guard mà AS-row trỏ `#N`/`AS-N` → gộp) = **29 item**. Per-role sub-coverage: denom = numbered anti-pattern/NEVER trong `agents/.md`; numer = diary `agent-memory//MEMORY.md` (KHÔNG project/user — bẫy trùng-tên H15-v3) match exact-id OR ≥2 content-word sau stop-list (đánh bại leading-verb-9/9-giả). Codified `scripts/mfe-eval.ps1` + engine §H. (WF1 self-write reverted AS-10; em-main harvest single-writer.) → _INDEX. +- **2026-07-06 Supplier 30-field invest+review WF `wf_5ac2cdb0` (anh Kiệt FDC — 🅰️ schema go-live):** ⭐ schema-domain lane **#53-GARBLED (null, "no StructuredOutput")** nhưng full design RECOVERED từ chính AS-10 memory-write của nó (reverted sau harvest — `feedback_agent_return_garble_recover`); em-main authored authoritative schema. **6 ground-truth correction vs brief:** (1) **ClosedXML 0.105.0 = project Excel-standard, KHÔNG phải OpenXml raw** — `csproj:8` + mọi path (`XlsxRenderer.cs:18`/`ContractExcelExporter.cs:56`/`AttendanceReportExcelExporter.cs:14`) dùng `XLWorkbook`; `cell.GetString()` auto-decode shared-string → "shared-string pitfall" MOOT (cả 2 pkg referenced, OpenXml KHÔNG dùng cho read). (2) **reuse-existing-cols > parallel-new-cols** — map TÊN CÔNG TY→`Name`(cũ), ĐỊA CHỈ XUẤT HĐ→`Address`, SĐT→`Phone`; thêm cột MỚI chỉ cho TYPE thật-mới (OfficeAddress/MailingAddress/ContactPhone); tạo companyName/invoiceAddress = ORPHAN cột seed live. (3) **`UpdateSupplierCommand.cs:49-57` blind absolute-set cả 9 incl Note = latent #73 clobber** → import (🅱️) PHẢI ghi entity direct + fill-where-non-empty, KHÔNG route qua Update cmd. (4) **seed idempotent-by-Code (`DbInitializer.cs:2781`) SKIP existing → cột mới NULL** → population = seed **fill-nulls-if-exists** (KHÔNG seed-insert-alone). (5) **`SupplierDto` hand-projected 2 site** (`GetSupplierQuery.cs:21`+`ListSuppliersQuery.cs:48-50` positional, no AutoMapper) → +6-file thread mỗi cột. (6) FE: **`Dialog.tsx:48` đã `max-h-70vh overflow-auto`** → form-expand cần 0 layout-code (go-live win lớn nhất); HoSoLink `toFileUrl`/`PathWithCopy` LOCAL-không-export trong `PeDetailTabs.tsx:2087/2098` → extract shared `ui/PathLink.tsx`. Design chốt: +18 nullable AddColumn (net 89), `SupplierType +CaHai=6` APPEND, new `SupplierStatus` enum nullable, Mig 62. Reviews 3× PASS_WITH_CONCERNS (2 goLiveSafe, import-robustness=false chờ 🅱️). Tag `[supplier-30field, wf-invest, closedxml-not-openxml, reuse-cols, hand-dto-2site, update-blind-set-73, seed-fillnulls, dialog-autoscroll]`. +- **[→ git+session-log 07-03 + adap-reports] S101 H19-adopt Lane-2:** map reviewer=review-gate / investigator=ground-truth-lane; 12-pt tier-checklist ALL✅ (11/11 inherit, C3 no-`[1m]`-in-frontmatter); toggle-marker MUST copy `.gitignore:87` last-match placement; VACUOUS-MET all-inherit+Fable. *(verbatim → archive/2026-07.md)* +- **[→ git+session-log 07-02 + adap-reports] S100 H18-adopt WF1:** ⭐ ghost-wire-class **config-key-defined-but-unread** (`budget.json:54-55` script re-hardcode same-value→no-flag; catch=grep-key-across-scripts); cron=ghost-wire (CronList=0); `_ledger` orphan-catch 0/15-lifetime. *(verbatim → archive/2026-07.md)* +- **[→ git+session-log 07-02] S98 verify-lane V2:** detector 28→25, 8 derived-stale=100% FP count-token-soft-net vs canonical 61/89/440/79; grep-gotcha "Fable RESTORED" exact misses README variant ":3 Fable 5 1M RESTORED". *(verbatim → archive/2026-07.md)* +- **[→ git+session-log 07-01] S97 feedback-audit:** #77/#78/#79 present `gotchas.md:1301/1317/1325`; #53-garble ×6 = cicd MEMORY-self-target ~17.5KB structural-root-cause; Mig 60 wrong-table Approvals→Mig 61 Changelogs both present. *(verbatim → archive/2026-07.md)* +- **[→ 07-06 entry above + session-log] 2026-07-01 Supplier GAP predecessor:** SUPERSEDED by 07-06 schema-design entry above (same anchors: 9-prop lean, seed-cram→Note, HoSoLink NAS precedent, prod 20-NCC). *(verbatim → archive/2026-07.md)* +- **[→ `scripts/mfe-eval.ps1` §H + session-log 06-29] S93 MFE ground-truth:** denominator=marks/AS/guards/gotcha dedup-by-AS-xref=29; per-role coverage denom=numbered-anti-pattern numer=diary-match exact-id OR ≥2-content-word (beats leading-verb-giả). *(verbatim → archive/2026-07.md)* - **PE FROZEN-Mig59 patchwork + go-live recon cluster (S87→S89, 8 entries → `archive/2026-06.md`):** AREA-2 budget-matrix (`SetPeCcmBudgetPeriodCommand` band-aid misplaced in `PeSuggestedPriceFeatures.cs:153-199`; PRO=drafter-flow vs CCM=role-flow authz asymmetry Section-B row3; "Dự án" col intentional FE-only "—") · AREA-3 finalize/price (AllowApproverFinalize AUTO Mig58 + finalizeByCcmDelegation OPT-IN Mig54 coexist, AUTO-first; ApplyApprovedPriceOnFinalize allow-list {Ncc,ProMin,ProMax,Ccm}; isSystem-branch DEAD via public ApproveV2Async) · AREA-4 UpdatePeDraft (**LATENT #73-class BUG:** HoSoLink absolute-set `PurchaseEvaluationFeatures.cs:280` but PeHeaderForm PUT OMITS → clears; 2 PUT call-sites mutually destructive; no HoSoLink-preserve test) · AREA-5 urgent/notify/TZ (SignalR push BYPASSES UtcDateTimeJsonConverter benign-Kind.Utc; urgent SET/UNSET symmetric fail-closed; possible double-notify-then-skip drafter=Cấp1) · AREA-6 FE-consumers (all 6 PE-comp+3 pages SHA-identical 2-app; residual single-winner `PeListPanel.tsx:168` blank ≥2 joint; #70 stale-echo PRO row3/8 no-peFetching) · S89 AllowApproverFinalize-NOTE feasibility (**GAP: BE field MỚI cần** — flag chỉ ở `currentLevelOptions` current-level; approvalFlow+list+dashboard DTO KHÔNG carry → expose `EndsBeforeCeo`+FinalizeStep/LevelName; FE note đầu `PeWorkflowPanel.tsx` flow `
    `) · 06-24 3-change (winner=SINGLE `SelectedSupplierId`, winnerQuoteTotal DERIVED 3-site; budget=0 blocked 2-layer; terminal=NEW per-Level bool mirror SkipToFinal) · 06-23 D2/D4/D5 UAT (urgent authz BẤT-ĐỐI-XỨNG gắn-role/gỡ-DeptMgr; PE-create dropdown `PeWorkspaceCreateView.tsx:94`; workflow-required 2-tầng). - **2026-06-20 governance-landing map (RC-sig + User-Mark H12/13 + objective-criteria):** ⭐ WHERE-to-land 3 AI_INFRA gov broadcasts. `harness-11-engine.md` = CANONICAL engine (D5/D6/D7 safety-tier + D8 one-direction-lock + D9 single-writer + D10 Bash-residual + CAVEAT no-OS-hook). `error-ledger.md` = §L.a AS-1..13 + §L.b 7-step. adap-report FORMAT richest = `2026-06-18-Governance-harness-11.md`. rules.md §6.6 = objective-criteria. **report-before-stamp ⊂ D7 (extend, đừng duplicate → C3 vocab-fork).** → _INDEX. @@ -91,5 +92,5 @@ Bearer từ `POST api.solutions.com.vn/api/auth/login` → status matrix expecte ## 🔄 Curate trigger - >~30KB → archive recent → L2 `archive/.md` (byte-exact append) + `_INDEX.md` substring pointer. Stale >3mo → remove. -- **Last curate: 2026-06-20 S80 (em-main, archive-gate keep-floor-hit → manual)** (39.8→~14KB): moved 15 recon entries (lines 73-105 byte-exact via `sed`) → `archive/2026-06.md` (33→67KB) + `_INDEX.md` +15 table-row pointers (all verified count=1). KEPT foundation + 2 newest 06-20 + compressed recon-clusters + 3 git-stubs; UPDATED stale counts (40→57 mig, 84→88 tables, 130→354 test, 55→71 gotcha, 7→11 sub). gist NOT updated (em-main distill later). +- **Last curate: 2026-07-06 (em-main single-writer, hook-triggered @21.4KB)** — 6 stale governance/superseded entries (S93/S97/S98/S100/S101 + 07-01 Supplier-predecessor) verbatim → `archive/2026-07.md`, replaced with pointer-stubs. L1 back under target. - **Prev curate: 2026-06-18 S71** (29.8→23.2KB FIFO-trim 3 + gist gen:2). **Prev S70** (47.0→24.1KB dark-matter recovery + built _INDEX/gist). **Prev S40** (35.7→~20KB). diff --git a/.claude/agent-memory/investigator-codebase/archive/2026-07.md b/.claude/agent-memory/investigator-codebase/archive/2026-07.md new file mode 100644 index 0000000..e1fc1cf --- /dev/null +++ b/.claude/agent-memory/investigator-codebase/archive/2026-07.md @@ -0,0 +1,11 @@ +# investigator-codebase — archive 2026-07 (L2 verbatim, frozen additive) + + +## Curated 2026-07-06 (em-main, hook-triggered L1->L2) + +- **2026-07-03 S101 H19-adopt Lane-2 (mapping + model-tier compliance, WF1 investigate — VERDICT SOUND):** ⭐ Mapping CORRECT: reviewer=final-review-gate (Category 1-6 adversarial + Smart-Friend anti-rubberstamp `reviewer.md:268-276` + live-curl deploy-verify = H19 §3a "cổng rà-soát cuối" exact) · investigator-codebase=ground-truth-lane (`investigator-codebase.md:23-26` file:line-evidence + sqlcmd + grep + "if uncertain say uncertain" = H19 §3b "xác-minh sự-thật chống bịa-số/dẫn-chứng"). NO better-fit: investigator-api=EXTERNAL-docs (WebFetch, out-of-scope internal-truth) · database-agent=narrow DB-lens (subset không phải general fact-verify). **Model-tier checklist 12-pt: SE meets A1✅(settings pin `claude-fable-5[1m]` — `[1m]` VALID in settings.json ≠ frontmatter; Fable-down→Opus 1M H5-fallback = A1/A2 frontier-1M allowed) A2✅ A3✅(all-inherit=all-top, 5-fn map) A4/A5/A6 N/A-by-form(no tier-2/helper layer) B1✅ B2✅ B3✅(11 role-names SE-own, 0 copied) C1✅(11/11 `model: inherit` grep) C2✅(hmw.js `tier` field) C3✅(0 `[1m]` in FRONTMATTER model: line — 4 grep hits ALL prose: README:9/12/16 Upgrade-notes + database-agent:46 checklist).** ⚠️ Toggle-marker template EXACT-exists: `.claude/hmw-mode.on` gitignored AFTER `!.claude/**` last-match-wins (`.gitignore:87`); new `.claude/model-real-mode.on` MUST copy placement or gets un-ignored. ⚠️ Ảo-ensemble reuse: hmw.js `parallel()` :97 + synthesis machinery PRESENT (grep 10 hits) — but "S101 WF2 3-lane" is LIVE-mechanism NOT persisted artifact (runs/ = old 06-18 only, HMW-ephemeral S94+ pattern). VACUOUS-MET nuance TRUE: under all-inherit+Fable, 2 positions ALREADY top → H19 §4 "allow reach top-model" adds 0 runtime-delta; new value = toggle depth-control + Fable-outage multi-Opus>single-Opus. Tag `[s101-h19-lane2, mapping-sound, 12pt-compliance, marker-template, vacuous-met]`. +- **2026-07-02 (S100 H18-adopt WF1 `wf_50a817ce-a69` — 3 lane ∥, on-behalf em main APPEND B3, return-only 0-residual):** L1 measurer-coverage: 3/3 script (`mfe-eval:216`/`selfimprove:133-137`/`archive-gate:106`) **GLOB-LIVE 0-hardcode** — agent thứ 12 tự-cử; ⭐ ghost-wire-class MỚI: **config-key defined-but-unread** (`memory-budget.json:54-55` `role_file_glob`/`diary_path_pattern` — script re-hardcode giá trị TRÙNG → không detector nào flag vì cả 2 phía "đúng"; catch = grep key-name across scripts/) + latent skip-if-no-`tools:` (`selfimprove:147`, 0 affected 11/11 có). L2 ghost-wire+taxonomy: MAST=0 repo-wide (grep PHẢI case-sensitive `\bMAST\b` — insensitive dính "Master" noise); cron monthly = ghost-wire THẬT (CronList=0 + scheduler RỖNG 05-04 log + S96 chạy 13:04 em-main in-session); convention "auto = step em-main kích, no-OS-hook" nhất quán 5 nơi. L3 ledger-đo: `_ledger.md` true-orphan-catch **0/15 lifetime** (single-day artifact 06-18, 15 row/14 folder — mig54-R2 share) · mode-A coverage 0/8 S93+ · ⭐ "S71 `harvest/` rỗng" = **criterion-wording KHÔNG phải incident** (đính chính claim em-main) · repo có 5 "ledger" khác tên → sweep grep `_ledger` EXACT · hmw.js 0-touch. Tag `[s100-h18-wf1, 3-lane, ghostwire-configkey-class, ledger-0-15, on-behalf]`. +- **2026-07-02 S98 verify-lane V2 post-flush (VERDICT PASS):** detector 28→25 (derived-stale 11→8; wikilink 14 + vocab-fork 3 giữ by-design). **8 derived-stale còn = 100% FP-class count-token soft-net:** CLAUDE.md:84 tests-tree "(6 test…)" · ef-core SKILL :94/:95 ("2/1 migration tách/GỘP" history) + :103/:111/:114 ("4/3/1 bảng" Budget-defer/Mig-15 module-local) + :162/:179 (heading "Revert 1 migration" + comment "Script từ 1 migration") — 0 genuine drift vs canonical 61/89/440/79; SKILL edit sáng (+rows 60/61 @:82-83) chỉ shift line-number FP cũ, 0 flag MỚI. ⭐ Grep gotcha: **"Fable RESTORED" exact-string CHỈ STATUS:24 + session-start:29; agents/README dùng biến-thể "Fable 5 1M RESTORED" (:3) + "Fable-restore" (:12)** — exact-phrase grep miss README dù substance đủ. HANDOFF:5 mega-line: bundle mEGqlNWc/Dnrp4PU1=#484, CeTA7Z82 chỉ trong note "= #483" (1 line match duy nhất cả file). 3 on-behalf append đúng-chỗ: database-agent :36 (cuối Log = EOF) · reviewer addendum TRONG-entry S97-bis :68 (câu cuối + marker on-behalf @S98) · impl-fe S97-Part2 :16 giữa badge:9/S97:19. cicd "S98" = 2× "(curate S98)" stub :73/:74, 0 material-tag. Ledger :7 Mode-A ephemeral note (wf mode-A vắng ledger-row ≠ orphan) + bảng 15 row :11-25 nguyên. +- **2026-07-01 S97 session-end feedback-audit (VERDICT CLEAN):** Grep-verified capture readiness pre-close. ✅ gotcha #77/#78/#79 present `docs/gotchas.md:1301/1317/1325` (format `### N.` count=79 = STATUS header — no self-count drift; all 3 have Triệu-chứng+Cơ-chế+Fix+**Quy-tắc** root-cause). ✅ #53 return-garble **x6 (cicd 5/6)** in BOTH `feedback_agent_return_garble_recover.md` (Why-line ×5→×6 + **structural root-cause: cicd MEMORY self-target ~17.1KB→curate-at-return→thinking-step=message-cuối=return-value**; fix=archive-cicd-sớm NOT instruction) AND S97-log Parts 1/2/4 (lần-4/5/6). cicd MEMORY LIVE=17.5KB (confirms self-target). ✅ Mig 60 wrong-table BUG = 2-fix present: code (Mig 61 `20260701142752` query Changelogs) + guard (gotcha #79 "xác định ĐÚNG bảng writer" + "verify marker-count prod trước"). Mig 60 code `:29-31` confirmed `PurchaseEvaluationApprovals a...a.Comment LIKE` = wrong. Both Mig 60/61 have 3-file rule. ✅ git status CLEAN, 0 stray `.claude` misland, 0 `git add -A` in log, S97 workflows HMW-ephemeral (NOT persisted run-folders — consistent S94+ pattern, runs/ only old 06-18). ✅ Product decisions captured (STATUS/HANDOFF/log + commit-msg): "duyệt là fix"→#480 price-lock, "fix trọn"→Mig 60 endsBeforeCeo-runtime, "hiện luôn CEO duyệt"→#483 badge, Supplier-backlog "15-18 field"→STATUS Next-up. **MINOR only:** S97-log per-Part State footers show progression (Part-1 `:47` "88 bảng gotcha 77" stale vs session-end "89/79" Part-4 `:113`) — intentional per-part snapshot but mid-log reader sees stale count. No BLOCKING/MAJOR gaps. +- **2026-07-01 Supplier Excel-import GAP audit (anh Kiệt FDC — 30-col "Database NCC & Nhà thầu phụ" cho bên Pro):** ⭐ **Entity CỰC LEAN 9 domain-prop** (`Domain/Master/Supplier.cs:5-16`: Code·Name·Type·TaxCode·Phone·Email·Address·ContactPerson·Note) + 8 audit inherited (Base/AuditableEntity). EF `SupplierConfiguration.cs`: Code len50 UNIQUE-filtered `[IsDeleted]=0`(:24, Mig47 #57), Name200, TaxCode20, Phone30, Email100, Address500, ContactPerson200, Note1000. **enum `SupplierType.cs:3-10` = NhaCungCap1/NhaThauPhu2/ToDoi3/DonViDichVu4/ChuDauTu5 — KHÔNG có "Cả hai/Both"** (FE mirror `fe-admin/types/master.ts:11-16` identical). **GAP 30→entity: 6✅ · 7⚠️collision · 17❌ no-home** — Excel splits Address×2(invoice/office), Phone×2(company/contact), ContactPerson+role; ❌ Fax·Bank-acct×2·Legal-rep+role·GUQ+3-NAS-links·Status/blacklist·Referral·PMH-owner. ⚠️ **S55 seed `SeedRealMasterDataAsync` (`DbInitializer.cs:2768-2787`) crams NĐD/bank/status/category vào free-text `Note`** (:2771-73 TRUONGGIANG/TANPHU/TGN) — proof entity thiếu home. Seed **UNGATED** (called :128, idempotent-key=`Code` :2780) — KHÁC demo-master (`SeedDemoMasterDataAsync` GATED `DemoSeed:Disabled` :117, #75). POST any-auth (`SuppliersController.cs:37-42` S59). FE SHA-identical 2-app (`c1760788`, 253L, 9 fields). **Prod 20 NCC** (Type1×3+Type2×17; type3/4/5 wiped go-live S91 → "Cả hai" enum genuinely-needed). Precedent NAS-link = `PE.HoSoLink nvarchar(1000)` Mig52. Fork→em-main: core-widen ~15col+CaHai=6 vs satellite `SupplierDetail`. → _INDEX pending. +- **2026-06-29 S93 Harness-16 MFE ground-truth (WF1 `wf_4c63e1bd`):** ⭐ MFE denominator extraction (deterministic, status-field KHÔNG grep): marks Active(-High) (`ACTIVE-MARKS.md`) + AS-class + Active-Guards (`error-ledger.md` Verified✅) + recurring-gotcha (`gotchas.md`); **dedup-by-AS-cross-reference** (gotcha/guard mà AS-row trỏ `#N`/`AS-N` → gộp) = **29 item**. Per-role sub-coverage: denom = numbered anti-pattern/NEVER trong `agents/.md`; numer = diary `agent-memory//MEMORY.md` (KHÔNG project/user — bẫy trùng-tên H15-v3) match exact-id OR ≥2 content-word sau stop-list (đánh bại leading-verb-9/9-giả). Codified `scripts/mfe-eval.ps1` + engine §H. (WF1 self-write reverted AS-10; em-main harvest single-writer.) → _INDEX. diff --git a/fe-admin/src/components/ui/PathLink.tsx b/fe-admin/src/components/ui/PathLink.tsx new file mode 100644 index 0000000..357dcac --- /dev/null +++ b/fe-admin/src/components/ui/PathLink.tsx @@ -0,0 +1,68 @@ +import { useState } from 'react' +import { toast } from 'sonner' +import { Button } from '@/components/ui/Button' + +// Đổi đường dẫn Windows → URL file:// (O:\DATA\x → file:///O:/DATA/x · \\srv\share → file://srv/share). +function toFileUrl(p: string): string { + const slashed = p.trim().replace(/\\/g, '/') + const url = slashed.startsWith('//') ? 'file:' + slashed : 'file:///' + slashed + return encodeURI(url) +} + +// Link đường dẫn hồ sơ / NAS dùng chung (trích từ PeDetailTabs). +// - Link web (http/https, vd SharePoint) → bấm mở thẳng tab mới. +// - Đường dẫn ổ cứng/ổ mạng (O:\…, \\server) → render LINK file:// để BẤM-THỬ mở File +// Explorer (chạy nếu máy/trình duyệt cho phép: Edge bật policy IntranetFileLinksEnabled +// qua GPO + host trong Intranet Zone) + nút Copy dự phòng (default Chrome/Edge CHẶN +// https→file:// → bấm no-op → khi đó dùng Copy dán vào File Explorer, máy đã map ổ mạng +// là mở ngay). +export function PathLink({ path }: { path: string }) { + const [copied, setCopied] = useState(false) + const trimmed = path.trim() + + if (/^https?:\/\//i.test(trimmed)) { + return ( + + {path} + + ) + } + + const copy = async () => { + try { + await navigator.clipboard.writeText(path) + setCopied(true) + setTimeout(() => setCopied(false), 1500) + } catch { + toast.error('Không copy được — vui lòng bôi đen đường dẫn rồi Ctrl+C.') + } + } + + return ( +
    + + {path} + + +
    + ) +} diff --git a/fe-admin/src/pages/master/SuppliersPage.tsx b/fe-admin/src/pages/master/SuppliersPage.tsx index ea1d16f..0d79640 100644 --- a/fe-admin/src/pages/master/SuppliersPage.tsx +++ b/fe-admin/src/pages/master/SuppliersPage.tsx @@ -11,10 +11,17 @@ import { Label } from '@/components/ui/Label' import { Select } from '@/components/ui/Select' import { Textarea } from '@/components/ui/Textarea' import { Dialog } from '@/components/ui/Dialog' +import { PathLink } from '@/components/ui/PathLink' import { api } from '@/lib/api' import { getErrorMessage } from '@/lib/apiError' import { MenuKeys } from '@/lib/menuKeys' -import { SupplierType, SupplierTypeLabel, type Paged, type Supplier } from '@/types/master' +import { + SupplierStatusLabel, + SupplierType, + SupplierTypeLabel, + type Paged, + type Supplier, +} from '@/types/master' type FormState = { id?: string @@ -27,11 +34,34 @@ type FormState = { address: string contactPerson: string note: string + packageCategory: string + officeAddress: string + mailingAddress: string + fax: string + bankAccount: string + secondaryBankAccount: string + legalRepresentative: string + legalRepTitle: string + authorizationNote: string + linkGuq: string + linkGpkd: string + linkHsnl: string + contactTitle: string + contactPhone: string + mailRecipient: string + referralSource: string + ownerPmh: string + status: string } const emptyForm: FormState = { code: '', name: '', type: SupplierType.NhaCungCap, taxCode: '', phone: '', email: '', address: '', contactPerson: '', note: '', + packageCategory: '', officeAddress: '', mailingAddress: '', fax: '', + bankAccount: '', secondaryBankAccount: '', legalRepresentative: '', legalRepTitle: '', + authorizationNote: '', linkGuq: '', linkGpkd: '', linkHsnl: '', + contactTitle: '', contactPhone: '', mailRecipient: '', referralSource: '', ownerPmh: '', + status: '', } export function SuppliersPage() { @@ -68,6 +98,24 @@ export function SuppliersPage() { address: data.address || null, contactPerson: data.contactPerson || null, note: data.note || null, + packageCategory: data.packageCategory || null, + officeAddress: data.officeAddress || null, + mailingAddress: data.mailingAddress || null, + fax: data.fax || null, + bankAccount: data.bankAccount || null, + secondaryBankAccount: data.secondaryBankAccount || null, + legalRepresentative: data.legalRepresentative || null, + legalRepTitle: data.legalRepTitle || null, + authorizationNote: data.authorizationNote || null, + linkGuq: data.linkGuq || null, + linkGpkd: data.linkGpkd || null, + linkHsnl: data.linkHsnl || null, + contactTitle: data.contactTitle || null, + contactPhone: data.contactPhone || null, + mailRecipient: data.mailRecipient || null, + referralSource: data.referralSource || null, + ownerPmh: data.ownerPmh || null, + status: data.status ? Number(data.status) : null, } if (data.id) { await api.put(`/suppliers/${data.id}`, payload) @@ -103,6 +151,15 @@ export function SuppliersPage() { id: s.id, code: s.code, name: s.name, type: s.type, taxCode: s.taxCode ?? '', phone: s.phone ?? '', email: s.email ?? '', address: s.address ?? '', contactPerson: s.contactPerson ?? '', note: s.note ?? '', + packageCategory: s.packageCategory ?? '', officeAddress: s.officeAddress ?? '', + mailingAddress: s.mailingAddress ?? '', fax: s.fax ?? '', + bankAccount: s.bankAccount ?? '', secondaryBankAccount: s.secondaryBankAccount ?? '', + legalRepresentative: s.legalRepresentative ?? '', legalRepTitle: s.legalRepTitle ?? '', + authorizationNote: s.authorizationNote ?? '', linkGuq: s.linkGuq ?? '', + linkGpkd: s.linkGpkd ?? '', linkHsnl: s.linkHsnl ?? '', + contactTitle: s.contactTitle ?? '', contactPhone: s.contactPhone ?? '', + mailRecipient: s.mailRecipient ?? '', referralSource: s.referralSource ?? '', + ownerPmh: s.ownerPmh ?? '', status: s.status != null ? String(s.status) : '', }) setOpen(true) } @@ -246,6 +303,114 @@ export function SuppliersPage() {