diff --git a/services/common/src/components/documents/__snapshots__/DocumentTable.spec.tsx.snap b/services/common/src/components/documents/__snapshots__/DocumentTable.spec.tsx.snap
index 99e4067692..0a65f83f18 100644
--- a/services/common/src/components/documents/__snapshots__/DocumentTable.spec.tsx.snap
+++ b/services/common/src/components/documents/__snapshots__/DocumentTable.spec.tsx.snap
@@ -744,7 +744,7 @@ exports[`DocumentTable renders properly 1`] = `
= ({
maxFileSize = "750MB",
maxFileNameLength = null,
acceptedFileTypesMap = {},
- onFileLoad = () => {},
- onRemoveFile = () => {},
- addFileStart = () => {},
+ onFileLoad = () => { },
+ onRemoveFile = () => { },
+ addFileStart = () => { },
chunkSize = 1048576, // 1MB
allowRevert = false,
allowMultiple = true,
allowReorder = false,
- onProcessFiles = () => {},
- onAbort = () => {},
- onInit = () => {},
+ onProcessFiles = () => { },
+ onAbort = () => { },
+ onInit = () => { },
itemInsertLocation = "before" as ItemInsertLocationType,
labelInstruction = 'Drag & Drop your files or Browse',
abbrevLabel = false,
- beforeAddFile = () => {},
- beforeDropFile = () => {},
+ beforeAddFile = () => { },
+ beforeDropFile = () => { },
labelHref,
label,
required,
@@ -160,9 +160,8 @@ export const FileUpload: FC = ({
const secondLine = abbrevLabel
? ` We accept most common ${fileTypeDisplayString} files${fileSize}. `
: `Accepted filetypes: ${fileTypeDisplayString} `;
- return `${labelInstruction} ${
- maxFileNameLength ? secondLineWithNamingConvention : secondLine
- }`;
+ return `${labelInstruction} ${maxFileNameLength ? secondLineWithNamingConvention : secondLine
+ }`;
};
// Stores metadata and process function for each file, so we can manually
@@ -197,9 +196,7 @@ export const FileUpload: FC = ({
)
) {
notification.error({
- message: `Failed to upload ${file && file.name ? file.name : ""}: ${
- errorMessage ? errorMessage : err
- }`,
+ message: `Failed to upload ${file?.name ?? ""}: ${errorMessage ?? err}`,
duration: 10,
});
}
@@ -254,9 +251,8 @@ export const FileUpload: FC = ({
}
notification.error({
- message: `Failed to upload ${file && file.name ? file.name : ""}: ${
- response.data.status
- }`,
+ message: `Failed to upload ${file?.name ?? ""}: ${response.data.status
+ }`,
duration: 10,
});
@@ -539,6 +535,7 @@ export const FileUpload: FC = ({
/>
)}
= ({
(meta?.warning && {meta?.warning}))
}
>
- <>
- (filepond = ref)}
- server={server}
- name="file"
- beforeDropFile={beforeDropFile}
- beforeAddFile={beforeAddFile}
- allowRevert={allowRevert}
- onremovefile={onRemoveFile}
- allowMultiple={allowMultiple}
- onaddfilestart={addFileStart}
- allowReorder={allowReorder}
- maxParallelUploads={1}
- maxFileSize={maxFileSize}
- minFileSize="1"
- allowFileTypeValidation={acceptedFileMimeTypes.length > 0}
- acceptedFileTypes={acceptedFileMimeTypes}
- onaddfile={handleFileAdd}
- onprocessfiles={onProcessFiles}
- onprocessfileabort={onAbort}
- oninit={onInit}
- labelIdle={getFilePondLabel()}
- itemInsertLocation={itemInsertLocation}
- credits={null}
- fileValidateTypeLabelExpectedTypes={getfileValidateTypeLabelExpectedTypes()}
- fileValidateTypeDetectType={(source, type) =>
- new Promise((resolve, reject) => {
- // If the browser can't automatically detect the file's MIME type, use the one stored in the "accepted file types" map.
- if (!type) {
- const exts = source.name.split(".");
- const ext = exts?.length > 0 && `.${exts.pop().toLowerCase()}`;
-
- if (ext && acceptedFileTypeExtensions.includes(ext)) {
- const match = acceptedFileTypesMap[ext];
- type = Array.isArray(match) ? match[0] : match;
- } else {
- reject(type);
- }
+ (filepond = ref)}
+ server={server}
+ name="file"
+ beforeDropFile={beforeDropFile}
+ beforeAddFile={beforeAddFile}
+ allowRevert={allowRevert}
+ onremovefile={onRemoveFile}
+ allowMultiple={allowMultiple}
+ onaddfilestart={addFileStart}
+ allowReorder={allowReorder}
+ maxParallelUploads={1}
+ maxFileSize={maxFileSize}
+ minFileSize="1"
+ allowFileTypeValidation={acceptedFileMimeTypes.length > 0}
+ acceptedFileTypes={acceptedFileMimeTypes}
+ onaddfile={handleFileAdd}
+ onprocessfiles={onProcessFiles}
+ onprocessfileabort={onAbort}
+ oninit={onInit}
+ labelIdle={getFilePondLabel()}
+ itemInsertLocation={itemInsertLocation}
+ credits={null}
+ fileValidateTypeLabelExpectedTypes={getfileValidateTypeLabelExpectedTypes()}
+ fileValidateTypeDetectType={(source, type) =>
+ new Promise((resolve, reject) => {
+ // If the browser can't automatically detect the file's MIME type, use the one stored in the "accepted file types" map.
+ if (!type) {
+ const exts = source.name.split(".");
+ const ext = exts?.length > 0 && `.${exts.pop().toLowerCase()}`;
+
+ if (ext && acceptedFileTypeExtensions.includes(ext)) {
+ const match = acceptedFileTypesMap[ext];
+ type = Array.isArray(match) ? match[0] : match;
+ } else {
+ reject(type);
}
- resolve(type);
- })
- }
- />
- >
+ }
+ resolve(type);
+ })
+ }
+ />
);
diff --git a/services/common/src/components/forms/RenderGroupCheckbox.tsx b/services/common/src/components/forms/RenderGroupCheckbox.tsx
index f0a0ca2b9d..b400c708be 100644
--- a/services/common/src/components/forms/RenderGroupCheckbox.tsx
+++ b/services/common/src/components/forms/RenderGroupCheckbox.tsx
@@ -38,6 +38,7 @@ const RenderGroupCheckbox: FC = ({
if (!isEditMode) {
return (
{label}}
getValueProps={() => ({ value: input.value })}
diff --git a/services/common/src/components/forms/RenderOrgBookSearch.tsx b/services/common/src/components/forms/RenderOrgBookSearch.tsx
index ed4d261e8f..e4fb3e886d 100644
--- a/services/common/src/components/forms/RenderOrgBookSearch.tsx
+++ b/services/common/src/components/forms/RenderOrgBookSearch.tsx
@@ -16,7 +16,6 @@ import { BaseInputProps, getFormItemLabel } from "./BaseInput";
interface OrgBookSearchProps extends BaseInputProps {
data?: any;
- isDisabled?: boolean;
setCredential: (credential: IOrgbookCredential) => void;
}
@@ -29,7 +28,7 @@ const RenderOrgBookSearch: FC = ({
input,
meta,
required,
- isDisabled = false,
+ disabled = false,
setCredential,
}) => {
const dispatch = useDispatch();
@@ -121,26 +120,28 @@ const RenderOrgBookSearch: FC = ({
required={required}
getValueProps={() => input?.value !== "" && { value: input?.value }}
>
- } /> : null}
- filterOption={false}
- onSearch={handleSearchDebounced}
- onChange={handleChange}
- onSelect={handleSelect}
- style={{ width: "100%" }}
- disabled={isDisabled}
- value={options.length === 1 ? { key: options[0].text } : null}
- >
- {options.map((option) => (
- {option.text}
- ))}
-
- {help && {help} }
+ <>
+ } /> : null}
+ filterOption={false}
+ onSearch={handleSearchDebounced}
+ onChange={handleChange}
+ onSelect={handleSelect}
+ style={{ width: "100%" }}
+ disabled={disabled}
+ value={options.length === 1 ? { key: options[0].text } : undefined}
+ >
+ {options.map((option) => (
+ {option.text}
+ ))}
+
+ {help && {help} }
+ >
);
};
diff --git a/services/common/src/components/forms/RenderSelect.tsx b/services/common/src/components/forms/RenderSelect.tsx
index 6b3d5a3a39..72d1a52563 100644
--- a/services/common/src/components/forms/RenderSelect.tsx
+++ b/services/common/src/components/forms/RenderSelect.tsx
@@ -13,7 +13,6 @@ import { FormConsumer, IFormContext } from "./FormWrapper";
interface SelectProps extends BaseInputProps {
data: IOption[];
onSelect?: (value, option) => void;
- usedOptions: string[];
allowClear?: boolean;
}
@@ -25,7 +24,7 @@ export const RenderSelect: FC = ({
input,
placeholder = "Please select",
data = [],
- onSelect = () => {},
+ onSelect = () => { },
allowClear = true,
disabled = false,
required = false,
diff --git a/services/common/src/components/projectSummary/Agent.spec.tsx b/services/common/src/components/projectSummary/Agent.spec.tsx
index 998ca116e7..0b7dad4c48 100644
--- a/services/common/src/components/projectSummary/Agent.spec.tsx
+++ b/services/common/src/components/projectSummary/Agent.spec.tsx
@@ -7,19 +7,20 @@ import FormWrapper from "../forms/FormWrapper";
import * as MOCK from "@mds/common/tests/mocks/dataMocks";
import { Agent } from "./Agent";
+const formValues = {
+ values: {
+ status_code: "DFT",
+ agent: {
+ credential_id: 1000,
+ party_type_code: null,
+ address: { address_type_code: "CAN", sub_division_code: "BC" },
+ },
+ is_agent: true,
+ },
+};
const initialState = {
form: {
- [FORM.ADD_EDIT_PROJECT_SUMMARY]: {
- values: {
- status_code: "DFT",
- agent: {
- credential_id: 1000,
- party_type_code: null,
- address: { address_type_code: "CAN", sub_division_code: "BC" },
- },
- is_agent: true,
- },
- },
+ [FORM.ADD_EDIT_PROJECT_SUMMARY]: { values: formValues },
},
[PROJECTS]: {
projectSummary: MOCK.PROJECT_SUMMARY,
@@ -38,10 +39,10 @@ describe("Agent Component", () => {
{}}
+ initialValues={formValues}
+ onSubmit={() => { }}
>
-
+
);
diff --git a/services/common/src/components/projectSummary/Agent.tsx b/services/common/src/components/projectSummary/Agent.tsx
index 2f16350318..ad9b4568d5 100644
--- a/services/common/src/components/projectSummary/Agent.tsx
+++ b/services/common/src/components/projectSummary/Agent.tsx
@@ -3,7 +3,6 @@ import { useSelector, useDispatch } from "react-redux";
import { Field, change, getFormValues } from "redux-form";
import { Col, Row, Typography, Alert } from "antd";
import { FORM } from "@mds/common/constants";
-import { isFieldDisabled } from "../projects/projectUtils";
import RenderField from "@mds/common/components/forms/RenderField";
import RenderRadioButtons from "@mds/common/components/forms/RenderRadioButtons";
import RenderSelect from "@mds/common/components/forms/RenderSelect";
@@ -27,10 +26,10 @@ import { getOrgBookCredential } from "@mds/common/redux/selectors/orgbookSelecto
import { normalizePhone } from "@mds/common/redux/utils/helpers";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faCircleCheck, faCircleX, faSpinner } from "@fortawesome/pro-light-svg-icons";
-import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
import { IProjectSummaryForm } from "@mds/common/interfaces";
+import { ProjectSummaryFormComponentProps } from "./ProjectSummaryForm";
-export const Agent: FC = () => {
+export const Agent: FC = ({ fieldsDisabled }) => {
const dispatch = useDispatch();
const formValues = useSelector(getFormValues(FORM.ADD_EDIT_PROJECT_SUMMARY)) as IProjectSummaryForm;
const { agent, is_agent = false } = formValues;
@@ -45,7 +44,6 @@ export const Agent: FC = () => {
const [verified, setVerified] = useState(false);
const [checkingStatus, setCheckingStatus] = useState(false);
const [verifiedCredential, setVerifiedCredential] = useState(null);
- const systemFlag = useSelector(getSystemFlag);
useEffect(() => {
setCheckingStatus(true);
@@ -183,7 +181,7 @@ export const Agent: FC = () => {
validate={[requiredRadioButton]}
label="Are you an agent applying on behalf of the applicant?"
component={RenderRadioButtons}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{is_agent && (
@@ -199,7 +197,7 @@ export const Agent: FC = () => {
]}
optionType="button"
onChange={handleResetParty}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{party_type_code === "ORG" && (
@@ -213,6 +211,7 @@ export const Agent: FC = () => {
data={orgBookOptions}
help={"as registered with the BC Registrar of Companies"}
component={RenderOrgBookSearch}
+ disabled={fieldsDisabled}
/>
{verifiedCredential && (
@@ -239,7 +238,7 @@ export const Agent: FC = () => {
required
validate={[required, maxLength(25)]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -254,7 +253,7 @@ export const Agent: FC = () => {
component={RenderField}
required
validate={[required, maxLength(60)]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -264,7 +263,7 @@ export const Agent: FC = () => {
component={RenderField}
required
validate={[required, maxLength(60)]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -277,7 +276,7 @@ export const Agent: FC = () => {
label="Agent's Title"
component={RenderField}
validate={[maxLength(100)]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -295,7 +294,7 @@ export const Agent: FC = () => {
}
component={RenderField}
normalize={normalizePhone}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -304,6 +303,7 @@ export const Agent: FC = () => {
validate={[maxLength(4)]}
label="Ext."
component={RenderField}
+ disabled={fieldsDisabled}
/>
@@ -313,7 +313,7 @@ export const Agent: FC = () => {
required
validate={[required, email, maxLength(60)]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -327,7 +327,7 @@ export const Agent: FC = () => {
required
validate={[required, maxLength(100)]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -336,7 +336,7 @@ export const Agent: FC = () => {
label="Unit #"
component={RenderField}
validate={[maxLength(5)]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -350,7 +350,7 @@ export const Agent: FC = () => {
validate={[required]}
data={CONTACTS_COUNTRY_OPTIONS}
component={RenderSelect}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -362,7 +362,7 @@ export const Agent: FC = () => {
data={provinceOptions.filter((p) => p.subType === address_type_code)}
validate={!isInternational ? [required] : []}
component={RenderSelect}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -375,7 +375,7 @@ export const Agent: FC = () => {
required
validate={[required]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -384,7 +384,7 @@ export const Agent: FC = () => {
label="Postal Code"
component={RenderField}
validate={[postalCodeWithCountry(address_type_code), maxLength(10)]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
diff --git a/services/common/src/components/projectSummary/Applicant.spec.tsx b/services/common/src/components/projectSummary/Applicant.spec.tsx
index 2cfd96c862..0436f9737c 100644
--- a/services/common/src/components/projectSummary/Applicant.spec.tsx
+++ b/services/common/src/components/projectSummary/Applicant.spec.tsx
@@ -34,7 +34,7 @@ describe("Applicant Component", () => {
initialValues={initialValues}
onSubmit={() => { }}
>
-
+
);
diff --git a/services/common/src/components/projectSummary/Applicant.tsx b/services/common/src/components/projectSummary/Applicant.tsx
index 88bc2342ac..86726a903a 100644
--- a/services/common/src/components/projectSummary/Applicant.tsx
+++ b/services/common/src/components/projectSummary/Applicant.tsx
@@ -1,5 +1,5 @@
import { Col, Row, Typography } from "antd";
-import React, { useEffect, useState } from "react";
+import React, { FC, useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Field, getFormValues, change } from "redux-form";
import {
@@ -12,7 +12,6 @@ import {
} from "@mds/common/redux/utils/Validate";
import RenderRadioButtons from "@mds/common/components/forms/RenderRadioButtons";
import { FORM } from "@mds/common/constants";
-import { isFieldDisabled } from "../projects/projectUtils";
import { CONTACTS_COUNTRY_OPTIONS } from "@mds/common/constants/strings";
import { IOrgbookCredential } from "@mds/common/interfaces/party";
import RenderOrgBookSearch from "@mds/common/components/forms/RenderOrgBookSearch";
@@ -29,8 +28,8 @@ import RenderCheckbox from "@mds/common/components/forms/RenderCheckbox";
import { normalizePhone } from "@mds/common/redux/utils/helpers";
import { getOrgBookCredential } from "@mds/common/redux/selectors/orgbookSelectors";
import { PaymentContact } from "@mds/common/components/projectSummary/PaymentContact";
-import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
import { IProjectSummaryForm } from "@mds/common/interfaces";
+import { ProjectSummaryFormComponentProps } from "./ProjectSummaryForm";
const { Title, Paragraph } = Typography;
interface IVerifiedCredential {
@@ -39,7 +38,7 @@ interface IVerifiedCredential {
registriesId: number;
}
-const Applicant = () => {
+const Applicant: FC = ({ fieldsDisabled }) => {
const dispatch = useDispatch();
const provinceOptions = useSelector(getDropdownProvinceOptions);
const [credential, setCredential] = useState(null);
@@ -50,7 +49,6 @@ const Applicant = () => {
const orgBookCredential = useSelector(getOrgBookCredential);
const formValues = useSelector(getFormValues(FORM.ADD_EDIT_PROJECT_SUMMARY)) as IProjectSummaryForm;
- const systemFlag = useSelector(getSystemFlag);
const {
applicant = {},
is_legal_address_same_as_mailing_address = false,
@@ -290,7 +288,7 @@ const Applicant = () => {
]}
optionType="button"
onChange={handleResetParty}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{party_type_code === "ORG" && (
@@ -304,7 +302,7 @@ const Applicant = () => {
data={orgBookOptions}
help={"as registered with the BC Registrar of Companies"}
component={RenderOrgBookSearch}
- isDisabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{verifiedCredential && (
@@ -330,7 +328,7 @@ const Applicant = () => {
label="Doing Business As"
component={RenderField}
validate={[maxLength(100)]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -342,7 +340,7 @@ const Applicant = () => {
required
validate={[required, maxLength(25)]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -357,7 +355,7 @@ const Applicant = () => {
required
validate={[required, maxLength(60)]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -366,6 +364,7 @@ const Applicant = () => {
validate={[maxLength(60)]}
label="Middle Name"
component={RenderField}
+ disabled={fieldsDisabled}
/>
@@ -375,7 +374,7 @@ const Applicant = () => {
required
validate={[required, maxLength(60)]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -389,7 +388,7 @@ const Applicant = () => {
component={RenderField}
validate={[phoneNumber, maxLength(12), required]}
normalize={normalizePhone}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -398,7 +397,7 @@ const Applicant = () => {
label="Ext."
component={RenderField}
validate={[maxLength(4)]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -408,7 +407,7 @@ const Applicant = () => {
required
validate={[required, email, maxLength(60)]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -421,7 +420,7 @@ const Applicant = () => {
required
validate={[required, maxLength(100)]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -430,7 +429,7 @@ const Applicant = () => {
name="applicant.address[0].suite_no"
label="Unit #"
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -443,12 +442,12 @@ const Applicant = () => {
validate={[required]}
data={CONTACTS_COUNTRY_OPTIONS}
component={RenderSelect}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{
{
{
}}
type="checkbox"
disabled={
- isFieldDisabled(systemFlag, formValues?.status_code) ||
+ fieldsDisabled ||
!areAllAddressFieldsValid(isMailingInternational, applicantAddress.mailingAddress)
}
onChange={(e) =>
@@ -517,12 +516,12 @@ const Applicant = () => {
required
validate={[required]}
component={RenderField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{
{
{
{
{
label: "Same as mailing address",
}}
disabled={
- isFieldDisabled(systemFlag, formValues?.status_code) ||
+ fieldsDisabled ||
!areAllAddressFieldsValid(isMailingInternational, applicantAddress.mailingAddress) ||
is_billing_address_same_as_legal_address
}
@@ -621,7 +620,7 @@ const Applicant = () => {
label: "Same as legal address",
}}
disabled={
- isFieldDisabled(systemFlag, formValues?.status_code) ||
+ fieldsDisabled ||
is_billing_address_same_as_mailing_address ||
(!areAllAddressFieldsValid(isLegalInternational, applicantAddress.legalAddress) &&
!is_legal_address_same_as_mailing_address)
@@ -639,7 +638,7 @@ const Applicant = () => {
{
{
{
{
{
{
>
)}
-
+
);
};
diff --git a/services/common/src/components/projectSummary/ApplicationSummary.spec.tsx b/services/common/src/components/projectSummary/ApplicationSummary.spec.tsx
index 2a88ed4bc5..72f056b4cb 100644
--- a/services/common/src/components/projectSummary/ApplicationSummary.spec.tsx
+++ b/services/common/src/components/projectSummary/ApplicationSummary.spec.tsx
@@ -30,8 +30,8 @@ describe("ApplicationSummary Component", () => {
it("should render the component with expected fields", () => {
const { container } = render(
- {}}>
-
+ { }}>
+
);
diff --git a/services/common/src/components/projectSummary/ApplicationSummary.tsx b/services/common/src/components/projectSummary/ApplicationSummary.tsx
index 9a1d2d0666..0e326b5528 100644
--- a/services/common/src/components/projectSummary/ApplicationSummary.tsx
+++ b/services/common/src/components/projectSummary/ApplicationSummary.tsx
@@ -13,12 +13,11 @@ import { renderTextColumn } from "@mds/common/components/common/CoreTableCommonC
import CoreTable from "@mds/common/components/common/CoreTable";
import { getPermits } from "@mds/common/redux/selectors/permitSelectors";
import { FORM } from "@mds/common/constants";
-import { isFieldDisabled } from "../projects/projectUtils";
import { IAuthorizationSummary, IProjectSummaryForm } from "@mds/common/interfaces";
-import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
import { FormContext } from "../forms/FormWrapper";
+import { ProjectSummaryFormComponentProps } from "./ProjectSummaryForm";
-export const ApplicationSummary: FC = () => {
+export const ApplicationSummary: FC = ({ fieldsDisabled }) => {
const permits = useSelector(getPermits);
const formValues = useSelector(getFormValues(FORM.ADD_EDIT_PROJECT_SUMMARY)) as IProjectSummaryForm;
const dropdownProjectSummaryPermitTypes = useSelector(getDropdownProjectSummaryPermitTypes);
@@ -36,7 +35,6 @@ export const ApplicationSummary: FC = () => {
const processedEnvironmentActPermitResult: any[] = [];
let processedOtherActPermitResult: any[] = [];
- const systemFlag = useSelector(getSystemFlag);
const { isEditMode } = useContext(FormContext);
const minesActColumns: ColumnsType = [
@@ -231,11 +229,10 @@ export const ApplicationSummary: FC = () => {
const editButton =
;
diff --git a/services/common/src/components/projectSummary/AuthorizationSupportDocumentUpload.spec.tsx b/services/common/src/components/projectSummary/AuthorizationSupportDocumentUpload.spec.tsx
index ebe3396f43..aac5212f9f 100644
--- a/services/common/src/components/projectSummary/AuthorizationSupportDocumentUpload.spec.tsx
+++ b/services/common/src/components/projectSummary/AuthorizationSupportDocumentUpload.spec.tsx
@@ -7,10 +7,11 @@ import FormWrapper from "../forms/FormWrapper";
import * as MOCK from "@mds/common/tests/mocks/dataMocks";
import AuthorizationSupportDocumentUpload from "./AuthorizationSupportDocumentUpload";
+const formValues = {}
const initialState = {
form: {
[FORM.ADD_EDIT_PROJECT_SUMMARY]: {
- values: {},
+ values: formValues,
},
},
[PROJECTS]: {
@@ -30,15 +31,14 @@ describe("AuthorizationSupportDocumentUpload Component", () => {
{}}
+ initialValues={formValues}
+ onSubmit={() => { }}
>
{}}
- removeAmendmentDocument={() => {}}
+ updateAmendmentDocument={() => { }}
+ removeAmendmentDocument={() => { }}
projectGuid={"project_guid"}
projectSummaryGuid={"project_summary_guid"}
showExemptionSection={false}
diff --git a/services/common/src/components/projectSummary/AuthorizationSupportDocumentUpload.tsx b/services/common/src/components/projectSummary/AuthorizationSupportDocumentUpload.tsx
index c3bafbcb92..0e7d01a90b 100644
--- a/services/common/src/components/projectSummary/AuthorizationSupportDocumentUpload.tsx
+++ b/services/common/src/components/projectSummary/AuthorizationSupportDocumentUpload.tsx
@@ -91,7 +91,7 @@ export const AuthorizationSupportDocumentUpload: FC
+
{!isDisabled && (
{
{}}
+ initialValues={MOCK.PROJECT_SUMMARY}
+ onSubmit={() => { }}
>
-
+
diff --git a/services/common/src/components/projectSummary/AuthorizationsInvolved.tsx b/services/common/src/components/projectSummary/AuthorizationsInvolved.tsx
index 8cc723b65f..39374585cf 100644
--- a/services/common/src/components/projectSummary/AuthorizationsInvolved.tsx
+++ b/services/common/src/components/projectSummary/AuthorizationsInvolved.tsx
@@ -1,4 +1,4 @@
-import React, { useContext, useEffect, useState } from "react";
+import React, { FC, useContext, useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Link } from "react-router-dom";
import {
@@ -54,10 +54,11 @@ import {
WASTE_DISCHARGE_NEW_AUTHORIZATIONS_URL,
WASTE_DISCHARGE_AMENDMENT_AUTHORIZATIONS_URL,
} from "../..";
-import { isFieldDisabled } from "../projects/projectUtils";
import { SystemFlagEnum } from "@mds/common/constants/enums";
import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
import { FormContext } from "../forms/FormWrapper";
+import { ProjectSummaryFormComponentProps } from "./ProjectSummaryForm";
+import { areAuthEnvFieldsDisabled, areDocumentFieldsDisabled } from "../projects/projectUtils";
const RenderEMAPermitCommonSections = ({ code, isAmendment, index, isDisabled }) => {
const dispatch = useDispatch();
@@ -65,9 +66,10 @@ const RenderEMAPermitCommonSections = ({ code, isAmendment, index, isDisabled })
? "Additional Amendment Request Information"
: "Purpose of Application";
const authType = isAmendment ? "AMENDMENT" : "NEW";
- const { authorizations, mine_guid, project_guid, project_summary_guid } = useSelector(
+ const { authorizations, mine_guid, project_guid, project_summary_guid, status_code } = useSelector(
getFormValues(FORM.ADD_EDIT_PROJECT_SUMMARY)
) as IProjectSummaryForm;
+ const systemFlag = useSelector(getSystemFlag);
const codeAuthorizations = authorizations[code];
const { AMENDMENT, NEW } = codeAuthorizations;
const sectionValues = isAmendment ? AMENDMENT[index] : NEW[index];
@@ -76,8 +78,9 @@ const RenderEMAPermitCommonSections = ({ code, isAmendment, index, isDisabled })
);
const projectSummaryDocumentTypesHash = useSelector(getProjectSummaryDocumentTypesHash);
+ const docFieldsDisabled = areDocumentFieldsDisabled(systemFlag, status_code);
- const onChange = (value, _newVal, _prevVal, _fieldName) => {
+ const onChange = (value) => {
setShowExemptionSection(value);
};
@@ -222,7 +225,7 @@ const RenderEMAPermitCommonSections = ({ code, isAmendment, index, isDisabled })
showExemptionSection={showExemptionSection}
isAmendment={isAmendment}
amendmentChanges={sectionValues?.amendment_changes}
- isDisabled={isDisabled}
+ isDisabled={docFieldsDisabled}
/>
{
- {isEditMode &&
+ {isEditMode && !isDisabled &&
}
@@ -327,7 +330,7 @@ const RenderEMAAmendFieldArray = ({ fields, code, isDisabled, isEditMode }) => {
validate={[required, minLength(2), maxLength(6), digitCharactersOnly]}
help="Number only (e.g. PC12345 should be entered as 12345)"
component={RenderField}
- isDisabled={isDisabled}
+ disabled={isDisabled}
/>
{
{ label: "Significant", value: "SIG" },
{ label: "Minor", value: "MIN" },
]}
- isDisabled={isDisabled}
+ disabled={isDisabled}
/>
{
{ label: "Regulatory Change", value: "RCH" },
{ label: "Other", value: "OTH" },
]}
- isDisabled={isDisabled}
+ disabled={isDisabled}
/>
{
required
validate={[requiredRadioButton]}
component={RenderRadioButtons}
- isDisabled={isDisabled}
+ disabled={isDisabled}
/>
{
const RenderAuthCodeFormSection = ({ authorizationType, code, isDisabled }) => {
const dropdownProjectSummaryPermitTypes = useSelector(getDropdownProjectSummaryPermitTypes);
- if (authorizationType === "ENVIRONMENTAL_MANAGMENT_ACT") {
+ if (authorizationType === ENVIRONMENTAL_MANAGMENT_ACT) {
// AMS authorizations, have options of amend/new with more details
return ;
}
@@ -526,36 +529,38 @@ const RenderAuthCodeFormSection = ({ authorizationType, code, isDisabled }) => {
return (
-
- {isMinesAct ? (
-
- ) : (
+
val.split(",").map((v) => v.trim())}
- component={RenderField}
- label="If your application involved a change to an existing permit, please list the numbers of the permits involved."
- help="Please separate each permit with a comma"
+ name="project_summary_permit_type"
+ props={{
+ options: dropdownProjectSummaryPermitTypes,
+ label: "What type of permit is involved in your application?",
+ }}
+ component={RenderGroupCheckbox}
+ required
+ validate={[requiredList]}
+ normalize={normalizeGroupCheckBox}
/>
- )}
+ {isMinesAct ? (
+
+ ) : (
+ val.split(",").map((v) => v.trim())}
+ component={RenderField}
+ label="If your application involved a change to an existing permit, please list the numbers of the permits involved."
+ help="Please separate each permit with a comma"
+ />
+ )}
+
);
};
-export const AuthorizationsInvolved = () => {
+export const AuthorizationsInvolved: FC = ({ fieldsDisabled }) => {
const dispatch = useDispatch();
const transformedProjectSummaryAuthorizationTypes = useSelector(
getTransformedProjectSummaryAuthorizationTypes
@@ -566,6 +571,7 @@ export const AuthorizationsInvolved = () => {
const systemFlag = useSelector(getSystemFlag);
const isCore = systemFlag === SystemFlagEnum.core;
+ const envFieldsDisabled = areAuthEnvFieldsDisabled(systemFlag, formValues?.status_code);
const handleChange = (e, code) => {
if (e.target.checked) {
@@ -602,6 +608,7 @@ export const AuthorizationsInvolved = () => {
component={RenderHiddenField}
required
validate={[requiredList]}
+ disabled={fieldsDisabled}
label={Regulatory Approval Type}
>
@@ -632,18 +639,22 @@ export const AuthorizationsInvolved = () => {
{authorization.children.map((child) => {
const checked = formValues.authorizationTypes?.includes(child.code);
+ const isEnv = authorization?.code === ENVIRONMENTAL_MANAGMENT_ACT;
+ const isDisabled = fieldsDisabled || (isEnv && envFieldsDisabled);
+
return (
handleChange(e, child.code)}
>
- {child.description}
+ {child.description}
{checked && (
<>
@@ -691,11 +702,7 @@ export const AuthorizationsInvolved = () => {
/>
)}
diff --git a/services/common/src/components/projectSummary/BasicInformation.spec.tsx b/services/common/src/components/projectSummary/BasicInformation.spec.tsx
index 3c4e4f5696..8f2a828df9 100644
--- a/services/common/src/components/projectSummary/BasicInformation.spec.tsx
+++ b/services/common/src/components/projectSummary/BasicInformation.spec.tsx
@@ -19,8 +19,8 @@ describe("BasicInformation", () => {
test("renders properly", () => {
const { container } = render(
- {}}>
-
+ { }}>
+
);
diff --git a/services/common/src/components/projectSummary/BasicInformation.tsx b/services/common/src/components/projectSummary/BasicInformation.tsx
index a4ee1eecfb..47f0f960f5 100644
--- a/services/common/src/components/projectSummary/BasicInformation.tsx
+++ b/services/common/src/components/projectSummary/BasicInformation.tsx
@@ -1,19 +1,12 @@
-import React from "react";
+import React, { FC } from "react";
import { Typography } from "antd";
-import { Field, getFormValues } from "redux-form";
-import { useSelector } from "react-redux";
+import { Field } from "redux-form";
import { maxLength, required } from "@mds/common/redux/utils/Validate";
import RenderField from "@mds/common/components/forms/RenderField";
import RenderAutoSizeField from "@mds/common/components/forms/RenderAutoSizeField";
-import { FORM } from "@mds/common/constants";
-import { isFieldDisabled } from "../projects/projectUtils";
-import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
-import { IProjectSummaryForm } from "@mds/common/interfaces";
-
-export const BasicInformation = () => {
- const formValues = useSelector(getFormValues(FORM.ADD_EDIT_PROJECT_SUMMARY)) as IProjectSummaryForm;
- const systemFlag = useSelector(getSystemFlag);
+import { ProjectSummaryFormComponentProps } from "./ProjectSummaryForm";
+export const BasicInformation: FC = ({ fieldsDisabled }) => {
return (
<>
Basic Information
@@ -24,7 +17,7 @@ export const BasicInformation = () => {
required
component={RenderField}
validate={[maxLength(300), required]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{
labelSubtitle="If your company uses a tracking number to identify projects, please provide it here."
component={RenderField}
validate={[maxLength(20)]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{
minRows={10}
maximumCharacters={4000}
validate={[maxLength(4000), required]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
>
);
diff --git a/services/common/src/components/projectSummary/DocumentUpload.spec.tsx b/services/common/src/components/projectSummary/DocumentUpload.spec.tsx
index 5eec638418..84860e2331 100644
--- a/services/common/src/components/projectSummary/DocumentUpload.spec.tsx
+++ b/services/common/src/components/projectSummary/DocumentUpload.spec.tsx
@@ -25,10 +25,10 @@ describe("DocumentUpload", () => {
{}}
+ initialValues={MOCK.PROJECT_SUMMARY}
+ onSubmit={() => { }}
>
-
+
);
diff --git a/services/common/src/components/projectSummary/DocumentUpload.tsx b/services/common/src/components/projectSummary/DocumentUpload.tsx
index ad22a34551..10c1c1701f 100644
--- a/services/common/src/components/projectSummary/DocumentUpload.tsx
+++ b/services/common/src/components/projectSummary/DocumentUpload.tsx
@@ -15,7 +15,6 @@ import {
FORM,
PROJECT_SUMMARY_DOCUMENT_TYPE_CODE,
} from "@mds/common/constants";
-import { isDocumentFieldDisabled } from "../projects/projectUtils";
import { postNewDocumentVersion } from "@mds/common/redux/actionCreators/documentActionCreator";
import LinkButton from "../common/LinkButton";
import * as API from "@mds/common/constants/API";
@@ -25,7 +24,6 @@ import SpatialDocumentTable from "../documents/spatial/SpatialDocumentTable";
import { FormContext } from "../forms/FormWrapper";
import { useFeatureFlag } from "@mds/common/providers/featureFlags/useFeatureFlag";
import { Feature, IProjectSummaryForm } from "../..";
-import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
const RenderOldDocuments = ({
documents,
@@ -67,9 +65,12 @@ const RenderOldDocuments = ({
);
};
-export const DocumentUpload: FC = () => {
+interface DocumentUploadProps {
+ docFieldsDisabled: boolean;
+}
+
+export const DocumentUpload: FC = ({ docFieldsDisabled }) => {
const dispatch = useDispatch();
- const systemFlag = useSelector(getSystemFlag);
const {
spatial_documents = [],
support_documents = [],
@@ -77,7 +78,6 @@ export const DocumentUpload: FC = () => {
project_guid,
project_summary_guid,
documents,
- status_code,
} = useSelector(getFormValues(FORM.ADD_EDIT_PROJECT_SUMMARY)) as IProjectSummaryForm;
const { isEditMode } = useContext(FormContext);
@@ -220,9 +220,8 @@ export const DocumentUpload: FC = () => {
{spatialFeatureEnabled ? (
<>
- {isEditMode && (
+ {isEditMode && !docFieldsDisabled && (
{
component={RenderField}
/>
{
component={RenderSelect}
/>
{
/>
{
/>
{zoning === false && (
{
{
{
{
{
{
{}}>
-
+ { }}>
+
);
diff --git a/services/common/src/components/projectSummary/LegalLandOwnerInformation.tsx b/services/common/src/components/projectSummary/LegalLandOwnerInformation.tsx
index 14f34b9e8f..6b692eb8f6 100644
--- a/services/common/src/components/projectSummary/LegalLandOwnerInformation.tsx
+++ b/services/common/src/components/projectSummary/LegalLandOwnerInformation.tsx
@@ -15,17 +15,16 @@ import {
min,
} from "@mds/common/redux/utils/Validate";
import { FORM } from "@mds/common/constants";
-import { isFieldDisabled } from "../projects/projectUtils";
import RenderField from "../forms/RenderField";
import { getDropdownMunicipalities } from "@mds/common/redux/selectors/staticContentSelectors";
import RenderSelect from "@mds/common/components/forms/RenderSelect";
import { normalizePhone } from "@mds/common/redux/utils/helpers";
import CoreMap from "../common/Map";
import RenderAutoSizeField from "../forms/RenderAutoSizeField";
-import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
import { IProjectSummaryForm } from "@mds/common/interfaces";
+import { ProjectSummaryFormComponentProps } from "./ProjectSummaryForm";
-export const LegalLandOwnerInformation: FC = () => {
+export const LegalLandOwnerInformation: FC = ({ fieldsDisabled }) => {
const formValues = useSelector(getFormValues(FORM.ADD_EDIT_PROJECT_SUMMARY)) as IProjectSummaryForm;
const formErrors = useSelector(getFormSyncErrors(FORM.ADD_EDIT_PROJECT_SUMMARY)) as any;
@@ -40,7 +39,6 @@ export const LegalLandOwnerInformation: FC = () => {
const [pin, setPin] = useState>([]);
const municipalityOptions = useSelector(getDropdownMunicipalities);
- const systemFlag = useSelector(getSystemFlag);
const dataSourceOptions = [
{ value: "GPS", label: "GPS" },
@@ -69,7 +67,7 @@ export const LegalLandOwnerInformation: FC = () => {
validate={[requiredRadioButton]}
label="Is the Applicant the Legal Land Owner?"
component={RenderRadioButtons}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{!is_legal_land_owner && (
<>
@@ -82,7 +80,7 @@ export const LegalLandOwnerInformation: FC = () => {
validate={!is_legal_land_owner ? [requiredRadioButton] : []}
label="Is this federal or provincial Crown land?"
component={RenderRadioButtons}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -93,7 +91,7 @@ export const LegalLandOwnerInformation: FC = () => {
validate={!is_legal_land_owner ? [requiredRadioButton] : []}
label="Is the Legal Land Owner aware of the proposed application to discharge waste?"
component={RenderRadioButtons}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -108,7 +106,7 @@ export const LegalLandOwnerInformation: FC = () => {
required={!is_legal_land_owner}
validate={!is_legal_land_owner ? [required, maxLength(100)] : [maxLength(100)]}
help="If it is provincial or federal, write in that"
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -120,7 +118,7 @@ export const LegalLandOwnerInformation: FC = () => {
validate={!is_legal_land_owner ? [requiredRadioButton] : []}
label="Has the Legal Land Owner received a copy of this application?"
component={RenderRadioButtons}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -136,7 +134,7 @@ export const LegalLandOwnerInformation: FC = () => {
!is_legal_land_owner ? [phoneNumber, maxLength(12), required] : [maxLength(12)]
}
normalize={normalizePhone}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -149,7 +147,7 @@ export const LegalLandOwnerInformation: FC = () => {
validate={
!is_legal_land_owner ? [required, email, maxLength(100)] : [maxLength(100)]
}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -165,7 +163,7 @@ export const LegalLandOwnerInformation: FC = () => {
label="Latitude"
component={RenderField}
help="Must be between 47 and 60 with no more than 7 decimal places"
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{
label="Longitude"
component={RenderField}
help="Must be between -113 and -140 with no more than 7 decimal places"
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{
label="Source of Data"
data={dataSourceOptions}
component={RenderSelect}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -199,7 +197,7 @@ export const LegalLandOwnerInformation: FC = () => {
maximumCharacters={4000}
rows={3}
component={RenderAutoSizeField}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
)}
@@ -212,7 +210,7 @@ export const LegalLandOwnerInformation: FC = () => {
component={RenderSelect}
data={municipalityOptions}
validate={[required]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
@@ -223,7 +221,7 @@ export const LegalLandOwnerInformation: FC = () => {
validate={!legal_land_desc ? [required, maxLength(100)] : [maxLength(100)]}
maximumCharacters={100}
required={!legal_land_desc}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{
rows={3}
component={RenderAutoSizeField}
required={!facility_pid_pin_crown_file_no}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
{
required
component={RenderField}
validate={[required, maxLength(100)]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ disabled={fieldsDisabled}
/>
);
diff --git a/services/common/src/components/projectSummary/PaymentContact.tsx b/services/common/src/components/projectSummary/PaymentContact.tsx
index 72a16c75cf..e9ef24ecc9 100644
--- a/services/common/src/components/projectSummary/PaymentContact.tsx
+++ b/services/common/src/components/projectSummary/PaymentContact.tsx
@@ -85,7 +85,7 @@ export const PaymentContact = ({ isDisabled }) => {
/>
-
+
{
it("should render the component with expected fields", () => {
const { container } = render(
- {}}>
-
+ { }}>
+
);
diff --git a/services/common/src/components/projectSummary/ProjectContacts.tsx b/services/common/src/components/projectSummary/ProjectContacts.tsx
index dd30b249ce..6c48414b92 100644
--- a/services/common/src/components/projectSummary/ProjectContacts.tsx
+++ b/services/common/src/components/projectSummary/ProjectContacts.tsx
@@ -16,13 +16,12 @@ import {
import { normalizePhone } from "@mds/common/redux/utils/helpers";
import LinkButton from "@mds/common/components/common/LinkButton";
import { FORM, CONTACTS_COUNTRY_OPTIONS } from "@mds/common/constants";
-import { isFieldDisabled } from "../projects/projectUtils";
import RenderField from "@mds/common/components/forms/RenderField";
import RenderSelect from "@mds/common/components/forms/RenderSelect";
import { getDropdownProvinceOptions } from "@mds/common/redux/selectors/staticContentSelectors";
-import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
import { FormContext } from "../forms/FormWrapper";
import { IProjectSummaryForm } from "@mds/common/interfaces";
+import { ProjectSummaryFormComponentProps } from "./ProjectSummaryForm";
const RenderContacts = ({ fields, isDisabled }) => {
const dispatch = useDispatch();
@@ -68,7 +67,7 @@ const RenderContacts = ({ fields, isDisabled }) => {
Additional project contact #{index}
- {isEditMode &&
+ {isEditMode && !isDisabled &&
{
);
})}
- {isEditMode && fields.push({ is_primary: false })}
title="Add additional project contacts"
>
@@ -268,11 +266,10 @@ const RenderContacts = ({ fields, isDisabled }) => {
);
};
-export const ProjectContacts: FC = () => {
+export const ProjectContacts: FC = ({ fieldsDisabled }) => {
const dispatch = useDispatch();
const formValues = useSelector(getFormValues(FORM.ADD_EDIT_PROJECT_SUMMARY)) as IProjectSummaryForm;
const { contacts } = formValues;
- const systemFlag = useSelector(getSystemFlag);
useEffect(() => {
if (isNil(contacts) || contacts.length === 0) {
@@ -285,7 +282,7 @@ export const ProjectContacts: FC = () => {
Project Contacts
>
diff --git a/services/common/src/components/projectSummary/ProjectDates.spec.tsx b/services/common/src/components/projectSummary/ProjectDates.spec.tsx
index b786aeda07..73da21ca34 100644
--- a/services/common/src/components/projectSummary/ProjectDates.spec.tsx
+++ b/services/common/src/components/projectSummary/ProjectDates.spec.tsx
@@ -27,10 +27,10 @@ describe("ProjectDates", () => {
{}}
+ initialValues={MOCK.PROJECT_SUMMARY}
+ onSubmit={() => { }}
>
-
+
);
diff --git a/services/common/src/components/projectSummary/ProjectDates.tsx b/services/common/src/components/projectSummary/ProjectDates.tsx
index 19443f6c5d..a7d90aebef 100644
--- a/services/common/src/components/projectSummary/ProjectDates.tsx
+++ b/services/common/src/components/projectSummary/ProjectDates.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { FC } from "react";
import { useSelector } from "react-redux";
import { Field, getFormValues } from "redux-form";
import { Col, Row, Typography } from "antd";
@@ -9,19 +9,17 @@ import {
} from "@mds/common/redux/utils/Validate";
import Callout from "@mds/common/components/common/Callout";
import { FORM } from "@mds/common/constants";
-import { isFieldDisabled } from "../projects/projectUtils";
import RenderDate from "@mds/common/components/forms/RenderDate";
-import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
import { IProjectSummaryForm } from "@mds/common/interfaces";
+import { ProjectSummaryFormComponentProps } from "./ProjectSummaryForm";
-export const ProjectDates = () => {
+export const ProjectDates: FC = ({ fieldsDisabled }) => {
const formValues = useSelector(getFormValues(FORM.ADD_EDIT_PROJECT_SUMMARY)) as IProjectSummaryForm;
const {
expected_permit_application_date,
expected_draft_irt_submission_date,
expected_permit_receipt_date,
} = formValues;
- const systemFlag = useSelector(getSystemFlag);
return (
<>
@@ -54,8 +52,8 @@ export const ProjectDates = () => {
placeholder="Please select date"
component={RenderDate}
allowClear
- validate={[dateInFuture, dateNotAfterOther(expected_permit_application_date, "the expected permit application date")]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ validate={!fieldsDisabled ? [dateInFuture, dateNotAfterOther(expected_permit_application_date, "the expected permit application date")] : []}
+ disabled={fieldsDisabled}
/>
@@ -66,8 +64,8 @@ export const ProjectDates = () => {
placeholder="Please select date"
component={RenderDate}
allowClear
- validate={[dateInFuture, dateNotBeforeOther(expected_draft_irt_submission_date, "the expected draft IRT submission date")]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ validate={!fieldsDisabled ? [dateInFuture, dateNotBeforeOther(expected_draft_irt_submission_date, "the expected draft IRT submission date")] : []}
+ disabled={fieldsDisabled}
/>
@@ -78,8 +76,8 @@ export const ProjectDates = () => {
placeholder="Please select date"
component={RenderDate}
allowClear
- validate={[dateInFuture, dateNotBeforeOther(expected_permit_application_date, "the expected permit application date")]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ validate={!fieldsDisabled ? [dateInFuture, dateNotBeforeOther(expected_permit_application_date, "the expected permit application date")] : []}
+ disabled={fieldsDisabled}
/>
@@ -90,8 +88,8 @@ export const ProjectDates = () => {
placeholder="Please select date"
component={RenderDate}
allowClear
- validate={[dateInFuture, dateNotBeforeOther(expected_permit_receipt_date, "the expected permit receipt date")]}
- disabled={isFieldDisabled(systemFlag, formValues?.status_code)}
+ validate={!fieldsDisabled ? [dateInFuture, dateNotBeforeOther(expected_permit_receipt_date, "the expected permit receipt date")] : []}
+ disabled={fieldsDisabled}
/>
diff --git a/services/common/src/components/projectSummary/ProjectLinks.spec.tsx b/services/common/src/components/projectSummary/ProjectLinks.spec.tsx
index abc5d69e6c..2bb1b29154 100644
--- a/services/common/src/components/projectSummary/ProjectLinks.spec.tsx
+++ b/services/common/src/components/projectSummary/ProjectLinks.spec.tsx
@@ -21,10 +21,10 @@ describe("ProjectLinks Component", () => {
{}}
+ initialValues={MOCK.PROJECT_SUMMARY}
+ onSubmit={() => { }}
>
- ""} />
+ ""} />
);
diff --git a/services/common/src/components/projectSummary/ProjectLinks.tsx b/services/common/src/components/projectSummary/ProjectLinks.tsx
index 3fa3d78508..6d6dec0b6a 100644
--- a/services/common/src/components/projectSummary/ProjectLinks.tsx
+++ b/services/common/src/components/projectSummary/ProjectLinks.tsx
@@ -1,14 +1,14 @@
import React, { FC, useContext, useEffect, useState } from "react";
import { useSelector, useDispatch } from "react-redux";
-import { Field, change, getFormValues } from "redux-form";
+import { Field, change } from "redux-form";
import { Button, Col, Row, Typography } from "antd";
import ProjectLinksTable from "@mds/common/components/projectSummary/ProjectLinksTable";
-import { ILinkedProject, IProject, IProjectSummaryForm } from "@mds/common/interfaces";
+import { ILinkedProject, IProject } from "@mds/common/interfaces";
import {
FORM,
USER_ROLES,
} from "@mds/common/constants";
-import { isFieldDisabled, getProjectStatusDescription } from "../projects/projectUtils";
+import { getProjectStatusDescription } from "../projects/projectUtils";
import { isProponent, userHasRole } from "@mds/common/redux/reducers/authenticationReducer";
import {
createProjectLinks,
@@ -18,10 +18,10 @@ import { getProject, getProjects } from "@mds/common/redux/selectors/projectSele
import { dateSorter } from "@mds/common/redux/utils/helpers";
import RenderMultiSelect from "../forms/RenderMultiSelect";
import * as Strings from "@mds/common/constants/strings";
-import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";
import { FormContext } from "../forms/FormWrapper";
+import { ProjectSummaryFormComponentProps } from "./ProjectSummaryForm";
-interface ProjectLinksProps {
+interface ProjectLinksProps extends ProjectSummaryFormComponentProps {
viewProject: (record: ILinkedProject) => string;
tableOnly?: boolean; // only show the table, no inputs
}
@@ -31,8 +31,6 @@ const ProjectLinkInput = ({ unrelatedProjects = [], mineGuid, projectGuid }) =>
const [currentSelection, setCurrentSelection] = useState([]);
const formName = FORM.ADD_EDIT_PROJECT_SUMMARY;
const fieldName = "linked-projects";
- const formValues = useSelector(getFormValues(formName)) as IProjectSummaryForm;
- const systemFlag = useSelector(getSystemFlag);
if (!projectGuid) {
return (
@@ -67,7 +65,6 @@ const ProjectLinkInput = ({ unrelatedProjects = [], mineGuid, projectGuid }) =>
/>
@@ -226,6 +687,7 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
@@ -234,7 +696,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Effluent discharge permit
@@ -260,6 +724,7 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
@@ -268,7 +733,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Refuse discharge permit
@@ -303,6 +770,7 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
@@ -311,7 +779,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Change approval
@@ -337,6 +807,7 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
@@ -345,7 +816,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Use approval
@@ -363,14 +836,16 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
style="padding-top: 8px; padding-bottom: 8px;"
>
+
@@ -406,14 +1105,16 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
style="padding-top: 8px; padding-bottom: 8px;"
>
+
@@ -449,14 +1374,16 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
style="padding-top: 8px; padding-bottom: 8px;"
>
+
diff --git a/services/common/src/components/projectSummary/__snapshots__/DocumentUpload.spec.tsx.snap b/services/common/src/components/projectSummary/__snapshots__/DocumentUpload.spec.tsx.snap
index aa6f275bc1..9a2f9204be 100644
--- a/services/common/src/components/projectSummary/__snapshots__/DocumentUpload.spec.tsx.snap
+++ b/services/common/src/components/projectSummary/__snapshots__/DocumentUpload.spec.tsx.snap
@@ -307,7 +307,7 @@ exports[`DocumentUpload renders properly 1`] = `
>
|
Object).values(PROJECT_STATUS_CODES);
+
+const TEST_PARAMETERS = [
+ {
+ label: "areFieldsDisabled",
+ testFunction: areFieldsDisabled,
+ coreDisabledStatuses: ["WDN", "COM"],
+ coreEnabledStatuses: ["DFT", "SUB", "ASG", "UNR", "CHR", "OHD"],
+ msDisabledStatuses: ["SUB", "ASG", "UNR", "WDN", "OHD", "COM"],
+ msEnabledStatuses: ["DFT", "CHR"],
+ },
+ {
+ label: "areDocumentFieldsDisabled",
+ testFunction: areDocumentFieldsDisabled,
+ coreDisabledStatuses: ["WDN", "COM"],
+ coreEnabledStatuses: ["DFT", "SUB", "ASG", "UNR", "CHR", "OHD"],
+ msDisabledStatuses: ["UNR", "WDN", "OHD", "COM"],
+ msEnabledStatuses: ["DFT", "SUB", "ASG", "CHR"],
+ },
+ {
+ label: "areAuthFieldsDisabled",
+ testFunction: areAuthFieldsDisabled,
+ coreDisabledStatuses: ["WDN", "COM", "CHR", "UNR"],
+ coreEnabledStatuses: ["DFT", "SUB", "ASG", "OHD"],
+ msDisabledStatuses: ["UNR", "WDN", "OHD", "COM", "SUB", "ASG", "CHR"],
+ msEnabledStatuses: ["DFT"],
+ },
+ {
+ label: "areAuthEnvFieldsDisabled",
+ testFunction: areAuthEnvFieldsDisabled,
+ coreDisabledStatuses: ["WDN", "COM", "ASG", "UNR", "CHR", "OHD", "SUB"],
+ coreEnabledStatuses: ["DFT"],
+ msDisabledStatuses: ["UNR", "WDN", "OHD", "COM", "SUB", "ASG", "CHR"],
+ msEnabledStatuses: ["DFT"],
+ }
+];
+
+TEST_PARAMETERS.forEach(
+ ({ label, testFunction, coreDisabledStatuses, coreEnabledStatuses, msDisabledStatuses, msEnabledStatuses }) => {
+ describe(label, () => {
+ const coreStatuses = [...coreDisabledStatuses, ...coreEnabledStatuses];
+ const msStatuses = [...msDisabledStatuses, ...msEnabledStatuses];
+
+ enumValues.forEach((status) => {
+ it(`Enum value ${status} should be included in testing`, () => {
+ const coreIncludes = coreStatuses.includes(status);
+ const msIncludes = msStatuses.includes(status);
+ expect(coreIncludes).toBe(true);
+ expect(msIncludes).toBe(true);
+ });
+ });
+
+ coreDisabledStatuses.forEach((status) => {
+ it(`CORE status: ${status} Should return true (disabled)`, () => {
+ const result = testFunction(SystemFlagEnum.core, status);
+ expect(result).toBe(true);
+ });
+ });
+ msDisabledStatuses.forEach((status) => {
+ it(`MS status: ${status} Should return true (disabled)`, () => {
+ const result = testFunction(SystemFlagEnum.ms, status);
+ expect(result).toBe(true);
+ });
+ });
+
+ coreEnabledStatuses.forEach((status) => {
+ it(`CORE status: ${status} Should return false (enabled)`, () => {
+ const result = testFunction(SystemFlagEnum.core, status);
+ expect(result).toBe(false);
+ });
+ });
+ msEnabledStatuses.forEach((status) => {
+ it(`MS status: ${status} Should return false (enabled)`, () => {
+ const result = testFunction(SystemFlagEnum.ms, status);
+ expect(result).toBe(false);
+ });
+ });
+
+ it("should return false (enabled) when there is no status", () => {
+ const coreResult = testFunction(SystemFlagEnum.core, "");
+ expect(coreResult).toBe(false);
+ const msResult = testFunction(SystemFlagEnum.ms, "");
+ expect(msResult).toBe(false);
+ });
+ });
+ })
+
+// when it says that the user can make changes except env/auths, does that include docs?
\ No newline at end of file
diff --git a/services/common/src/components/projects/projectUtils.ts b/services/common/src/components/projects/projectUtils.ts
index 5e1efef517..4f0d47ac3c 100644
--- a/services/common/src/components/projects/projectUtils.ts
+++ b/services/common/src/components/projects/projectUtils.ts
@@ -1,44 +1,64 @@
-import { SystemFlagEnum } from "@mds/common/constants/enums";
+import { PROJECT_STATUS_CODES, SystemFlagEnum } from "@mds/common/constants/enums";
+import { memoize } from "lodash";
-export const isFieldDisabled = (
- systemFlag,
- projectSummaryStatusCode = "",
- isAuthorizationPage = false
-) => {
- // Return false if status = "" => "Not Started"
- if (!projectSummaryStatusCode) return false;
+export const areFieldsDisabled = memoize((systemFlag: SystemFlagEnum, projectSummaryStatusCode: string) => {
+ // Return false (enabled) if status = "" => "Not Started"
+ const isStatusInEnum = (Object).values(PROJECT_STATUS_CODES).includes(projectSummaryStatusCode);
+
+ if (!isStatusInEnum) return false;
+ const projectSummaryStatus = projectSummaryStatusCode as PROJECT_STATUS_CODES;
+
+ const disabledStatuses = [PROJECT_STATUS_CODES.WDN, PROJECT_STATUS_CODES.COM];
+
+ const enabledStatuses = systemFlag === SystemFlagEnum.core
+ ? [PROJECT_STATUS_CODES.DFT, PROJECT_STATUS_CODES.ASG, PROJECT_STATUS_CODES.UNR, PROJECT_STATUS_CODES.CHR, PROJECT_STATUS_CODES.OHD, PROJECT_STATUS_CODES.SUB]
+ : [PROJECT_STATUS_CODES.DFT, PROJECT_STATUS_CODES.CHR];
+
+ if (disabledStatuses.includes(projectSummaryStatus)) return true;
+ return !enabledStatuses.includes(projectSummaryStatus);
+
+},
+ (systemFlag: SystemFlagEnum, projectSummaryStatusCode: string) => `${systemFlag}_${projectSummaryStatusCode}`);
+
+export const areAuthFieldsDisabled = memoize((systemFlag: SystemFlagEnum, projectSummaryStatusCode: string) => {
+ const fieldsDisabled = areFieldsDisabled(systemFlag, projectSummaryStatusCode);
+ if (fieldsDisabled) return true;
+
+ const extraDisabledStatuses = [PROJECT_STATUS_CODES.CHR, PROJECT_STATUS_CODES.UNR];
+ const authDisabled = extraDisabledStatuses.includes(projectSummaryStatusCode as PROJECT_STATUS_CODES)
+ return authDisabled;
+}, (systemFlag: SystemFlagEnum, projectSummaryStatusCode: string) => `${systemFlag}_${projectSummaryStatusCode}`);
- const disabledStatuses = new Set(["WDN", "COM"]);
- const enabledStatusMapping = {
- [SystemFlagEnum.ms]: new Set(["DFT", "CHR"]),
- [SystemFlagEnum.core]: new Set(["DFT", "ASG", "UNR", "CHR", "OHD"]),
- };
+export const areAuthEnvFieldsDisabled = memoize((systemFlag, projectSummaryStatusCode) => {
+ const authFieldsDisabled = areAuthFieldsDisabled(systemFlag, projectSummaryStatusCode);
+ if (authFieldsDisabled) return true;
- if (disabledStatuses.has(projectSummaryStatusCode)) return true;
+ const extraDisabledStatuses = systemFlag === SystemFlagEnum.core
+ ? [PROJECT_STATUS_CODES.ASG, PROJECT_STATUS_CODES.OHD, PROJECT_STATUS_CODES.SUB]
+ : [PROJECT_STATUS_CODES.CHR];
- const enabledStatuses = enabledStatusMapping[systemFlag];
- const isFieldEnabled = enabledStatuses?.has(projectSummaryStatusCode) ?? false;
+ const envDisabled = extraDisabledStatuses.includes(projectSummaryStatusCode as PROJECT_STATUS_CODES);
- if (!isFieldEnabled) return true;
+ return envDisabled;
+}, (systemFlag: SystemFlagEnum, projectSummaryStatusCode: string) => `${systemFlag}_${projectSummaryStatusCode}`);
- return isAuthorizationPage ? projectSummaryStatusCode !== "DFT" : false;
-};
+export const areDocumentFieldsDisabled = memoize((systemFlag: SystemFlagEnum, projectSummaryStatusCode: string) => {
+ // Return false (enabled) if status = "" => "Not Started"
+ const isStatusInEnum = (Object).values(PROJECT_STATUS_CODES).includes(projectSummaryStatusCode)
+ if (!isStatusInEnum) return false;
-export const isDocumentFieldDisabled = (systemFlag, projectSummaryStatusCode = "") => {
- // Return false if status = "" => "Not Started"
- if (!projectSummaryStatusCode) return false;
+ const projectSummaryStatus = projectSummaryStatusCode as PROJECT_STATUS_CODES;
+ const disabledStatuses = [PROJECT_STATUS_CODES.WDN, PROJECT_STATUS_CODES.COM];
- const disabledStatuses = new Set(["WDN", "COM"]);
- const enabledStatusMapping = {
- [SystemFlagEnum.ms]: new Set(["DFT", "SUB", "ASG", "CHR"]),
- [SystemFlagEnum.core]: new Set(["DFT", "SUB", "ASG", "UNR", "CHR", "OHD"]),
- };
+ const enabledStatuses = systemFlag === SystemFlagEnum.core
+ ? [PROJECT_STATUS_CODES.DFT, PROJECT_STATUS_CODES.SUB, PROJECT_STATUS_CODES.ASG, PROJECT_STATUS_CODES.UNR, PROJECT_STATUS_CODES.CHR, PROJECT_STATUS_CODES.OHD]
+ : [PROJECT_STATUS_CODES.DFT, PROJECT_STATUS_CODES.SUB, PROJECT_STATUS_CODES.ASG, PROJECT_STATUS_CODES.CHR];
- if (disabledStatuses.has(projectSummaryStatusCode)) return true;
+ if (disabledStatuses.includes(projectSummaryStatus)) return true;
+ return !enabledStatuses.includes(projectSummaryStatus);
- const enabledStatuses = enabledStatusMapping[systemFlag];
- return !enabledStatuses?.has(projectSummaryStatusCode);
-};
+},
+ (systemFlag: SystemFlagEnum, projectSummaryStatusCode: string) => `${systemFlag}_${projectSummaryStatusCode}`);
export const getProjectStatusDescription = (
projectSummaryStatusCode,
diff --git a/services/common/src/components/reports/__snapshots__/ReportDetailsForm-edit.spec.tsx.snap b/services/common/src/components/reports/__snapshots__/ReportDetailsForm-edit.spec.tsx.snap
index 82598dbd66..42d267ed3c 100644
--- a/services/common/src/components/reports/__snapshots__/ReportDetailsForm-edit.spec.tsx.snap
+++ b/services/common/src/components/reports/__snapshots__/ReportDetailsForm-edit.spec.tsx.snap
@@ -878,6 +878,7 @@ exports[`ReportDetailsForm renders edit mode properly 1`] = `
>
{
return formattedContacts;
};
-const formatAuthorizations = (amsAuthTypes, statusCode, authorizations = []) => {
+const formatAuthorizations = (amsAuthTypes, confirmation_of_submission, authorizations = []) => {
const authorizationTypes = uniq(authorizations?.map((a) => a.project_summary_authorization_type));
const formattedAuthorizations = {};
let ams_terms_agreed = false;
@@ -99,7 +99,7 @@ const formatAuthorizations = (amsAuthTypes, statusCode, authorizations = []) =>
}
});
// ams terms will be true on load if record is submitted with ams auths
- ams_terms_agreed = ams_terms_agreed && statusCode === "SUB";
+ ams_terms_agreed = ams_terms_agreed && confirmation_of_submission;
return { authorizations: formattedAuthorizations, authorizationTypes, ams_terms_agreed };
};
@@ -138,27 +138,34 @@ export const getFormattedProjectApplication = createSelector(
}
);
+const formatProjectSummary = (summary, project, amsAuthTypes) => {
+ const documents = formatProjectSummaryDocuments(summary.documents);
+ const contacts = formatProjectContact(project.contacts);
+ const agent = formatProjectSummaryParty(summary.agent);
+ const facility_operator = formatProjectSummaryParty(summary.facility_operator);
+ const confirmation_of_submission = summary.submission_date ? true : undefined;
+
+ const formattedSummary = {
+ ...summary,
+ contacts,
+ agent,
+ facility_operator,
+ confirmation_of_submission,
+ ...formatAuthorizations(amsAuthTypes, confirmation_of_submission, summary.authorizations),
+ ...documents,
+ };
+
+ formattedSummary.project_lead_party_guid = project.project_lead_party_guid;
+ return formattedSummary;
+}
+
export const getFormattedProjectSummary = createSelector(
[getProjectSummary, getProject, getAmsAuthorizationTypes],
(summary, project, amsAuthTypes) => {
- const documents = formatProjectSummaryDocuments(summary.documents);
- const contacts = formatProjectContact(project.contacts);
- const agent = formatProjectSummaryParty(summary.agent);
- const facility_operator = formatProjectSummaryParty(summary.facility_operator);
- const confirmation_of_submission = summary.status_code === "SUB";
-
- const formattedSummary = {
- ...summary,
- contacts,
- agent,
- facility_operator,
- confirmation_of_submission,
- ...formatAuthorizations(amsAuthTypes, summary.status_code, summary.authorizations),
- ...documents,
- };
-
- formattedSummary.project_lead_party_guid = project.project_lead_party_guid;
-
- return formattedSummary;
+ return formatProjectSummary(summary, project, amsAuthTypes);
}
);
+
+export const exportForTesting = {
+ formatProjectSummary
+}
diff --git a/services/common/src/setupTests.ts b/services/common/src/setupTests.ts
index eb1ea9fe2f..ea46a880a9 100644
--- a/services/common/src/setupTests.ts
+++ b/services/common/src/setupTests.ts
@@ -53,6 +53,14 @@ jest.mock("@mds/common/providers/featureFlags/useFeatureFlag", () => ({
isFeatureEnabled: () => true,
}),
}));
+
+jest.mock("@mds/common/redux/createAppSlice", () => {
+ const original = jest.requireActual("@mds/common/redux/createAppSlice");
+ return {
+ ...original,
+ rejectHandler: jest.fn(),
+ };
+});
window.scrollTo = jest.fn();
const location = JSON.stringify(window.location);
delete window.location;
@@ -86,7 +94,7 @@ global.document.createElementNS = function (namespaceURI, qualifiedName) {
if (namespaceURI === "http://www.w3.org/2000/svg" && qualifiedName === "svg") {
// eslint-disable-next-line prefer-rest-params
const element = createElementNSOrig.apply(this, arguments);
- element.createSVGRect = function () {};
+ element.createSVGRect = function () { };
return element;
}
// eslint-disable-next-line prefer-rest-params
diff --git a/services/common/src/tests/mocks/dataMocks.tsx b/services/common/src/tests/mocks/dataMocks.tsx
index 106fbe01ff..534c7f615c 100644
--- a/services/common/src/tests/mocks/dataMocks.tsx
+++ b/services/common/src/tests/mocks/dataMocks.tsx
@@ -14,6 +14,7 @@ import {
MINE_INCIDENT_DOCUMENT_TYPE_CODE,
NodStatusSaveEnum,
NoDTypeSaveEnum,
+ PROJECT_STATUS_CODES,
PROJECT_SUMMARY_STATUS_CODES,
SystemFlagEnum,
VC_CONNECTION_STATES,
@@ -7551,7 +7552,7 @@ export const PROJECT_SUMMARY: IProjectSummary = {
mine_guid: "60300a07-376c-46f1-a984-88a813f91438",
project_guid: "74120872-74f2-4e27-82e6-878ddb472e5a",
project_summary_guid: "70414192-ca71-4d03-93a5-630491e9c554",
- status_code: "OPN",
+ status_code: PROJECT_STATUS_CODES.DFT,
project_summary_title: "Sample title",
project_summary_description: "Sample description",
project_summary_id: 1304,
@@ -7637,7 +7638,7 @@ export const PROJECT_SUMMARY: IProjectSummary = {
project_summary_document_type_code: "SPR",
mine_document_guid: "b869134f-bcf8-47d9-ac61-c90835e20601",
mine_guid: "60300a07-376c-46f1-a984-88a813f91438",
- document_manager_guid: "1c77f818-3d7a-461c-902d-7546755f4661",
+ document_manager_guid: "1c77f818-3d7a-461c-902d-7546755f4662",
document_name: "shape.shx",
upload_date: "2024-06-26 19:51:43.058986+00:00",
create_user: "idir\\username",
diff --git a/services/core-web/src/components/mine/Projects/ProjectOverviewTab.tsx b/services/core-web/src/components/mine/Projects/ProjectOverviewTab.tsx
index e3f9967a2b..430f4f3e73 100644
--- a/services/core-web/src/components/mine/Projects/ProjectOverviewTab.tsx
+++ b/services/core-web/src/components/mine/Projects/ProjectOverviewTab.tsx
@@ -239,6 +239,7 @@ export const ProjectOverviewTab: FC = () => {
{shouldDisplayLinkedProjects && (
routes.EDIT_PROJECT_SUMMARY.dynamicRoute(p.project_guid, p.project_summary_guid)
}
diff --git a/services/core-web/src/tests/components/Forms/ExplosivesPermit/__snapshots__/ExplosivesPermitFileUpload.spec.js.snap b/services/core-web/src/tests/components/Forms/ExplosivesPermit/__snapshots__/ExplosivesPermitFileUpload.spec.js.snap
index f6fbada19d..ceaff96043 100644
--- a/services/core-web/src/tests/components/Forms/ExplosivesPermit/__snapshots__/ExplosivesPermitFileUpload.spec.js.snap
+++ b/services/core-web/src/tests/components/Forms/ExplosivesPermit/__snapshots__/ExplosivesPermitFileUpload.spec.js.snap
@@ -45,6 +45,7 @@ exports[`ExplosivesPermitFileUpload renders properly 1`] = `
>
- N/A
+ [Draft]
|
diff --git a/services/document-manager/backend/app/docman/utils/geomark_helper.py b/services/document-manager/backend/app/docman/utils/geomark_helper.py
index bc7955afd8..400ba71e6c 100644
--- a/services/document-manager/backend/app/docman/utils/geomark_helper.py
+++ b/services/document-manager/backend/app/docman/utils/geomark_helper.py
@@ -62,7 +62,8 @@ def add_geomark_to_group(self, geomark_id, group_id):
resp = response.json()
if resp.get('status') != 'Added':
- raise InternalServerError('Error adding geomark to group. Geomark service returned status: ' + resp.get('status'))
+ current_app.logger.info(resp)
+ raise InternalServerError('Error adding geomark to group. Geomark service returned status: ' + resp.get('status', "No status"))
current_app.logger.info(f"Geomark {geomark_id} successfully added to group {group_id}")
diff --git a/services/minespace-web/src/tests/components/project/projectOverviewTab/__snapshots__/ProjectOverviewTab.spec.tsx.snap b/services/minespace-web/src/tests/components/project/projectOverviewTab/__snapshots__/ProjectOverviewTab.spec.tsx.snap
index c5139f0c55..2943524e35 100644
--- a/services/minespace-web/src/tests/components/project/projectOverviewTab/__snapshots__/ProjectOverviewTab.spec.tsx.snap
+++ b/services/minespace-web/src/tests/components/project/projectOverviewTab/__snapshots__/ProjectOverviewTab.spec.tsx.snap
@@ -266,7 +266,7 @@ exports[`ProjectOverviewTab renders properly 1`] = `
title="Stage Status"
>
- N/A
+ Draft
diff --git a/services/minespace-web/src/tests/components/project/projectSummaryPage/__snapshots__/ProjectSummaryPage.spec.tsx.snap b/services/minespace-web/src/tests/components/project/projectSummaryPage/__snapshots__/ProjectSummaryPage.spec.tsx.snap
index 6ca612ceda..9954f53107 100644
--- a/services/minespace-web/src/tests/components/project/projectSummaryPage/__snapshots__/ProjectSummaryPage.spec.tsx.snap
+++ b/services/minespace-web/src/tests/components/project/projectSummaryPage/__snapshots__/ProjectSummaryPage.spec.tsx.snap
@@ -286,8 +286,7 @@ exports[`ProjectSummaryPage renders properly 1`] = `
class="ant-form-item-control-input-content"
>