From a8c2a6735bc6dee6c74bb37b2a66d84e2d697674 Mon Sep 17 00:00:00 2001 From: WuYongJie Date: Tue, 24 Nov 2026 15:53:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(workbench):=20=E6=8B=86=E5=88=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E4=B8=8E=E9=A2=84=E4=BC=B0=E6=88=90=E6=9C=AC?= =?UTF-8?q?=E6=B5=8B=E7=AE=97=E5=85=A5=E5=8F=A3=E5=B9=B6=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E9=A1=B5=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit d1c2584edee2ee57430a3f7310aa510ba489b785) --- .../src/app/database/BomDatabaseWorkspace.tsx | 32 ++ .../src/app/database/[library]/page.tsx | 42 ++ .../bom-library/AccessoryLibraryLogic.tsx | 0 .../bom-library/AccessoryLibraryPanel.tsx | 0 .../bom-library/AlphabetLibraryPanel.test.tsx | 4 +- .../bom-library/AlphabetLibraryPanel.tsx | 0 .../bom-library/BomLibraryDomain.tsx | 5 +- .../EdgeBandingLibraryPanel.test.tsx | 2 +- .../bom-library/EdgeBandingLibraryPanel.tsx | 0 .../PackagingMaterialLibraryPanel.tsx | 0 .../bom-library/SteelFrameLibraryPanel.tsx | 0 .../accessory-models/AccessoryGlbPreview.tsx | 0 .../accessory-models/AccessoryModelCover.tsx | 0 .../accessory-models/AccessoryModelDetail.tsx | 0 .../accessory-models/AccessoryModelEditor.tsx | 0 .../AccessoryModelGallery.tsx | 0 .../AccessoryModelLibrary.tsx | 0 .../accessory-models/AccessoryModelPhoto.tsx | 0 .../AccessoryModelWorkspace.tsx | 0 .../accessory-models/CamPhotoChoices.tsx | 0 .../accessory-models/draft-client.ts | 0 .../accessory-models/generate-model.ts | 0 .../bom-library/accessory-models/model-glb.ts | 0 .../accessory-models/render-model-cover.ts | 0 .../bom-library/bomLibraryConfig.ts | 9 +- .../RawMaterialLibraryDomain.tsx | 0 .../RawMaterialLibraryPanel.tsx | 0 .../RawMaterialLibraryWorkspaceContent.tsx | 2 +- .../rawMaterialLibraryConfig.ts | 5 +- .../intake/IntakeActiveWorkspaceContent.tsx | 48 +- .../src/app/intake/IntakeClient.test.tsx | 422 +----------------- .../app/intake/IntakePrimaryDomainContent.tsx | 20 +- .../intake/IntakeWorkspaceContentPanel.tsx | 3 + .../BomLibraryWorkbenchSection.tsx | 62 --- .../BomLibraryWorkspaceContent.tsx | 58 --- .../FormalIntakeWorkbench.navigation.test.tsx | 14 +- .../components/FormalIntakeWorkbench.tsx | 41 -- .../components/IntakeMobileNavigation.tsx | 3 - .../components/IntakeWorkspaceShell.tsx | 36 +- .../src/app/intake/intakeClientTypes.ts | 8 +- .../src/app/intake/intakeClientViewProps.tsx | 65 +-- .../src/app/intake/intakeDomainConfig.ts | 6 +- .../src/app/intake/intakeWorkspaceState.ts | 32 +- .../src/app/intake/intakeWorkspaceTypes.ts | 4 +- .../workspaces/RawMaterialDomain.tsx | 2 +- furniture-3d-system/src/app/intake/page.tsx | 35 +- .../RawMaterialLibraryWorkbenchSection.tsx | 69 --- .../ReferenceEstimatorWorkbenchSection.tsx | 62 --- .../ReferenceEstimatorWorkspaceContent.tsx | 32 -- .../app/intake/useIntakeClientViewModel.ts | 50 +-- .../useIntakeMaterialLibraryFinishes.ts | 17 - .../intake/useIntakeWorkspaceActivation.ts | 4 +- .../app/intake/useIntakeWorkspaceOpeners.ts | 39 +- .../reference-estimator/BomBoardTable.tsx | 0 .../reference-estimator/BomExtraItems.tsx | 0 .../BomTemplateSettings.tsx | 0 .../BomTemplateTable.test.tsx | 0 .../reference-estimator/BomTemplateTable.tsx | 0 .../EstimateDetailTable.tsx | 0 .../EstimateInputPanel.tsx | 0 .../EstimatePackedView.tsx | 0 .../EstimatePackingPanel.tsx | 0 .../EstimateSettingsPanel.tsx | 0 .../EstimateSkillLibrary.tsx | 0 .../EstimateSkillPanel.tsx | 0 .../EstimateStageSkillLibrary.tsx | 0 .../ReferenceEstimatorDetail.tsx | 0 .../ReferenceEstimatorDomain.tsx | 0 .../ReferenceEstimatorV1.tsx | 0 .../bom-template-inputs.tsx | 0 .../estimate-export-image.ts | 0 .../estimate-skill-actions.ts | 0 .../reference-estimator/estimate.module.css | 0 .../src/app/reference-estimator/page.tsx | 21 + .../referenceEstimateLinks.ts | 4 +- .../referenceEstimatorCalculations.ts | 0 .../referenceEstimatorConfig.ts | 0 .../skill-library-events.ts | 0 .../skill-library.module.css | 0 .../standard/BookshelfLibraryRecords.tsx | 0 .../standard/CabinetModelView.tsx | 0 .../standard/CabinetStructureDetails.tsx | 0 .../standard/ImageSkillRecords.tsx | 0 .../standard/ModelConversationComposer.tsx | 0 .../standard/ModelConversationPanel.tsx | 0 .../standard/ModelWorkspace.tsx | 0 .../standard/StageAssistantWorkspace.tsx | 0 .../standard/StandardEstimator.tsx | 2 + .../standard/StandardModelPanel.tsx | 0 .../standard/StandardPackingPanel.tsx | 0 .../standard/StandardQuotesPanel.tsx | 0 .../standard/StandardRecognitionReview.tsx | 0 .../standard/StandardSamplingPanel.tsx | 0 .../standard/StandardTemplateTable.tsx | 0 .../standard/bookshelf-memory-client.ts | 0 .../standard/cad-part-geometry.ts | 0 .../standard/estimate-drawings-cache.ts | 0 .../standard/estimate-drawings.worker.ts | 0 .../standard/estimate-packing-preview.ts | 0 .../standard/model-conversation-actions.ts | 0 .../standard/model-export-images.ts | 0 .../standard/model-workspace.module.css | 0 .../standard/recognize-image.ts | 0 .../reference-image-autosave.test.tsx | 0 .../standard/reference-image-paste.ts | 0 .../standard/sampling-preview.module.css | 0 .../standard/stage-assistant-client.ts | 0 .../standard/standard.module.css | 0 .../standard/useEstimateDrawings.ts | 0 .../standard/useStandardEstimator.ts | 0 .../standard/workflow.module.css | 0 .../useEstimateController.ts | 0 .../components/permissionMatrixGroups.test.ts | 14 +- .../components/productPermissionGroups.ts | 8 +- .../src/components/layout/AppShell.tsx | 12 +- .../src/components/layout/AppTopNav.tsx | 9 +- .../components/layout/ProductSideNavMenu.tsx | 10 +- .../layout/ProductWorkspaceTabs.tsx | 195 ++++++++ .../layout/__tests__/AppSideNav.test.tsx | 10 + .../__tests__/MobileNavDropdown.test.tsx | 9 + .../src/config/intake-library-navigation.ts | 27 ++ .../config/product-workbench-navigation.ts | 16 +- .../src/lib/intake-library-access.ts | 32 ++ .../__tests__/image-assembly.test.ts | 2 +- .../__tests__/skill-routing.test.ts | 2 +- .../src/lib/selection-market/navigation.ts | 8 + .../src/lib/workspace-route-permissions.ts | 8 + .../src/server/services/auth.service.ts | 9 +- .../bookshelf-memory.service.test.ts | 2 +- 129 files changed, 553 insertions(+), 1080 deletions(-) create mode 100644 furniture-3d-system/src/app/database/BomDatabaseWorkspace.tsx create mode 100644 furniture-3d-system/src/app/database/[library]/page.tsx rename furniture-3d-system/src/app/{intake => database}/bom-library/AccessoryLibraryLogic.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/AccessoryLibraryPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/AlphabetLibraryPanel.test.tsx (99%) rename furniture-3d-system/src/app/{intake => database}/bom-library/AlphabetLibraryPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/BomLibraryDomain.tsx (96%) rename furniture-3d-system/src/app/{intake => database}/bom-library/EdgeBandingLibraryPanel.test.tsx (98%) rename furniture-3d-system/src/app/{intake => database}/bom-library/EdgeBandingLibraryPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/PackagingMaterialLibraryPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/SteelFrameLibraryPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/AccessoryGlbPreview.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/AccessoryModelCover.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/AccessoryModelDetail.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/AccessoryModelEditor.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/AccessoryModelGallery.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/AccessoryModelLibrary.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/AccessoryModelPhoto.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/AccessoryModelWorkspace.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/CamPhotoChoices.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/draft-client.ts (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/generate-model.ts (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/model-glb.ts (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/accessory-models/render-model-cover.ts (100%) rename furniture-3d-system/src/app/{intake => database}/bom-library/bomLibraryConfig.ts (89%) rename furniture-3d-system/src/app/{intake => database}/raw-material-library/RawMaterialLibraryDomain.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/raw-material-library/RawMaterialLibraryPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => database}/raw-material-library/RawMaterialLibraryWorkspaceContent.tsx (88%) rename furniture-3d-system/src/app/{intake => database}/raw-material-library/rawMaterialLibraryConfig.ts (66%) delete mode 100644 furniture-3d-system/src/app/intake/bom-library/BomLibraryWorkbenchSection.tsx delete mode 100644 furniture-3d-system/src/app/intake/bom-library/BomLibraryWorkspaceContent.tsx delete mode 100644 furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryWorkbenchSection.tsx delete mode 100644 furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorWorkbenchSection.tsx delete mode 100644 furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorWorkspaceContent.tsx delete mode 100644 furniture-3d-system/src/app/intake/useIntakeMaterialLibraryFinishes.ts rename furniture-3d-system/src/app/{intake => }/reference-estimator/BomBoardTable.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/BomExtraItems.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/BomTemplateSettings.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/BomTemplateTable.test.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/BomTemplateTable.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/EstimateDetailTable.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/EstimateInputPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/EstimatePackedView.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/EstimatePackingPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/EstimateSettingsPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/EstimateSkillLibrary.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/EstimateSkillPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/EstimateStageSkillLibrary.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/ReferenceEstimatorDetail.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/ReferenceEstimatorDomain.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/ReferenceEstimatorV1.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/bom-template-inputs.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/estimate-export-image.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/estimate-skill-actions.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/estimate.module.css (100%) create mode 100644 furniture-3d-system/src/app/reference-estimator/page.tsx rename furniture-3d-system/src/app/{intake => }/reference-estimator/referenceEstimateLinks.ts (91%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/referenceEstimatorCalculations.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/referenceEstimatorConfig.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/skill-library-events.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/skill-library.module.css (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/BookshelfLibraryRecords.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/CabinetModelView.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/CabinetStructureDetails.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/ImageSkillRecords.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/ModelConversationComposer.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/ModelConversationPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/ModelWorkspace.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/StageAssistantWorkspace.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/StandardEstimator.tsx (97%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/StandardModelPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/StandardPackingPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/StandardQuotesPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/StandardRecognitionReview.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/StandardSamplingPanel.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/StandardTemplateTable.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/bookshelf-memory-client.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/cad-part-geometry.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/estimate-drawings-cache.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/estimate-drawings.worker.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/estimate-packing-preview.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/model-conversation-actions.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/model-export-images.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/model-workspace.module.css (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/recognize-image.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/reference-image-autosave.test.tsx (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/reference-image-paste.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/sampling-preview.module.css (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/stage-assistant-client.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/standard.module.css (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/useEstimateDrawings.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/useStandardEstimator.ts (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/standard/workflow.module.css (100%) rename furniture-3d-system/src/app/{intake => }/reference-estimator/useEstimateController.ts (100%) create mode 100644 furniture-3d-system/src/components/layout/ProductWorkspaceTabs.tsx create mode 100644 furniture-3d-system/src/config/intake-library-navigation.ts create mode 100644 furniture-3d-system/src/lib/intake-library-access.ts diff --git a/furniture-3d-system/src/app/database/BomDatabaseWorkspace.tsx b/furniture-3d-system/src/app/database/BomDatabaseWorkspace.tsx new file mode 100644 index 00000000..d3bdb72b --- /dev/null +++ b/furniture-3d-system/src/app/database/BomDatabaseWorkspace.tsx @@ -0,0 +1,32 @@ +import type { ComponentProps } from 'react' +import { assetCenterService } from '@/server/services/asset-center.service' +import { materialService } from '@/server/services/material.service' +import { BomLibraryDomain, type BomLibraryKey } from './bom-library/BomLibraryDomain' + +export async function BomDatabaseWorkspace({ + library, user, canEdit, +}: { + library: BomLibraryKey + user: ComponentProps['user'] + canEdit: boolean +}) { + const usesMaterialCatalog = library === 'materialLibrary' || library === 'finishLibrary' + const [substrates, finishes, categories, dictionaries] = await Promise.all([ + usesMaterialCatalog ? assetCenterService.listSubstrates() : [], + usesMaterialCatalog ? materialService.findAll({ limit: 500 }) : [], + usesMaterialCatalog ? materialService.findAllCategories() : [], + usesMaterialCatalog ? assetCenterService.getSubstrateDictionaryBundle() : undefined, + ]) + + return ( + + ) +} diff --git a/furniture-3d-system/src/app/database/[library]/page.tsx b/furniture-3d-system/src/app/database/[library]/page.tsx new file mode 100644 index 00000000..ca27631b --- /dev/null +++ b/furniture-3d-system/src/app/database/[library]/page.tsx @@ -0,0 +1,42 @@ +import { notFound, redirect } from 'next/navigation' +import { DATABASE_LIBRARIES } from '@/config/intake-library-navigation' +import { getIntakeLibraryAccess } from '@/lib/intake-library-access' +import { requireSession } from '@/lib/server-session' +import { intakeNodePermissionSettingsService } from '@/server/services/intake-node-permission-settings.service' +import { BomDatabaseWorkspace } from '../BomDatabaseWorkspace' +import { RawMaterialLibraryDomain } from '../raw-material-library/RawMaterialLibraryDomain' + +type DatabasePageProps = { + params: Promise<{ library: string }> + searchParams: Promise<{ material?: string | string[] }> +} + +export async function generateMetadata({ params }: DatabasePageProps) { + const { library } = await params + return { title: DATABASE_LIBRARIES.find((item) => item.slug === library)?.label ?? '数据库' } +} + +export default async function DatabaseLibraryPage({ params, searchParams }: DatabasePageProps) { + const { library: slug } = await params + const library = DATABASE_LIBRARIES.find((item) => item.slug === slug) + if (!library) notFound() + + const { user, authUser } = await requireSession() + const { overrides } = await intakeNodePermissionSettingsService.getSettings() + const access = getIntakeLibraryAccess(authUser, overrides, library.targetKey) + if (!access.canView) redirect('/intake') + + const { material } = await searchParams + return ( +
+ {library.targetKey === 'bomLibrary' ? ( + + ) : ( + + )} +
+ ) +} diff --git a/furniture-3d-system/src/app/intake/bom-library/AccessoryLibraryLogic.tsx b/furniture-3d-system/src/app/database/bom-library/AccessoryLibraryLogic.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/AccessoryLibraryLogic.tsx rename to furniture-3d-system/src/app/database/bom-library/AccessoryLibraryLogic.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/AccessoryLibraryPanel.tsx b/furniture-3d-system/src/app/database/bom-library/AccessoryLibraryPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/AccessoryLibraryPanel.tsx rename to furniture-3d-system/src/app/database/bom-library/AccessoryLibraryPanel.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/AlphabetLibraryPanel.test.tsx b/furniture-3d-system/src/app/database/bom-library/AlphabetLibraryPanel.test.tsx similarity index 99% rename from furniture-3d-system/src/app/intake/bom-library/AlphabetLibraryPanel.test.tsx rename to furniture-3d-system/src/app/database/bom-library/AlphabetLibraryPanel.test.tsx index 95962ce3..e9185ac3 100644 --- a/furniture-3d-system/src/app/intake/bom-library/AlphabetLibraryPanel.test.tsx +++ b/furniture-3d-system/src/app/database/bom-library/AlphabetLibraryPanel.test.tsx @@ -1,7 +1,7 @@ import { fireEvent, render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import AccessoryLibraryPanel from '@/app/intake/bom-library/AccessoryLibraryPanel' -import PackagingMaterialLibraryPanel from '@/app/intake/bom-library/PackagingMaterialLibraryPanel' +import AccessoryLibraryPanel from '@/app/database/bom-library/AccessoryLibraryPanel' +import PackagingMaterialLibraryPanel from '@/app/database/bom-library/PackagingMaterialLibraryPanel' const LEGACY_PACKAGING_MATERIAL_LIBRARY_STORAGE_KEY = 'formal-intake-packaging-material-library-items' diff --git a/furniture-3d-system/src/app/intake/bom-library/AlphabetLibraryPanel.tsx b/furniture-3d-system/src/app/database/bom-library/AlphabetLibraryPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/AlphabetLibraryPanel.tsx rename to furniture-3d-system/src/app/database/bom-library/AlphabetLibraryPanel.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/BomLibraryDomain.tsx b/furniture-3d-system/src/app/database/bom-library/BomLibraryDomain.tsx similarity index 96% rename from furniture-3d-system/src/app/intake/bom-library/BomLibraryDomain.tsx rename to furniture-3d-system/src/app/database/bom-library/BomLibraryDomain.tsx index 8a6119cd..9e2c4648 100644 --- a/furniture-3d-system/src/app/intake/bom-library/BomLibraryDomain.tsx +++ b/furniture-3d-system/src/app/database/bom-library/BomLibraryDomain.tsx @@ -36,7 +36,7 @@ type BomLibraryDomainProps = { materialLibrarySubstrates: SubstrateDTO[]; materialLibraryFinishes: MaterialDTO[]; materialLibraryCategories: MaterialCategoryDTO[]; - materialLibraryDictionaries: SubstrateDictionaryBundleDTO; + materialLibraryDictionaries?: SubstrateDictionaryBundleDTO; onMaterialLibraryFinishesChange?: (finishes: MaterialDTO[]) => void; }; @@ -57,6 +57,9 @@ export function BomLibraryDomain({ isIntakeNonIntegratedDesignDepartmentUser(user)); if (activeBomLibrary === "materialLibrary" || activeBomLibrary === "finishLibrary") { + if (!materialLibraryDictionaries) { + throw new Error("板材与花色资料需要基础字典"); + } const visibleTab = activeBomLibrary === "materialLibrary" ? "substrate" : "finish"; return (
diff --git a/furniture-3d-system/src/app/intake/bom-library/EdgeBandingLibraryPanel.test.tsx b/furniture-3d-system/src/app/database/bom-library/EdgeBandingLibraryPanel.test.tsx similarity index 98% rename from furniture-3d-system/src/app/intake/bom-library/EdgeBandingLibraryPanel.test.tsx rename to furniture-3d-system/src/app/database/bom-library/EdgeBandingLibraryPanel.test.tsx index ec857af5..a13ce9e5 100644 --- a/furniture-3d-system/src/app/intake/bom-library/EdgeBandingLibraryPanel.test.tsx +++ b/furniture-3d-system/src/app/database/bom-library/EdgeBandingLibraryPanel.test.tsx @@ -1,6 +1,6 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import EdgeBandingLibraryPanel from '@/app/intake/bom-library/EdgeBandingLibraryPanel' +import EdgeBandingLibraryPanel from '@/app/database/bom-library/EdgeBandingLibraryPanel' import { createEdgeBandingLibraryItem } from '@/lib/edge-banding-library' const LEGACY_EDGE_BANDING_LIBRARY_STORAGE_KEY = diff --git a/furniture-3d-system/src/app/intake/bom-library/EdgeBandingLibraryPanel.tsx b/furniture-3d-system/src/app/database/bom-library/EdgeBandingLibraryPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/EdgeBandingLibraryPanel.tsx rename to furniture-3d-system/src/app/database/bom-library/EdgeBandingLibraryPanel.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/PackagingMaterialLibraryPanel.tsx b/furniture-3d-system/src/app/database/bom-library/PackagingMaterialLibraryPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/PackagingMaterialLibraryPanel.tsx rename to furniture-3d-system/src/app/database/bom-library/PackagingMaterialLibraryPanel.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/SteelFrameLibraryPanel.tsx b/furniture-3d-system/src/app/database/bom-library/SteelFrameLibraryPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/SteelFrameLibraryPanel.tsx rename to furniture-3d-system/src/app/database/bom-library/SteelFrameLibraryPanel.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryGlbPreview.tsx b/furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryGlbPreview.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryGlbPreview.tsx rename to furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryGlbPreview.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelCover.tsx b/furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelCover.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelCover.tsx rename to furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelCover.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelDetail.tsx b/furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelDetail.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelDetail.tsx rename to furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelDetail.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelEditor.tsx b/furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelEditor.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelEditor.tsx rename to furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelEditor.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelGallery.tsx b/furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelGallery.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelGallery.tsx rename to furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelGallery.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelLibrary.tsx b/furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelLibrary.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelLibrary.tsx rename to furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelLibrary.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelPhoto.tsx b/furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelPhoto.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelPhoto.tsx rename to furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelPhoto.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelWorkspace.tsx b/furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelWorkspace.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/AccessoryModelWorkspace.tsx rename to furniture-3d-system/src/app/database/bom-library/accessory-models/AccessoryModelWorkspace.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/CamPhotoChoices.tsx b/furniture-3d-system/src/app/database/bom-library/accessory-models/CamPhotoChoices.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/CamPhotoChoices.tsx rename to furniture-3d-system/src/app/database/bom-library/accessory-models/CamPhotoChoices.tsx diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/draft-client.ts b/furniture-3d-system/src/app/database/bom-library/accessory-models/draft-client.ts similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/draft-client.ts rename to furniture-3d-system/src/app/database/bom-library/accessory-models/draft-client.ts diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/generate-model.ts b/furniture-3d-system/src/app/database/bom-library/accessory-models/generate-model.ts similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/generate-model.ts rename to furniture-3d-system/src/app/database/bom-library/accessory-models/generate-model.ts diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/model-glb.ts b/furniture-3d-system/src/app/database/bom-library/accessory-models/model-glb.ts similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/model-glb.ts rename to furniture-3d-system/src/app/database/bom-library/accessory-models/model-glb.ts diff --git a/furniture-3d-system/src/app/intake/bom-library/accessory-models/render-model-cover.ts b/furniture-3d-system/src/app/database/bom-library/accessory-models/render-model-cover.ts similarity index 100% rename from furniture-3d-system/src/app/intake/bom-library/accessory-models/render-model-cover.ts rename to furniture-3d-system/src/app/database/bom-library/accessory-models/render-model-cover.ts diff --git a/furniture-3d-system/src/app/intake/bom-library/bomLibraryConfig.ts b/furniture-3d-system/src/app/database/bom-library/bomLibraryConfig.ts similarity index 89% rename from furniture-3d-system/src/app/intake/bom-library/bomLibraryConfig.ts rename to furniture-3d-system/src/app/database/bom-library/bomLibraryConfig.ts index 87e71102..dc613805 100644 --- a/furniture-3d-system/src/app/intake/bom-library/bomLibraryConfig.ts +++ b/furniture-3d-system/src/app/database/bom-library/bomLibraryConfig.ts @@ -1,13 +1,15 @@ -import type { BomLibraryKey } from "@/app/intake/bom-library/BomLibraryDomain"; +import type { BomLibraryKey } from "@/app/database/bom-library/BomLibraryDomain"; export const BOM_LIBRARY_OPTIONS: { key: BomLibraryKey; + slug: string; label: string; description: string; helper: string; }[] = [ { key: "materialLibrary", + slug: "boards", label: "板材资料库", description: "只展示板材基材,方便在产品资料 BOM 下维护板材本体资料。", @@ -16,6 +18,7 @@ export const BOM_LIBRARY_OPTIONS: { }, { key: "finishLibrary", + slug: "finishes", label: "花色资料库", description: "只展示饰面花色,方便在产品资料 BOM 下维护花色、贴图和参数。", @@ -24,6 +27,7 @@ export const BOM_LIBRARY_OPTIONS: { }, { key: "edgeBandingLibrary", + slug: "edge-banding", label: "封边资料库", description: "按板材厚度维护封边条,细节资料里的封边自动项会按对应厚度筛选并带出单价。", @@ -32,6 +36,7 @@ export const BOM_LIBRARY_OPTIONS: { }, { key: "steelFrameLibrary", + slug: "steel-frames", label: "钢架资料库", description: "不再预置系统钢架规格,只保留每吨钢价与人工新建规格,系统会自动重算重量、支数和每米单价。", @@ -40,6 +45,7 @@ export const BOM_LIBRARY_OPTIONS: { }, { key: "packagingLibrary", + slug: "accessories", label: "配件资料库", description: "产品资料下独立维护的配件资料区,按新的业务口径重新配置,不复用原包材资料逻辑。", @@ -47,6 +53,7 @@ export const BOM_LIBRARY_OPTIONS: { }, { key: "packagingMaterialLibrary", + slug: "packaging-materials", label: "包材资料库", description: "产品资料下独立维护的包材资料区,沿用和配件资料库相同的字母分组逻辑,但单独保存数据。", diff --git a/furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryDomain.tsx b/furniture-3d-system/src/app/database/raw-material-library/RawMaterialLibraryDomain.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryDomain.tsx rename to furniture-3d-system/src/app/database/raw-material-library/RawMaterialLibraryDomain.tsx diff --git a/furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryPanel.tsx b/furniture-3d-system/src/app/database/raw-material-library/RawMaterialLibraryPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryPanel.tsx rename to furniture-3d-system/src/app/database/raw-material-library/RawMaterialLibraryPanel.tsx diff --git a/furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryWorkspaceContent.tsx b/furniture-3d-system/src/app/database/raw-material-library/RawMaterialLibraryWorkspaceContent.tsx similarity index 88% rename from furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryWorkspaceContent.tsx rename to furniture-3d-system/src/app/database/raw-material-library/RawMaterialLibraryWorkspaceContent.tsx index bafd47a4..fe1c25bb 100644 --- a/furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryWorkspaceContent.tsx +++ b/furniture-3d-system/src/app/database/raw-material-library/RawMaterialLibraryWorkspaceContent.tsx @@ -1,7 +1,7 @@ "use client"; import type { IntakeWorkspaceTab } from "@/app/intake/intakeWorkspaceTypes"; -import { RawMaterialLibraryDomain } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; +import { RawMaterialLibraryDomain } from "@/app/database/raw-material-library/RawMaterialLibraryDomain"; type RawMaterialLibraryWorkspaceTab = Extract< IntakeWorkspaceTab, diff --git a/furniture-3d-system/src/app/intake/raw-material-library/rawMaterialLibraryConfig.ts b/furniture-3d-system/src/app/database/raw-material-library/rawMaterialLibraryConfig.ts similarity index 66% rename from furniture-3d-system/src/app/intake/raw-material-library/rawMaterialLibraryConfig.ts rename to furniture-3d-system/src/app/database/raw-material-library/rawMaterialLibraryConfig.ts index ec521c57..8bc3dd6e 100644 --- a/furniture-3d-system/src/app/intake/raw-material-library/rawMaterialLibraryConfig.ts +++ b/furniture-3d-system/src/app/database/raw-material-library/rawMaterialLibraryConfig.ts @@ -1,17 +1,20 @@ -import type { RawMaterialLibraryKey } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; +import type { RawMaterialLibraryKey } from "@/app/database/raw-material-library/RawMaterialLibraryDomain"; export const RAW_MATERIAL_LIBRARY_OPTIONS: { key: RawMaterialLibraryKey; + slug: string; label: string; description: string; }[] = [ { key: "processConfig", + slug: "material-processes", label: "材质工艺配置", description: "表格类信息和工艺规则占位", }, { key: "detailArchive", + slug: "material-archive", label: "材质详情档案", description: "材质百科式详情页占位", }, diff --git a/furniture-3d-system/src/app/intake/IntakeActiveWorkspaceContent.tsx b/furniture-3d-system/src/app/intake/IntakeActiveWorkspaceContent.tsx index 5df4132e..e7bf06c5 100644 --- a/furniture-3d-system/src/app/intake/IntakeActiveWorkspaceContent.tsx +++ b/furniture-3d-system/src/app/intake/IntakeActiveWorkspaceContent.tsx @@ -3,10 +3,6 @@ import { type ReactNode } from "react"; import { BarcodePrintWorkspace } from "@/app/intake/barcode-print/BarcodePrintWorkspace"; import { BrandFilingWorkspace } from "@/app/intake/brand-filing/BrandFilingWorkspace"; -import { - BomLibraryWorkspaceContent, - isBomLibraryWorkspaceTab, -} from "@/app/intake/bom-library/BomLibraryWorkspaceContent"; import type { IntakeEntryTab, IntakeWorkspaceTab, @@ -32,11 +28,7 @@ import { import { isRawMaterialLibraryWorkspaceTab, RawMaterialLibraryWorkspaceContent, -} from "@/app/intake/raw-material-library/RawMaterialLibraryWorkspaceContent"; -import { - isReferenceEstimatorWorkspaceTab, - ReferenceEstimatorWorkspaceContent, -} from "@/app/intake/reference-estimator/ReferenceEstimatorWorkspaceContent"; +} from "@/app/database/raw-material-library/RawMaterialLibraryWorkspaceContent"; import { WorkRecordWorkspace } from "@/app/intake/work-record/WorkRecordWorkspace"; import { WorkRecordMonthlyArchiveWorkspace } from "@/app/intake/work-record/WorkRecordMonthlyArchiveWorkspace"; import { WorkRecordMonthlyArchiveDetailWorkspace } from "@/app/intake/work-record/WorkRecordMonthlyArchiveDetailWorkspace"; @@ -47,10 +39,7 @@ import { canManageWorkRecordScores, } from "@/app/intake/work-record/workRecordPermissions"; import type { - MaterialCategoryDTO, MaterialDTO, - SubstrateDictionaryBundleDTO, - SubstrateDTO, } from "@/server/services"; type IntakeWorkspaceUser = { @@ -69,7 +58,6 @@ type IntakeActiveWorkspaceContentProps = { fallback: ReactNode; currentUser: IntakeWorkspaceUser; canManageSpuRuleLibrary: boolean; - canEditBomLibrary: boolean; canViewWorkRecordArchives: boolean; canEditWorkRecordArchives: boolean; canDownloadWorkRecordArchives: boolean; @@ -83,10 +71,7 @@ type IntakeActiveWorkspaceContentProps = { existingSeriesNames: string[]; existingSeriesComponentDetailNames: string[]; seriesDraftSkuOptions: WorkbenchSku[]; - materialLibrarySubstrates: SubstrateDTO[]; materialLibraryFinishes: MaterialDTO[]; - materialLibraryCategories: MaterialCategoryDTO[]; - materialLibraryDictionaries: SubstrateDictionaryBundleDTO; selectedRawMaterialName?: string; nonIntegratedProducts: NonIntegratedProductRecord[]; productDevelopmentProgressProducts: NonIntegratedProductRecord[]; @@ -106,7 +91,6 @@ type IntakeActiveWorkspaceContentProps = { entryTabOverride?: IntakeEntryTab, ) => void; onCloseNewProductWorkspace: (tabId: string) => void; - onMaterialLibraryFinishesChange: (finishes: MaterialDTO[]) => void; onOpenWorkRecordArchiveDetailWorkspace: (monthKey: string, label?: string) => void; }; @@ -115,7 +99,6 @@ export function IntakeActiveWorkspaceContent({ fallback, currentUser, canManageSpuRuleLibrary, - canEditBomLibrary, canViewWorkRecordArchives, canEditWorkRecordArchives, canDownloadWorkRecordArchives, @@ -129,10 +112,7 @@ export function IntakeActiveWorkspaceContent({ existingSeriesNames, existingSeriesComponentDetailNames, seriesDraftSkuOptions, - materialLibrarySubstrates, materialLibraryFinishes, - materialLibraryCategories, - materialLibraryDictionaries, selectedRawMaterialName, nonIntegratedProducts, productDevelopmentProgressProducts, @@ -144,7 +124,6 @@ export function IntakeActiveWorkspaceContent({ onOpenRawMaterialProcessConfig, onActivatePendingEntryListWorkspace, onCloseNewProductWorkspace, - onMaterialLibraryFinishesChange, onOpenWorkRecordArchiveDetailWorkspace, }: IntakeActiveWorkspaceContentProps) { if (!activeWorkspaceTab) return <>{fallback}; @@ -180,21 +159,6 @@ export function IntakeActiveWorkspaceContent({ ); } - if (isBomLibraryWorkspaceTab(activeWorkspaceTab)) { - return ( - - ); - } - if (isRawMaterialLibraryWorkspaceTab(activeWorkspaceTab)) { return ( - ); - } - if (isProductPatentWorkspaceTab(activeWorkspaceTab)) { return ( ({ + usePathname: () => '/intake', useRouter: () => ({ push }), })) @@ -93,32 +94,6 @@ jest.mock('@/components/platform/AccordionSection', () => ({ ), })) -jest.mock('@/app/asset-center/material-library/MaterialLibraryClient', () => ({ - __esModule: true, - default: ({ - initialActiveTab, - visibleTabs, - canEditOverride, - }: { - initialActiveTab?: string - visibleTabs?: string[] - canEditOverride?: boolean - }) => ( -
- material-library-copy - - {initialActiveTab ?? 'finish'} - - - {(visibleTabs ?? []).join(',')} - - - {String(canEditOverride)} - -
- ), -})) - jest.mock('./non-integrated/NonIntegratedDetailClient', () => ({ __esModule: true, default: ({ @@ -284,15 +259,13 @@ function renderSelector(props?: { initialActiveSection?: | 'pending' | 'progress' - | 'bom' | 'rawMaterialLibrary' - | 'referenceEstimator' | 'patents' | null initialActiveRawMaterialLibrary?: 'processConfig' | 'detailArchive' initialRawMaterialName?: string initialNodePermissionOverrides?: IntakeNodePermissionOverrideMap - materialLibrarySubstrates?: Array> + initialSeriesNameOptions?: string[] initialOpenProductWorkspace?: { product: Record @@ -342,22 +315,13 @@ function renderSelector(props?: { eligibleSkuList={props?.eligibleSkuList as never} draftGroupId={null} hasIneligibleSelected={false} - materialLibrarySubstrates={ - (props?.materialLibrarySubstrates as never) ?? [] - } materialLibraryFinishes={[] as never} - materialLibraryCategories={[] as never} - materialLibraryDictionaries={ - { - categories: [], - environmentGrades: [], - thicknessSpecs: [], - surfaceOptions: [], - } as never - } initialNonIntegratedProducts={ (props?.initialNonIntegratedProducts as never) ?? [] } + initialProductDevelopmentProgressProducts={ + (props?.initialNonIntegratedProducts as never) ?? [] + } initialActiveSection={props?.initialActiveSection} initialActiveRawMaterialLibrary={props?.initialActiveRawMaterialLibrary} initialRawMaterialName={props?.initialRawMaterialName} @@ -387,18 +351,9 @@ function renderSelectorWithInitialCreateWorkspace() { eligibleSkuList={[] as never} draftGroupId={null} hasIneligibleSelected={false} - materialLibrarySubstrates={[] as never} materialLibraryFinishes={[] as never} - materialLibraryCategories={[] as never} - materialLibraryDictionaries={ - { - categories: [], - environmentGrades: [], - thicknessSpecs: [], - surfaceOptions: [], - } as never - } initialNonIntegratedProducts={[] as never} + initialProductDevelopmentProgressProducts={[]} initialOpenNewNonIntegratedProduct />, ) @@ -449,18 +404,9 @@ function renderEditor() { locations={[] as never} categories={[] as never} defaultAttachProductId={null} - materialLibrarySubstrates={[] as never} materialLibraryFinishes={[] as never} - materialLibraryCategories={[] as never} - materialLibraryDictionaries={ - { - categories: [], - environmentGrades: [], - thicknessSpecs: [], - surfaceOptions: [], - } as never - } initialNonIntegratedProducts={[] as never} + initialProductDevelopmentProgressProducts={[]} />, ) } @@ -587,30 +533,6 @@ function createApprovedWorkflowStateBefore(targetCategory: string) { } } -function mockFileReaderDataUrl( - resultDataUrl = 'data:image/png;base64,reference-image', -) { - class MockFileReader { - result = resultDataUrl - onload: (() => void) | null = null - - readAsDataURL() { - this.onload?.() - } - } - - Object.defineProperty(globalThis, 'FileReader', { - configurable: true, - writable: true, - value: MockFileReader, - }) - Object.defineProperty(window, 'FileReader', { - configurable: true, - writable: true, - value: MockFileReader, - }) -} - describe('IntakeClient', () => { beforeEach(() => { cleanup() @@ -638,18 +560,7 @@ describe('IntakeClient', () => { const rightPanel = screen.getByTestId('right-panel') expect(within(rightPanel).getByRole('button', { name: '产品开发' })).toBeInTheDocument() expect(within(rightPanel).getByRole('button', { name: /产品开发进度/ })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: 'BOM资料库' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '原材料资料库' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '板材资料库' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '花色资料库' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '钢架资料库' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '配件资料库' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '包材资料库' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '材质工艺配置' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '材质详情档案' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '预估成本测算' })).toBeInTheDocument() - await actor.click(within(rightPanel).getByRole('button', { name: '预估成本测算' })) - expect(within(rightPanel).getByRole('button', { name: '参考图预估成本' })).toBeInTheDocument() + expect(within(rightPanel).queryByRole('button', { name: /^(BOM资料库|原材料资料库|预估成本测算)$/ })).not.toBeInTheDocument() expect(within(rightPanel).getByRole('button', { name: '产品专利' })).toBeInTheDocument() await actor.click(within(rightPanel).getByRole('button', { name: '产品专利' })) expect(within(rightPanel).getByRole('button', { name: '产品专利明细' })).toBeInTheDocument() @@ -1802,65 +1713,6 @@ describe('IntakeClient', () => { expect(within(leftPanel).queryByText('GBGJ-SZ0230')).not.toBeInTheDocument() }) - it('splits board and finish material libraries while keeping packaging library config', async () => { - const actor = userEvent.setup() - renderSelector({ eligibleSkuList: [] }) - - const rightPanel = screen.getByTestId('right-panel') - - await actor.click(within(rightPanel).getByRole('button', { name: 'BOM资料库' })) - - expect(screen.getByText('material-library-copy')).toBeInTheDocument() - expect(screen.getByTestId('material-library-active-tab')).toHaveTextContent('substrate') - expect(screen.getByTestId('material-library-visible-tabs')).toHaveTextContent('substrate') - - await actor.click(within(rightPanel).getByRole('button', { name: '花色资料库' })) - - expect(screen.getByText('material-library-copy')).toBeInTheDocument() - expect(screen.getByTestId('material-library-active-tab')).toHaveTextContent('finish') - expect(screen.getByTestId('material-library-visible-tabs')).toHaveTextContent('finish') - - await actor.click(within(rightPanel).getByRole('button', { name: '包材资料库' })) - - expect(screen.getByLabelText('包材编号')).toBeInTheDocument() - expect(screen.getByLabelText('包材名称')).toBeInTheDocument() - expect(screen.getByRole('button', { name: '查询' })).toBeInTheDocument() - }) - - it('opens raw material library entries as workspace tabs', async () => { - const actor = userEvent.setup() - renderSelector({ eligibleSkuList: [] }) - - const rightPanel = screen.getByTestId('right-panel') - await actor.click( - within(rightPanel).getByRole('button', { name: '原材料资料库' }), - ) - - await actor.click(within(rightPanel).getByRole('button', { name: '材质工艺配置' })) - - expect(screen.getByRole('tab', { name: '材质工艺配置' })).toHaveAttribute( - 'aria-selected', - 'true', - ) - - const leftPanel = screen.getByTestId('left-panel') - expect( - within(leftPanel).getByRole('heading', { name: '材质工艺配置' }), - ).toBeInTheDocument() - expect(within(leftPanel).getByText('主流木材等级')).toBeInTheDocument() - expect(within(leftPanel).getByText('生长树龄')).toBeInTheDocument() - expect(within(leftPanel).getByText('图片占位')).toBeInTheDocument() - - await actor.click(within(rightPanel).getByRole('button', { name: '材质详情档案' })) - - expect(screen.getByRole('tab', { name: '材质详情档案' })).toHaveAttribute( - 'aria-selected', - 'true', - ) - expect(within(leftPanel).getByText('材质名称列表')).toBeInTheDocument() - expect(within(leftPanel).getByText(/材质详情档案占位已预留/)).toBeInTheDocument() - }) - it('opens raw material process config with the material name from query state', () => { renderSelector({ eligibleSkuList: [], @@ -1904,201 +1756,6 @@ describe('IntakeClient', () => { expect(within(leftPanel).getByText('后续这里会按该材质定位工艺资料。')).toBeInTheDocument() }) - it('estimates board material cost from reference image recognition', async () => { - const actor = userEvent.setup() - const referenceImageEstimatePayload = { - success: true, - data: { - boardPieces: [ - { label: '柜体侧板', lengthMm: 1060, widthMm: 240, quantity: 2 }, - { label: '层板/顶底板', lengthMm: 730, widthMm: 240, quantity: 4 }, - { label: '前后拉板', lengthMm: 730, widthMm: 50, quantity: 2 }, - { label: '三合板背板', lengthMm: 1060, widthMm: 830, quantity: 1 }, - ], - hardwareItems: [{ id: 'wrench', name: '扳手', quantity: 1 }], - summary: '图片识别完成', - }, - } - let resolveReferenceImageEstimateJson: - | ((value: typeof referenceImageEstimatePayload) => void) - | null = null - const referenceImageEstimateJson = jest.fn( - () => - new Promise((resolve) => { - resolveReferenceImageEstimateJson = resolve - }), - ) - const fetchMock = jest.fn().mockResolvedValue({ - ok: true, - json: referenceImageEstimateJson, - } as Response) - Object.defineProperty(global, 'fetch', { - value: fetchMock, - configurable: true, - writable: true, - }) - mockFileReaderDataUrl() - - renderSelector({ - eligibleSkuList: [], - materialLibrarySubstrates: [ - { - id: 'substrate-1', - code: 'BC-0001', - name: '15密度板', - description: null, - systemNameOptionId: null, - systemNameOptionName: null, - categoryId: 'category-density', - categoryName: '密度板', - environmentGradeId: 'env-enf', - environmentGradeName: 'ENF', - thicknessSpecId: 'thickness-15', - thicknessSpecName: '15mm', - thicknessMm: 15, - sheetLengthMm: 1000, - sheetWidthMm: 1000, - surfaceOptionId: 'surface-double', - surfaceOptionName: '双贴', - suggestedPrice: 100, - weightKg: 20, - finishes: [{ id: 'finish-black', name: '炭黑色' }], - metadata: { systemName: '15密度板' }, - isActive: true, - createdAt: new Date('2026-04-29T00:00:00.000Z'), - updatedAt: new Date('2026-04-29T00:00:00.000Z'), - }, - { - id: 'substrate-plywood', - code: 'BC-0002', - name: '三合板', - description: null, - systemNameOptionId: null, - systemNameOptionName: null, - categoryId: 'category-plywood', - categoryName: '三合板', - environmentGradeId: 'env-enf', - environmentGradeName: 'ENF', - thicknessSpecId: 'thickness-3', - thicknessSpecName: '3mm', - thicknessMm: 3, - sheetLengthMm: 1000, - sheetWidthMm: 1000, - surfaceOptionId: 'surface-double', - surfaceOptionName: '双贴', - suggestedPrice: 60, - weightKg: 8, - finishes: [{ id: 'finish-black', name: '炭黑色' }], - metadata: { systemName: '三合板' }, - isActive: true, - createdAt: new Date('2026-04-29T00:00:00.000Z'), - updatedAt: new Date('2026-04-29T00:00:00.000Z'), - }, - ], - }) - - const rightPanel = screen.getByTestId('right-panel') - expect( - within(rightPanel).getByRole('button', { name: '预估成本测算' }), - ).toBeInTheDocument() - await actor.click(within(rightPanel).getByRole('button', { name: '预估成本测算' })) - await actor.click( - within(rightPanel).getByRole('button', { name: '参考图预估成本' }), - ) - - expect(screen.getByRole('tab', { name: '参考图预估成本' })).toHaveAttribute( - 'aria-selected', - 'true', - ) - expect(screen.getByRole('heading', { name: '参考图预估成本' })).toBeInTheDocument() - - await actor.type( - screen.getByLabelText('图片补充'), - '高106 宽83 深24,15mm侧板,4层', - ) - await actor.upload( - screen.getByLabelText('上传参考图'), - new File(['reference-image'], 'cabinet.png', { type: 'image/png' }), - ) - - await waitFor( - () => { - expect(fetchMock).toHaveBeenCalledWith( - '/api/intake/reference-image-estimate', - expect.objectContaining({ method: 'POST' }), - ) - }, - { timeout: 5000 }, - ) - await waitFor(() => { - expect(referenceImageEstimateJson).toHaveBeenCalled() - }) - await act(async () => { - resolveReferenceImageEstimateJson?.(referenceImageEstimatePayload) - await Promise.resolve() - await Promise.resolve() - }) - expect(fetchMock).toHaveBeenCalledTimes(1) - await waitFor( - () => { - expect(screen.queryByText('图片识别中...')).not.toBeInTheDocument() - }, - { timeout: 5000 }, - ) - - expect(screen.getByRole('heading', { name: '样包模板明细' })).toBeInTheDocument() - expect(screen.getByText('分类')).toBeInTheDocument() - expect(screen.getByText('封边米数')).toBeInTheDocument() - expect( - await screen.findByText('图片识别:柜体侧板', undefined, { - timeout: 5000, - }), - ).toBeInTheDocument() - expect(screen.getByText('图片识别:层板/顶底板')).toBeInTheDocument() - expect(screen.getByText('图片识别:前后拉板')).toBeInTheDocument() - expect(screen.getByText('图片识别:三合板背板')).toBeInTheDocument() - expect(screen.getAllByText('1060').length).toBeGreaterThanOrEqual(1) - expect(screen.getAllByText('800').length).toBeGreaterThanOrEqual(1) - expect(screen.getAllByText('810').length).toBeGreaterThanOrEqual(1) - expect(screen.getAllByText('260').length).toBeGreaterThanOrEqual(1) - expect(screen.getAllByText('15密度板 炭黑色 双贴').length).toBeGreaterThanOrEqual(1) - expect(screen.getByText('同色的三合板')).toBeInTheDocument() - expect(screen.getByText('封边+胶水')).toBeInTheDocument() - expect(screen.getByLabelText('板材厚度')).toBeInTheDocument() - expect(screen.getByLabelText('大板价格')).toBeInTheDocument() - expect(screen.getByLabelText('系数')).toHaveValue('1.05') - expect(screen.queryByLabelText('五金参考')).not.toBeInTheDocument() - expect(screen.getAllByText('五金').length).toBeGreaterThanOrEqual(1) - expect(screen.getByText('偏心杆+偏心轮')).toBeInTheDocument() - expect(screen.getByText('半铁层板托')).toBeInTheDocument() - expect(screen.getByText('5*40自攻丝')).toBeInTheDocument() - expect(screen.getByText('扳手')).toBeInTheDocument() - expect(screen.getAllByText('包材').length).toBeGreaterThanOrEqual(1) - expect(screen.getByText('外箱纸箱')).toBeInTheDocument() - expect(screen.getByText('PE防尘袋')).toBeInTheDocument() - expect(screen.getByText('1120')).toBeInTheDocument() - expect(screen.getByText('320')).toBeInTheDocument() - expect(screen.getByText(/箱高约182mm/)).toBeInTheDocument() - expect(screen.getAllByText('配件').length).toBeGreaterThanOrEqual(1) - expect(screen.getByText('说明书')).toBeInTheDocument() - expect(screen.getAllByText('小计').length).toBeGreaterThanOrEqual(5) - expect(screen.getAllByText('0.26').length).toBeGreaterThanOrEqual(1) - expect(fetchMock).toHaveBeenCalledWith( - '/api/intake/reference-image-estimate', - expect.objectContaining({ - method: 'POST', - body: expect.stringContaining('高106 宽83 深24'), - }), - ) - - await actor.type(screen.getByLabelText('大板价格'), '120') - - await actor.type(screen.getByLabelText('板材厚度'), '15松木') - - expect(screen.getAllByText('15松木').length).toBeGreaterThanOrEqual(1) - expect(screen.getByText('同色的三合板')).toBeInTheDocument() - }, 10000) - it('defaults to the non-integrated intake view with the pending section expanded', () => { renderSelector({ eligibleSkuList: [] }) @@ -2150,8 +1807,7 @@ describe('IntakeClient', () => { expect(within(workspacePanel).queryByRole('button', { name: '新增部件' })).not.toBeInTheDocument() }) - it('keeps BOM libraries visible but read-only entry points hidden from purchasing users', async () => { - const actor = userEvent.setup() + it('keeps product development available to purchasing users', () => { renderSelector({ eligibleSkuList: [], @@ -2167,45 +1823,9 @@ describe('IntakeClient', () => { const rightPanel = screen.getByTestId('right-panel') expect(within(rightPanel).getByRole('button', { name: '产品开发明细' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: 'BOM资料库' })).toBeInTheDocument() expect(within(rightPanel).queryByRole('button', { name: '产品专利' })).not.toBeInTheDocument() expect(screen.queryByRole('button', { name: '新增产品' })).not.toBeInTheDocument() - await actor.click(within(rightPanel).getByRole('button', { name: 'BOM资料库' })) - expect(screen.getByText('material-library-copy')).toBeInTheDocument() - expect(screen.getByTestId('material-library-active-tab')).toHaveTextContent('substrate') - }) - - it('keeps BOM library editing enabled for admins', async () => { - const actor = userEvent.setup() - - renderSelector({ - eligibleSkuList: [], - userRole: 'ADMIN', - userBusinessRoles: ['PURCHASING'], - }) - - const rightPanel = screen.getByTestId('right-panel') - await actor.click(within(rightPanel).getByRole('button', { name: /BOM/ })) - - expect(screen.getByText('material-library-copy')).toBeInTheDocument() - expect(screen.getByTestId('material-library-can-edit')).toHaveTextContent('true') - }) - - it('keeps BOM library editing enabled for designers', async () => { - const actor = userEvent.setup() - - renderSelector({ - eligibleSkuList: [], - userRole: 'USER', - userBusinessRoles: ['DESIGN'], - }) - - const rightPanel = screen.getByTestId('right-panel') - await actor.click(within(rightPanel).getByRole('button', { name: /BOM/ })) - - expect(screen.getByText('material-library-copy')).toBeInTheDocument() - expect(screen.getByTestId('material-library-can-edit')).toHaveTextContent('true') }) it('opens the series development list with the same product detail capabilities', async () => { @@ -2986,7 +2606,7 @@ describe('IntakeClient', () => { ) }) - it('opens non-integrated products and BOM libraries as workspace tabs', async () => { + it('opens non-integrated products as workspace tabs', async () => { const actor = userEvent.setup() replaceNonIntegratedProducts([createNonIntegratedProduct()]) @@ -3014,25 +2634,6 @@ describe('IntakeClient', () => { expect(screen.getByRole('button', { name: '打开DNZ0001工作页' })).toBeInTheDocument() expect(within(rightPanel).getByRole('button', { name: '产品开发明细' })).toBeInTheDocument() - await actor.click(within(rightPanel).getByRole('button', { name: '板材资料库' })) - - expect(screen.getByRole('tab', { name: '板材资料库' })).toBeInTheDocument() - expect(screen.getByText('material-library-copy')).toBeInTheDocument() - expect(screen.getByTestId('material-library-active-tab')).toHaveTextContent('substrate') - - await actor.click(screen.getByRole('button', { name: '关闭板材资料库' })) - - expect(screen.queryByRole('tab', { name: '板材资料库' })).not.toBeInTheDocument() - expect(screen.getByRole('tab', { name: 'DNZ0001产品开发明细' })).toHaveAttribute( - 'aria-selected', - 'true', - ) - - await actor.click(screen.getByRole('tab', { name: '产品开发明细' })) - - expect(screen.getByRole('button', { name: '打开DNZ0001工作页' })).toBeInTheDocument() - expect(within(rightPanel).getByRole('button', { name: '产品开发明细' })).toBeInTheDocument() - await actor.click(screen.getByRole('button', { name: '关闭产品开发明细' })) expect(screen.queryByRole('tab', { name: '产品开发明细' })).not.toBeInTheDocument() @@ -4033,9 +3634,6 @@ describe('IntakeClient', () => { expect( within(rightPanel).getByRole('button', { name: 'SPU规则库' }), ).toBeInTheDocument() - expect( - within(rightPanel).getByRole('button', { name: 'BOM资料库' }), - ).toBeInTheDocument() }) it('does not restore removed node permission or admin-only workspaces for ordinary users', async () => { diff --git a/furniture-3d-system/src/app/intake/IntakePrimaryDomainContent.tsx b/furniture-3d-system/src/app/intake/IntakePrimaryDomainContent.tsx index 808a8601..7ec7b0e7 100644 --- a/furniture-3d-system/src/app/intake/IntakePrimaryDomainContent.tsx +++ b/furniture-3d-system/src/app/intake/IntakePrimaryDomainContent.tsx @@ -3,12 +3,10 @@ import type { ComponentProps, ReactNode } from "react"; import { BarcodePrintDomain } from "@/app/intake/barcode-print/BarcodePrintDomain"; import { BrandFilingDomain } from "@/app/intake/brand-filing/BrandFilingDomain"; -import { BomLibraryDomain } from "@/app/intake/bom-library/BomLibraryDomain"; import type { IntakeSection } from "@/app/intake/intakeWorkspaceTypes"; import { ProductDevelopmentDomain } from "@/app/intake/product-development/ProductDevelopmentDomain"; import { ProductPatentDashboard } from "@/app/intake/product-patent/ProductPatentDomain"; -import { RawMaterialLibraryDomain } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; -import { ReferenceEstimatorDomain } from "@/app/intake/reference-estimator/ReferenceEstimatorDomain"; +import { RawMaterialLibraryDomain } from "@/app/database/raw-material-library/RawMaterialLibraryDomain"; type ProductDevelopmentDomainProps = ComponentProps< typeof ProductDevelopmentDomain @@ -18,12 +16,8 @@ export type IntakePrimaryDomainContentProps = { activeSection: IntakeSection; fallback: ReactNode; productDevelopment: Omit; - canViewBomLibrary: boolean; - bomLibrary: ComponentProps; canViewRawMaterialLibrary: boolean; rawMaterialLibrary: ComponentProps; - canViewReferenceEstimator: boolean; - referenceEstimator: ComponentProps; canViewProductPatentLedger: boolean; productPatent: ComponentProps; canViewBarcodePrint: boolean; @@ -35,12 +29,8 @@ export function IntakePrimaryDomainContent({ activeSection, fallback, productDevelopment, - canViewBomLibrary, - bomLibrary, canViewRawMaterialLibrary, rawMaterialLibrary, - canViewReferenceEstimator, - referenceEstimator, canViewProductPatentLedger, productPatent, canViewBarcodePrint, @@ -56,18 +46,10 @@ export function IntakePrimaryDomainContent({ ); } - if (activeSection === "bom" && canViewBomLibrary) { - return ; - } - if (activeSection === "rawMaterialLibrary" && canViewRawMaterialLibrary) { return ; } - if (activeSection === "referenceEstimator" && canViewReferenceEstimator) { - return ; - } - if (activeSection === "patents" && canViewProductPatentLedger) { return ; } diff --git a/furniture-3d-system/src/app/intake/IntakeWorkspaceContentPanel.tsx b/furniture-3d-system/src/app/intake/IntakeWorkspaceContentPanel.tsx index 10713e90..759902d4 100644 --- a/furniture-3d-system/src/app/intake/IntakeWorkspaceContentPanel.tsx +++ b/furniture-3d-system/src/app/intake/IntakeWorkspaceContentPanel.tsx @@ -9,6 +9,7 @@ export type IntakeWorkspaceContentPanelProps = Omit< "fallback" > & { tabs: Array<{ id: string; label: string }>; + tabsReady: boolean; activeTabId: string | null; mainContent: ReactNode; onActivate: (tabId: string) => void; @@ -17,6 +18,7 @@ export type IntakeWorkspaceContentPanelProps = Omit< export function IntakeWorkspaceContentPanel({ tabs, + tabsReady, activeTabId, mainContent, onActivate, @@ -26,6 +28,7 @@ export function IntakeWorkspaceContentPanel({ return ( ) => void; - onBomLibraryChange: (library: BomLibraryKey) => void; -}) { - if (!canViewBomLibrary) return null; - - return ( - - } - expanded={activeSection === "bom"} - onToggle={() => onToggle("bom")} - > -
- {BOM_LIBRARY_OPTIONS.map((option) => ( - - ))} -
-
- ); -} diff --git a/furniture-3d-system/src/app/intake/bom-library/BomLibraryWorkspaceContent.tsx b/furniture-3d-system/src/app/intake/bom-library/BomLibraryWorkspaceContent.tsx deleted file mode 100644 index 2bb66ac0..00000000 --- a/furniture-3d-system/src/app/intake/bom-library/BomLibraryWorkspaceContent.tsx +++ /dev/null @@ -1,58 +0,0 @@ -"use client"; - -import { BomLibraryDomain } from "@/app/intake/bom-library/BomLibraryDomain"; -import type { IntakeWorkspaceTab } from "@/app/intake/intakeWorkspaceTypes"; -import type { - MaterialCategoryDTO, - MaterialDTO, - SubstrateDictionaryBundleDTO, - SubstrateDTO, -} from "@/server/services"; - -type BomLibraryWorkspaceTab = Extract; - -type BomLibraryWorkspaceUser = { - role?: string; - businessRoles?: string[] | null; - department?: { name?: string | null; fullPath?: string | null } | null; - departmentPaths?: string[] | null; -}; - -export function isBomLibraryWorkspaceTab( - tab: IntakeWorkspaceTab, -): tab is BomLibraryWorkspaceTab { - return tab.kind === "bomLibrary"; -} - -export function BomLibraryWorkspaceContent({ - activeWorkspaceTab, - currentUser, - canEditBomLibrary, - materialLibrarySubstrates, - materialLibraryFinishes, - materialLibraryCategories, - materialLibraryDictionaries, - onMaterialLibraryFinishesChange, -}: { - activeWorkspaceTab: BomLibraryWorkspaceTab; - currentUser: BomLibraryWorkspaceUser; - canEditBomLibrary: boolean; - materialLibrarySubstrates: SubstrateDTO[]; - materialLibraryFinishes: MaterialDTO[]; - materialLibraryCategories: MaterialCategoryDTO[]; - materialLibraryDictionaries: SubstrateDictionaryBundleDTO; - onMaterialLibraryFinishesChange: (finishes: MaterialDTO[]) => void; -}) { - return ( - - ); -} diff --git a/furniture-3d-system/src/app/intake/components/FormalIntakeWorkbench.navigation.test.tsx b/furniture-3d-system/src/app/intake/components/FormalIntakeWorkbench.navigation.test.tsx index add130c3..b14c4dfe 100644 --- a/furniture-3d-system/src/app/intake/components/FormalIntakeWorkbench.navigation.test.tsx +++ b/furniture-3d-system/src/app/intake/components/FormalIntakeWorkbench.navigation.test.tsx @@ -15,11 +15,6 @@ describe('FormalIntakeWorkbench navigation source', () => { pendingEntryTab="nonIntegrated" onPendingEntryTabChange={noop} onOpenProgressDashboard={noop} - activeBomLibrary="materialLibrary" - onBomLibraryChange={noop} - activeRawMaterialLibrary="processConfig" - onOpenRawMaterialLibraryWorkspace={noop} - onOpenReferenceEstimatorWorkspace={noop} onOpenProductPatents={noop} onOpenProductPatentLedger={noop} onOpenProductPatentDashboard={noop} @@ -32,20 +27,19 @@ describe('FormalIntakeWorkbench navigation source', () => { canViewSeriesDevelopmentList canViewProductProgressDashboard canViewStockDevelopmentList - canViewBomLibrary - canViewRawMaterialLibrary - canViewReferenceEstimator canViewProductPatentLedger canViewProductPatentDashboard canViewBarcodePrint canViewBrandFiling - canViewWorkRecord={false} - canViewWorkRecordArchives={false} + canViewWorkRecord + canViewWorkRecordArchives />, ) PRODUCT_RECORDS_NAV_ITEMS.forEach((item) => { expect(screen.getByText(item.label)).toBeInTheDocument() }) + expect(screen.queryByRole('button', { name: /^(BOM资料库|原材料资料库|预估成本测算)$/ })) + .not.toBeInTheDocument() }) }) diff --git a/furniture-3d-system/src/app/intake/components/FormalIntakeWorkbench.tsx b/furniture-3d-system/src/app/intake/components/FormalIntakeWorkbench.tsx index 2cf11eba..e2be567b 100644 --- a/furniture-3d-system/src/app/intake/components/FormalIntakeWorkbench.tsx +++ b/furniture-3d-system/src/app/intake/components/FormalIntakeWorkbench.tsx @@ -4,18 +4,13 @@ import { useEffect, useRef } from "react"; import { BarcodePrintWorkbenchButton } from "@/app/intake/barcode-print/BarcodePrintWorkbenchButton"; import { BrandFilingWorkbenchSection } from "@/app/intake/brand-filing/BrandFilingWorkbenchSection"; import type { BrandFilingBrand } from "@/app/intake/brand-filing/brandFilingConfig"; -import { BomLibraryWorkbenchSection } from "@/app/intake/bom-library/BomLibraryWorkbenchSection"; import type { IntakeEntryTab, IntakeSection, IntakeWorkspaceTab, } from "@/app/intake/intakeWorkspaceTypes"; -import type { BomLibraryKey } from "@/app/intake/bom-library/BomLibraryDomain"; import { ProductDevelopmentWorkbenchSection } from "@/app/intake/product-development/ProductDevelopmentWorkbenchSection"; import { ProductPatentWorkbenchSection } from "@/app/intake/product-patent/ProductPatentWorkbenchSection"; -import type { RawMaterialLibraryKey } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; -import { RawMaterialLibraryWorkbenchSection } from "@/app/intake/raw-material-library/RawMaterialLibraryWorkbenchSection"; -import { ReferenceEstimatorWorkbenchSection } from "@/app/intake/reference-estimator/ReferenceEstimatorWorkbenchSection"; import { WorkRecordWorkbenchSection } from "@/app/intake/work-record/WorkRecordWorkbenchSection"; export function FormalIntakeWorkbench({ @@ -26,11 +21,6 @@ export function FormalIntakeWorkbench({ pendingEntryTab, onPendingEntryTabChange, onOpenProgressDashboard, - activeBomLibrary, - onBomLibraryChange, - activeRawMaterialLibrary, - onOpenRawMaterialLibraryWorkspace, - onOpenReferenceEstimatorWorkspace, onOpenProductPatents, onOpenProductPatentLedger, onOpenProductPatentDashboard, @@ -44,9 +34,6 @@ export function FormalIntakeWorkbench({ canViewSeriesDevelopmentList, canViewProductProgressDashboard, canViewStockDevelopmentList, - canViewBomLibrary, - canViewRawMaterialLibrary, - canViewReferenceEstimator, canViewProductPatentLedger, canViewProductPatentDashboard, canViewBarcodePrint, @@ -61,11 +48,6 @@ export function FormalIntakeWorkbench({ pendingEntryTab: IntakeEntryTab; onPendingEntryTabChange: (tab: IntakeEntryTab) => void; onOpenProgressDashboard: () => void; - activeBomLibrary: BomLibraryKey; - onBomLibraryChange: (library: BomLibraryKey) => void; - activeRawMaterialLibrary: RawMaterialLibraryKey; - onOpenRawMaterialLibraryWorkspace: (library: RawMaterialLibraryKey) => void; - onOpenReferenceEstimatorWorkspace: () => void; onOpenProductPatents: () => void; onOpenProductPatentLedger: () => void; onOpenProductPatentDashboard: () => void; @@ -79,9 +61,6 @@ export function FormalIntakeWorkbench({ canViewSeriesDevelopmentList: boolean; canViewProductProgressDashboard: boolean; canViewStockDevelopmentList: boolean; - canViewBomLibrary: boolean; - canViewRawMaterialLibrary: boolean; - canViewReferenceEstimator: boolean; canViewProductPatentLedger: boolean; canViewProductPatentDashboard: boolean; canViewBarcodePrint: boolean; @@ -115,26 +94,6 @@ export function FormalIntakeWorkbench({ canViewProductProgressDashboard={canViewProductProgressDashboard} canViewStockDevelopmentList={canViewStockDevelopmentList} /> - - - ; + tabsReady?: boolean; activeTabId: string | null; activeContent: ReactNode; onActivate: (tabId: string) => void; onClose: (tabId: string) => void; }) { const { isMobileOrTablet } = useBreakpoint(); + const workspaceTabs = useProductWorkspaceTabs(); + const command = workspaceTabs?.isIntake ? workspaceTabs.intakeCommands[0] : undefined; + const finishCommand = workspaceTabs?.finishCommand; + const reportIntakeTabs = workspaceTabs?.reportIntakeTabs; + + useEffect(() => { + if (!tabsReady || !workspaceTabs?.isIntake) return; + if (!command) { + reportIntakeTabs?.(tabs); + return; + } + if (tabs.some((tab) => tab.id === command.id)) { + if (command.action === 'close') onClose(command.id); + else onActivate(command.id); + } + finishCommand?.(command); + }, [command, finishCommand, onActivate, onClose, reportIntakeTabs, tabs, tabsReady, workspaceTabs?.isIntake]); return (
- + {workspaceTabs?.renderPageTabBar(tabs, activeTabId, onActivate, onClose) ?? ( + + )}
{activeContent}
diff --git a/furniture-3d-system/src/app/intake/intakeClientTypes.ts b/furniture-3d-system/src/app/intake/intakeClientTypes.ts index e8014269..242f2981 100644 --- a/furniture-3d-system/src/app/intake/intakeClientTypes.ts +++ b/furniture-3d-system/src/app/intake/intakeClientTypes.ts @@ -1,4 +1,4 @@ -import type { RawMaterialLibraryKey } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; +import type { RawMaterialLibraryKey } from "@/app/database/raw-material-library/RawMaterialLibraryDomain"; import type { IntakeEntryTab, IntakeSection, @@ -11,10 +11,7 @@ import type { CategoryDTO, DraftGroupDetailDTO, IntakeProductRecommendationDTO, - MaterialCategoryDTO, MaterialDTO, - SubstrateDictionaryBundleDTO, - SubstrateDTO, WarehouseLocationDTO, } from "@/server/services"; import type { PlatformMetricItem } from "@/components/platform/types"; @@ -43,10 +40,7 @@ type IntakeOpenProductWorkspaceInput = { type CommonIntakeClientProps = { user: IntakeClientUser; metrics: PlatformMetricItem[]; - materialLibrarySubstrates: SubstrateDTO[]; materialLibraryFinishes: MaterialDTO[]; - materialLibraryCategories: MaterialCategoryDTO[]; - materialLibraryDictionaries: SubstrateDictionaryBundleDTO; initialNonIntegratedProducts: NonIntegratedProductRecord[]; initialProductDevelopmentProgressProducts?: NonIntegratedProductRecord[]; initialNonIntegratedPageInfo?: { diff --git a/furniture-3d-system/src/app/intake/intakeClientViewProps.tsx b/furniture-3d-system/src/app/intake/intakeClientViewProps.tsx index 1d3ad75a..a446447e 100644 --- a/furniture-3d-system/src/app/intake/intakeClientViewProps.tsx +++ b/furniture-3d-system/src/app/intake/intakeClientViewProps.tsx @@ -1,7 +1,6 @@ "use client"; import type { BrandFilingBrand } from "@/app/intake/brand-filing/brandFilingConfig"; -import type { BomLibraryKey } from "@/app/intake/bom-library/BomLibraryDomain"; import { IntakeEmptyDetail } from "@/app/intake/IntakeMainLayout"; import type { IntakePrimaryDomainContentProps } from "@/app/intake/IntakePrimaryDomainContent"; import type { IntakeRightWorkbenchPanelProps } from "@/app/intake/IntakeRightWorkbenchPanel"; @@ -19,24 +18,21 @@ import type { } from "@/app/intake/intakeWorkspaceTypes"; import type { NonIntegratedProductKindFilter } from "@/app/intake/product-development/nonIntegratedListState"; import type { ProductPatentLedgerTarget } from "@/app/intake/product-patent/ProductPatentDomain"; -import type { RawMaterialLibraryKey } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; +import type { RawMaterialLibraryKey } from "@/app/database/raw-material-library/RawMaterialLibraryDomain"; import type { NonIntegratedProductRecord } from "@/app/intake/non-integrated/nonIntegratedStorage"; import type { - MaterialCategoryDTO, MaterialDTO, - SubstrateDictionaryBundleDTO, - SubstrateDTO, } from "@/server/services"; type IntakeViewUser = IntakeClientProps["user"]; export function buildIntakeWorkspacePanelProps(params: { workspaceTabs: IntakeWorkspaceTab[]; + workspaceStateReady: boolean; activeWorkspaceTabId: string | null; activeWorkspaceTab: IntakeWorkspaceTab | null; user: IntakeViewUser; canManageSpuRuleLibrary: boolean; - canEditBomLibrary: boolean; canViewProductPatentLedger: boolean; canEditProductPatentLedger: boolean; canViewProductPatentDashboard: boolean; @@ -50,10 +46,7 @@ export function buildIntakeWorkspacePanelProps(params: { existingSeriesNames: string[]; existingSeriesComponentDetailNames: string[]; seriesDraftSkuOptions: WorkbenchSku[]; - materialLibrarySubstrates: SubstrateDTO[]; materialLibraryFinishes: MaterialDTO[]; - materialLibraryCategories: MaterialCategoryDTO[]; - materialLibraryDictionaries: SubstrateDictionaryBundleDTO; selectedRawMaterialName: string; nonIntegratedProducts: NonIntegratedProductRecord[]; productDevelopmentProgressProducts: NonIntegratedProductRecord[]; @@ -73,18 +66,17 @@ export function buildIntakeWorkspacePanelProps(params: { entryTabOverride?: IntakeEntryTab, ) => void; onCloseNewProductWorkspace: (tabId: string) => void; - onMaterialLibraryFinishesChange: (finishes: MaterialDTO[]) => void; onOpenWorkRecordArchiveDetailWorkspace: (monthKey: string, label?: string) => void; onActivate: (tabId: string) => void; onClose: (tabId: string) => void; }): Omit { return { tabs: params.workspaceTabs, + tabsReady: params.workspaceStateReady, activeTabId: params.activeWorkspaceTabId, activeWorkspaceTab: params.activeWorkspaceTab, currentUser: params.user, canManageSpuRuleLibrary: params.canManageSpuRuleLibrary, - canEditBomLibrary: params.canEditBomLibrary, canViewProductPatentLedger: params.canViewProductPatentLedger, canEditProductPatentLedger: params.canEditProductPatentLedger, canViewProductPatentDashboard: params.canViewProductPatentDashboard, @@ -100,10 +92,7 @@ export function buildIntakeWorkspacePanelProps(params: { existingSeriesComponentDetailNames: params.existingSeriesComponentDetailNames, seriesDraftSkuOptions: params.seriesDraftSkuOptions, - materialLibrarySubstrates: params.materialLibrarySubstrates, materialLibraryFinishes: params.materialLibraryFinishes, - materialLibraryCategories: params.materialLibraryCategories, - materialLibraryDictionaries: params.materialLibraryDictionaries, selectedRawMaterialName: params.selectedRawMaterialName, nonIntegratedProducts: params.nonIntegratedProducts, productDevelopmentProgressProducts: @@ -118,7 +107,6 @@ export function buildIntakeWorkspacePanelProps(params: { onActivatePendingEntryListWorkspace: params.onActivatePendingEntryListWorkspace, onCloseNewProductWorkspace: params.onCloseNewProductWorkspace, - onMaterialLibraryFinishesChange: params.onMaterialLibraryFinishesChange, onOpenWorkRecordArchiveDetailWorkspace: params.onOpenWorkRecordArchiveDetailWorkspace, onActivate: params.onActivate, @@ -154,18 +142,9 @@ export function buildIntakePrimaryDomainProps(params: { onOpenNewProductWorkspace: ( productDevelopmentKind: ProductDevelopmentKind, ) => void; - canViewBomLibrary: boolean; - canEditBomLibrary: boolean; - activeBomLibrary: BomLibraryKey; - materialLibrarySubstrates: SubstrateDTO[]; - materialLibraryFinishes: MaterialDTO[]; - materialLibraryCategories: MaterialCategoryDTO[]; - materialLibraryDictionaries: SubstrateDictionaryBundleDTO; - onMaterialLibraryFinishesChange: (finishes: MaterialDTO[]) => void; canViewRawMaterialLibrary: boolean; activeRawMaterialLibrary: RawMaterialLibraryKey; selectedRawMaterialName: string; - canViewReferenceEstimator: boolean; canViewProductPatentLedger: boolean; canEditProductPatentLedger: boolean; canViewBarcodePrint: boolean; @@ -197,28 +176,11 @@ export function buildIntakePrimaryDomainProps(params: { onOpenProductWorkspace: params.onOpenProductWorkspace, onOpenNewProductWorkspace: params.onOpenNewProductWorkspace, }, - canViewBomLibrary: params.canViewBomLibrary, - bomLibrary: { - user: params.user, - canEditLibraries: params.canEditBomLibrary, - activeBomLibrary: params.activeBomLibrary, - materialLibrarySubstrates: params.materialLibrarySubstrates, - materialLibraryFinishes: params.materialLibraryFinishes, - materialLibraryCategories: params.materialLibraryCategories, - materialLibraryDictionaries: params.materialLibraryDictionaries, - onMaterialLibraryFinishesChange: - params.onMaterialLibraryFinishesChange, - }, canViewRawMaterialLibrary: params.canViewRawMaterialLibrary, rawMaterialLibrary: { activeRawMaterialLibrary: params.activeRawMaterialLibrary, selectedMaterialName: params.selectedRawMaterialName, }, - canViewReferenceEstimator: params.canViewReferenceEstimator, - referenceEstimator: { - materialLibrarySubstrates: params.materialLibrarySubstrates, - userId: params.user.id, - }, canViewProductPatentLedger: params.canViewProductPatentLedger, productPatent: { products: params.productDevelopmentProgressProducts, @@ -242,14 +204,6 @@ export function buildIntakeRightWorkbenchProps(params: { pendingEntryTab: IntakeEntryTab; onPendingEntryTabChange: (entryTab: IntakeEntryTab) => void; onOpenProgressDashboard: () => void; - activeBomLibrary: BomLibraryKey; - onBomLibraryChange: (library: BomLibraryKey) => void; - activeRawMaterialLibrary: RawMaterialLibraryKey; - onOpenRawMaterialLibraryWorkspace: ( - library: RawMaterialLibraryKey, - selectedMaterialName?: string, - ) => void; - onOpenReferenceEstimatorWorkspace: () => void; onOpenProductPatents: () => void; onOpenProductPatentLedger: () => void; onOpenProductPatentDashboard: () => void; @@ -263,9 +217,6 @@ export function buildIntakeRightWorkbenchProps(params: { canViewSeriesDevelopmentList: boolean; canViewProductProgressDashboard: boolean; canViewStockDevelopmentList: boolean; - canViewBomLibrary: boolean; - canViewRawMaterialLibrary: boolean; - canViewReferenceEstimator: boolean; canViewProductPatentLedger: boolean; canViewProductPatentDashboard: boolean; canViewBarcodePrint: boolean; @@ -283,13 +234,6 @@ export function buildIntakeRightWorkbenchProps(params: { pendingEntryTab: params.pendingEntryTab, onPendingEntryTabChange: params.onPendingEntryTabChange, onOpenProgressDashboard: params.onOpenProgressDashboard, - activeBomLibrary: params.activeBomLibrary, - onBomLibraryChange: params.onBomLibraryChange, - activeRawMaterialLibrary: params.activeRawMaterialLibrary, - onOpenRawMaterialLibraryWorkspace: - params.onOpenRawMaterialLibraryWorkspace, - onOpenReferenceEstimatorWorkspace: - params.onOpenReferenceEstimatorWorkspace, onOpenProductPatents: params.onOpenProductPatents, onOpenProductPatentLedger: params.onOpenProductPatentLedger, onOpenProductPatentDashboard: params.onOpenProductPatentDashboard, @@ -304,9 +248,6 @@ export function buildIntakeRightWorkbenchProps(params: { canViewProductProgressDashboard: params.canViewProductProgressDashboard, canViewStockDevelopmentList: params.canViewStockDevelopmentList, - canViewBomLibrary: params.canViewBomLibrary, - canViewRawMaterialLibrary: params.canViewRawMaterialLibrary, - canViewReferenceEstimator: params.canViewReferenceEstimator, canViewProductPatentLedger: params.canViewProductPatentLedger, canViewProductPatentDashboard: params.canViewProductPatentDashboard, canViewBarcodePrint: params.canViewBarcodePrint, diff --git a/furniture-3d-system/src/app/intake/intakeDomainConfig.ts b/furniture-3d-system/src/app/intake/intakeDomainConfig.ts index 3bdcd90d..dfaab70c 100644 --- a/furniture-3d-system/src/app/intake/intakeDomainConfig.ts +++ b/furniture-3d-system/src/app/intake/intakeDomainConfig.ts @@ -1,5 +1,5 @@ export { BARCODE_PRINT_LABEL } from "@/app/intake/barcode-print/barcodePrintConfig"; -export { BOM_LIBRARY_OPTIONS } from "@/app/intake/bom-library/bomLibraryConfig"; +export { BOM_LIBRARY_OPTIONS } from "@/app/database/bom-library/bomLibraryConfig"; export { PRODUCT_PATENT_DASHBOARD_LABEL, PRODUCT_PATENT_LEDGER_LABEL } from "@/app/intake/product-patent/productPatentConfig"; -export { RAW_MATERIAL_LIBRARY_OPTIONS } from "@/app/intake/raw-material-library/rawMaterialLibraryConfig"; -export { REFERENCE_ESTIMATOR_GROUP_LABEL, REFERENCE_ESTIMATOR_WORKSPACE_LABEL } from "@/app/intake/reference-estimator/referenceEstimatorConfig"; +export { RAW_MATERIAL_LIBRARY_OPTIONS } from "@/app/database/raw-material-library/rawMaterialLibraryConfig"; +export { REFERENCE_ESTIMATOR_GROUP_LABEL, REFERENCE_ESTIMATOR_WORKSPACE_LABEL } from "@/app/reference-estimator/referenceEstimatorConfig"; diff --git a/furniture-3d-system/src/app/intake/intakeWorkspaceState.ts b/furniture-3d-system/src/app/intake/intakeWorkspaceState.ts index 3b4e6e6c..1659d027 100644 --- a/furniture-3d-system/src/app/intake/intakeWorkspaceState.ts +++ b/furniture-3d-system/src/app/intake/intakeWorkspaceState.ts @@ -2,19 +2,19 @@ import { getBrandFilingWorkspaceLabel, type BrandFilingBrand, } from "@/app/intake/brand-filing/brandFilingConfig"; -import type { BomLibraryKey } from "@/app/intake/bom-library/BomLibraryDomain"; -import { BOM_LIBRARY_OPTIONS } from "@/app/intake/bom-library/bomLibraryConfig"; +import type { BomLibraryKey } from "@/app/database/bom-library/BomLibraryDomain"; +import { BOM_LIBRARY_OPTIONS } from "@/app/database/bom-library/bomLibraryConfig"; import { BARCODE_PRINT_LABEL } from "@/app/intake/barcode-print/barcodePrintConfig"; import type { ProductPatentLedgerTarget } from "@/app/intake/product-patent/ProductPatentDomain"; import { PRODUCT_PATENT_DASHBOARD_LABEL, PRODUCT_PATENT_LEDGER_LABEL, } from "@/app/intake/product-patent/productPatentConfig"; -import type { RawMaterialLibraryKey } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; -import { RAW_MATERIAL_LIBRARY_OPTIONS } from "@/app/intake/raw-material-library/rawMaterialLibraryConfig"; +import type { RawMaterialLibraryKey } from "@/app/database/raw-material-library/RawMaterialLibraryDomain"; +import { RAW_MATERIAL_LIBRARY_OPTIONS } from "@/app/database/raw-material-library/rawMaterialLibraryConfig"; import { REFERENCE_ESTIMATOR_WORKSPACE_LABEL, -} from "@/app/intake/reference-estimator/referenceEstimatorConfig"; +} from "@/app/reference-estimator/referenceEstimatorConfig"; import { canAccessWorkRecord, canDownloadWorkRecordMonthlyArchives, @@ -613,23 +613,11 @@ function restoreIntakeWorkspaceTab( : "new", ); } - if (tab.kind === "bomLibrary") { - const option = BOM_LIBRARY_OPTIONS.find( - (item) => item.key === tab.bomLibrary, - ); - if (!option) return null; - return { - id: tab.id, - kind: tab.kind, - label: option.label, - bomLibrary: option.key, - }; - } if (tab.kind === "rawMaterialLibrary") { const option = RAW_MATERIAL_LIBRARY_OPTIONS.find( (item) => item.key === tab.rawMaterialLibrary, ); - if (!option) return null; + if (!option || !tab.selectedMaterialName) return null; return { id: tab.id, kind: tab.kind, @@ -638,14 +626,6 @@ function restoreIntakeWorkspaceTab( selectedMaterialName: tab.selectedMaterialName, }; } - if (tab.kind === "referenceEstimator") { - return { - id: tab.id, - kind: tab.kind, - label: REFERENCE_ESTIMATOR_WORKSPACE_LABEL, - }; - } - return null; } diff --git a/furniture-3d-system/src/app/intake/intakeWorkspaceTypes.ts b/furniture-3d-system/src/app/intake/intakeWorkspaceTypes.ts index 3d9bdfbe..0f27c870 100644 --- a/furniture-3d-system/src/app/intake/intakeWorkspaceTypes.ts +++ b/furniture-3d-system/src/app/intake/intakeWorkspaceTypes.ts @@ -1,7 +1,7 @@ import type { BrandFilingBrand } from "@/app/intake/brand-filing/brandFilingConfig"; -import type { BomLibraryKey } from "@/app/intake/bom-library/BomLibraryDomain"; +import type { BomLibraryKey } from "@/app/database/bom-library/BomLibraryDomain"; import type { ProductPatentLedgerTarget } from "@/app/intake/product-patent/ProductPatentDomain"; -import type { RawMaterialLibraryKey } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; +import type { RawMaterialLibraryKey } from "@/app/database/raw-material-library/RawMaterialLibraryDomain"; import type { NonIntegratedDocumentWorkspaceCategory, NonIntegratedProductRecord, diff --git a/furniture-3d-system/src/app/intake/non-integrated/workspaces/RawMaterialDomain.tsx b/furniture-3d-system/src/app/intake/non-integrated/workspaces/RawMaterialDomain.tsx index 03abbd96..fe992a32 100644 --- a/furniture-3d-system/src/app/intake/non-integrated/workspaces/RawMaterialDomain.tsx +++ b/furniture-3d-system/src/app/intake/non-integrated/workspaces/RawMaterialDomain.tsx @@ -1,6 +1,6 @@ "use client"; -import RawMaterialLibraryPanel from "@/app/intake/raw-material-library/RawMaterialLibraryPanel"; +import RawMaterialLibraryPanel from "@/app/database/raw-material-library/RawMaterialLibraryPanel"; import type { LinkEntryWorkspaceTab } from "./shared/LinkEntryWorkspaceContent"; type RawMaterialDomainProps = { diff --git a/furniture-3d-system/src/app/intake/page.tsx b/furniture-3d-system/src/app/intake/page.tsx index e5c88542..cd717335 100644 --- a/furniture-3d-system/src/app/intake/page.tsx +++ b/furniture-3d-system/src/app/intake/page.tsx @@ -1,3 +1,6 @@ +import { redirect } from 'next/navigation' +import { rawMaterialLibraryHref } from '@/config/intake-library-navigation' +import { linkedReferenceEstimateId, referenceEstimateHref } from '@/app/reference-estimator/referenceEstimateLinks' import { requireSession } from '@/lib/server-session' import { assetCenterService } from '@/server/services/asset-center.service' import { categoryService } from '@/server/services/category.service' @@ -205,15 +208,13 @@ export default async function IntakePage({ }) { const { user, authUser } = await requireSession('/login') const params = await searchParams + const estimateId = linkedReferenceEstimateId(new URLSearchParams({ estimateId: readSingleSearchParam(params, 'estimateId') ?? '' }).toString()) + if (estimateId) redirect(referenceEstimateHref(estimateId)) + if (readSingleSearchParam(params, 'section') === 'rawMaterialLibrary') { + const library = readSingleSearchParam(params, 'rawMaterialLibrary') === 'detailArchive' ? 'detailArchive' : 'processConfig' + redirect(rawMaterialLibraryHref(library, readSingleSearchParam(params, 'material'))) + } const draftGroupId = typeof params.draftGroupId === 'string' ? params.draftGroupId : null - const initialActiveSection = - readSingleSearchParam(params, 'section') === 'rawMaterialLibrary' - ? 'rawMaterialLibrary' - : undefined - const rawMaterialLibraryParam = readSingleSearchParam(params, 'rawMaterialLibrary') - const initialActiveRawMaterialLibrary = - rawMaterialLibraryParam === 'detailArchive' ? 'detailArchive' : 'processConfig' - const initialRawMaterialName = readSingleSearchParam(params, 'material') const initialOpenNewNonIntegratedProduct = params.newProduct === '1' const initialOpenProductId = readSingleSearchParam(params, 'openProductId') const initialOpenProductMode: 'view' | 'edit' = @@ -227,10 +228,7 @@ export default async function IntakePage({ const [ draftGroups, locations, - materialLibrarySubstrates, materialLibraryFinishes, - materialLibraryCategories, - materialLibraryDictionaries, initialProductNonIntegratedProductPage, initialStockNonIntegratedProductPage, initialSeriesNonIntegratedProductPage, @@ -241,10 +239,7 @@ export default async function IntakePage({ ] = await Promise.all([ draftGroupService.list(), warehouseService.listLocations(), - assetCenterService.listSubstrates(), materialService.findAll({ limit: 500 }), - materialService.findAllCategories(), - assetCenterService.getSubstrateDictionaryBundle(), intakeNonIntegratedProductService.listPage(authUser, { page: 1, pageSize: 50, @@ -382,17 +377,11 @@ export default async function IntakePage({ eligibleSkuList={eligibleSkuList} draftGroupId={draftGroupId} hasIneligibleSelected={!!draftGroupId && !!selectedDetail} - materialLibrarySubstrates={materialLibrarySubstrates} materialLibraryFinishes={materialLibraryFinishes} - materialLibraryCategories={materialLibraryCategories} - materialLibraryDictionaries={materialLibraryDictionaries} initialNonIntegratedProducts={initialNonIntegratedProducts} initialProductDevelopmentProgressProducts={initialProductDevelopmentProgressProducts} initialNonIntegratedPageInfo={initialNonIntegratedPageInfo} initialNodePermissionOverrides={nodePermissionSettings.overrides} - initialActiveSection={initialActiveSection} - initialActiveRawMaterialLibrary={initialActiveRawMaterialLibrary} - initialRawMaterialName={initialRawMaterialName} initialOpenNewNonIntegratedProduct={initialOpenNewNonIntegratedProduct} initialOpenProductRequested={Boolean(initialOpenProductId)} initialOpenProductWorkspace={initialOpenProductWorkspace} @@ -411,17 +400,11 @@ export default async function IntakePage({ locations={locations} categories={categories} defaultAttachProductId={defaultAttachProductId} - materialLibrarySubstrates={materialLibrarySubstrates} materialLibraryFinishes={materialLibraryFinishes} - materialLibraryCategories={materialLibraryCategories} - materialLibraryDictionaries={materialLibraryDictionaries} initialNonIntegratedProducts={initialNonIntegratedProducts} initialProductDevelopmentProgressProducts={initialProductDevelopmentProgressProducts} initialNonIntegratedPageInfo={initialNonIntegratedPageInfo} initialNodePermissionOverrides={nodePermissionSettings.overrides} - initialActiveSection={initialActiveSection} - initialActiveRawMaterialLibrary={initialActiveRawMaterialLibrary} - initialRawMaterialName={initialRawMaterialName} initialOpenNewNonIntegratedProduct={initialOpenNewNonIntegratedProduct} initialOpenProductRequested={Boolean(initialOpenProductId)} initialOpenProductWorkspace={initialOpenProductWorkspace} diff --git a/furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryWorkbenchSection.tsx b/furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryWorkbenchSection.tsx deleted file mode 100644 index e03cda65..00000000 --- a/furniture-3d-system/src/app/intake/raw-material-library/RawMaterialLibraryWorkbenchSection.tsx +++ /dev/null @@ -1,69 +0,0 @@ -"use client"; - -import { Database } from "lucide-react"; -import { AccordionSection } from "@/components/platform/AccordionSection"; -import { - FORMAL_SIDEBAR_SECTION_ICON_CLASS, - FormalSidebarIcon, -} from "@/app/intake/components/FormalSidebarIcon"; -import type { IntakeSection } from "@/app/intake/intakeWorkspaceTypes"; -import type { RawMaterialLibraryKey } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; -import { RAW_MATERIAL_LIBRARY_OPTIONS } from "@/app/intake/raw-material-library/rawMaterialLibraryConfig"; -import { getProductRecordsNavLabel } from "@/config/product-workbench-navigation"; - -export function RawMaterialLibraryWorkbenchSection({ - activeSection, - activeRawMaterialLibrary, - canViewRawMaterialLibrary, - onToggle, - onOpenRawMaterialLibraryWorkspace, -}: { - activeSection: IntakeSection; - activeRawMaterialLibrary: RawMaterialLibraryKey; - canViewRawMaterialLibrary: boolean; - onToggle: (section: Exclude) => void; - onOpenRawMaterialLibraryWorkspace: (library: RawMaterialLibraryKey) => void; -}) { - if (!canViewRawMaterialLibrary) return null; - - return ( - - } - expanded={activeSection === "rawMaterialLibrary"} - onToggle={() => onToggle("rawMaterialLibrary")} - > -
- {RAW_MATERIAL_LIBRARY_OPTIONS.map((option) => ( - - ))} -
-
- ); -} diff --git a/furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorWorkbenchSection.tsx b/furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorWorkbenchSection.tsx deleted file mode 100644 index 936a5249..00000000 --- a/furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorWorkbenchSection.tsx +++ /dev/null @@ -1,62 +0,0 @@ -"use client"; - -import { Calculator } from "lucide-react"; -import { AccordionSection } from "@/components/platform/AccordionSection"; -import { - FORMAL_SIDEBAR_SECTION_ICON_CLASS, - FormalSidebarIcon, -} from "@/app/intake/components/FormalSidebarIcon"; -import type { IntakeSection } from "@/app/intake/intakeWorkspaceTypes"; -import { - REFERENCE_ESTIMATOR_WORKSPACE_LABEL, -} from "@/app/intake/reference-estimator/referenceEstimatorConfig"; -import { getProductRecordsNavLabel } from "@/config/product-workbench-navigation"; -import { openEstimateSkillLibrary } from './skill-library-events'; - -export function ReferenceEstimatorWorkbenchSection({ - activeSection, - canViewReferenceEstimator, - onToggle, - onOpenReferenceEstimatorWorkspace, -}: { - activeSection: IntakeSection; - canViewReferenceEstimator: boolean; - onToggle: (section: Exclude) => void; - onOpenReferenceEstimatorWorkspace: () => void; -}) { - if (!canViewReferenceEstimator) return null; - - return ( - - } - expanded={activeSection === "referenceEstimator"} - onToggle={() => onToggle("referenceEstimator")} - > - - - - ); -} diff --git a/furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorWorkspaceContent.tsx b/furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorWorkspaceContent.tsx deleted file mode 100644 index 672d3108..00000000 --- a/furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorWorkspaceContent.tsx +++ /dev/null @@ -1,32 +0,0 @@ -"use client"; - -import type { IntakeWorkspaceTab } from "@/app/intake/intakeWorkspaceTypes"; -import { ReferenceEstimatorDomain } from "@/app/intake/reference-estimator/ReferenceEstimatorDomain"; -import type { SubstrateDTO } from "@/server/services"; - -type ReferenceEstimatorWorkspaceTab = Extract< - IntakeWorkspaceTab, - { kind: "referenceEstimator" } ->; - -export function isReferenceEstimatorWorkspaceTab( - tab: IntakeWorkspaceTab, -): tab is ReferenceEstimatorWorkspaceTab { - return tab.kind === "referenceEstimator"; -} - -export function ReferenceEstimatorWorkspaceContent({ - materialLibrarySubstrates, - userId, -}: { - activeWorkspaceTab: ReferenceEstimatorWorkspaceTab; - materialLibrarySubstrates: SubstrateDTO[]; - userId: string; -}) { - return ( - - ); -} diff --git a/furniture-3d-system/src/app/intake/useIntakeClientViewModel.ts b/furniture-3d-system/src/app/intake/useIntakeClientViewModel.ts index 950784e3..eaf39d43 100644 --- a/furniture-3d-system/src/app/intake/useIntakeClientViewModel.ts +++ b/furniture-3d-system/src/app/intake/useIntakeClientViewModel.ts @@ -1,6 +1,5 @@ "use client"; -import { useEffect, useRef } from "react"; import type { IntakeClientWorkspaceViewProps, } from "@/app/intake/IntakeClientWorkspaceView"; @@ -22,8 +21,6 @@ import { useIntakeNonIntegratedProducts } from "@/app/intake/useIntakeNonIntegra import { useIntakeWorkspaceActivation } from "@/app/intake/useIntakeWorkspaceActivation"; import { useInitialNewNonIntegratedProductWorkspace } from "@/app/intake/useInitialNewNonIntegratedProductWorkspace"; import { useIntakeInitialWorkspaceState } from "@/app/intake/useIntakeInitialWorkspaceState"; -import { useIntakeMaterialLibraryFinishes } from "@/app/intake/useIntakeMaterialLibraryFinishes"; -import { linkedReferenceEstimateId } from "@/app/intake/reference-estimator/referenceEstimateLinks"; import { buildIntakeClientDerivedData } from "@/app/intake/intakeClientDerivedData"; import { canCreateNonIntegratedProductFromIntake } from "@/lib/non-integrated-permissions"; import { @@ -59,10 +56,7 @@ export function useIntakeClientViewModel( canViewSeriesDevelopmentList, canViewProductProgressDashboard, canViewStockDevelopmentList, - canViewBomLibrary, - canEditBomLibrary, canViewRawMaterialLibrary, - canViewReferenceEstimator, canViewProductPatentLedger, canEditProductPatentLedger, canViewProductPatentDashboard, @@ -78,8 +72,6 @@ export function useIntakeClientViewModel( }); const { initialActiveWorkspaceTab, initialWorkspaceState } = useIntakeInitialWorkspaceState(props); - const { materialLibraryFinishes, setMaterialLibraryFinishes } = - useIntakeMaterialLibraryFinishes(props.materialLibraryFinishes); const { selectedRawMaterialName, seriesDraftSkuOptions, @@ -87,7 +79,6 @@ export function useIntakeClientViewModel( skuList, } = buildIntakeClientDerivedData(props); const { - activeBomLibrary, activeRawMaterialLibrary, activeSection, handleWorkspaceActivationStateChange, @@ -173,7 +164,6 @@ export function useIntakeClientViewModel( closeNewNonIntegratedProductWorkspace, openBarcodePrintWorkspace, openBrandFilingWorkspace, - openBomLibraryWorkspace, openNewNonIntegratedProductWorkspace, openPendingEntryWorkspace, openProductPatentDashboardWorkspace, @@ -183,7 +173,6 @@ export function useIntakeClientViewModel( openProductWorkspace, openProgressDashboardWorkspace, openRawMaterialLibraryWorkspace, - openReferenceEstimatorWorkspace, openSpuRuleLibraryWorkspace, openWorkRecordWorkspace, openWorkRecordScoreWorkspace, @@ -199,13 +188,11 @@ export function useIntakeClientViewModel( canViewBrandFiling, canViewWorkRecord, canViewWorkRecordArchives, - canViewBomLibrary, canViewFormalWorkspaceByTarget, canViewProductPatentDashboard, canViewProductPatentLedger, canViewProductProgressDashboard, canViewRawMaterialLibrary, - canViewReferenceEstimator, createWorkspaceTabId, markProductWorkspaceTabLoaded, openWorkspaceTab, @@ -217,14 +204,6 @@ export function useIntakeClientViewModel( user: props.user, workspaceTabs, }); - const openedEstimateLink = useRef(false); - useEffect(() => { - if (!workspaceStateReady || !canViewReferenceEstimator || openedEstimateLink.current) return; - if (!linkedReferenceEstimateId(window.location.search)) return; - openedEstimateLink.current = true; - openReferenceEstimatorWorkspace(); - }, [workspaceStateReady, canViewReferenceEstimator, openReferenceEstimatorWorkspace]); - useInitialNewNonIntegratedProductWorkspace({ canCreateNonIntegratedProducts, initialOpenNewNonIntegratedProduct: props.initialOpenNewNonIntegratedProduct, @@ -253,18 +232,9 @@ export function useIntakeClientViewModel( onProductsChange: handleScopedProductsChange, onOpenProductWorkspace: openProductWorkspace, onOpenNewProductWorkspace: openNewNonIntegratedProductWorkspace, - canViewBomLibrary, - canEditBomLibrary, - activeBomLibrary, - materialLibrarySubstrates: props.materialLibrarySubstrates, - materialLibraryFinishes, - materialLibraryCategories: props.materialLibraryCategories, - materialLibraryDictionaries: props.materialLibraryDictionaries, - onMaterialLibraryFinishesChange: setMaterialLibraryFinishes, canViewRawMaterialLibrary, activeRawMaterialLibrary, selectedRawMaterialName, - canViewReferenceEstimator, canViewProductPatentLedger, canEditProductPatentLedger, canViewBarcodePrint, @@ -272,11 +242,11 @@ export function useIntakeClientViewModel( }), workspace: buildIntakeWorkspacePanelProps({ workspaceTabs, + workspaceStateReady, activeWorkspaceTabId, activeWorkspaceTab, user: props.user, canManageSpuRuleLibrary: canManageSpuRules, - canEditBomLibrary, canViewProductPatentLedger, canEditProductPatentLedger, canViewProductPatentDashboard, @@ -290,10 +260,7 @@ export function useIntakeClientViewModel( existingSeriesNames, existingSeriesComponentDetailNames, seriesDraftSkuOptions, - materialLibrarySubstrates: props.materialLibrarySubstrates, - materialLibraryFinishes, - materialLibraryCategories: props.materialLibraryCategories, - materialLibraryDictionaries: props.materialLibraryDictionaries, + materialLibraryFinishes: props.materialLibraryFinishes, selectedRawMaterialName, nonIntegratedProducts, productDevelopmentProgressProducts, @@ -307,7 +274,6 @@ export function useIntakeClientViewModel( openRawMaterialLibraryWorkspace("processConfig", materialName), onActivatePendingEntryListWorkspace: activatePendingEntryListWorkspace, onCloseNewProductWorkspace: closeNewNonIntegratedProductWorkspace, - onMaterialLibraryFinishesChange: setMaterialLibraryFinishes, onOpenWorkRecordArchiveDetailWorkspace: openWorkRecordArchiveDetailWorkspace, onActivate: activateWorkspaceTab, onClose: closeWorkspaceTab, @@ -320,21 +286,12 @@ export function useIntakeClientViewModel( : null, activeSection, onToggle: (section) => { - if (section === "referenceEstimator") { - openReferenceEstimatorWorkspace(); - return; - } setActiveWorkspaceTabId(null); toggleActiveSection(section); }, pendingEntryTab, onPendingEntryTabChange: openPendingEntryWorkspace, onOpenProgressDashboard: openProgressDashboardWorkspace, - activeBomLibrary, - onBomLibraryChange: openBomLibraryWorkspace, - activeRawMaterialLibrary, - onOpenRawMaterialLibraryWorkspace: openRawMaterialLibraryWorkspace, - onOpenReferenceEstimatorWorkspace: openReferenceEstimatorWorkspace, onOpenProductPatents: openProductPatents, onOpenProductPatentLedger: openProductPatentLedgerWorkspace, onOpenProductPatentDashboard: openProductPatentDashboardWorkspace, @@ -350,9 +307,6 @@ export function useIntakeClientViewModel( canViewSeriesDevelopmentList, canViewProductProgressDashboard, canViewStockDevelopmentList, - canViewBomLibrary, - canViewRawMaterialLibrary, - canViewReferenceEstimator, canViewProductPatentLedger, canViewProductPatentDashboard, canViewBarcodePrint, diff --git a/furniture-3d-system/src/app/intake/useIntakeMaterialLibraryFinishes.ts b/furniture-3d-system/src/app/intake/useIntakeMaterialLibraryFinishes.ts deleted file mode 100644 index 72b6c463..00000000 --- a/furniture-3d-system/src/app/intake/useIntakeMaterialLibraryFinishes.ts +++ /dev/null @@ -1,17 +0,0 @@ -"use client"; - -import { useState } from "react"; -import type { MaterialDTO } from "@/server/services"; - -export function useIntakeMaterialLibraryFinishes( - initialMaterialLibraryFinishes: MaterialDTO[], -) { - const [materialLibraryFinishes, setMaterialLibraryFinishes] = useState< - MaterialDTO[] - >(() => initialMaterialLibraryFinishes); - - return { - materialLibraryFinishes, - setMaterialLibraryFinishes, - }; -} diff --git a/furniture-3d-system/src/app/intake/useIntakeWorkspaceActivation.ts b/furniture-3d-system/src/app/intake/useIntakeWorkspaceActivation.ts index 8bbadf0a..595fe475 100644 --- a/furniture-3d-system/src/app/intake/useIntakeWorkspaceActivation.ts +++ b/furniture-3d-system/src/app/intake/useIntakeWorkspaceActivation.ts @@ -5,7 +5,7 @@ import { useEffect, useState, } from "react"; -import type { BomLibraryKey } from "@/app/intake/bom-library/BomLibraryDomain"; +import type { BomLibraryKey } from "@/app/database/bom-library/BomLibraryDomain"; import type { IntakeEntryTab, IntakeSection, @@ -19,7 +19,7 @@ import { } from "@/app/intake/intakeWorkspaceState"; import type { RawMaterialLibraryKey, -} from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; +} from "@/app/database/raw-material-library/RawMaterialLibraryDomain"; import { isSupplierAccount } from "@/lib/supplier-account"; import type { IntakeNonIntegratedPermissionUser } from "@/lib/non-integrated-permissions"; diff --git a/furniture-3d-system/src/app/intake/useIntakeWorkspaceOpeners.ts b/furniture-3d-system/src/app/intake/useIntakeWorkspaceOpeners.ts index c3367b43..1d962685 100644 --- a/furniture-3d-system/src/app/intake/useIntakeWorkspaceOpeners.ts +++ b/furniture-3d-system/src/app/intake/useIntakeWorkspaceOpeners.ts @@ -2,7 +2,6 @@ import { useCallback, type Dispatch, type SetStateAction } from "react"; import type { BrandFilingBrand } from "@/app/intake/brand-filing/brandFilingConfig"; -import type { BomLibraryKey } from "@/app/intake/bom-library/BomLibraryDomain"; import type { IntakeEntryTab, IntakeSection, @@ -14,7 +13,6 @@ import type { import { createBarcodePrintWorkspaceTab, createBrandFilingWorkspaceTab, - createBomLibraryWorkspaceTab, createNewNonIntegratedProductWorkspaceTab, createNonIntegratedProductWorkspaceTab, createNonIntegratedProductWorkspaceTabForCurrentNode, @@ -23,7 +21,6 @@ import { createProductPatentLedgerWorkspaceTab, createProgressDashboardWorkspaceTab, createRawMaterialLibraryWorkspaceTab, - createReferenceEstimatorWorkspaceTab, createSpuRuleLibraryWorkspaceTab, createWorkRecordArchiveWorkspaceTab, createWorkRecordArchiveDetailWorkspaceTab, @@ -37,7 +34,7 @@ import { getPendingEntryTabFromProductDevelopmentKind, } from "@/app/intake/product-development/nonIntegratedProductIdentity"; import type { ProductPatentLedgerTarget } from "@/app/intake/product-patent/ProductPatentDomain"; -import type { RawMaterialLibraryKey } from "@/app/intake/raw-material-library/RawMaterialLibraryDomain"; +import type { RawMaterialLibraryKey } from "@/app/database/raw-material-library/RawMaterialLibraryDomain"; import type { IntakeNodePermissionTargetKey } from "@/lib/intake-node-permission-settings"; import type { IntakeNonIntegratedPermissionUser } from "@/lib/non-integrated-permissions"; @@ -50,7 +47,6 @@ type WorkspaceOpenersParams = { canViewBrandFiling: boolean; canViewWorkRecord: boolean; canViewWorkRecordArchives: boolean; - canViewBomLibrary: boolean; canViewFormalWorkspaceByTarget: ( targetKey: IntakeNodePermissionTargetKey, ) => boolean; @@ -58,7 +54,6 @@ type WorkspaceOpenersParams = { canViewProductPatentLedger: boolean; canViewProductProgressDashboard: boolean; canViewRawMaterialLibrary: boolean; - canViewReferenceEstimator: boolean; createWorkspaceTabId: (prefix: string, key: string) => string; markProductWorkspaceTabLoaded: (tabId: string) => void; openWorkspaceTab: (nextTab: IntakeWorkspaceTab) => void; @@ -80,13 +75,11 @@ export function useIntakeWorkspaceOpeners({ canViewBrandFiling, canViewWorkRecord, canViewWorkRecordArchives, - canViewBomLibrary, canViewFormalWorkspaceByTarget, canViewProductPatentDashboard, canViewProductPatentLedger, canViewProductProgressDashboard, canViewRawMaterialLibrary, - canViewReferenceEstimator, createWorkspaceTabId, markProductWorkspaceTabLoaded, openWorkspaceTab, @@ -342,22 +335,6 @@ export function useIntakeWorkspaceOpeners({ [createWorkspaceTabId, setWorkspaceTabs, syncWorkspaceState, workspaceTabs], ); - const openBomLibraryWorkspace = useCallback( - (library: BomLibraryKey) => { - if (!canViewBomLibrary) { - return; - } - - openWorkspaceTab( - createBomLibraryWorkspaceTab( - createWorkspaceTabId("bom-library", library), - library, - ), - ); - }, - [canViewBomLibrary, createWorkspaceTabId, openWorkspaceTab], - ); - const openRawMaterialLibraryWorkspace = useCallback( (library: RawMaterialLibraryKey, selectedMaterialName?: string) => { if (!canViewRawMaterialLibrary) { @@ -381,18 +358,6 @@ export function useIntakeWorkspaceOpeners({ [canViewRawMaterialLibrary, createWorkspaceTabId, openWorkspaceTab], ); - const openReferenceEstimatorWorkspace = useCallback(() => { - if (!canViewReferenceEstimator) { - return; - } - - openWorkspaceTab( - createReferenceEstimatorWorkspaceTab( - createWorkspaceTabId("reference-estimator", "reference-image-cost"), - ), - ); - }, [canViewReferenceEstimator, createWorkspaceTabId, openWorkspaceTab]); - const openProductPatentDashboardWorkspace = useCallback(() => { if (!canViewProductPatentDashboard) { return; @@ -527,7 +492,6 @@ export function useIntakeWorkspaceOpeners({ closeNewNonIntegratedProductWorkspace, openBarcodePrintWorkspace, openBrandFilingWorkspace, - openBomLibraryWorkspace, openNewNonIntegratedProductWorkspace, openPendingEntryWorkspace, openProductPatentDashboardWorkspace, @@ -537,7 +501,6 @@ export function useIntakeWorkspaceOpeners({ openProductWorkspace, openProgressDashboardWorkspace, openRawMaterialLibraryWorkspace, - openReferenceEstimatorWorkspace, openSpuRuleLibraryWorkspace, openWorkRecordWorkspace, openWorkRecordScoreWorkspace, diff --git a/furniture-3d-system/src/app/intake/reference-estimator/BomBoardTable.tsx b/furniture-3d-system/src/app/reference-estimator/BomBoardTable.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/BomBoardTable.tsx rename to furniture-3d-system/src/app/reference-estimator/BomBoardTable.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/BomExtraItems.tsx b/furniture-3d-system/src/app/reference-estimator/BomExtraItems.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/BomExtraItems.tsx rename to furniture-3d-system/src/app/reference-estimator/BomExtraItems.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/BomTemplateSettings.tsx b/furniture-3d-system/src/app/reference-estimator/BomTemplateSettings.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/BomTemplateSettings.tsx rename to furniture-3d-system/src/app/reference-estimator/BomTemplateSettings.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/BomTemplateTable.test.tsx b/furniture-3d-system/src/app/reference-estimator/BomTemplateTable.test.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/BomTemplateTable.test.tsx rename to furniture-3d-system/src/app/reference-estimator/BomTemplateTable.test.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/BomTemplateTable.tsx b/furniture-3d-system/src/app/reference-estimator/BomTemplateTable.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/BomTemplateTable.tsx rename to furniture-3d-system/src/app/reference-estimator/BomTemplateTable.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/EstimateDetailTable.tsx b/furniture-3d-system/src/app/reference-estimator/EstimateDetailTable.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/EstimateDetailTable.tsx rename to furniture-3d-system/src/app/reference-estimator/EstimateDetailTable.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/EstimateInputPanel.tsx b/furniture-3d-system/src/app/reference-estimator/EstimateInputPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/EstimateInputPanel.tsx rename to furniture-3d-system/src/app/reference-estimator/EstimateInputPanel.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/EstimatePackedView.tsx b/furniture-3d-system/src/app/reference-estimator/EstimatePackedView.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/EstimatePackedView.tsx rename to furniture-3d-system/src/app/reference-estimator/EstimatePackedView.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/EstimatePackingPanel.tsx b/furniture-3d-system/src/app/reference-estimator/EstimatePackingPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/EstimatePackingPanel.tsx rename to furniture-3d-system/src/app/reference-estimator/EstimatePackingPanel.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/EstimateSettingsPanel.tsx b/furniture-3d-system/src/app/reference-estimator/EstimateSettingsPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/EstimateSettingsPanel.tsx rename to furniture-3d-system/src/app/reference-estimator/EstimateSettingsPanel.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/EstimateSkillLibrary.tsx b/furniture-3d-system/src/app/reference-estimator/EstimateSkillLibrary.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/EstimateSkillLibrary.tsx rename to furniture-3d-system/src/app/reference-estimator/EstimateSkillLibrary.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/EstimateSkillPanel.tsx b/furniture-3d-system/src/app/reference-estimator/EstimateSkillPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/EstimateSkillPanel.tsx rename to furniture-3d-system/src/app/reference-estimator/EstimateSkillPanel.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/EstimateStageSkillLibrary.tsx b/furniture-3d-system/src/app/reference-estimator/EstimateStageSkillLibrary.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/EstimateStageSkillLibrary.tsx rename to furniture-3d-system/src/app/reference-estimator/EstimateStageSkillLibrary.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorDetail.tsx b/furniture-3d-system/src/app/reference-estimator/ReferenceEstimatorDetail.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorDetail.tsx rename to furniture-3d-system/src/app/reference-estimator/ReferenceEstimatorDetail.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorDomain.tsx b/furniture-3d-system/src/app/reference-estimator/ReferenceEstimatorDomain.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorDomain.tsx rename to furniture-3d-system/src/app/reference-estimator/ReferenceEstimatorDomain.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorV1.tsx b/furniture-3d-system/src/app/reference-estimator/ReferenceEstimatorV1.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/ReferenceEstimatorV1.tsx rename to furniture-3d-system/src/app/reference-estimator/ReferenceEstimatorV1.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/bom-template-inputs.tsx b/furniture-3d-system/src/app/reference-estimator/bom-template-inputs.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/bom-template-inputs.tsx rename to furniture-3d-system/src/app/reference-estimator/bom-template-inputs.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/estimate-export-image.ts b/furniture-3d-system/src/app/reference-estimator/estimate-export-image.ts similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/estimate-export-image.ts rename to furniture-3d-system/src/app/reference-estimator/estimate-export-image.ts diff --git a/furniture-3d-system/src/app/intake/reference-estimator/estimate-skill-actions.ts b/furniture-3d-system/src/app/reference-estimator/estimate-skill-actions.ts similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/estimate-skill-actions.ts rename to furniture-3d-system/src/app/reference-estimator/estimate-skill-actions.ts diff --git a/furniture-3d-system/src/app/intake/reference-estimator/estimate.module.css b/furniture-3d-system/src/app/reference-estimator/estimate.module.css similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/estimate.module.css rename to furniture-3d-system/src/app/reference-estimator/estimate.module.css diff --git a/furniture-3d-system/src/app/reference-estimator/page.tsx b/furniture-3d-system/src/app/reference-estimator/page.tsx new file mode 100644 index 00000000..5b38db2d --- /dev/null +++ b/furniture-3d-system/src/app/reference-estimator/page.tsx @@ -0,0 +1,21 @@ +import { redirect } from 'next/navigation' +import { getIntakeLibraryAccess } from '@/lib/intake-library-access' +import { requireSession } from '@/lib/server-session' +import { assetCenterService } from '@/server/services/asset-center.service' +import { intakeNodePermissionSettingsService } from '@/server/services/intake-node-permission-settings.service' +import { ReferenceEstimatorDomain } from './ReferenceEstimatorDomain' + +export const metadata = { title: '预估成本测算' } + +export default async function ReferenceEstimatorPage() { + const { authUser } = await requireSession() + const { overrides } = await intakeNodePermissionSettingsService.getSettings() + if (!getIntakeLibraryAccess(authUser, overrides, 'referenceEstimator').canView) redirect('/intake') + + const substrates = await assetCenterService.listSubstrates() + return ( +
+ +
+ ) +} diff --git a/furniture-3d-system/src/app/intake/reference-estimator/referenceEstimateLinks.ts b/furniture-3d-system/src/app/reference-estimator/referenceEstimateLinks.ts similarity index 91% rename from furniture-3d-system/src/app/intake/reference-estimator/referenceEstimateLinks.ts rename to furniture-3d-system/src/app/reference-estimator/referenceEstimateLinks.ts index 3d170429..5374edfc 100644 --- a/furniture-3d-system/src/app/intake/reference-estimator/referenceEstimateLinks.ts +++ b/furniture-3d-system/src/app/reference-estimator/referenceEstimateLinks.ts @@ -1,9 +1,11 @@ +import { REFERENCE_ESTIMATOR_PATH } from '@/config/intake-library-navigation' + const estimateQuery = 'estimateId' const productLibraryPath = '/intake/product-library' export const referenceEstimateWorkspaceKey = 'reference-estimator' export function referenceEstimateHref(id: string) { - return '/intake?' + new URLSearchParams({ [estimateQuery]: id }) + return REFERENCE_ESTIMATOR_PATH + '?' + new URLSearchParams({ [estimateQuery]: id }) } export function linkedReferenceEstimateId(search: string) { diff --git a/furniture-3d-system/src/app/intake/reference-estimator/referenceEstimatorCalculations.ts b/furniture-3d-system/src/app/reference-estimator/referenceEstimatorCalculations.ts similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/referenceEstimatorCalculations.ts rename to furniture-3d-system/src/app/reference-estimator/referenceEstimatorCalculations.ts diff --git a/furniture-3d-system/src/app/intake/reference-estimator/referenceEstimatorConfig.ts b/furniture-3d-system/src/app/reference-estimator/referenceEstimatorConfig.ts similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/referenceEstimatorConfig.ts rename to furniture-3d-system/src/app/reference-estimator/referenceEstimatorConfig.ts diff --git a/furniture-3d-system/src/app/intake/reference-estimator/skill-library-events.ts b/furniture-3d-system/src/app/reference-estimator/skill-library-events.ts similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/skill-library-events.ts rename to furniture-3d-system/src/app/reference-estimator/skill-library-events.ts diff --git a/furniture-3d-system/src/app/intake/reference-estimator/skill-library.module.css b/furniture-3d-system/src/app/reference-estimator/skill-library.module.css similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/skill-library.module.css rename to furniture-3d-system/src/app/reference-estimator/skill-library.module.css diff --git a/furniture-3d-system/src/app/intake/reference-estimator/standard/BookshelfLibraryRecords.tsx b/furniture-3d-system/src/app/reference-estimator/standard/BookshelfLibraryRecords.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/standard/BookshelfLibraryRecords.tsx rename to furniture-3d-system/src/app/reference-estimator/standard/BookshelfLibraryRecords.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/standard/CabinetModelView.tsx b/furniture-3d-system/src/app/reference-estimator/standard/CabinetModelView.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/standard/CabinetModelView.tsx rename to furniture-3d-system/src/app/reference-estimator/standard/CabinetModelView.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/standard/CabinetStructureDetails.tsx b/furniture-3d-system/src/app/reference-estimator/standard/CabinetStructureDetails.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/standard/CabinetStructureDetails.tsx rename to furniture-3d-system/src/app/reference-estimator/standard/CabinetStructureDetails.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/standard/ImageSkillRecords.tsx b/furniture-3d-system/src/app/reference-estimator/standard/ImageSkillRecords.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/standard/ImageSkillRecords.tsx rename to furniture-3d-system/src/app/reference-estimator/standard/ImageSkillRecords.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/standard/ModelConversationComposer.tsx b/furniture-3d-system/src/app/reference-estimator/standard/ModelConversationComposer.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/standard/ModelConversationComposer.tsx rename to furniture-3d-system/src/app/reference-estimator/standard/ModelConversationComposer.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/standard/ModelConversationPanel.tsx b/furniture-3d-system/src/app/reference-estimator/standard/ModelConversationPanel.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/standard/ModelConversationPanel.tsx rename to furniture-3d-system/src/app/reference-estimator/standard/ModelConversationPanel.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/standard/ModelWorkspace.tsx b/furniture-3d-system/src/app/reference-estimator/standard/ModelWorkspace.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/standard/ModelWorkspace.tsx rename to furniture-3d-system/src/app/reference-estimator/standard/ModelWorkspace.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/standard/StageAssistantWorkspace.tsx b/furniture-3d-system/src/app/reference-estimator/standard/StageAssistantWorkspace.tsx similarity index 100% rename from furniture-3d-system/src/app/intake/reference-estimator/standard/StageAssistantWorkspace.tsx rename to furniture-3d-system/src/app/reference-estimator/standard/StageAssistantWorkspace.tsx diff --git a/furniture-3d-system/src/app/intake/reference-estimator/standard/StandardEstimator.tsx b/furniture-3d-system/src/app/reference-estimator/standard/StandardEstimator.tsx similarity index 97% rename from furniture-3d-system/src/app/intake/reference-estimator/standard/StandardEstimator.tsx rename to furniture-3d-system/src/app/reference-estimator/standard/StandardEstimator.tsx index 47c95a11..32cbcc0a 100644 --- a/furniture-3d-system/src/app/intake/reference-estimator/standard/StandardEstimator.tsx +++ b/furniture-3d-system/src/app/reference-estimator/standard/StandardEstimator.tsx @@ -20,6 +20,7 @@ import { StandardSamplingPanel } from './StandardSamplingPanel' import { useReferenceImagePaste } from './reference-image-paste' import { readWorkspacePosition, writeWorkspacePosition } from '@/lib/workspace-session-state' import { referenceEstimateWorkspaceKey } from '../referenceEstimateLinks' +import { openEstimateSkillLibrary } from '../skill-library-events' const stages = [['model','1 模型'],['sampling','2 打样资料'],['packing','3 包装'],['cost','4 成本明细']] as const type Stage = typeof stages[number][0] @@ -48,6 +49,7 @@ export function StandardEstimator({substrates,userId}:{substrates:SubstrateDTO[] c.title(e.target.value)}/> +