Skip to content

Commit

Permalink
[MDS-5725] Add submission report (#2900)
Browse files Browse the repository at this point in the history
* wip

* refactor code.

* remove console.log statement.

* add submission status
  • Loading branch information
henryoforeh-dev authored Jan 19, 2024
1 parent 069a40b commit 3085b02
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions services/common/src/components/reports/ReportDetailsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import RenderField from "../forms/RenderField";
import {
IMineReport,
IMineReportDefinition,
IMineReportSubmission,
IParty,
IPartyAppt,
MinePartyAppointmentTypeCodeEnum,
Expand Down Expand Up @@ -99,10 +100,10 @@ const ReportDetailsForm: FC<ReportDetailsFormProps> = ({
const dispatch = useDispatch();
const formValues: IMineReport =
useSelector((state) => getFormValues(FORM.VIEW_EDIT_REPORT)(state)) ?? {};
const { mine_report_category = "", mine_report_definition_guid = "" } = formValues;
const [mineManager, setMineManager] = useState<IParty>();
const [mineManagerGuid, setMineManagerGuid] = useState<string>("");
const [selectedReportName, setSelectedReportName] = useState("");
const { mine_report_category = "", mine_report_definition_guid = "" } = formValues;
const [selectedReportCode, setSelectedReportCode] = useState("");
const [formattedMineReportDefinitionOptions, setFormatMineReportDefinitionOptions] = useState([]);
const [mineReportSubmissions, setMineReportSubmissions] = useState([]);
Expand Down Expand Up @@ -185,7 +186,8 @@ const ReportDetailsForm: FC<ReportDetailsFormProps> = ({
}
}, [mine_report_definition_guid]);

const updateMineReportSubmissions = (updatedSubmissions) => {
const updateMineReportSubmissions = (updatedSubmissions: IMineReportSubmission[]) => {
dispatch(change(FORM.VIEW_EDIT_REPORT, "mine_report_submissions", updatedSubmissions));
setMineReportSubmissions(updatedSubmissions);
};

Expand Down
3 changes: 2 additions & 1 deletion services/common/src/components/reports/ReportSteps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { fetchMineRecordById } from "@mds/common/redux/actionCreators/mineAction
import moment from "moment-timezone";
import ReportDetailsForm from "@mds/common/components/reports/ReportDetailsForm";
import { createMineReport } from "@mds/common/redux/actionCreators/reportActionCreator";
import { MINE_REPORT_SUBMISSION_CODES } from "../..";

const ReportSteps = () => {
const history = useHistory();
Expand Down Expand Up @@ -98,7 +99,7 @@ const ReportSteps = () => {
isEditMode={false}
mineGuid={mineGuid}
handleSubmit={(values) => {
const formValues = { received_date: moment().format("YYYY-MM-DD"), ...values };
const formValues = { mine_report_submission_status: MINE_REPORT_SUBMISSION_CODES.REC, received_date: moment().format("YYYY-MM-DD"), ...values };
dispatch(createMineReport(mineGuid, formValues)).then((response) => {
if (response.data) {
const { mine_guid, mine_report_guid } = response.data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IMineReportSubmission } from "@mds/common/interfaces/reports/mineReportSubmission.interface";
import { IMineReportContact } from "./mineReportContact.interface";
import { MINE_REPORT_SUBMISSION_CODES } from "../..";

export interface IMineReport {
mine_report_id: string;
Expand All @@ -18,4 +19,5 @@ export interface IMineReport {
mine_name: string;
submitter_name: string;
submitter_email: string;
mine_report_submission_status?: MINE_REPORT_SUBMISSION_CODES;
}
2 changes: 1 addition & 1 deletion services/minespace-web/public/notify-parent.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This script is used to notify the parent window of the current URL and is used
// This script is used to notify the parent window of the current URL and is used
// by Keycloak in Minespace to seamlessly check if the user is logged in.
parent.postMessage(location.href, location.origin);

0 comments on commit 3085b02

Please sign in to comment.