Skip to content

Commit

Permalink
[MDS-6232] IRT/Application statuses (#3317)
Browse files Browse the repository at this point in the history
* make database changes for application and irt status tables

* whole lot of FE changes, mostly related to showing the status

* deal with the render errors on the MS IRT form, consolidate some useEffects with equal dep arrays, take out +=/-= that made no sense

* FE & BE issues with IRT

* issues with mma, fix typos, update test

* update BE tests

* remove commented out code

* remove typo from snaps

* update status_code change when submitting from a Changes Requested Status.

---------

Co-authored-by: Mat.Busby <[email protected]>
  • Loading branch information
taraepp and matbusby-fw authored Nov 29, 2024
1 parent 817518f commit 2aac6e5
Show file tree
Hide file tree
Showing 57 changed files with 1,149 additions and 1,674 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ALTER TABLE major_mine_application_status_code DROP COLUMN display_order;

INSERT INTO information_requirements_table_status_code (
information_requirements_table_status_code,
description,
create_user,
update_user
) VALUES
('OHD', 'On Hold', 'system-mds', 'system-mds'),
('WDN', 'Withdrawn', 'system-mds', 'system-mds'),
('COM', 'Complete', 'system-mds', 'system-mds')
;

INSERT INTO major_mine_application_status_code (
major_mine_application_status_code,
description,
create_user,
update_user
) VALUES
('OHD', 'On Hold', 'system-mds', 'system-mds'),
('WDN', 'Withdrawn', 'system-mds', 'system-mds'),
('COM', 'Complete', 'system-mds', 'system-mds')
;

UPDATE information_requirements_table SET status_code = 'COM' WHERE status_code = 'APV';
UPDATE major_mine_application SET status_code = 'COM' WHERE status_code = 'APV';

DELETE FROM information_requirements_table_status_code WHERE information_requirements_table_status_code = 'APV';
DELETE FROM major_mine_application_status_code WHERE major_mine_application_status_code = 'APV';
23 changes: 10 additions & 13 deletions services/common/src/components/project/ProjectDescriptionTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
} from "@mds/common/redux/actionCreators/projectActionCreator";
import Loading from "@mds/common/components/common/Loading";
import { formatProjectPayload } from "@mds/common/utils/helpers";
import ProjectCallout from "../projects/ProjectCallout";

const ProjectDescriptionTab = () => {
const [shouldDisplayRetryButton, setShouldDisplayRetryButton] = useState(false);
Expand Down Expand Up @@ -136,7 +137,7 @@ const ProjectDescriptionTab = () => {
));
const permitNo =
authorization?.project_summary_permit_type[0] === AMS_AUTHORIZATION_TYPES.AMENDMENT &&
authorization?.existing_permits_authorizations
authorization?.existing_permits_authorizations
? getPermitNumber(authorization?.existing_permits_authorizations[0])
: NOT_APPLICABLE;
const projectSummaryAuthorizationGuid = authorization?.project_summary_authorization_guid;
Expand Down Expand Up @@ -171,7 +172,7 @@ const ProjectDescriptionTab = () => {
)} - ${permitTypeLabel}`;
const permitNo =
authorization?.project_summary_permit_type[0] === AMS_AUTHORIZATION_TYPES.AMENDMENT &&
authorization?.existing_permits_authorizations
authorization?.existing_permits_authorizations
? authorization?.existing_permits_authorizations[0]
: NOT_APPLICABLE;
const projectSummaryAuthorizationGuid = authorization?.project_summary_authorization_guid;
Expand Down Expand Up @@ -406,18 +407,14 @@ const ProjectDescriptionTab = () => {
Both the Major Mines Office and Ministry of Environments reviews must be completed for
this stage to be considered complete.
</Typography.Paragraph>

<ProjectCallout
status_code={project?.project_summary?.status_code}
/>
{hasFailedAMSSubmission && (
<Callout
message={
<div className="nod-callout">
<h4>Submission Unsuccessful</h4>
<p>
One or more of your environment authorization applications has not been
submitted successfully. Please retry the submission.
</p>
</div>
}
title="Environmental Management Act Submission Unsuccessful"
message="One or more of your environment authorization applications has not been
submitted successfully."
severity={CALLOUT_SEVERITY.danger}
/>
)}
Expand Down Expand Up @@ -489,7 +486,7 @@ const ProjectDescriptionTab = () => {
message="Submission Unsuccessful"
showIcon
type="error"
description={`Your environment authorization application was not submitted successfully. Please retry the submission or start a new application for the rejected authorization(s). You can link the submission to the new application on the Related Projects page. One or more of your environment authorization application has not been submitted successfully. Please retry the submission.`}
description={`Your environment authorization application was not submitted successfully. Please start a new application for the rejected authorization(s). You can link the submission to the new application on the Related Projects page. One or more of your environment authorization application has not been submitted successfully.`}
action={
shouldDisplayRetryButton ? (
<Button onClick={handleRetryAMSSubmissionClicked}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ exports[`ProjectDescriptionTab renders properly 1`] = `
>
Below are the authorization submissions and their status in the project description. Both the Major Mines Office and Ministry of Environments reviews must be completed for this stage to be considered complete.
</div>
<div
class="bcgov-callout--warning bcgov-callout"
>
<p
class="bcgov-callout-title"
>
Draft
</p>
<p>
This project step has not been formally submitted by the proponent through MineSpace. MineSpace users can update text fields and add documents.
</p>
</div>
<h3
class="ant-typography font-colour"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { requiredList } from "@mds/common/redux/utils/Validate";
import { IGroupedDropdownList, IProjectSummaryForm, IProjectSummaryMinistryComment } from "@mds/common/interfaces";
import { Feature } from "@mds/common/utils";
import { USER_ROLES } from "@mds/common/constants";
import ProjectCallout from "../projects/ProjectCallout";

const { Paragraph, Title } = Typography;

Expand Down Expand Up @@ -88,12 +89,7 @@ export const ProjectManagement: FC = () => {
data={projectSummaryStatusCodes}
/>
)}
<Alert
message={projectSummaryStatusCodes.find((code) => code.value === status_code)?.label}
type="warning"
showIcon
className="margin-large--bottom"
/>
<ProjectCallout status_code={status_code} />
<Row gutter={8} justify="start" align="middle">
<Col>
<Title level={4}>Assigned Project Lead</Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ exports[`Project Management renders properly 1`] = `
</div>
</div>
<div
class="ant-alert ant-alert-warning margin-large--bottom"
class="ant-alert ant-alert-warning ant-alert-with-description margin-large--bottom"
data-show="true"
role="alert"
>
Expand All @@ -167,7 +167,10 @@ exports[`Project Management renders properly 1`] = `
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"
/>
<path
d="M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"
/>
</svg>
</span>
Expand All @@ -179,6 +182,19 @@ exports[`Project Management renders properly 1`] = `
>
Assigned
</div>
<div
class="ant-alert-description"
>
<div
class="ant-row ant-row-space-between"
>
<div
class="ant-col ant-col-24"
>
This project has been formally submitted by the proponent through MineSpace. MineSpace users can update documents only.
</div>
</div>
</div>
</div>
</div>
<div
Expand Down
67 changes: 67 additions & 0 deletions services/common/src/components/projects/ProjectCallout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React, { FC, ReactElement } from "react";
import { CALLOUT_SEVERITY, MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES, PROJECT_STATUS_CODES, PROJECT_SUMMARY_STATUS_CODES, SystemFlagEnum } from "@mds/common/constants";
import Callout from "../common/Callout";
import { Alert, Col, Row } from "antd";
import { useSelector } from "react-redux";
import { getSystemFlag } from "@mds/common/redux/selectors/authenticationSelectors";

export const statusTextHash = {
"DFT": { severity: CALLOUT_SEVERITY.warning, message: "This project step has not been formally submitted by the proponent through MineSpace. MineSpace users can update text fields and add documents." },
"WDN": { severity: CALLOUT_SEVERITY.danger, message: "MineSpace users cannot update text fields or update documents. Contact the Ministry to change this status." },
"COM": { severity: CALLOUT_SEVERITY.success, message: "The review of this project is completed. MineSpace users cannot update text fields or update documents." },
"OHD": { severity: CALLOUT_SEVERITY.danger, message: "This project is on hold. MineSpace users cannot update text fields or update documents. Contact the Ministry to change this status." },
"SUB": { severity: CALLOUT_SEVERITY.success, message: "This project has been formally submitted by the proponent through MineSpace. MineSpace users can update documents only." },
"UNR": { severity: CALLOUT_SEVERITY.warning, message: "This project is being actively reviewed. MineSpace users cannot update text fields or update documents." },
"CHR": { severity: CALLOUT_SEVERITY.warning, message: "This project requires changes by the mine. MineSpace users can update text fields and update documents. Note: when the MineSpace user resubmits at this step the project status will be changed to under review." },
"ASG": { severity: CALLOUT_SEVERITY.success, message: "This project has been formally submitted by the proponent through MineSpace. MineSpace users can update documents only." }
}

interface ProjectCalloutProps {
status_code: PROJECT_STATUS_CODES | MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES;
formField?: ReactElement;
}

const ProjectCallout: FC<ProjectCalloutProps> = ({
status_code,
formField }) => {

const systemFlag = useSelector(getSystemFlag);
const isCore = systemFlag === SystemFlagEnum.core;
const calloutParams = statusTextHash[status_code ?? "DFT"];
let title = PROJECT_SUMMARY_STATUS_CODES[status_code ?? "DFT"];
const hasFormField = Boolean(formField);
const colProps = hasFormField ? { xs: 24, md: 18 } : { span: 24 };

if (status_code === PROJECT_STATUS_CODES.ASG && !isCore) {
title = PROJECT_SUMMARY_STATUS_CODES.SUB;
}

return (
isCore ?
<Alert
message={title}
description={
<Row justify="space-between">
<Col {...colProps}>
{calloutParams.message}
</Col>
{hasFormField &&
<Col xs={24} md={6}>
{formField}
</Col>
}
</Row>
}
showIcon
type="warning"
className="margin-large--bottom"
/>
: <Callout
message={calloutParams.message}
title={title}
severity={calloutParams.severity}

/>);
};

export default ProjectCallout;
2 changes: 0 additions & 2 deletions services/common/src/constants/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ export const INFORMATION_REQUIREMENTS_TABLES = (projectGuid) =>
`/projects/${projectGuid}/information-requirements-table`;
export const INFORMATION_REQUIREMENTS_TABLE = (projectGuid, irtGuid) =>
`/projects/${projectGuid}/information-requirements-table/${irtGuid}`;
export const INFORMATION_REQUIREMENTS_TABLE_STATUS = (projectGuid, irtGuid) =>
`/projects/${projectGuid}/information-requirements-table/${irtGuid}/status`;

// Major mine application
export const MAJOR_MINE_APPLICATIONS = (projectGuid) =>
Expand Down
16 changes: 13 additions & 3 deletions services/common/src/constants/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ export enum PROJECT_STATUS_CODES {
CHR = "CHR",
}

export enum MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES {
DFT = "DFT",
WDN = "WDN",
COM = "COM",
OHD = "OHD",
SUB = "SUB",
UNR = "UNR",
CHR = "CHR",
}
export enum PROJECT_SUMMARY_STATUS_CODES {
DFT = "Draft",
WDN = "Withdrawn",
Expand All @@ -168,12 +177,13 @@ export enum PROJECT_SUMMARY_STATUS_CODES {

export enum MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODES {
DFT = "Draft",
APV = "Approved",
CHR = "Change Requested",
WDN = "Withdrawn",
COM = "Complete",
OHD = "On Hold",
SUB = "Submitted",
UNR = "Under review",
CHR = "Change Requested",
}

export enum PROJECT_DECISION_PACKAGE_STATUS_CODES {
CMP = "Completed",
INP = "In Progress",
Expand Down
2 changes: 2 additions & 0 deletions services/common/src/constants/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ export enum FORM {
ARCHIVE_DOCUMENT = "ARCHIVE_DOCUMENT",
EDIT_HELP_GUIDE = "EDIT_HELP_GUIDE",
INLINE_EDIT_PERMIT_CONDITION_CATEGORY = "INLINE_EDIT_PERMIT_CONDITION_CATEGORY",
UPDATE_MAJOR_MINE_APPLICATION = "UPDATE_MAJOR_MINE_APPLICATION",
UPDATE_IRT = "UPDATE_IRT"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IIRTDocument, IIRTRequirementsXref } from "@mds/common/index";
import { IIRTDocument, IIRTRequirementsXref, MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES } from "@mds/common/index";

export interface IInformationRequirementsTable {
irt_id: number;
Expand All @@ -9,7 +9,7 @@ export interface IInformationRequirementsTable {
create_user: string;
create_timestamp: string;
project_guid: string;
status_code: string;
status_code: MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES;
requirements: IIRTRequirementsXref[];
information_requirements_table_guid?: string;
information_requirements_table_id?: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { IMajorMinesApplicationDocument } from "@mds/common/index";
import { IMajorMinesApplicationDocument, MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES } from "@mds/common/index";

export interface IMajorMinesApplication {
major_mine_application_id: number;
major_mine_application_guid: string;
project_guid: string;
status_code: string;
status_code: MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES;
documents: IMajorMinesApplicationDocument[];
update_user: string;
update_timestamp: string;
create_user: string;
create_timestamp: string;
primary_documents: IMajorMinesApplicationDocument[];
spatial_documents: IMajorMinesApplicationDocument[];
supporting_documents: IMajorMinesApplicationDocument[];
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
PROJECT_SUMMARY_STATUS_CODES,
MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODES,
MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES,
} from "@mds/common/constants/enums";

interface IProjectLinkContact {
Expand All @@ -16,12 +16,12 @@ interface IProjectLinkSummary {

interface IMajorMineApplication {
major_mine_application_guid: string;
status_code: MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODES;
status_code: MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES;
}

interface IInformationRequirementsTable {
irt_guid: string;
status_code: MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODES;
status_code: MAJOR_MINE_APPLICATION_AND_IRT_STATUS_CODE_CODES;
}

interface IProjectLinkProject {
Expand Down
Loading

0 comments on commit 2aac6e5

Please sign in to comment.