Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDS-5725] Add submission report #2900

Merged
merged 5 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Loading