From ca8699fce8dfe30c8a7b9a18e17ab7dca2a2433c Mon Sep 17 00:00:00 2001 From: matbusby Date: Fri, 22 Mar 2024 09:36:11 -0600 Subject: [PATCH] Update "Back to Reports" link in Core view report to return to mine reports instead of all reports. --- services/common/src/constants/enums.ts | 6 ++++++ .../src/components/mine/Reports/ReportPage.tsx | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/services/common/src/constants/enums.ts b/services/common/src/constants/enums.ts index 1e62bdd38c..15d206e5bc 100644 --- a/services/common/src/constants/enums.ts +++ b/services/common/src/constants/enums.ts @@ -206,3 +206,9 @@ export enum MineReportType { "permit-required-reports" = "PRR", "tailings-reports" = "TAR", } + +export enum MineReportTypeUrlParam { + "CRR" = "code-required-reports", + "PRR" = "permit-required-reports", + "TAR" = "tailings-reports", +} diff --git a/services/core-web/src/components/mine/Reports/ReportPage.tsx b/services/core-web/src/components/mine/Reports/ReportPage.tsx index a551e390bc..a0c73935c7 100644 --- a/services/core-web/src/components/mine/Reports/ReportPage.tsx +++ b/services/core-web/src/components/mine/Reports/ReportPage.tsx @@ -13,6 +13,7 @@ import { IMineReportSubmission, MINE_REPORT_STATUS_HASH, MINE_REPORT_SUBMISSION_CODES, + MineReportTypeUrlParam, } from "@mds/common"; import { getMineById } from "@mds/common/redux/selectors/mineSelectors"; import { fetchMineRecordById } from "@mds/common/redux/actionCreators/mineActionCreator"; @@ -37,7 +38,9 @@ const ReportPage: FC = () => { const { mineGuid, reportGuid } = useParams<{ mineGuid: string; reportGuid: string }>(); const mine = useSelector((state) => getMineById(state, mineGuid)); const mineReportStatusOptions = useSelector(getDropdownMineReportStatusOptions); - const latestSubmission = useSelector((state) => getLatestReportSubmission(state, reportGuid)); + const latestSubmission: IMineReportSubmission = useSelector((state) => + getLatestReportSubmission(state, reportGuid) + ); const [selectedStatus, setSelectedStatus] = useState( latestSubmission?.mine_report_submission_status_code @@ -181,7 +184,13 @@ const ReportPage: FC = () => { - + Back to: Reports