Skip to content

Commit

Permalink
r2.2 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
devinleighsmith committed Aug 29, 2022
1 parent ff979b7 commit 2ae339e
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 17 deletions.
8 changes: 4 additions & 4 deletions backend/api/Areas/Tools/Controllers/LtsaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public async Task<IActionResult> FindTitleSummariesAsync(string pid)
[ProducesResponseType(typeof(Model.OrderWrapper<Model.TitleOrder>), 200)]
[ProducesResponseType(typeof(Pims.Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "tools-ltsa" })]
[HasPermission(Permissions.PropertyEdit)]
[HasPermission(Permissions.PropertyView)]
public async Task<IActionResult> PostTitleOrderAsync(string titleNumber, string landTitleDistrictCode)
{
var result = await _ltsaService.PostTitleOrder(titleNumber, landTitleDistrictCode);
Expand All @@ -84,7 +84,7 @@ public async Task<IActionResult> PostTitleOrderAsync(string titleNumber, string
[ProducesResponseType(typeof(Model.OrderWrapper<Model.ParcelInfoOrder>), 200)]
[ProducesResponseType(typeof(Pims.Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "tools-ltsa" })]
[HasPermission(Permissions.PropertyEdit)]
[HasPermission(Permissions.PropertyView)]
public async Task<IActionResult> PostParcelInfoOrderAsync(string pid)
{
if (!string.IsNullOrEmpty(pid))
Expand All @@ -105,7 +105,7 @@ public async Task<IActionResult> PostParcelInfoOrderAsync(string pid)
[ProducesResponseType(typeof(Model.OrderWrapper<Model.SpcpOrder>), 200)]
[ProducesResponseType(typeof(Pims.Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "tools-ltsa" })]
[HasPermission(Permissions.PropertyEdit)]
[HasPermission(Permissions.PropertyView)]
public async Task<IActionResult> PostSpcpOrderAsync(string strataPlanNumber)
{
var result = await _ltsaService.PostSpcpOrder(strataPlanNumber);
Expand All @@ -122,7 +122,7 @@ public async Task<IActionResult> PostSpcpOrderAsync(string strataPlanNumber)
[ProducesResponseType(typeof(IEnumerable<Model.LtsaOrders>), 200)]
[ProducesResponseType(typeof(Pims.Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "tools-ltsa" })]
[HasPermission(Permissions.PropertyEdit)]
[HasPermission(Permissions.PropertyView)]
public async Task<IActionResult> PostLtsaFields(string pid)
{
var result = await _ltsaService.PostLtsaFields(pid);
Expand Down
4 changes: 2 additions & 2 deletions backend/api/Pims.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<UserSecretsId>0ef6255f-9ea0-49ec-8c65-c172304b4926</UserSecretsId>
<Version>2.2.3-33.27</Version>
<AssemblyVersion>2.2.3.33</AssemblyVersion>
<Version>2.2.4-33.28</Version>
<AssemblyVersion>2.2.4.33</AssemblyVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ProjectGuid>16BC0468-78F6-4C91-87DA-7403C919E646</ProjectGuid>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "2.2.3-33.27",
"version": "2.2.4-33.28",
"private": true,
"dependencies": {
"@bcgov/bc-sans": "1.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ const UpdatePersonComponent: React.FC<FormikProps<IEditablePersonForm>> = ({
resetForm,
submitForm,
setFieldValue,
setFieldTouched,
initialValues,
}) => {
const history = useHistory();
Expand All @@ -126,6 +125,17 @@ const UpdatePersonComponent: React.FC<FormikProps<IEditablePersonForm>> = ({
}
};

const isContactMethodInvalid = useMemo(() => {
return (
!!touched.phoneContactMethods &&
!!touched.emailContactMethods &&
(!!touched.mailingAddress?.streetAddress1 ||
!!touched.propertyAddress?.streetAddress1 ||
!!touched.billingAddress?.streetAddress1) &&
getIn(errors, 'needsContactMethod')
);
}, [touched, errors]);

// update mailing address sub-form when "useOrganizationAddress" checkbox is toggled
useEffect(() => {
// toggle is on - set mailing address values to match organization address
Expand Down Expand Up @@ -194,7 +204,7 @@ const UpdatePersonComponent: React.FC<FormikProps<IEditablePersonForm>> = ({
</Styled.RowAligned>
</FormSection>

<PersonSubForm />
<PersonSubForm isContactMethodInvalid={isContactMethodInvalid} />
</FlexBox>
</Styled.Form>
</Styled.ScrollingFormLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const DepositsReceivedContainer: React.FC<IDepositsReceivedContainerProps> = ({
name="securityDepositsTable"
columns={columns}
data={dataSource}
manualPagination={false}
manualPagination={true}
hideToolbar={true}
noRowsMessage="There is no corresponding data"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const DepositsReturnedContainer: React.FC<IDepositsReturnedContainerProps> = ({
name="securityDepositReturnsTable"
columns={columns}
data={dataSource}
manualPagination={false}
manualPagination={true}
hideToolbar={true}
noRowsMessage="There is no corresponding data"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const PaymentsForm: React.FunctionComponent<IPaymentsFormProps> = ({
name="securityDepositsTable"
columns={columns}
data={payments ?? []}
manualPagination={false}
manualPagination={true}
hideToolbar={true}
noRowsMessage="There is no corresponding data"
footer={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const TermsForm: React.FunctionComponent<ITermsFormProps> = ({
name="leasePaymentsTable"
columns={columns}
data={formikProps.values.terms ?? []}
manualPagination={false}
manualPagination={true}
hideToolbar={true}
noRowsMessage="There is no corresponding data"
canRowExpand={() => true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const Surplus: React.FunctionComponent = () => {
name="leasesTable"
columns={columns}
data={declarations ?? []}
manualPagination={false}
manualPagination={true}
hideToolbar={true}
noRowsMessage="Lease / Surplus Declaration details do not exist in PIMS inventory"
></Table>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyAdjacentLandTypes, PropertyTenureTypes } from 'constants/index';
import { Claims, PropertyAdjacentLandTypes, PropertyTenureTypes } from 'constants/index';
import { createMemoryHistory } from 'history';
import { IPropertyApiModel } from 'interfaces/IPropertyApiModel';
import { mockLookups } from 'mocks/mockLookups';
Expand All @@ -13,6 +13,9 @@ const storeState = {
[lookupCodesSlice.name]: { lookupCodes: mockLookups },
};

// mock keycloak auth library
jest.mock('@react-keycloak/web');

describe('PropertyDetailsTabView component', () => {
// render component under test
const setup = (renderOptions: RenderOptions & { property?: IPropertyApiModel } = {}) => {
Expand All @@ -21,6 +24,7 @@ describe('PropertyDetailsTabView component', () => {
const component = render(<PropertyDetailsTabView property={formValues} loading={false} />, {
...rest,
store: storeState,
claims: [Claims.PROPERTY_EDIT],
history,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import LoadingBackdrop from 'components/maps/leaflet/LoadingBackdrop/LoadingBackdrop';
import * as API from 'constants/API';
import { PropertyAdjacentLandTypes, PropertyTenureTypes } from 'constants/index';
import { Claims, PropertyAdjacentLandTypes, PropertyTenureTypes } from 'constants/index';
import useKeycloakWrapper from 'hooks/useKeycloakWrapper';
import useLookupCodeHelpers from 'hooks/useLookupCodeHelpers';
import Api_TypeCode from 'models/api/TypeCode';
import Multiselect from 'multiselect-react-dropdown';
Expand Down Expand Up @@ -33,6 +34,7 @@ export const PropertyDetailsTabView: React.FunctionComponent<IPropertyDetailsTab
setEditMode,
}) => {
const { getOptionsByType } = useLookupCodeHelpers();
const { hasClaim } = useKeycloakWrapper();

const pphTypeOptions = getOptionsByType(API.PPH_STATUS_TYPES);

Expand Down Expand Up @@ -61,7 +63,7 @@ export const PropertyDetailsTabView: React.FunctionComponent<IPropertyDetailsTab
<StyledSummarySection>
<LoadingBackdrop show={loading} parentScreen={true} />
<StyledEditWrapper className="mr-3 my-1">
{setEditMode !== undefined && (
{setEditMode !== undefined && hasClaim(Claims.PROPERTY_EDIT) && (
<Button
variant="link"
onClick={() => {
Expand Down

0 comments on commit 2ae339e

Please sign in to comment.