Skip to content

Commit

Permalink
rent tab: edit old_dwellings_in_housing_companies_price_index_type (#554
Browse files Browse the repository at this point in the history
)
  • Loading branch information
NC-jsAhonen authored Dec 12, 2024
1 parent 9445bd7 commit f58808f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { getReviewDays } from "@/leases/helpers";
type Props = {
oldDwellingsInHousingCompaniesPriceIndex: OldDwellingsInHousingCompaniesPriceIndexProps;
oldDwellingsInHousingCompaniesPriceIndexType: OldDwellingsInHousingCompaniesPriceIndexType;
typeFieldName: string;
leaseAttributes: Attributes;
leaseStartDate: string;
isSaveClicked: boolean;
Expand All @@ -53,6 +54,7 @@ class OldDwellingsInHousingCompaniesPriceIndexEdit extends PureComponent<Props>
const {
oldDwellingsInHousingCompaniesPriceIndex,
oldDwellingsInHousingCompaniesPriceIndexType,
typeFieldName,
leaseAttributes,
leaseStartDate,
isSaveClicked,
Expand All @@ -77,7 +79,7 @@ class OldDwellingsInHousingCompaniesPriceIndexEdit extends PureComponent<Props>
leaseAttributes,
LeaseRentsFieldPaths.OLD_DWELLINGS_IN_HOUSING_COMPANIES_PRICE_INDEX_TYPE,
)}
name="old_dwellings_in_housing_companies_price_index_type"
name={typeFieldName}
overrideValues={{
label: LeaseRentOldDwellingsInHousingCompaniesPriceIndexFieldTitles.TYPE,
}}
Expand Down
2 changes: 1 addition & 1 deletion src/leases/components/leaseSections/rent/RentItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const RentItem = ({
archived = isArchived(rent),
rentType = get(rent, 'type'),
oldDwellingsInHousingCompaniesPriceIndex = get(rent, 'old_dwellings_in_housing_companies_price_index', {}),
oldDwellingsInHousingCompaniesPriceIndexType = get(rent, 'old_dwellings_in_housing_companies_price_index_type', null),
oldDwellingsInHousingCompaniesPriceIndexType = get(rent, 'old_dwellings_in_housing_companies_price_index_type'),
fixedInitialYearRents = get(rent, 'fixed_initial_year_rents', []),
contractRents = get(rent, 'contract_rents', []),
indexAdjustedRents = get(rent, 'index_adjusted_rents', []),
Expand Down
1 change: 1 addition & 0 deletions src/leases/components/leaseSections/rent/RentItemEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ class RentItemEdit extends PureComponent<Props, State> {
<OldDwellingsInHousingCompaniesPriceIndexEdit
oldDwellingsInHousingCompaniesPriceIndex={oldDwellingsInHousingCompaniesPriceIndex}
oldDwellingsInHousingCompaniesPriceIndexType={oldDwellingsInHousingCompaniesPriceIndexType}
typeFieldName={`${field}.old_dwellings_in_housing_companies_price_index_type`}
/>
</Collapse>
</Authorization>
Expand Down
3 changes: 2 additions & 1 deletion src/leases/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2680,7 +2680,8 @@ export const addRentsFormValuesToPayload = (payload: Record<string, any>, formVa
type: rent.type,
start_date: rent.start_date,
end_date: rent.end_date,
note: rent.note
note: rent.note,
old_dwellings_in_housing_companies_price_index_type: rent.old_dwellings_in_housing_companies_price_index_type,
};

// Patch amount only if rent type is one time
Expand Down

0 comments on commit f58808f

Please sign in to comment.