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

Sync staging with develop #538

Merged
merged 17 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
e21ad16
Add env variable for BAP REST API version number, and use it in estab…
courtneymyers Jan 17, 2025
19ba727
Add BAP env variables to app's required env variables array, and remo…
courtneymyers Jan 17, 2025
c06bfec
Update GitHub Actions workflows to include BAP REST API version env
courtneymyers Jan 17, 2025
47259aa
Merge pull request #534 from USEPA/feature/add-bap-api-version-env
courtneymyers Jan 17, 2025
42f41d2
Prefix unused function parameters with an underscore
courtneymyers Jan 17, 2025
415c707
Update queryBapFor2024PRFData to include 2024 FRF contacts record typ…
courtneymyers Jan 21, 2025
47618be
Update new 2024 PRF submission data to include contact record types
courtneymyers Jan 22, 2025
bac0b55
Merge pull request #535 from USEPA/feature/update-new-2024-prf-data
courtneymyers Jan 22, 2025
f2a076b
Update queryBapFor2024PRFData() to get each contact's record type fro…
courtneymyers Jan 22, 2025
d521147
Remove no longer used record type variables from fetchDataForPRFSubmi…
courtneymyers Jan 22, 2025
9de2026
Merge pull request #536 from USEPA/feature/update-2024-frf-record-typ…
courtneymyers Jan 22, 2025
afaf55b
Add server utility function to fetch a PDF of an existing form submis…
courtneymyers Jan 23, 2025
2443f0c
Add custom hook to fetch a PDF of a form submission from Formio
courtneymyers Jan 23, 2025
bfb4826
Update server app's 2022, 2023, and 2024 Formio API routes to include…
courtneymyers Jan 23, 2025
1680023
Update all forms to use the useSubmissionPDFQuery() custom hook and i…
courtneymyers Jan 23, 2025
f5abb29
Update OpenAPI docs to include new Formio PDF submission routes
courtneymyers Jan 23, 2025
5f4efe0
Merge pull request #537 from USEPA/feature/add-submission-download-fu…
courtneymyers Jan 23, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
FORMIO_PROJECT_NAME: ${{ secrets.FORMIO_PROJECT_NAME }}
FORMIO_API_KEY: ${{ secrets.FORMIO_API_KEY }}
FORMIO_PKG_AUTH_TOKEN: ${{ secrets.FORMIO_PKG_AUTH_TOKEN }}
BAP_REST_API_VERSION: ${{ secrets.BAP_REST_API_VERSION }}
BAP_CLIENT_ID: ${{ secrets.BAP_CLIENT_ID }}
BAP_CLIENT_SECRET: ${{ secrets.BAP_CLIENT_SECRET }}
BAP_URL: ${{ secrets.BAP_URL }}
Expand Down Expand Up @@ -177,6 +178,7 @@ jobs:
cf set-env $APP_NAME "FORMIO_BASE_URL" "$FORMIO_BASE_URL" > /dev/null
cf set-env $APP_NAME "FORMIO_PROJECT_NAME" "$FORMIO_PROJECT_NAME" > /dev/null
cf set-env $APP_NAME "FORMIO_API_KEY" "$FORMIO_API_KEY" > /dev/null
cf set-env $APP_NAME "BAP_REST_API_VERSION" "$BAP_REST_API_VERSION" > /dev/null
cf set-env $APP_NAME "BAP_CLIENT_ID" "$BAP_CLIENT_ID" > /dev/null
cf set-env $APP_NAME "BAP_CLIENT_SECRET" "$BAP_CLIENT_SECRET" > /dev/null
cf set-env $APP_NAME "BAP_URL" "$BAP_URL" > /dev/null
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
FORMIO_PROJECT_NAME: ${{ secrets.FORMIO_PROJECT_NAME }}
FORMIO_API_KEY: ${{ secrets.FORMIO_API_KEY }}
FORMIO_PKG_AUTH_TOKEN: ${{ secrets.FORMIO_PKG_AUTH_TOKEN }}
BAP_REST_API_VERSION: ${{ secrets.BAP_REST_API_VERSION }}
BAP_CLIENT_ID: ${{ secrets.BAP_CLIENT_ID }}
BAP_CLIENT_SECRET: ${{ secrets.BAP_CLIENT_SECRET }}
BAP_URL: ${{ secrets.BAP_URL }}
Expand Down Expand Up @@ -177,6 +178,7 @@ jobs:
cf set-env $APP_NAME "FORMIO_BASE_URL" "$FORMIO_BASE_URL" > /dev/null
cf set-env $APP_NAME "FORMIO_PROJECT_NAME" "$FORMIO_PROJECT_NAME" > /dev/null
cf set-env $APP_NAME "FORMIO_API_KEY" "$FORMIO_API_KEY" > /dev/null
cf set-env $APP_NAME "BAP_REST_API_VERSION" "$BAP_REST_API_VERSION" > /dev/null
cf set-env $APP_NAME "BAP_CLIENT_ID" "$BAP_CLIENT_ID" > /dev/null
cf set-env $APP_NAME "BAP_CLIENT_SECRET" "$BAP_CLIENT_SECRET" > /dev/null
cf set-env $APP_NAME "BAP_URL" "$BAP_URL" > /dev/null
Expand Down
34 changes: 33 additions & 1 deletion app/client/src/routes/crf2022.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
useContentData,
useConfigData,
useBapSamData,
useSubmissionPDFQuery,
useSubmissionsQueries,
useSubmissions,
submissionNeedsEdits,
Expand All @@ -27,7 +28,7 @@ import {
entityHasDebtSubjectToOffset,
getUserInfo,
} from "@/utilities";
import { Loading } from "@/components/loading";
import { Loading, LoadingButtonIcon } from "@/components/loading";
import { Message } from "@/components/message";
import { MarkdownContent } from "@/components/markdownContent";
import { useNotificationsActions } from "@/contexts/notifications";
Expand All @@ -40,6 +41,7 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) {

useEffect(() => {
queryClient.resetQueries({ queryKey: ["formio/2022/crf-submission"] });
queryClient.resetQueries({ queryKey: ["formio/2022/crf-pdf"] });
}, [queryClient]);

const url = `${serverUrl}/api/formio/2022/crf-submission/${rebateId}`;
Expand Down Expand Up @@ -129,6 +131,12 @@ function CloseOutRequestForm(props: { email: string }) {
const { query, mutation } = useFormioSubmissionQueryAndMutation(rebateId);
const { userAccess, formSchema, submission } = query.data ?? {};

const pdfQuery = useSubmissionPDFQuery({
rebateYear: "2022",
formType: "crf",
mongoId: submission?._id || "",
});

/**
* Stores when data is being posted to the server, so a loading overlay can
* be rendered over the form, preventing the user from losing input data when
Expand Down Expand Up @@ -243,6 +251,30 @@ function CloseOutRequestForm(props: { email: string }) {
</li>
</ul>

{submission?._id && (
<p>
<button
className="usa-button font-sans-2xs margin-right-0 padding-x-105 padding-y-1"
type="button"
disabled={pdfQuery.isFetching}
onClick={(_ev) => pdfQuery.refetch()}
>
<span className="display-flex flex-align-center">
<svg
className="usa-icon"
aria-hidden="true"
focusable="false"
role="img"
>
<use href={`${icons}#arrow_downward`} />
</svg>
<span className="margin-left-1">Download PDF</span>
{pdfQuery.isFetching && <LoadingButtonIcon position="end" />}
</span>
</button>
</p>
)}

<Dialog as="div" open={dataIsPosting.current} onClose={(_value) => {}}>
<div className={clsx("tw-fixed tw-inset-0 tw-bg-black/30")} />
<div className={clsx("tw-fixed tw-inset-0 tw-z-20")}>
Expand Down
32 changes: 31 additions & 1 deletion app/client/src/routes/frf2022.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
useContentData,
useConfigData,
useBapSamData,
useSubmissionPDFQuery,
useSubmissionsQueries,
useSubmissions,
submissionNeedsEdits,
Expand All @@ -27,7 +28,7 @@ import {
entityHasDebtSubjectToOffset,
getUserInfo,
} from "@/utilities";
import { Loading } from "@/components/loading";
import { Loading, LoadingButtonIcon } from "@/components/loading";
import { Message } from "@/components/message";
import { MarkdownContent } from "@/components/markdownContent";
import { useDialogActions } from "@/contexts/dialog";
Expand All @@ -41,6 +42,7 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) {

useEffect(() => {
queryClient.resetQueries({ queryKey: ["formio/2022/frf-submission"] });
queryClient.resetQueries({ queryKey: ["formio/2022/frf-pdf"] });
}, [queryClient]);

const url = `${serverUrl}/api/formio/2022/frf-submission/${mongoId}`;
Expand Down Expand Up @@ -142,6 +144,12 @@ function FundingRequestForm(props: { email: string }) {
const { query, mutation } = useFormioSubmissionQueryAndMutation(mongoId);
const { userAccess, formSchema, submission } = query.data ?? {};

const pdfQuery = useSubmissionPDFQuery({
rebateYear: "2022",
formType: "frf",
mongoId,
});

/**
* Stores when data is being posted to the server, so a loading overlay can
* be rendered over the form, preventing the user from losing input data when
Expand Down Expand Up @@ -391,6 +399,28 @@ function FundingRequestForm(props: { email: string }) {
)}
</ul>

<p>
<button
className="usa-button font-sans-2xs margin-right-0 padding-x-105 padding-y-1"
type="button"
disabled={pdfQuery.isFetching}
onClick={(_ev) => pdfQuery.refetch()}
>
<span className="display-flex flex-align-center">
<svg
className="usa-icon"
aria-hidden="true"
focusable="false"
role="img"
>
<use href={`${icons}#arrow_downward`} />
</svg>
<span className="margin-left-1">Download PDF</span>
{pdfQuery.isFetching && <LoadingButtonIcon position="end" />}
</span>
</button>
</p>

<Dialog as="div" open={dataIsPosting.current} onClose={(_value) => {}}>
<div className={clsx("tw-fixed tw-inset-0 tw-bg-black/30")} />
<div className={clsx("tw-fixed tw-inset-0 tw-z-20")}>
Expand Down
32 changes: 31 additions & 1 deletion app/client/src/routes/frf2023.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
useContentData,
useConfigData,
useBapSamData,
useSubmissionPDFQuery,
useSubmissionsQueries,
useSubmissions,
submissionNeedsEdits,
Expand All @@ -27,7 +28,7 @@ import {
entityHasDebtSubjectToOffset,
getUserInfo,
} from "@/utilities";
import { Loading } from "@/components/loading";
import { Loading, LoadingButtonIcon } from "@/components/loading";
import { Message } from "@/components/message";
import { MarkdownContent } from "@/components/markdownContent";
import { useDialogActions } from "@/contexts/dialog";
Expand All @@ -41,6 +42,7 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) {

useEffect(() => {
queryClient.resetQueries({ queryKey: ["formio/2023/frf-submission"] });
queryClient.resetQueries({ queryKey: ["formio/2023/frf-pdf"] });
}, [queryClient]);

const url = `${serverUrl}/api/formio/2023/frf-submission/${mongoId}`;
Expand Down Expand Up @@ -128,6 +130,12 @@ function FundingRequestForm(props: { email: string }) {
const { query, mutation } = useFormioSubmissionQueryAndMutation(mongoId);
const { userAccess, formSchema, submission } = query.data ?? {};

const pdfQuery = useSubmissionPDFQuery({
rebateYear: "2023",
formType: "frf",
mongoId,
});

/**
* Stores when data is being posted to the server, so a loading overlay can
* be rendered over the form, preventing the user from losing input data when
Expand Down Expand Up @@ -377,6 +385,28 @@ function FundingRequestForm(props: { email: string }) {
)}
</ul>

<p>
<button
className="usa-button font-sans-2xs margin-right-0 padding-x-105 padding-y-1"
type="button"
disabled={pdfQuery.isFetching}
onClick={(_ev) => pdfQuery.refetch()}
>
<span className="display-flex flex-align-center">
<svg
className="usa-icon"
aria-hidden="true"
focusable="false"
role="img"
>
<use href={`${icons}#arrow_downward`} />
</svg>
<span className="margin-left-1">Download PDF</span>
{pdfQuery.isFetching && <LoadingButtonIcon position="end" />}
</span>
</button>
</p>

<Dialog as="div" open={dataIsPosting.current} onClose={(_value) => {}}>
<div className={clsx("tw-fixed tw-inset-0 tw-bg-black/30")} />
<div className={clsx("tw-fixed tw-inset-0 tw-z-20")}>
Expand Down
32 changes: 31 additions & 1 deletion app/client/src/routes/frf2024.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
useContentData,
useConfigData,
useBapSamData,
useSubmissionPDFQuery,
useSubmissionsQueries,
useSubmissions,
submissionNeedsEdits,
Expand All @@ -27,7 +28,7 @@ import {
entityHasDebtSubjectToOffset,
getUserInfo,
} from "@/utilities";
import { Loading } from "@/components/loading";
import { Loading, LoadingButtonIcon } from "@/components/loading";
import { Message } from "@/components/message";
import { MarkdownContent } from "@/components/markdownContent";
import { useDialogActions } from "@/contexts/dialog";
Expand All @@ -41,6 +42,7 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) {

useEffect(() => {
queryClient.resetQueries({ queryKey: ["formio/2024/frf-submission"] });
queryClient.resetQueries({ queryKey: ["formio/2024/frf-pdf"] });
}, [queryClient]);

const url = `${serverUrl}/api/formio/2024/frf-submission/${mongoId}`;
Expand Down Expand Up @@ -128,6 +130,12 @@ function FundingRequestForm(props: { email: string }) {
const { query, mutation } = useFormioSubmissionQueryAndMutation(mongoId);
const { userAccess, formSchema, submission } = query.data ?? {};

const pdfQuery = useSubmissionPDFQuery({
rebateYear: "2024",
formType: "frf",
mongoId,
});

/**
* Stores when data is being posted to the server, so a loading overlay can
* be rendered over the form, preventing the user from losing input data when
Expand Down Expand Up @@ -377,6 +385,28 @@ function FundingRequestForm(props: { email: string }) {
)}
</ul>

<p>
<button
className="usa-button font-sans-2xs margin-right-0 padding-x-105 padding-y-1"
type="button"
disabled={pdfQuery.isFetching}
onClick={(_ev) => pdfQuery.refetch()}
>
<span className="display-flex flex-align-center">
<svg
className="usa-icon"
aria-hidden="true"
focusable="false"
role="img"
>
<use href={`${icons}#arrow_downward`} />
</svg>
<span className="margin-left-1">Download PDF</span>
{pdfQuery.isFetching && <LoadingButtonIcon position="end" />}
</span>
</button>
</p>

<Dialog as="div" open={dataIsPosting.current} onClose={(_value) => {}}>
<div className={clsx("tw-fixed tw-inset-0 tw-bg-black/30")} />
<div className={clsx("tw-fixed tw-inset-0 tw-z-20")}>
Expand Down
34 changes: 33 additions & 1 deletion app/client/src/routes/prf2022.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
useContentData,
useConfigData,
useBapSamData,
useSubmissionPDFQuery,
useSubmissionsQueries,
useSubmissions,
submissionNeedsEdits,
Expand All @@ -27,7 +28,7 @@ import {
entityHasDebtSubjectToOffset,
getUserInfo,
} from "@/utilities";
import { Loading } from "@/components/loading";
import { Loading, LoadingButtonIcon } from "@/components/loading";
import { Message } from "@/components/message";
import { MarkdownContent } from "@/components/markdownContent";
import { useNotificationsActions } from "@/contexts/notifications";
Expand All @@ -40,6 +41,7 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) {

useEffect(() => {
queryClient.resetQueries({ queryKey: ["formio/2022/prf-submission"] });
queryClient.resetQueries({ queryKey: ["formio/2022/prf-pdf"] });
}, [queryClient]);

const url = `${serverUrl}/api/formio/2022/prf-submission/${rebateId}`;
Expand Down Expand Up @@ -129,6 +131,12 @@ function PaymentRequestForm(props: { email: string }) {
const { query, mutation } = useFormioSubmissionQueryAndMutation(rebateId);
const { userAccess, formSchema, submission } = query.data ?? {};

const pdfQuery = useSubmissionPDFQuery({
rebateYear: "2022",
formType: "prf",
mongoId: submission?._id || "",
});

/**
* Stores when data is being posted to the server, so a loading overlay can
* be rendered over the form, preventing the user from losing input data when
Expand Down Expand Up @@ -264,6 +272,30 @@ function PaymentRequestForm(props: { email: string }) {
</li>
</ul>

{submission?._id && (
<p>
<button
className="usa-button font-sans-2xs margin-right-0 padding-x-105 padding-y-1"
type="button"
disabled={pdfQuery.isFetching}
onClick={(_ev) => pdfQuery.refetch()}
>
<span className="display-flex flex-align-center">
<svg
className="usa-icon"
aria-hidden="true"
focusable="false"
role="img"
>
<use href={`${icons}#arrow_downward`} />
</svg>
<span className="margin-left-1">Download PDF</span>
{pdfQuery.isFetching && <LoadingButtonIcon position="end" />}
</span>
</button>
</p>
)}

<Dialog as="div" open={dataIsPosting.current} onClose={(_value) => {}}>
<div className={clsx("tw-fixed tw-inset-0 tw-bg-black/30")} />
<div className={clsx("tw-fixed tw-inset-0 tw-z-20")}>
Expand Down
Loading
Loading