Skip to content

Commit 082be91

Browse files
[MDS-6469] Upcoming Reports (#3722)
* Add support for fetching, storing, and displaying upcoming mine reports. * rejigger reports redux actions start * add date sorting * Add support for upcoming reports table, component refactoring, and improved date sorting * Refactor reports API and frontend components to consolidate upcoming reports handling. Remove `MineUpcomingReportListResource`, update endpoints to use filters, and migrate legacy action creators to slice-based thunks. * Refactor reports handling: remove legacy action creators, consolidate tests, update components with new slice-based thunks, and enhance UI with badges and reminders. * Refactor reports handling: remove legacy action creators, consolidate tests, update components with new slice-based thunks, and enhance UI with badges and reminders. * Add tests for upcoming and pending mine reports with status and date range filters. * Remove legacy report action creators, update selectors, replace positional parameters with object-based ones, and consolidate reducers into `reportSlice`. * Remove legacy `mineReportActions` and `reportReducer`, update tests, and refactor components for consistency with `reportSlice`. * Update ReportManagement snapshot tests for layout changes and new upcoming reports UI elements * Update `Reports.spec.tsx` to revise table header validations and align with updated UI labels * Removed redundant styles --------- Co-authored-by: mat <matbusby@gmail.com>
1 parent 5f00d41 commit 082be91

File tree

37 files changed

+2298
-2208
lines changed

37 files changed

+2298
-2208
lines changed

services/common/src/components/common/ResponsivePagination.js

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* @constant Pagination is used on the MineHomePage and ContactHomePage.js, this file was created to DRY up the pagination logic.
3+
*/
4+
import React, { FC } from "react";
5+
import MediaQuery from "react-responsive";
6+
import { Pagination } from "antd";
7+
8+
interface ResponsivePaginationProps {
9+
onPageChange: (page: number, pageSize: number) => void;
10+
currentPage: number;
11+
pageTotal: number;
12+
itemsPerPage: number;
13+
}
14+
15+
const ResponsivePagination: FC<ResponsivePaginationProps> = ({
16+
onPageChange,
17+
currentPage = 1,
18+
pageTotal,
19+
itemsPerPage,
20+
}) => (
21+
<div>
22+
<MediaQuery maxWidth={500}>
23+
<Pagination
24+
size="small"
25+
showSizeChanger
26+
onShowSizeChange={onPageChange}
27+
onChange={onPageChange}
28+
defaultCurrent={currentPage}
29+
current={currentPage}
30+
total={pageTotal}
31+
pageSizeOptions={["10", "25", "50", "75", "100"]}
32+
pageSize={itemsPerPage}
33+
/>
34+
</MediaQuery>
35+
<MediaQuery minWidth={501}>
36+
<Pagination
37+
showSizeChanger
38+
onShowSizeChange={onPageChange}
39+
onChange={onPageChange}
40+
defaultCurrent={currentPage}
41+
current={currentPage}
42+
total={pageTotal}
43+
pageSizeOptions={["10", "25", "50", "75", "100"]}
44+
pageSize={itemsPerPage}
45+
showTotal={(total) => `${total} Results`}
46+
/>
47+
</MediaQuery>
48+
</div>
49+
);
50+
51+
export default ResponsivePagination;

services/common/src/constants/API.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ export const MINE_REPORT_DEFINITION = "/mines/reports/definitions";
291291
export const MINE_REPORT_DUE_DATE_TYPES = "/mines/reports/due-date-types";
292292
export const MINE_REPORTS = (mineGuid, params?) =>
293293
`/mines/${mineGuid}/reports?${queryString.stringify(params)}`;
294+
export const MINE_UPCOMING_REPORTS = (mineGuid, params?) =>
295+
`/mines/${mineGuid}/reports?${queryString.stringify({ ...params, upcoming: true })}`;
294296
export const MINE_REPORT = (mineGuid, mineReportGuid) =>
295297
`/mines/${mineGuid}/reports/${mineReportGuid}`;
296298
export const MINE_REPORT_STATS = (mineGuid: string) => `/mines/${mineGuid}/reports/stats`;

services/common/src/constants/actionTypes.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,6 @@ export const REMOVE_MINE_INCIDENT_DOCUMENT = "REMOVE_MINE_INCIDENT_DOCUMENT";
140140
// Work Information
141141
export const STORE_MINE_WORK_INFORMATIONS = "STORE_MINE_WORK_INFORMATIONS";
142142

143-
// Reports
144-
export const STORE_REPORTS = "STORE_REPORTS";
145-
export const STORE_MINE_REPORTS = "STORE_MINE_REPORTS";
146-
export const CLEAR_MINE_REPORTS = "CLEAR_MINE_REPORTS";
147-
export const STORE_MINE_REPORT = "STORE_MINE_REPORT";
148-
export const STORE_MINE_REPORT_COMMENTS = "STORE_MINE_REPORT_COMMENTS";
149-
export const STORE_MINE_REPORT_STATUS_OPTIONS = "STORE_MINE_REPORT_STATUS_OPTIONS";
150-
export const STORE_MINE_REPORT_CATEGORY_OPTIONS = "STORE_MINE_REPORT_CATEGORY_OPTIONS";
151-
152143
// notice of work
153144
export const STORE_NOTICE_OF_WORK_APPLICATIONS = "STORE_NOTICE_OF_WORK_APPLICATIONS";
154145
export const STORE_NOTICE_OF_WORK_APPLICATION = "STORE_NOTICE_OF_WORK_APPLICATION";

services/common/src/constants/reducerTypes.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ export const INCIDENTS = "INCIDENTS";
4646
// Work Information
4747
export const MINE_WORK_INFORMATIONS = "MINE_WORK_INFORMATIONS";
4848

49-
// Reports
50-
export const REPORTS = "REPORTS";
51-
5249
// Notices of Work
5350
export const NOTICE_OF_WORK = "NOTICE_OF_WORK";
5451

services/common/src/redux/actionCreators/reportActionCreator.ts

Lines changed: 0 additions & 108 deletions
This file was deleted.

services/common/src/redux/actionCreators/reportCommentActionCreator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { showLoading, hideLoading } from "react-redux-loading-bar";
33
import { ENVIRONMENT } from "@mds/common/constants/environment";
44
import { request, success, error } from "../actions/genericActions";
55
import { NetworkReducerTypes } from "@mds/common/constants/networkReducerTypes";
6-
import * as mineReportActions from "../actions/mineReportActions";
6+
import { storeMineReportComments } from "@mds/common/redux/slices/reportSlice";
77
import * as API from "@mds/common/constants/API";
88
import { createRequestHeader } from "../utils/RequestHeaders";
99
import CustomAxios from "../customAxios";
@@ -18,7 +18,7 @@ export const fetchMineReportComments = (mineGuid, mineReportGuid) => (dispatch)
1818
)
1919
.then((response) => {
2020
dispatch(success(NetworkReducerTypes.GET_MINE_REPORT_COMMENTS));
21-
dispatch(mineReportActions.storeMineReportComments(response.data));
21+
dispatch(storeMineReportComments(response.data));
2222
return response;
2323
})
2424
.catch(() => dispatch(error(NetworkReducerTypes.GET_MINE_REPORT_COMMENTS)))

services/common/src/redux/actions/mineReportActions.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

services/common/src/redux/reducers.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import orgbookReducerObject from "./reducers/orgbookReducer";
1414
import partiesReducerObject from "./reducers/partiesReducer";
1515
import permitReducerObject from "./reducers/permitReducer";
1616
import projectReducerObject from "./reducers/projectReducer";
17-
import reportReducerObject from "./reducers/reportReducer";
1817
import searchReducerObject from "./reducers/searchReducer";
1918
import securitiesReducerObject from "./reducers/securitiesReducer";
2019
import staticContentReducerObject from "./reducers/staticContentReducer";
@@ -32,7 +31,6 @@ export const documentViewerReducer = documentViewerReducerObject;
3231
export const noticeOfWorkReducer = noticeOfWorkReducerObject;
3332
export const partiesReducer = partiesReducerObject;
3433
export const permitReducer = permitReducerObject;
35-
export const reportReducer = reportReducerObject;
3634
export const searchReducer = searchReducerObject;
3735
export const staticContentReducer = staticContentReducerObject;
3836
export const varianceReducer = varianceReducerObject;

services/common/src/redux/reducers/reportReducer.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)