Skip to content

Commit

Permalink
PSP-4089 FT-REG: Property Info - When getting a Land Parcel Type that…
Browse files Browse the repository at this point in the history
… is not defined by PIMS, on edit mode, should display the default option as "Unknown" (#4032)

* Update api models

* Lint fixes

* Set property type to UNKNOWN for disabled code values
  • Loading branch information
asanchezr authored May 22, 2024
1 parent 0bf643e commit 616cd20
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 6 deletions.
39 changes: 39 additions & 0 deletions source/backend/apimodels/CodeTypes/PropertyTypes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Runtime.Serialization;
using System.Text.Json.Serialization;

namespace Pims.Api.Models.CodeTypes
{
[JsonConverter(typeof(JsonStringEnumMemberConverter))]
public enum PropertyTypes
{
[EnumMember(Value = "CROWNFSRVD")]
CROWNFSRVD,

[EnumMember(Value = "CROWNFUSRVD")]
CROWNFUSRVD,

[EnumMember(Value = "CROWNPSRVD")]
CROWNPSRVD,

[EnumMember(Value = "CROWNPUSRVD")]
CROWNPUSRVD,

[EnumMember(Value = "HWYROAD")]
HWYROAD,

[EnumMember(Value = "PARKS")]
PARKS,

[EnumMember(Value = "RESERVE")]
RESERVE,

[EnumMember(Value = "STRATACP")]
STRATACP,

[EnumMember(Value = "TITLED")]
TITLED,

[EnumMember(Value = "UNKNOWN")]
UNKNOWN,
}
}
1 change: 0 additions & 1 deletion source/frontend/src/assets/scss/_variables.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
slideOutBlue: $slide-out-blue;
filterBoxColor: $filter-box-color;


filterBoxColor: $filter-box-color;

completedColor: $completed-color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ describe('LeaseDetailSubForm component', () => {
const { container, getTerminationReason } = await setup({});

await act(async () => {
fillInput(container, 'statusTypeCode', ApiGen_CodeTypes_LeaseStatusTypes.TERMINATED, 'select');
fillInput(
container,
'statusTypeCode',
ApiGen_CodeTypes_LeaseStatusTypes.TERMINATED,
'select',
);
});

expect(getTerminationReason()).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { GeoJsonProperties } from 'geojson';
import { isEmpty } from 'lodash';

import { ApiGen_CodeTypes_PropertyPPHStatusTypes } from '@/models/api/generated/ApiGen_CodeTypes_PropertyPPHStatusTypes';
import { ApiGen_CodeTypes_PropertyTypes } from '@/models/api/generated/ApiGen_CodeTypes_PropertyTypes';
import { ApiGen_Concepts_Address } from '@/models/api/generated/ApiGen_Concepts_Address';
import { ApiGen_Concepts_CodeType } from '@/models/api/generated/ApiGen_Concepts_CodeType';
import { ApiGen_Concepts_HistoricalFileNumber } from '@/models/api/generated/ApiGen_Concepts_HistoricalFileNumber';
Expand Down Expand Up @@ -228,9 +229,12 @@ export class UpdatePropertyDetailsFormModel {
model.volumetricUnitTypeCode = fromTypeCode(base.volumetricUnit) ?? undefined;
model.volumetricParcelTypeCode = fromTypeCode(base.volumetricType) ?? undefined;

model.propertyTypeCode = fromTypeCode(base.propertyType) ?? undefined;
model.statusTypeCode = fromTypeCode(base.status) ?? undefined;
model.propertyTypeCode =
exists(base.propertyType) && !base.propertyType.isDisabled
? fromTypeCode(base.propertyType)
: ApiGen_CodeTypes_PropertyTypes.UNKNOWN.toString();

model.statusTypeCode = fromTypeCode(base.status) ?? undefined;
model.districtTypeCode = fromTypeCode<number>(base.district) ?? undefined;
model.districtTypeCodeDescription = base.district?.description ?? undefined;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* File autogenerated by TsGenerator.
* Do not manually modify, changes made to this file will be lost when this file is regenerated.
*/
export enum ApiGen_CodeTypes_PropertyTypes {
CROWNFSRVD = 'CROWNFSRVD',
CROWNFUSRVD = 'CROWNFUSRVD',
CROWNPSRVD = 'CROWNPSRVD',
CROWNPUSRVD = 'CROWNPUSRVD',
HWYROAD = 'HWYROAD',
PARKS = 'PARKS',
RESERVE = 'RESERVE',
STRATACP = 'STRATACP',
TITLED = 'TITLED',
UNKNOWN = 'UNKNOWN',
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export interface ApiGen_Concepts_Insurance extends ApiGen_Base_BaseAudit {
coverageDescription: string | null;
coverageLimit: number | null;
expiryDate: UtcIsoDate | null;
isInsuranceInPlace: boolean;
isInsuranceInPlace: boolean | null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export interface ApiGen_Mayan_FilePage {
document_file_id: number;
document_file_url: string | null;
image_url: string | null;
page_number: string | null;
page_number: number;
url: string | null;
}

0 comments on commit 616cd20

Please sign in to comment.