Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Psp 8855 correct lease-specific property attribution when adding from the map. #4202

Merged
merged 5 commits into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions source/frontend/src/features/leases/add/AddLeaseForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ const AddLeaseForm: React.FunctionComponent<React.PropsWithChildren<IAddLeaseFor
propertyInfo,
}) => {
const defaultFormLease = getDefaultFormLease();
const apiFormLease = LeaseFormModel.toApi(defaultFormLease);

const { getByType } = useLookupCodeHelpers();
const consultationTypes = getByType(API.CONSULTATION_TYPES);
apiFormLease.consultations = getConsultations(apiFormLease, consultationTypes);
if (propertyInfo) {
defaultFormLease.properties = [];
defaultFormLease.properties.push(FormLeaseProperty.fromMapProperty(propertyInfo));
defaultFormLease.regionId = propertyInfo.region ? propertyInfo.region.toString() : '';
}
const apiFormLease = LeaseFormModel.toApi(defaultFormLease);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing the conversion to an apiFormLease after the properties are added to the defaultFormLease now.

apiFormLease.consultations = getConsultations(apiFormLease, consultationTypes);

const handleSubmit = async (
values: LeaseFormModel,
Expand Down
Loading