From 2bbefc82b925a2af21777d01118cfb9c23b6be0c Mon Sep 17 00:00:00 2001 From: Simen Fivelstad Smaaberg <66635118+simensma-fresh@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:21:00 -0800 Subject: [PATCH] [MDS-6260] Add Report Type to Report requirement form, make initial submission date optional (#3340) * MDS-6260 Added report type field to FE * updated report permit requirement form spec * MDS-6260 Updated import validation --- services/common/src/constants/strings.tsx | 1 + .../mineReportPermitRequirements.interface.ts | 2 + .../reports/ReportPermitRequirementForm.tsx | 36 +++++---- .../mine/Permit/PermitConditions.tsx | 2 +- .../ReportPermitRequirementForm.spec.tsx.snap | 77 +++++++++++++++++-- 5 files changed, 97 insertions(+), 21 deletions(-) diff --git a/services/common/src/constants/strings.tsx b/services/common/src/constants/strings.tsx index a950affaa9..7417157392 100755 --- a/services/common/src/constants/strings.tsx +++ b/services/common/src/constants/strings.tsx @@ -491,5 +491,6 @@ export const REPORT_FREQUENCY_HASH = { "Semi-Annually": 6, "Annually": 12, "Bi-Annually": 24, + "Every 5 Years": 60, "Not Specified": 0, }; diff --git a/services/common/src/interfaces/permits/mineReportPermitRequirements.interface.ts b/services/common/src/interfaces/permits/mineReportPermitRequirements.interface.ts index 8f0656ad18..e405a5509b 100644 --- a/services/common/src/interfaces/permits/mineReportPermitRequirements.interface.ts +++ b/services/common/src/interfaces/permits/mineReportPermitRequirements.interface.ts @@ -1,7 +1,9 @@ export interface IMineReportPermitRequirement { + report_name: string; mine_report_permit_requirement_id: number; cim_or_cpo: string; ministry_recipient: string[]; permit_condition_id: number; due_date_period_months: number; + initial_due_date: Date; } diff --git a/services/core-web/src/components/Forms/reports/ReportPermitRequirementForm.tsx b/services/core-web/src/components/Forms/reports/ReportPermitRequirementForm.tsx index 9c41112ac7..d5699c1ade 100644 --- a/services/core-web/src/components/Forms/reports/ReportPermitRequirementForm.tsx +++ b/services/core-web/src/components/Forms/reports/ReportPermitRequirementForm.tsx @@ -13,7 +13,7 @@ import { REPORT_REGULATORY_AUTHORITY_CODES_HASH, REPORT_TYPE_CODES, } from "@mds/common"; -import { required, requiredRadioButton } from "@mds/common/redux/utils/Validate"; +import { required, requiredRadioButton, maxLength } from "@mds/common/redux/utils/Validate"; import FormWrapper from "@mds/common/components/forms/FormWrapper"; import RenderSelect from "@mds/common/components/forms/RenderSelect"; import RenderDate from "@mds/common/components/forms/RenderDate"; @@ -54,19 +54,19 @@ export const ReportPermitRequirementForm: FC = ({ initialValues={ mineReportPermitRequirement ? { - ...mineReportPermitRequirement, - stepPath: condition.stepPath, - permit_amendment_id: latestPermitAmendment.permit_amendment_id, - } + ...mineReportPermitRequirement, + stepPath: condition.stepPath, + permit_amendment_id: latestPermitAmendment.permit_amendment_id, + } : { - mine_report_status_code: MINE_REPORT_SUBMISSION_CODES.NON, - stepPath: condition.stepPath, - permit_condition_category_code: condition.condition_category_code, - permit_condition_type_code: REPORT_TYPE_CODES.PRR, - permit_condition_id: condition.permit_condition_id, - permit_guid: permitGuid, - permit_amendment_id: latestPermitAmendment.permit_amendment_id, - } + mine_report_status_code: MINE_REPORT_SUBMISSION_CODES.NON, + stepPath: condition.stepPath, + permit_condition_category_code: condition.condition_category_code, + permit_condition_type_code: REPORT_TYPE_CODES.PRR, + permit_condition_id: condition.permit_condition_id, + permit_guid: permitGuid, + permit_amendment_id: latestPermitAmendment.permit_amendment_id, + } } > @@ -80,6 +80,14 @@ export const ReportPermitRequirementForm: FC = ({ disabled /> + + + = ({ name="initial_due_date" label="Initial Due Date" placeholder="Select date" - required - validate={[required]} formatViewDate component={RenderDate} /> diff --git a/services/core-web/src/components/mine/Permit/PermitConditions.tsx b/services/core-web/src/components/mine/Permit/PermitConditions.tsx index 1bf3a30b5e..20d9de122e 100644 --- a/services/core-web/src/components/mine/Permit/PermitConditions.tsx +++ b/services/core-web/src/components/mine/Permit/PermitConditions.tsx @@ -339,7 +339,7 @@ const PermitConditions: FC = ({ Report #{index + 1} + Report #{index + 1}{cond.mineReportPermitRequirement?.report_name ? ` - ${cond.mineReportPermitRequirement.report_name}` : ''} } className="report-collapse" > diff --git a/services/core-web/src/tests/components/Forms/reports/__snapshots__/ReportPermitRequirementForm.spec.tsx.snap b/services/core-web/src/tests/components/Forms/reports/__snapshots__/ReportPermitRequirementForm.spec.tsx.snap index 08861c4da0..7cb3885376 100644 --- a/services/core-web/src/tests/components/Forms/reports/__snapshots__/ReportPermitRequirementForm.spec.tsx.snap +++ b/services/core-web/src/tests/components/Forms/reports/__snapshots__/ReportPermitRequirementForm.spec.tsx.snap @@ -73,6 +73,70 @@ exports[`RequestReportForm renders form properly 1`] = ` +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+