From 234153312921464740c1fc1dc22c2837d682ef7c Mon Sep 17 00:00:00 2001 From: Jukka Ahonen Date: Fri, 29 Nov 2024 12:37:23 +0200 Subject: [PATCH] authorization and collapse state cleanup --- ...dDwellingsInHousingCompaniesPriceIndex.tsx | 47 ++++++------------- .../leaseSections/rent/RentItem.tsx | 15 +++--- 2 files changed, 23 insertions(+), 39 deletions(-) diff --git a/src/leases/components/leaseSections/rent/OldDwellingsInHousingCompaniesPriceIndex.tsx b/src/leases/components/leaseSections/rent/OldDwellingsInHousingCompaniesPriceIndex.tsx index a8b8b03a..5832f2c8 100644 --- a/src/leases/components/leaseSections/rent/OldDwellingsInHousingCompaniesPriceIndex.tsx +++ b/src/leases/components/leaseSections/rent/OldDwellingsInHousingCompaniesPriceIndex.tsx @@ -12,10 +12,8 @@ import { withWindowResize } from '@/components/resize/WindowResizeHandler'; import FormText from "@/components/form/FormText"; import FormTextTitle from '@/components/form/FormTextTitle'; import { LeaseFieldTitles, LeaseRentOldDwellingsInHousingCompaniesPriceIndexFieldPaths, LeaseRentOldDwellingsInHousingCompaniesPriceIndexFieldTitles } from '@/leases/enums'; -import Authorization from '@/components/authorization/Authorization'; import { getUiDataLeaseKey } from '@/uiData/helpers'; -import { formatDate } from '../../../../util/helpers'; -import { OldDwellingsInHousingCompaniesPriceIndex } from '../../../types'; +import { formatDate } from '@/util/helpers'; type Props = { oldDwellingsInHousingCompaniesPriceIndex: OldDwellingsInHousingCompaniesPriceIndexProps; @@ -51,40 +49,25 @@ class OldDwellingsInHousingCompaniesPriceIndexView extends PureComponent - - <> - - {LeaseRentOldDwellingsInHousingCompaniesPriceIndexFieldTitles.NAME} - - {name} - - + + {LeaseRentOldDwellingsInHousingCompaniesPriceIndexFieldTitles.NAME} + + {name} - - <> - - {LeaseFieldTitles.START_DATE} - - {formatDate(leaseStartDate)} - - + + {LeaseFieldTitles.START_DATE} + + {formatDate(leaseStartDate)} - - <> - - {LeaseRentOldDwellingsInHousingCompaniesPriceIndexFieldTitles.NUMBERS} - - {getLastYearsIndexPointNumber(pointFigures)} - {sourceTableLabel} - - - + + {LeaseRentOldDwellingsInHousingCompaniesPriceIndexFieldTitles.NUMBERS} + + {getLastYearsIndexPointNumber(pointFigures)} + {sourceTableLabel} - - <> {LeaseRentOldDwellingsInHousingCompaniesPriceIndexFieldTitles.REVIEW_DAYS} @@ -99,8 +82,6 @@ class OldDwellingsInHousingCompaniesPriceIndexView extends PureComponent ) : ""} - - diff --git a/src/leases/components/leaseSections/rent/RentItem.tsx b/src/leases/components/leaseSections/rent/RentItem.tsx index 035820b7..10116778 100644 --- a/src/leases/components/leaseSections/rent/RentItem.tsx +++ b/src/leases/components/leaseSections/rent/RentItem.tsx @@ -26,6 +26,7 @@ const formName = FormNames.LEASE_RENTS; type Props = { contractRentsCollapseState: boolean; equalizedRentsCollapseState: boolean; + oldDwellingsInHousingCompaniesPriceIndexCollapseState: boolean; fixedInitialYearRentsCollapseState: boolean; indexAdjustedRentsCollapseState: boolean; leaseAttributes: Attributes; @@ -41,6 +42,7 @@ type Props = { const RentItem = ({ contractRentsCollapseState, equalizedRentsCollapseState, + oldDwellingsInHousingCompaniesPriceIndexCollapseState, fixedInitialYearRentsCollapseState, indexAdjustedRentsCollapseState, leaseAttributes, @@ -117,12 +119,12 @@ const RentItem = ({ } onToggle={handleRentCollapseToggle}> {/* TODO: Add authorization for OldDwellingsInHousingCompaniesPriceIndex */} - { oldDwellingsInHousingCompaniesPriceIndex && - /* */ - - - - {/* */} + + {oldDwellingsInHousingCompaniesPriceIndex && + + + } + @@ -168,6 +170,7 @@ export default connect((state, props) => { return { contractRentsCollapseState: getCollapseStateByKey(state, `${ViewModes.READONLY}.${formName}.${id}.contract_rents`), equalizedRentsCollapseState: getCollapseStateByKey(state, `${ViewModes.READONLY}.${formName}.${id}.equalized_rents`), + oldDwellingsInHousingCompaniesPriceIndexCollapseState: getCollapseStateByKey(state, `${ViewModes.READONLY}.${formName}.${id}.old_dwellings_in_housing_companies_price_index`), fixedInitialYearRentsCollapseState: getCollapseStateByKey(state, `${ViewModes.READONLY}.${formName}.${id}.fixed_initial_year_rents`), indexAdjustedRentsCollapseState: getCollapseStateByKey(state, `${ViewModes.READONLY}.${formName}.${id}.index_adjusted_rents`), leaseAttributes: getLeaseAttributes(state),