From cb4e5e5eaa758207259ca33a3b86e3940b16fca3 Mon Sep 17 00:00:00 2001 From: Simen Fivelstad Smaaberg <66635118+simensma-fresh@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:16:51 +0000 Subject: [PATCH 1/3] MDS-6260 Added report type field to FE --- services/common/src/constants/strings.tsx | 1 + .../mineReportPermitRequirements.interface.ts | 2 ++ .../reports/ReportPermitRequirementForm.tsx | 35 +++++++++++-------- .../mine/Permit/PermitConditions.tsx | 2 +- 4 files changed, 25 insertions(+), 15 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..b2f778071e 100644 --- a/services/core-web/src/components/Forms/reports/ReportPermitRequirementForm.tsx +++ b/services/core-web/src/components/Forms/reports/ReportPermitRequirementForm.tsx @@ -24,6 +24,7 @@ import RenderGroupCheckbox, { } from "@mds/common/components/forms/RenderGroupCheckbox"; import { getLatestAmendmentByPermitGuid } from "@mds/common/redux/selectors/permitSelectors"; import RenderRadioButtons from "@mds/common/components/forms/RenderRadioButtons"; +import { maxLength } from "@common/utils/Validate"; interface ReportPermitRequirementProps { onSubmit: (values: Partial) => void | Promise; @@ -54,19 +55,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 +81,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" > From acfe21dcae31fdceabaf299a8456bfaa524c0f1a Mon Sep 17 00:00:00 2001 From: Simen Fivelstad Smaaberg <66635118+simensma-fresh@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:24:35 +0000 Subject: [PATCH 2/3] updated report permit requirement form spec --- .../ReportPermitRequirementForm.spec.tsx.snap | 77 +++++++++++++++++-- 1 file changed, 72 insertions(+), 5 deletions(-) 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`] = ` +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+