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

feat: SRS-361 Implement editing of Parcel Descriptions #243

Merged
merged 11 commits into from
Jan 9, 2025
6 changes: 3 additions & 3 deletions backend/src/app/dto/parcelDescription.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ export type ParcelDescriptionTypeValue =
@ObjectType()
export class ParcelDescriptionDto {
constructor(
id: number | null,
id: string | null,
descriptionType: ParcelDescriptionTypeValue | null,
idPinNumber: string | null,
dateNoted: Date | null,
landDescription: string | null,
userAction: string | null,
srAction: string | null,
) {
this.id = id ? id : 0;
this.id = id ? id : '';
this.descriptionType = descriptionType
? descriptionType
: ParcelDescriptionType.Unknown;
Expand All @@ -44,7 +44,7 @@ export class ParcelDescriptionDto {
}
@Field()
@IsInt()
id: number;
id: string;

@Field()
@IsString()
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/app/features/details/SaveSiteDetailsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const initialState: SaveSiteDetails = {
siteParticipantData: null,
documentsData: null,
landHistoriesData: null,
subDivisionsData: null,
parcelDescriptionsData: null,
profilesData: null,
siteAssociationsData: null,
siteId: '',
Expand Down Expand Up @@ -52,7 +52,7 @@ const siteDetailsSlice = createSlice({
newState.siteParticipantData = null;
newState.documentsData = null;
newState.landHistoriesData = null;
newState.subDivisionsData = null;
newState.parcelDescriptionsData = null;
newState.profilesData = null;
newState.siteAssociationsData = null;
newState.siteId = '';
Expand Down Expand Up @@ -109,11 +109,11 @@ const siteDetailsSlice = createSlice({
newState.landHistoriesData = action.payload;
return newState;
},
setupSubDivisionsDataForSaving: (state, action) => {
setupParcelDescriptionsDataForSaving: (state, action) => {
const newState = {
...state,
};
newState.subDivisionsData = action.payload;
newState.parcelDescriptionsData = action.payload;
return newState;
},
setupSiteAssociationDataForSaving: (state, action) => {
Expand Down Expand Up @@ -178,7 +178,7 @@ export const getSiteDetailsToBeSaved = (state: any) => {
UserActionEnum.updated,
UserActionEnum.deleted,
]),
subDivisions: state.siteDetails.subDivisions,
parcelDescriptions: state.siteDetails.parcelDescriptionsData,
landHistories: state.siteDetails.landHistoriesData,
profiles:
state.siteDetails.profilesData &&
Expand Down Expand Up @@ -214,7 +214,7 @@ export const {
setupLandHistoriesDataForSaving,
setupSiteAssociationDataForSaving,
setupSiteParticipantDataForSaving,
setupSubDivisionsDataForSaving,
setupParcelDescriptionsDataForSaving,
setupSiteSummaryForSaving,
setupSiteDisclosureDataForSaving,
} = siteDetailsSlice.actions;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/features/details/dto/SiteDetailsMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface SaveSiteDetails {
notationData: any;
siteParticipantData: any;
siteAssociationsData: any;
subDivisionsData: any;
parcelDescriptionsData: any;
landHistoriesData: any;
documentsData: any;
profilesData: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import Table from '../../../components/table/Table';
import { RequestStatus } from '../../../helpers/requests/status';
import { TableColumn } from '../../../components/table/TableColumn';
import { SiteDetailsMode } from '../dto/SiteDetailsMode';

interface IParcelDescriptionTable {
requestStatus: RequestStatus;
Expand All @@ -14,6 +15,7 @@ interface IParcelDescriptionTable {
resultsPerPage: number | undefined;
handleTableSortChange: (column: TableColumn, descending: boolean) => void;
showPageOptions: boolean;
viewMode: SiteDetailsMode;
tableChangeHandler: (event: any) => void;
}

Expand All @@ -28,6 +30,7 @@ const ParcelDescriptionTable: React.FC<IParcelDescriptionTable> = ({
resultsPerPage,
handleTableSortChange,
showPageOptions,
viewMode,
tableChangeHandler,
}) => {
return (
Expand All @@ -42,9 +45,9 @@ const ParcelDescriptionTable: React.FC<IParcelDescriptionTable> = ({
changeResultsPerPage={handleChangeResultsPerPage}
currentPage={currentPage}
resultsPerPage={resultsPerPage}
allowRowsSelect={false}
allowRowsSelect={viewMode == SiteDetailsMode.EditMode}
changeHandler={tableChangeHandler}
editMode={false}
editMode={viewMode === SiteDetailsMode.EditMode}
idColumnName="id"
sortHandler={handleTableSortChange}
></Table>
Expand Down
Loading
Loading