From 0edbdd81185bd20eed85819f90fb0486dbb424c3 Mon Sep 17 00:00:00 2001 From: Henri Nieminen <118905702+henrinie-nc@users.noreply.github.com> Date: Fri, 14 Jun 2024 09:39:29 +0300 Subject: [PATCH] add intended use filter for least list (#490) utilizes choices loaded from metadata with OPTIONS lease/ --- src/components/form/FormField.tsx | 4 +--- src/leases/components/search/Search.tsx | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/components/form/FormField.tsx b/src/components/form/FormField.tsx index 3ce86ffba..cf544d108 100644 --- a/src/components/form/FormField.tsx +++ b/src/components/form/FormField.tsx @@ -172,6 +172,7 @@ const FormFieldInput = ({ case FieldTypeOptions.STRING: case FieldTypeOptions.HIDDEN: case FieldTypeOptions.FRACTIONAL: + case FieldTypeOptions.INTENDED_USE: return value; case FieldTypeOptions.REFERENCE_NUMBER: @@ -189,9 +190,6 @@ const FormFieldInput = ({ case FieldTypeOptions.USER: return getUserFullName(value); - case FieldTypeOptions.INTENDED_USE: - return value ? value.label : '-'; - default: console.error(`Field type ${type} is not implemented`); return 'NOT IMPLEMENTED'; diff --git a/src/leases/components/search/Search.tsx b/src/leases/components/search/Search.tsx index 941d7faba..0f0a35caa 100644 --- a/src/leases/components/search/Search.tsx +++ b/src/leases/components/search/Search.tsx @@ -47,6 +47,7 @@ type Props = { }; type State = { decisionMakerOptions: Array>; + intendedUseOptions: Array>; isBasicSearch: boolean; leaseAttributes: Attributes; lessors: LessorList; @@ -61,6 +62,7 @@ class Search extends PureComponent { _isMounted: boolean; state = { decisionMakerOptions: [], + intendedUseOptions: [], isBasicSearch: true, leaseAttributes: null, lessors: [], @@ -96,6 +98,7 @@ class Search extends PureComponent { if (props.leaseAttributes !== state.leaseAttributes) { newState.leaseAttributes = props.leaseAttributes; newState.decisionMakerOptions = getFieldOptions(props.leaseAttributes, LeaseDecisionsFieldPaths.DECISION_MAKER); + newState.intendedUseOptions = getFieldOptions(props.leaseAttributes, LeaseFieldPaths.INTENDED_USE); newState.municipalityOptions = getFieldOptions(props.leaseAttributes, LeaseFieldPaths.MUNICIPALITY); newState.tenantTypeOptions = getFieldOptions(props.leaseAttributes, LeaseTenantContactSetFieldPaths.TYPE, false); newState.typeOptions = getFieldOptions(props.leaseAttributes, LeaseFieldPaths.TYPE); @@ -161,6 +164,7 @@ class Search extends PureComponent { delete searchQuery.in_bbox; delete searchQuery.visualization; delete searchQuery.zoom; + delete searchQuery.intended_use; delete searchQuery.service_unit; const keys = Object.keys(searchQuery); @@ -215,6 +219,7 @@ class Search extends PureComponent { } = this.props; const { decisionMakerOptions, + intendedUseOptions, isBasicSearch, lessorOptions, municipalityOptions, @@ -589,6 +594,21 @@ class Search extends PureComponent { }} invisibleLabel name='invoice_number' /> + + + + Vuokrauksen käyttötarkoitus + + + + + }