Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 1x 1x 1x | import { LoaderFunction, Navigate, useParams } from "react-router";
import { Action, AuthorityUnion } from "shared-types";
import { getItem } from "@/api";
import { queryClient } from "@/utils";
import { TemporaryExtensionForm } from "../waiver/temporary-extension";
import { Amendment } from "./amend";
import { RespondToRaiChip, RespondToRaiMedicaid, RespondToRaiWaiver } from "./respond-to-rai";
import { DisableWithdrawRaiForm, EnableWithdrawRaiForm } from "./toggle-withdraw-rai";
import { UploadSubsequentDocuments } from "./upload-subsequent-documents";
import {
WithdrawPackageAction,
WithdrawPackageActionChip,
WithdrawPackageActionWaiver,
} from "./withdraw-package";
import { WithdrawRaiForm } from "./withdraw-rai";
export const postSubmissionForms: Partial<
Record<Action, Partial<Record<AuthorityUnion, () => React.ReactNode>>>
> = {
"withdraw-package": {
"1915(b)": WithdrawPackageActionWaiver,
"1915(c)": WithdrawPackageActionWaiver,
"Medicaid SPA": WithdrawPackageAction,
"CHIP SPA": WithdrawPackageActionChip,
},
"respond-to-rai": {
"1915(b)": RespondToRaiWaiver,
"1915(c)": RespondToRaiWaiver,
"Medicaid SPA": RespondToRaiMedicaid,
"CHIP SPA": RespondToRaiChip,
},
"withdraw-rai": {
"1915(b)": WithdrawRaiForm,
"1915(c)": WithdrawRaiForm,
"Medicaid SPA": WithdrawRaiForm,
"CHIP SPA": WithdrawRaiForm,
},
"enable-rai-withdraw": {
"1915(b)": EnableWithdrawRaiForm,
"1915(c)": EnableWithdrawRaiForm,
"Medicaid SPA": EnableWithdrawRaiForm,
"CHIP SPA": EnableWithdrawRaiForm,
},
"disable-rai-withdraw": {
"1915(b)": DisableWithdrawRaiForm,
"1915(c)": DisableWithdrawRaiForm,
"Medicaid SPA": DisableWithdrawRaiForm,
"CHIP SPA": DisableWithdrawRaiForm,
},
"temporary-extension": {
"1915(b)": TemporaryExtensionForm,
},
"amend-waiver": {
["1915(b)"]: Amendment,
},
"upload-subsequent-documents": {
["1915(b)"]: UploadSubsequentDocuments,
["1915(c)"]: UploadSubsequentDocuments,
["Medicaid SPA"]: UploadSubsequentDocuments,
["CHIP SPA"]: UploadSubsequentDocuments,
},
};
export const PostSubmissionWrapper = () => {
const { type, authority } = useParams<{ authority: AuthorityUnion; type: string }>();
const PostSubmissionForm = postSubmissionForms?.[type]?.[authority];
if (PostSubmissionForm === undefined) {
return <Navigate to="/" />;
}
return <PostSubmissionForm />;
};
export const postSubmissionLoader: LoaderFunction = async ({ params }) => {
return await queryClient.fetchQuery({
queryKey: ["record", params.id],
queryFn: async () => getItem(params.id),
});
};
|