From 9ec08667d3cc0f7d5598e6400845247c79492f56 Mon Sep 17 00:00:00 2001 From: mihir Date: Tue, 17 Nov 2026 00:24:11 +0530 Subject: [PATCH] feat: record and cancel B2B partner orders --- docs/PHASES.md | 4 +- src/App.tsx | 12 ++ src/components/BusinessSnapshot.tsx | 12 ++ src/components/WorkspaceShell.tsx | 1 + src/lib/partner-orders.ts | 53 ++++++++ src/lib/quotes.ts | 2 +- src/pages/BusinessAccountsPage.tsx | 1 + src/pages/PartnerOrdersPage.tsx | 164 +++++++++++++++++++++++++ src/pages/QuotesPage.tsx | 19 +-- test/partner-orders.test.ts | 75 ++++++++++++ test/partner-orders.ui.test.tsx | 181 ++++++++++++++++++++++++++++ test/quotes.test.ts | 9 +- 12 files changed, 517 insertions(+), 16 deletions(-) create mode 100644 src/components/BusinessSnapshot.tsx create mode 100644 src/lib/partner-orders.ts create mode 100644 src/pages/PartnerOrdersPage.tsx create mode 100644 test/partner-orders.test.ts create mode 100644 test/partner-orders.ui.test.tsx diff --git a/docs/PHASES.md b/docs/PHASES.md index 0f001e4..6af63b3 100644 --- a/docs/PHASES.md +++ b/docs/PHASES.md @@ -60,4 +60,6 @@ Customer and administration screens are implemented, with recovery, pricing, sto - Sample UAT should verify ineligible accounts and variants, self-review, dispatch only after approval, and replay with the original payload and key. - B2B artwork supports private PDF, PNG, and JPEG version uploads, independent review, and permission-based downloads. - Artwork UAT should use separate uploader, reviewer, and reader accounts. Exercise the 2 MiB upload limit through ingress, approval and rejection, download permissions, and preservation of prior approved versions. -- Partner orders and payments, custom requests and reporting remain open. +- Partner orders support conversion from accepted, unexpired quotations, immutable merchandise snapshots, and reasoned cancellation. +- Partner order UAT should verify expired quotes, duplicate references and quote conversion, exact retries, and cancellation blocked by an active payment receipt. +- Partner payments, custom requests and reporting remain open. diff --git a/src/App.tsx b/src/App.tsx index 835d059..930e8f4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -35,6 +35,7 @@ const QuotesPage = lazy(() => import("@/pages/QuotesPage")); const CreditPoliciesPage = lazy(() => import("@/pages/CreditPoliciesPage")); const SamplesPage = lazy(() => import("@/pages/SamplesPage")); const ArtworkPage = lazy(() => import("@/pages/ArtworkPage")); +const PartnerOrdersPage = lazy(() => import("@/pages/PartnerOrdersPage")); const MaterialCostRatesPage = lazy(() => import("@/pages/MaterialCostRatesPage")); const ProcurementPage = lazy(() => import("@/pages/ProcurementPage")); const BomPage = lazy(() => import("@/pages/BomPage")); @@ -129,6 +130,17 @@ function Router() { {(params) => } + {() => } + {() => } + + {(params) => } + + + {(params) => } + + + {(params) => } + {() => } {(params) => } diff --git a/src/components/BusinessSnapshot.tsx b/src/components/BusinessSnapshot.tsx new file mode 100644 index 0000000..a1946e2 --- /dev/null +++ b/src/components/BusinessSnapshot.tsx @@ -0,0 +1,12 @@ +import type { z } from "zod"; +import type { profileSnapshot } from "@/lib/business"; + +export function BusinessSnapshot({ account }: { account: z.infer }) { + return
+

Business at quotation issuance

+

{account.legalName}{account.tradingName && ` · ${account.tradingName}`} · Profile version {account.profileVersion}

+

Registration {account.registrationNumber}{account.taxIdentifier && ` · Tax ID ${account.taxIdentifier}`}

+

{account.contactEmail}{account.contactPhone && ` · ${account.contactPhone}`}

+

{[account.billingLine1, account.billingCity, account.billingRegion, account.billingPostalCode, account.countryCode].join(", ")}

+
; +} diff --git a/src/components/WorkspaceShell.tsx b/src/components/WorkspaceShell.tsx index 75a8615..45f144a 100644 --- a/src/components/WorkspaceShell.tsx +++ b/src/components/WorkspaceShell.tsx @@ -76,6 +76,7 @@ export function WorkspaceNavigation() { { label: "B2B credit policies", path: "/admin/b2b-credit-policies", permission: "b2b.credit.read" }, { label: "B2B samples", path: "/admin/b2b-samples", permission: "b2b.sample.read" }, { label: "B2B artwork", path: "/admin/b2b-artwork", permission: "b2b.artwork.read" }, + { label: "B2B partner orders", path: "/admin/b2b-partner-orders", permission: "b2b.order.read" }, ]; return (