Skip to content

Commit

Permalink
[MDS-6260] Add Report Type to Report requirement form, make initial s…
Browse files Browse the repository at this point in the history
…ubmission date optional (#3340)

* MDS-6260 Added report type field to FE

* updated report permit requirement form spec

* MDS-6260 Updated import validation
  • Loading branch information
simensma-fresh authored Dec 13, 2024
1 parent 9c52a18 commit 2bbefc8
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 21 deletions.
1 change: 1 addition & 0 deletions services/common/src/constants/strings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -491,5 +491,6 @@ export const REPORT_FREQUENCY_HASH = {
"Semi-Annually": 6,
"Annually": 12,
"Bi-Annually": 24,
"Every 5 Years": 60,
"Not Specified": 0,
};
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,19 +54,19 @@ export const ReportPermitRequirementForm: FC<ReportPermitRequirementProps> = ({
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,
}
}
>
<Row gutter={[16, 16]}>
Expand All @@ -80,6 +80,14 @@ export const ReportPermitRequirementForm: FC<ReportPermitRequirementProps> = ({
disabled
/>
</Col>
<Col span={24}>
<Field
name="report_name"
label="Report Type"
validate={[maxLength(255)]}
component={RenderField}
/>
</Col>
<Col span={12}>
<Field
name="due_date_period_months"
Expand All @@ -100,8 +108,6 @@ export const ReportPermitRequirementForm: FC<ReportPermitRequirementProps> = ({
name="initial_due_date"
label="Initial Due Date"
placeholder="Select date"
required
validate={[required]}
formatViewDate
component={RenderDate}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ const PermitConditions: FC<PermitConditionProps> = ({
<Collapse.Panel
key={cond.permit_condition_id}
header={
<Typography.Text strong>Report #{index + 1}</Typography.Text>
<Typography.Text strong>Report #{index + 1}{cond.mineReportPermitRequirement?.report_name ? ` - ${cond.mineReportPermitRequirement.report_name}` : ''}</Typography.Text>
}
className="report-collapse"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,70 @@ exports[`RequestReportForm renders form properly 1`] = `
</div>
</div>
</div>
<div
class="ant-col ant-col-24"
style="padding: 8px 8px 8px 8px;"
>
<div
class="ant-form-item ant-form-item-with-help"
>
<div
class="ant-row ant-form-item-row"
>
<div
class="ant-col ant-form-item-label"
>
<label
class=""
for="ADD_REPORT_TO_PERMIT_CONDITION-1639_report_name"
title=""
>
<div>
Report Type
<span
class="form-item-optional"
>
 (optional)
</span>
</div>
</label>
</div>
<div
class="ant-col ant-form-item-control"
>
<div
class="ant-form-item-control-input"
>
<div
class="ant-form-item-control-input-content"
>
<input
aria-label="report_name"
class="ant-input"
name="report_name"
type="text"
value=""
/>
</div>
</div>
<div
style="display: flex; flex-wrap: nowrap;"
>
<div
class="ant-form-item-explain ant-form-item-explain-connected"
id="ADD_REPORT_TO_PERMIT_CONDITION-1639_report_name_help"
role="alert"
>
<div
class=""
/>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class="ant-col ant-col-12"
style="padding: 8px 8px 8px 8px;"
Expand Down Expand Up @@ -199,14 +263,18 @@ exports[`RequestReportForm renders form properly 1`] = `
class="ant-col ant-form-item-label"
>
<label
class="ant-form-item-required"
class=""
for="ADD_REPORT_TO_PERMIT_CONDITION-1639_initial_due_date"
title=""
>
<div
style="width: 100%;"
>
<div>
Initial Due Date
<span
class="form-item-optional"
>
 (optional)
</span>
</div>
</label>
</div>
Expand All @@ -226,7 +294,6 @@ exports[`RequestReportForm renders form properly 1`] = `
class="ant-picker-input"
>
<input
aria-required="true"
autocomplete="off"
id="ADD_REPORT_TO_PERMIT_CONDITION-1639_initial_due_date"
name="initial_due_date"
Expand Down

0 comments on commit 2bbefc8

Please sign in to comment.