From 57ffbf3835786316f97a14c61c2b71462a0e8566 Mon Sep 17 00:00:00 2001 From: Tomer Shvadron Date: Sun, 10 Nov 2024 16:38:08 +0200 Subject: [PATCH] feat: small fixes for the Backoffice (#2829) --- .../validation-schemas.ts | 16 ++++++++++++++-- .../utils/get-tabs-block-map.tsx | 8 ++++++-- .../useCaseBlocksLogic/utils/get-variant-tabs.ts | 12 ++++++------ .../Entity/components/Case/Case.Actions.tsx | 4 ++-- .../components/CaseOverview/CaseOverview.tsx | 4 ++-- .../useCaseActionsLogic/useCaseActionsLogic.tsx | 1 + .../pages/Entity/components/Case/interfaces.ts | 2 -- .../report/hooks/useReportTabs/useReportTabs.tsx | 6 ++++-- .../workflows-service/prisma/data-migrations | 2 +- .../src/workflow/workflow.service.ts | 6 +++--- 10 files changed, 39 insertions(+), 22 deletions(-) diff --git a/apps/backoffice-v2/src/common/hooks/useSearchParamsByEntity/validation-schemas.ts b/apps/backoffice-v2/src/common/hooks/useSearchParamsByEntity/validation-schemas.ts index b31e26e21b..43d813f4a7 100644 --- a/apps/backoffice-v2/src/common/hooks/useSearchParamsByEntity/validation-schemas.ts +++ b/apps/backoffice-v2/src/common/hooks/useSearchParamsByEntity/validation-schemas.ts @@ -39,8 +39,8 @@ export const MonitoringReportsTabs = [ export const CaseTabs = [ 'summary', - 'company', - 'store', + 'companyInformation', + 'storeInfo', 'documents', 'ubos', 'associatedCompanies', @@ -49,6 +49,18 @@ export const CaseTabs = [ 'customData', ] as const; +export const TabToLabel = { + summary: 'Summary', + companyInformation: 'Company', + storeInformation: 'Store', + documents: 'Documents', + ubos: 'UBOs', + associatedCompanies: 'Associated Companies', + directors: 'Directors', + monitoringReports: 'Monitoring Reports', + customData: 'Custom Data', +} as const; + export const CaseTabsSchema = z.enum(CaseTabs); export const IndividualsSearchSchema = (authenticatedUserId: string) => diff --git a/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx b/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx index 19508c683d..7cc8930dab 100644 --- a/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx +++ b/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx @@ -67,7 +67,7 @@ export const getTabsToBlocksMap = ({ ? merchantScreeningBlock : []), ], - [Tab.COMPANY]: [ + [Tab.COMPANY_INFORMATION]: [ ...entityInfoBlock, // ...mapBlock, ...addressWithContainerBlock, @@ -76,7 +76,11 @@ export const getTabsToBlocksMap = ({ ...companySanctionsBlock, ...bankingDetailsBlock, ], - [Tab.STORE]: [...storeInfoBlock, ...processingDetailsBlock, ...websiteBasicRequirementBlock], + [Tab.STORE_INFO]: [ + ...storeInfoBlock, + ...processingDetailsBlock, + ...websiteBasicRequirementBlock, + ], [Tab.DOCUMENTS]: [...parentDocumentBlocks], [Tab.UBOS]: [ ...ubosUserProvidedBlock, diff --git a/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-variant-tabs.ts b/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-variant-tabs.ts index 74d03c4561..8a92a194b7 100644 --- a/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-variant-tabs.ts +++ b/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-variant-tabs.ts @@ -5,8 +5,8 @@ import { WorkflowDefinitionConfigThemeEnum } from '@ballerine/common'; export const Tab = { SUMMARY: 'SUMMARY', - COMPANY: 'COMPANY', - STORE: 'STORE', + COMPANY_INFORMATION: 'COMPANY_INFORMATION', + STORE_INFO: 'STORE_INFO', DOCUMENTS: 'DOCUMENTS', UBOS: 'UBOS', ASSOCIATED_COMPANIES: 'ASSOCIATED_COMPANIES', @@ -28,14 +28,14 @@ export const getVariantTabs = ( disabled: !tabBlocks[Tab.SUMMARY]?.length, }, { - name: Tab.COMPANY, + name: Tab.COMPANY_INFORMATION, displayName: 'Company', - disabled: !tabBlocks[Tab.COMPANY]?.length, + disabled: !tabBlocks[Tab.COMPANY_INFORMATION]?.length, }, { - name: Tab.STORE, + name: Tab.STORE_INFO, displayName: 'Store', - disabled: !tabBlocks[Tab.STORE]?.length, + disabled: !tabBlocks[Tab.STORE_INFO]?.length, }, { name: Tab.DOCUMENTS, diff --git a/apps/backoffice-v2/src/pages/Entity/components/Case/Case.Actions.tsx b/apps/backoffice-v2/src/pages/Entity/components/Case/Case.Actions.tsx index ec948ccb3c..312bdcc47f 100644 --- a/apps/backoffice-v2/src/pages/Entity/components/Case/Case.Actions.tsx +++ b/apps/backoffice-v2/src/pages/Entity/components/Case/Case.Actions.tsx @@ -29,7 +29,6 @@ import { createInitials } from '@/common/utils/create-initials/create-initials'; export const Actions: FunctionComponent = ({ id, fullName, - workflow, numberOfNotes, showResolutionButtons, }) => { @@ -42,6 +41,7 @@ export const Actions: FunctionComponent = ({ onMutateAssignWorkflow, workflowDefinition, isWorkflowCompleted, + avatarUrl, } = useCaseActionsLogic({ workflowId: id, fullName }); const entityInitials = createInitials(fullName); @@ -65,7 +65,7 @@ export const Actions: FunctionComponent = ({
{ const isValidCaseTab = CaseTabs.includes(tab); return { - title: titleCase(domain ?? ''), + title: TabToLabel[tab as keyof typeof TabToLabel] ?? titleCase(domain ?? ''), search: isValidCaseTab ? getUpdatedSearchParamsWithActiveTab({ tab: tab, diff --git a/apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx b/apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx index 03d9de7ecd..3d402d2026 100644 --- a/apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx +++ b/apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx @@ -78,5 +78,6 @@ export const useCaseActionsLogic = ({ workflowId, fullName }: IUseActions) => { workflow, workflowDefinition: workflow?.workflowDefinition, isWorkflowCompleted, + avatarUrl: workflow?.entity?.avatarUrl || '', }; }; diff --git a/apps/backoffice-v2/src/pages/Entity/components/Case/interfaces.ts b/apps/backoffice-v2/src/pages/Entity/components/Case/interfaces.ts index 8bdebdfb90..100927eb38 100644 --- a/apps/backoffice-v2/src/pages/Entity/components/Case/interfaces.ts +++ b/apps/backoffice-v2/src/pages/Entity/components/Case/interfaces.ts @@ -1,6 +1,5 @@ import { ComponentProps } from 'react'; -import { TWorkflowById } from '@/domains/workflows/fetchers'; import { TStateTags } from '@ballerine/common'; import { TAssignee } from '../../../../common/components/atoms/AssignDropdown/AssignDropdown'; import { Actions } from './Case.Actions'; @@ -28,7 +27,6 @@ export interface IActionsProps { id: string; fullName: string; numberOfNotes: number; - workflow: TWorkflowById; showResolutionButtons?: boolean; } diff --git a/packages/ui/src/components/templates/report/hooks/useReportTabs/useReportTabs.tsx b/packages/ui/src/components/templates/report/hooks/useReportTabs/useReportTabs.tsx index eb628c2c1a..2610aa110b 100644 --- a/packages/ui/src/components/templates/report/hooks/useReportTabs/useReportTabs.tsx +++ b/packages/ui/src/components/templates/report/hooks/useReportTabs/useReportTabs.tsx @@ -1,6 +1,7 @@ -import React, { ComponentProps, ReactNode, useMemo } from 'react'; -import { Writable } from 'type-fest'; import { Crown } from 'lucide-react'; +import { Writable } from 'type-fest'; +import React, { ComponentProps, ReactNode, useMemo } from 'react'; + import { BusinessReportSummary, WebsitesCompany, @@ -196,6 +197,7 @@ export const useReportTabs = ({ formattedMcc, homepageScreenshotUrl, lineOfBusinessDescription, + ongoingMonitoringSummary, onlineReputationAnalysis, pricingAnalysis, relatedAdsImages, diff --git a/services/workflows-service/prisma/data-migrations b/services/workflows-service/prisma/data-migrations index f9008a19a5..1a49e3bf2b 160000 --- a/services/workflows-service/prisma/data-migrations +++ b/services/workflows-service/prisma/data-migrations @@ -1 +1 @@ -Subproject commit f9008a19a5430cead09300ac3e519d7189e8576c +Subproject commit 1a49e3bf2b61df96247e761cc49a6b5fd6510ffe diff --git a/services/workflows-service/src/workflow/workflow.service.ts b/services/workflows-service/src/workflow/workflow.service.ts index 16bc9a47be..32e1846eed 100644 --- a/services/workflows-service/src/workflow/workflow.service.ts +++ b/services/workflows-service/src/workflow/workflow.service.ts @@ -567,8 +567,6 @@ export class WorkflowService { return workflows.map(workflow => { const isIndividual = 'endUser' in workflow; - const businessWebsiteUrl = !isIndividual && getAvatarUrl(workflow?.business?.website); - return { id: workflow?.id, status: workflow?.status, @@ -578,7 +576,9 @@ export class WorkflowService { name: isIndividual ? `${String(workflow?.endUser?.firstName)} ${String(workflow?.endUser?.lastName)}` : workflow?.business?.companyName, - avatarUrl: isIndividual ? workflow?.endUser?.avatarUrl : businessWebsiteUrl, + avatarUrl: isIndividual + ? workflow?.endUser?.avatarUrl + : getAvatarUrl(workflow?.business?.website), approvalState: isIndividual ? workflow?.endUser?.approvalState : workflow?.business?.approvalState,