Skip to content

Commit

Permalink
Merge pull request #3498 from bcgov/NDT-359-edit-cbc-geographic-name-…
Browse files Browse the repository at this point in the history
…economic-region-and-regional-district

feat: edit cbc geographic name
  • Loading branch information
RRanath authored Aug 27, 2024
2 parents ab7db8c + 485e00d commit 572b335
Show file tree
Hide file tree
Showing 29 changed files with 1,551 additions and 88 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# [1.186.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.185.0...v1.186.0) (2024-08-27)

### Bug Fixes

- 500 error when visiting non-locations page ([b3a101c](https://github.com/bcgov/CONN-CCBC-portal/commit/b3a101c68f6ee5351f335e872b8583a8391dbce8))
- add permissions for executing function ([6defd8f](https://github.com/bcgov/CONN-CCBC-portal/commit/6defd8f09689bdf6f9cfc320294c2953ca70e182))
- cleanup of [section] to remove dataBySection ([35a85ee](https://github.com/bcgov/CONN-CCBC-portal/commit/35a85ee778573f92f526c8bff124c79abd40b43c))
- clear button and inputs show correct values at all times ([abd9f20](https://github.com/bcgov/CONN-CCBC-portal/commit/abd9f20a15b2d15564a114f13f18ac4faa8b8542))
- empty communities are not saved ([9c0c906](https://github.com/bcgov/CONN-CCBC-portal/commit/9c0c906e4b17c9e6e5105903bcfee4a74a7c0dc1))
- geographic name options are by economic region and regional district ([a1c6927](https://github.com/bcgov/CONN-CCBC-portal/commit/a1c6927b67f89e81683716e0de8a39a4b0fd080d))
- geographic name options are populated with only economic region ([40b9438](https://github.com/bcgov/CONN-CCBC-portal/commit/40b9438ef9793d5b83c178d9901e0eb587c8771d))
- update on save instead of after refresh ([56b42f2](https://github.com/bcgov/CONN-CCBC-portal/commit/56b42f246d06b423ad279333199115fcccec035a))
- user correct rowId ([378dcfc](https://github.com/bcgov/CONN-CCBC-portal/commit/378dcfcebef4b01a48e8da34ae92b03f3c2d3269))

### Features

- add and remove community source behaves as expected ([ce70b29](https://github.com/bcgov/CONN-CCBC-portal/commit/ce70b29e6f100032f9c92b6f8d7023d18d0e10a3))
- added community sources are read only ([39e3834](https://github.com/bcgov/CONN-CCBC-portal/commit/39e3834d2b75707dd0cdf0ebcc1379b3ede77869))
- community source data is now displayed properly ([b8e811e](https://github.com/bcgov/CONN-CCBC-portal/commit/b8e811e456700752e0d18c9ca18ea835915c790c))
- disable previously selected options ([7c810e3](https://github.com/bcgov/CONN-CCBC-portal/commit/7c810e3ace1a19e3da2217f28b9dd2a5dd3c0236))
- section community source data behaves similar to quick edit ([b9d8e7c](https://github.com/bcgov/CONN-CCBC-portal/commit/b9d8e7c96d348515f99a3b3b8644a3dad618fa6b))
- style buttons for add, remove, and clear ([35698ff](https://github.com/bcgov/CONN-CCBC-portal/commit/35698ff6ee1164d2a9e90828ce3d1a79193ecf24))

# [1.185.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.184.2...v1.185.0) (2024-08-26)

### Features
Expand Down
6 changes: 4 additions & 2 deletions app/components/Analyst/CBC/CbcTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import {
TextWidget,
DatePickerWidget,
} from 'lib/theme/widgets';
import ArrayLocationFieldTemplate from 'lib/theme/fields/ArrayLocationDataField';
import CommunitySourceWidget from 'lib/theme/widgets/custom/CommunitySourceWidget';
import ArrayBooleanField from '../../Review/fields/ArrayBooleanField';
import ReviewCheckboxField from '../../Review/fields/ReviewCheckboxField';
import ReviewInlineArrayField from '../../Review/fields/ReviewInlineArrayField';
import ReviewObjectFieldTemplate from '../../Review/ReviewObjectFieldTemplate';
import ReviewSectionField from '../../Review/ReviewSectionField';
import ReviewArrayFieldTemplate from '../../Review/fields/ReviewArrayFieldTemplate';
import ReviewFieldTemplate from '../../Review/fields/ReviewFieldTemplate';
import DefaultWidget from '../../Review/widgets/DefaultWidget';
import BooleanWidget from '../../Review/widgets/BooleanWidget';
Expand Down Expand Up @@ -47,12 +48,13 @@ const CbcTheme: ThemeProps = {
NumberWidget,
NumericStringWidget,
ReadOnlyWidget: DefaultWidget,
CommunitySourceWidget,
},
templates: {
...templates,
ObjectFieldTemplate: ReviewObjectFieldTemplate,
FieldTemplate: ReviewFieldTemplate,
ArrayFieldTemplate: ReviewArrayFieldTemplate,
ArrayFieldTemplate: ArrayLocationFieldTemplate,
},
};

Expand Down
2 changes: 2 additions & 0 deletions app/components/Analyst/Project/ProjectTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ArrayFieldTemplate from 'lib/theme/fields/ArrayFieldTemplate';
import * as widgets from 'lib/theme/widgets';
import ReadOnlyWidget from 'components/Analyst/Project/ConditionalApproval/widgets/ReadOnlyWidget';
import ExcelImportFileWidget from 'components/Analyst/Project/ProjectInformation/widgets/ExcelImportFileWidget';
import CommunitySourceWidget from 'lib/theme/widgets/custom/CommunitySourceWidget';
import { StatusSelectWidget } from './ConditionalApproval/widgets';
import ProjectFieldTemplate from './fields/ProjectFieldTemplate';
import ProjectObjectFieldTemplate from './fields/ProjectObjectFieldTemplate';
Expand Down Expand Up @@ -30,6 +31,7 @@ const ProjectTheme: ThemeProps = {
CcbcIdWidget,
HiddenWidget,
ContextErrorWidget,
CommunitySourceWidget,
},
templates: {
...templates,
Expand Down
6 changes: 6 additions & 0 deletions app/components/Review/fields/ReviewFieldTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ const ReviewFieldTemplate: React.FC<FieldTemplateProps> = ({
const title =
(uiSchema?.['ui:options']?.customTitle as JSX.Element) ?? schema.title;

const isExcludeTableFormat = uiSchema?.['ui:options']?.excludeTableFormat;

if (isExcludeTableFormat) {
return <>{children}</>;
}

const before = uiSchema?.['ui:before'];
const after = uiSchema?.['ui:after'];
const fieldName = id?.split('_')?.[2];
Expand Down
3 changes: 2 additions & 1 deletion app/cypress/e2e/analyst/cbc/[cbcId].cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ describe('The cbc project view', () => {
cy.contains('h1', 'Project 1');
cy.contains('h2', 'Tombstone');
cy.contains('h2', 'Project type');
cy.contains('h2', 'Locations and counts');
cy.contains('h2', 'Locations');
cy.contains('h2', 'Counts');
cy.contains('h2', 'Funding');
cy.contains('h2', 'Events and dates');
cy.contains('h2', 'Miscellaneous');
Expand Down
36 changes: 36 additions & 0 deletions app/formSchema/analyst/cbc/locations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { RJSFSchema } from '@rjsf/utils';

const locations: RJSFSchema = {
title: 'Locations',
description: '',
type: 'object',
required: [],
properties: {
projectLocations: {
type: 'string',
title: 'Project Locations',
},
geographicNames: {
type: 'string',
title: 'Geographic Names',
},
regionalDistricts: {
type: 'string',
title: 'Regional Districts',
},
economicRegions: {
type: 'string',
title: 'Economic Regions',
},
communitySourceData: {
type: 'array',
default: [],
items: {
type: 'integer',
enum: [],
},
},
},
};

export default locations;
18 changes: 1 addition & 17 deletions app/formSchema/analyst/cbc/locationsAndCounts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RJSFSchema } from '@rjsf/utils';

const locationsAndCounts: RJSFSchema = {
title: 'Locations and counts',
title: 'Counts',
description: '',
type: 'object',
required: [
Expand All @@ -10,22 +10,6 @@ const locationsAndCounts: RJSFSchema = {
'householdCount',
],
properties: {
projectLocations: {
type: 'string',
title: 'Project Locations',
},
geographicNames: {
type: 'string',
title: 'Geographic Names',
},
regionalDistricts: {
type: 'string',
title: 'Regional Districts',
},
economicRegions: {
type: 'string',
title: 'Economic Regions',
},
communitiesAndLocalesCount: {
type: 'number',
title: 'Communities and locales count',
Expand Down
7 changes: 7 additions & 0 deletions app/formSchema/analyst/cbc/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import funding from './funding';
import eventsAndDates from './eventsAndDates';
import miscellaneous from './miscellaneous';
import projectDataReviews from './projectDataReviews';
import locationsUi from './locations';

const review: RJSFSchema = {
type: 'object',
Expand All @@ -24,6 +25,12 @@ const review: RJSFSchema = {
...projectType.properties,
},
},
locations: {
title: locationsUi.title,
properties: {
...locationsUi.properties,
},
},
locationsAndCounts: {
required: locationsAndCounts.required,
title: locationsAndCounts.title,
Expand Down
37 changes: 37 additions & 0 deletions app/formSchema/uiSchema/cbc/editLocationsUiSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const locationsUiSchema = {
'ui:field': 'SectionField',
'ui:options': {
dividers: true,
},
projectLocations: {
'ui:widget': 'TextAreaWidget',
'ui:label': 'Project Locations',
},
geographicNames: {
'ui:hidden': true,
'ui:widget': 'HiddenWidget',
},
regionalDistricts: {
'ui:hidden': true,
'ui:widget': 'HiddenWidget',
},
economicRegions: {
'ui:hidden': true,
'ui:widget': 'HiddenWidget',
},
communitySourceData: {
'ui:field': 'ArrayLocationDataField',
'ui:label': 'Community Location Data',
items: {
'ui:widget': 'CommunitySourceWidget',
'ui:options': {
excludeTableFormat: true,
},
},
'ui:options': {
excludeTableFormat: true,
},
},
};

export default locationsUiSchema;
5 changes: 5 additions & 0 deletions app/formSchema/uiSchema/cbc/editUiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import fundingUiSchema from './fundingUiSchema';
import eventsAndDatesUiSchema from './eventsAndDatesUiSchema';
import miscellaneousUiSchema from './miscellaneousUiSchema';
import projectDataReviewsUiSchema from './projectDataReviewsUiSchema';
import editLocationsUiSchema from './editLocationsUiSchema';

const editUiSchema = {
'ui:title': 'CBC Edit',
Expand All @@ -21,6 +22,10 @@ const editUiSchema = {
'ui:title': 'Locations and Counts',
...locationsAndCountsUiSchema,
},
locations: {
'ui:title': 'Locations',
...editLocationsUiSchema,
},
funding: {
'ui:title': 'Funding',
...fundingUiSchema,
Expand Down
19 changes: 0 additions & 19 deletions app/formSchema/uiSchema/cbc/locationsAndCountsUiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,6 @@ const locationsAndCountsUiSchema = {
dividers: true,
},
'ui:title': 'Locations and Counts',
projectLocations: {
'ui:widget': 'TextAreaWidget',
'ui:label': 'Project Locations',
'ui:options': {
maxLength: 1000,
},
},
geographicNames: {
'ui:widget': 'ReadOnlyWidget',
'ui:label': 'Geographic Names',
},
regionalDistricts: {
'ui:widget': 'ReadOnlyWidget',
'ui:label': 'Regional Districts',
},
economicRegions: {
'ui:widget': 'ReadOnlyWidget',
'ui:label': 'Economic Regions',
},
communitiesAndLocalesCount: {
'ui:widget': 'NumberWidget',
'ui:label': 'Communities and Locales Count',
Expand Down
27 changes: 27 additions & 0 deletions app/formSchema/uiSchema/cbc/locationsUiSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const locationsUiSchema = {
'ui:field': 'SectionField',
'ui:options': {
dividers: true,
},
projectLocations: {
'ui:widget': 'TextAreaWidget',
'ui:label': 'Project Locations',
},
geographicNames: {
'ui:widget': 'TextAreaWidget',
'ui:label': 'Geographic Names',
},
regionalDistricts: {
'ui:widget': 'TextAreaWidget',
'ui:label': 'Regional Districts',
},
economicRegions: {
'ui:widget': 'TextAreaWidget',
'ui:label': 'Economic Regions',
},
communitySourceData: {
'ui:hidden': true,
},
};

export default locationsUiSchema;
6 changes: 5 additions & 1 deletion app/formSchema/uiSchema/cbc/reviewUiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import projectTypeUiSchema from './projectTypeUiSchema';
import tombstoneUiSchema from './tombstoneUiSchema';
import locationsAndCountsUiSchema from './locationsAndCountsUiSchema';
import fundingUiSchema from './fundingUiSchema';

import eventsAndDatesUiSchema from './eventsAndDatesUiSchema';
import miscellaneousUiSchema from './miscellaneousUiSchema';
import projectDataReviewsUiSchema from './projectDataReviewsUiSchema';
import locationsUiSchema from './locationsUiSchema';

const reviewUiSchema = {
tombstone: {
Expand All @@ -31,6 +31,10 @@ const reviewUiSchema = {
...projectTypeUiSchema,
'ui:options': { allowAnalystEdit: true },
},
locations: {
...locationsUiSchema,
'ui:options': { allowAnalystEdit: true },
},
locationsAndCounts: {
...locationsAndCountsUiSchema,
'ui:options': { allowAnalystEdit: true },
Expand Down
Loading

0 comments on commit 572b335

Please sign in to comment.