From d63dea4d4d327f9edec4595551445f0dce8a42b8 Mon Sep 17 00:00:00 2001 From: hhssb Date: Fri, 13 Dec 2024 14:27:55 +0100 Subject: [PATCH] [ui] Add address and legal form to search result table --- .../statistical-unit-table-header.tsx | 22 ++++++++- .../components/statistical-unit-table-row.tsx | 46 ++++++++++++++++++- app/src/app/search/search.d.ts | 13 +++++- app/src/app/search/table-columns.tsx | 16 +++++++ 4 files changed, 92 insertions(+), 5 deletions(-) diff --git a/app/src/app/search/components/statistical-unit-table-header.tsx b/app/src/app/search/components/statistical-unit-table-header.tsx index 47ce7fc01..5d3e46e19 100644 --- a/app/src/app/search/components/statistical-unit-table-header.tsx +++ b/app/src/app/search/components/statistical-unit-table-header.tsx @@ -115,7 +115,16 @@ export function StatisticalUnitTableHeader({ label="Sector" /> ); - case 'activity': + case "legal_form": + return ( + + ); + case "activity": return ( ); - case 'data_sources': + case "physical_address": + return ( + + Address + + ); + case "data_sources": return ( { switch (type) { case "enterprise": @@ -121,7 +129,9 @@ export const StatisticalUnitTableRow = ({ {externalIdentTypes - ?.map(({ code }) => unit.external_idents[code!] || "") + ?.map( + ({ code }) => unit.external_idents[code!] || "-" + ) .join(" | ")} {unit.invalid_codes && ( @@ -272,7 +282,39 @@ export const StatisticalUnitTableRow = ({ ); - + case 'legal_form': + return ( + +
+ {unit.legal_form_code} + + {unit.legal_form_name} + +
+
+ ); + case 'physical_address': + return ( + +
+ + {physical_address} + +
+
+ ); case 'data_sources': return ( diff --git a/app/src/app/search/search.d.ts b/app/src/app/search/search.d.ts index e35cdd538..50f44944d 100644 --- a/app/src/app/search/search.d.ts +++ b/app/src/app/search/search.d.ts @@ -69,7 +69,18 @@ export type SearchAction = SetQuery | ResetAll | SetOrder | SetPage; export type TableColumnVisibilityType = 'Adaptable' | 'Always'; export type ColumnProfile = "Brief" | "Regular" | "All"; -export type TableColumnCode = 'name' | 'activity_section' | 'activity' | 'top_region' | 'region' | 'statistic' | 'unit_counts' | 'sector' | 'data_sources'; +export type TableColumnCode = + | "name" + | "activity_section" + | "activity" + | "top_region" + | "region" + | "statistic" + | "unit_counts" + | "sector" + | "legal_form" + | "data_sources" + | "physical_address"; // Extend the base interface based on visibility type export interface AdaptableTableColumn{ diff --git a/app/src/app/search/table-columns.tsx b/app/src/app/search/table-columns.tsx index 3547b7dee..baf0ca6fc 100644 --- a/app/src/app/search/table-columns.tsx +++ b/app/src/app/search/table-columns.tsx @@ -115,6 +115,22 @@ export function TableColumnsProvider({ children }: { children: ReactNode }) { stat_code: null, profiles: ["All"], }, + { + type: "Adaptable", + code: "legal_form", + label: "Legal Form", + visible: false, + stat_code: null, + profiles: ["All"], + }, + { + type: "Adaptable", + code: "physical_address", + label: "Address", + visible: false, + stat_code: null, + profiles: ["All"], + }, { type: "Adaptable", code: "data_sources",