-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
334 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
bciers/apps/reporting/src/app/bceidbusiness/industry_user/new-entrant-information/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Suspense } from "react"; | ||
import Loading from "@bciers/components/loading/SkeletonForm"; | ||
import NewEntrantInformation from "@reporting/src/app/components/additionalInformation/newEntrantInformation/NewEntrantInformation"; | ||
interface PageProps { | ||
params: { version_id: number }; | ||
} | ||
|
||
export default async function Page({ params }: PageProps) { | ||
return ( | ||
<Suspense fallback={<Loading />}> | ||
<NewEntrantInformation versionId={params.version_id} /> | ||
</Suspense> | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
...p/bceidbusiness/industry_user_admin/reports/[version_id]/new-entrant-information/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Suspense } from "react"; | ||
import Loading from "@bciers/components/loading/SkeletonForm"; | ||
import NewEntrantInformation from "@reporting/src/app/components/additionalInformation/newEntrantInformation/NewEntrantInformation"; | ||
interface PageProps { | ||
params: { version_id: number }; | ||
} | ||
|
||
export default async function Page({ params }: PageProps) { | ||
return ( | ||
<Suspense fallback={<Loading />}> | ||
<NewEntrantInformation versionId={params.version_id} /> | ||
</Suspense> | ||
); | ||
} |
15 changes: 15 additions & 0 deletions
15
.../src/app/components/additionalInformation/newEntrantInformation/NewEntrantInformation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Suspense } from "react"; | ||
import Loading from "@bciers/components/loading/SkeletonForm"; | ||
import NewEntrantInformationForm from "@reporting/src/app/components/additionalInformation/newEntrantInformation/NewEntrantInformationForm"; | ||
|
||
export default async function NewEntrantInformation({ | ||
versionId, | ||
}: { | ||
versionId: number; | ||
}) { | ||
return ( | ||
<Suspense fallback={<Loading />}> | ||
<NewEntrantInformationForm versionId={versionId} /> | ||
</Suspense> | ||
); | ||
} |
84 changes: 84 additions & 0 deletions
84
.../app/components/additionalInformation/newEntrantInformation/NewEntrantInformationForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
"use client"; | ||
|
||
import React, { useState } from "react"; | ||
import MultiStepFormWithTaskList from "@bciers/components/form/MultiStepFormWithTaskList"; | ||
import { TaskListElement } from "@bciers/components/navigation/reportingTaskList/types"; | ||
import { useRouter } from "next/navigation"; | ||
|
||
import { actionHandler } from "@bciers/actions"; | ||
import { | ||
newEntrantInformationSchema, | ||
newEntrantInformationUiSchema, | ||
} from "@reporting/src/data/jsonSchema/newEntrantInformation/newEntrantInformation"; | ||
|
||
const baseUrl = "/reports"; | ||
const cancelUrl = "/reports"; | ||
|
||
interface AdditionalReportingDataProps { | ||
versionId: number; | ||
} | ||
|
||
export default function NewEntrantInformationForm({ | ||
versionId, | ||
}: AdditionalReportingDataProps) { | ||
const [formData, setFormData] = useState<FormData>(); | ||
|
||
const router = useRouter(); | ||
const saveAndContinueUrl = `/reports/${versionId}/new-entrant-information`; | ||
|
||
const taskListElements: TaskListElement[] = [ | ||
{ | ||
type: "Page", | ||
title: "Additional reporting data", | ||
isChecked: true, | ||
link: `/reports/${versionId}/additional-reporting-data`, | ||
}, | ||
{ | ||
type: "Page", | ||
title: "New entrant information", | ||
isActive: true, | ||
link: `/reports/${versionId}/new-entrant-information`, | ||
}, | ||
]; | ||
|
||
const handleSubmit = async (data: any) => { | ||
const endpoint = `reporting/report-version/${versionId}/additional-data`; | ||
const method = "POST"; | ||
|
||
const payload = { | ||
report_version: versionId, | ||
...data.captured_emissions_section, | ||
...data.additional_data_section, | ||
}; | ||
|
||
const response = await actionHandler(endpoint, method, endpoint, { | ||
body: JSON.stringify(payload), | ||
}); | ||
if (response) { | ||
router.push(saveAndContinueUrl); | ||
} | ||
}; | ||
|
||
return ( | ||
<MultiStepFormWithTaskList | ||
initialStep={2} | ||
steps={[ | ||
"Operation Information", | ||
"Report Information", | ||
"Additional Information", | ||
"Compliance Summary", | ||
"Sign-off & Submit", | ||
]} | ||
taskListElements={taskListElements} | ||
schema={newEntrantInformationSchema} | ||
uiSchema={newEntrantInformationUiSchema} | ||
formData={formData} | ||
baseUrl={baseUrl} | ||
cancelUrl={cancelUrl} | ||
onChange={(data: any) => { | ||
setFormData(data.formData); | ||
}} | ||
onSubmit={(data: any) => handleSubmit(data.formData)} | ||
/> | ||
); | ||
} |
15 changes: 15 additions & 0 deletions
15
bciers/apps/reporting/src/data/jsonSchema/newEntrantInformation/additionalMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Typography } from "@mui/material"; | ||
import { BC_GOV_BACKGROUND_COLOR_BLUE } from "@bciers/styles"; | ||
export const newEntrantInfo = ( | ||
<> | ||
<Typography | ||
variant="body2" | ||
color={BC_GOV_BACKGROUND_COLOR_BLUE} | ||
fontStyle="italic" | ||
fontSize={16} | ||
> | ||
This section applies to operations that fall under{" "} | ||
<u>new entrant category</u>. | ||
</Typography> | ||
</> | ||
); |
192 changes: 192 additions & 0 deletions
192
bciers/apps/reporting/src/data/jsonSchema/newEntrantInformation/newEntrantInformation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
import { RJSFSchema } from "@rjsf/utils"; | ||
import FieldTemplate from "@bciers/components/form/fields/FieldTemplate"; | ||
import { | ||
InlineFieldTemplate, | ||
TitleOnlyFieldTemplate, | ||
} from "@bciers/components/form/fields"; | ||
import SectionFieldTemplate from "@bciers/components/form/fields/SectionFieldTemplate"; | ||
import { DateWidget } from "@bciers/components/form/widgets"; | ||
import { newEntrantInfo } from "@reporting/src/data/jsonSchema/newEntrantInformation/additionalMessage"; | ||
|
||
export const newEntrantInformationSchema: RJSFSchema = { | ||
type: "object", | ||
title: "Additional Reporting Data", | ||
properties: { | ||
purpose_note: { type: "object", readOnly: true }, | ||
date_of_authorization: { | ||
type: "string", | ||
title: "Date of authorization", | ||
}, | ||
date_of_first_shipment: { | ||
type: "string", | ||
title: "Date of first shipment", | ||
}, | ||
date_of_new_entrant_period_began: { | ||
type: "string", | ||
title: "Date new entrant period began", | ||
}, | ||
assertion_statement: { | ||
type: "boolean", | ||
title: "Assertion statement", | ||
default: false, | ||
}, | ||
|
||
emission_after_new_entrant: { | ||
type: "object", | ||
title: "Emission categories after new entrant period began", | ||
properties: { | ||
flaring_emissions: { | ||
type: "number", | ||
title: "Flaring emissions", | ||
}, | ||
fugitive_emissions: { | ||
type: "number", | ||
title: "Fugitive emissions", | ||
}, | ||
industrial_process_emissions: { | ||
type: "number", | ||
title: "Industrial process emissions", | ||
}, | ||
on_site_transportation_emissions: { | ||
type: "number", | ||
title: "On-site transportation emissions", | ||
}, | ||
stationary_fuel_combustion_emissions: { | ||
type: "number", | ||
title: "Stationary fuel combustion emissions", | ||
}, | ||
venting_emissions_useful: { | ||
type: "number", | ||
title: "Venting emissions - useful", | ||
}, | ||
venting_emissions_non_useful: { | ||
type: "number", | ||
title: "Venting emissions - non-useful", | ||
}, | ||
emissions_from_waste: { | ||
type: "number", | ||
title: "Emissions from waste", | ||
}, | ||
emissions_from_wastewater: { | ||
type: "number", | ||
title: "Emissions from wastewater", | ||
}, | ||
}, | ||
}, | ||
emission_excluded_by_fuel_type: { | ||
type: "object", | ||
title: "Emissions excluded by fuel type", | ||
properties: { | ||
co2_emissions_from_excluded_woody_biomass: { | ||
type: "number", | ||
title: "CO2 emissions from excluded woody biomass", | ||
}, | ||
other_emissions_from_excluded_biomasss: { | ||
type: "number", | ||
title: "Other emissions from excluded biomass", | ||
}, | ||
emissions_from_excluded_non_biomass: { | ||
type: "number", | ||
title: "Emissions from excluded non-biomass", | ||
}, | ||
}, | ||
}, | ||
other_excluded_emissions: { | ||
type: "object", | ||
title: "Other excluded emissions", | ||
properties: { | ||
emissions_from_line_tracing: { | ||
type: "number", | ||
title: | ||
"Emissions from line tracing and non-processing and non-compression activities", | ||
}, | ||
emissions_from_fat_oil: { | ||
type: "number", | ||
title: | ||
"Emissions from fat, oil and grease collection, refining and storage ", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const newEntrantInformationUiSchema = { | ||
"ui:FieldTemplate": FieldTemplate, | ||
"ui:classNames": "form-heading-label", | ||
"ui:options": { label: false }, | ||
"ui:order": [ | ||
"purpose_note", | ||
"date_of_authorization", | ||
"date_of_first_shipment", | ||
"date_of_new_entrant_period_began", | ||
"assertion_statement", | ||
"emission_after_new_entrant", | ||
"emission_excluded_by_fuel_type", | ||
"other_excluded_emissions", | ||
], | ||
purpose_note: { | ||
"ui:FieldTemplate": TitleOnlyFieldTemplate, | ||
"ui:title": newEntrantInfo, | ||
}, | ||
date_of_authorization: { | ||
"ui:widget": DateWidget, | ||
}, | ||
|
||
date_of_first_shipment: { | ||
"ui:widget": DateWidget, | ||
}, | ||
date_of_new_entrant_period_began: { | ||
"ui:widget": DateWidget, | ||
}, | ||
emission_after_new_entrant: { | ||
"ui:FieldTemplate": SectionFieldTemplate, | ||
flaring_emissions: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
fugitive_emissions: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
industrial_process_emissions: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
on_site_transportation_emissions: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
stationary_fuel_combustion_emissions: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
venting_emissions_useful: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
venting_emissions_non_useful: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
emissions_from_waste: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
emissions_from_wastewater: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
}, | ||
emission_excluded_by_fuel_type: { | ||
"ui:FieldTemplate": SectionFieldTemplate, | ||
co2_emissions_from_excluded_woody_biomass: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
other_emissions_from_excluded_biomasss: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
emissions_from_excluded_non_biomass: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
}, | ||
other_excluded_emissions: { | ||
"ui:FieldTemplate": SectionFieldTemplate, | ||
emissions_from_line_tracing: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
emissions_from_fat_oil: { | ||
"ui:FieldTemplate": InlineFieldTemplate, | ||
}, | ||
}, | ||
}; |