From 0c71d39641dc035e867f996ee8f24f293fc9dd76 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Thu, 18 Jan 2024 14:07:08 -0500 Subject: [PATCH] Refactor preSubmitMessage --- .../ui/src/pages/actions/IssueRai.tsx | 32 +++++++++---------- .../ui/src/pages/actions/RespondToRai.tsx | 27 +++++++--------- .../ui/src/pages/actions/WithdrawPackage.tsx | 15 ++++----- .../ui/src/pages/actions/WithdrawRai.tsx | 19 ++++++----- .../ui/src/pages/actions/template.tsx | 31 +++++++++++------- 5 files changed, 61 insertions(+), 63 deletions(-) diff --git a/src/services/ui/src/pages/actions/IssueRai.tsx b/src/services/ui/src/pages/actions/IssueRai.tsx index 6355698374..b2b026a0b2 100644 --- a/src/services/ui/src/pages/actions/IssueRai.tsx +++ b/src/services/ui/src/pages/actions/IssueRai.tsx @@ -1,13 +1,13 @@ -import * as I from "@/components/Inputs"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; import { opensearch, PlanType } from "shared-types"; import { ActionFormTemplate } from "@/pages/actions/template"; import { useActionSubmitHandler } from "@/hooks/useActionFormController"; -import { ActionFormIntro } from "@/pages/actions/common"; import { FormSetup } from "@/pages/actions/setups"; +const preSubmitMessage = + "Once you submit this form, a confirmation email is sent to you and to the State."; export const RaiIssue = ({ item, schema, @@ -26,22 +26,20 @@ export const RaiIssue = ({ item={item} formController={form} submitHandler={handleSubmit} - intro={ - - Indicates a required field -

- Issuance of a Formal RAI in OneMAC will create a Formal RAI email - sent to the State. This will also create a section in the package - details summary for you and the State to have record. Please attach - the Formal RAI Letter along with any additional information or - comments in the provided text box. Once you submit this form, a - confirmation email is sent to you and to the State.{" "} - - If you leave this page, you will lose your progress on this form. - -

-
+ title={"Formal RAI Details"} + description={ +

+ Issuance of a Formal RAI in OneMAC will create a Formal RAI email sent + to the State. This will also create a section in the package details + summary for you and the State to have record. Please attach the Formal + RAI Letter along with any additional information or comments in the + provided text box. {preSubmitMessage} + + If you leave this page, you will lose your progress on this form. + +

} + preSubmitMessage={preSubmitMessage} attachments={attachments} attachmentFaqLink={"/faq/#medicaid-spa-rai-attachments"} requireAddlInfo diff --git a/src/services/ui/src/pages/actions/RespondToRai.tsx b/src/services/ui/src/pages/actions/RespondToRai.tsx index 4fa227fed8..16eff41bef 100644 --- a/src/services/ui/src/pages/actions/RespondToRai.tsx +++ b/src/services/ui/src/pages/actions/RespondToRai.tsx @@ -1,13 +1,12 @@ -import * as I from "@/components/Inputs"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { opensearch, PlanType } from "shared-types"; import { useActionSubmitHandler } from "@/hooks/useActionFormController"; -import { ActionFormIntro } from "@/pages/actions/common"; import { ActionFormTemplate } from "@/pages/actions/template"; import { FormSetup } from "@/pages/actions/setups"; -import { SetupOptions } from "@/pages"; +const preSubmitMessage = + "Once you submit this form, a confirmation email is sent to you and to CMS. CMS will use this content to review your package, and you will not be able to edit this form. If CMS needs any additional information, they will follow up by email."; export const RespondToRai = ({ item, schema, @@ -28,20 +27,16 @@ export const RespondToRai = ({ item={item} formController={form} submitHandler={handleSubmit} - intro={ - - Indicates a required field -

- Once you submit this form, a confirmation email is sent to you and - to CMS. CMS will use this content to review your package, and you - will not be able to edit this form. If CMS needs any additional - information, they will follow up by email.{" "} - - If you leave this page, you will lose your progress on this form. - -

-
+ title={`${item._source.planType} Formal RAI Details`} + description={ +

+ {preSubmitMessage}{" "} + + If you leave this page, you will lose your progress on this form. + +

} + preSubmitMessage={preSubmitMessage} attachments={attachments} attachmentFaqLink={"/faq/#medicaid-spa-rai-attachments"} addlInfoInstructions={ diff --git a/src/services/ui/src/pages/actions/WithdrawPackage.tsx b/src/services/ui/src/pages/actions/WithdrawPackage.tsx index e2e3054534..b70318890d 100644 --- a/src/services/ui/src/pages/actions/WithdrawPackage.tsx +++ b/src/services/ui/src/pages/actions/WithdrawPackage.tsx @@ -34,6 +34,8 @@ const addlInfoInstructions: Record = { "CHIP SPA":

Explain your need for withdrawal.

, }; +const preSubmitMessage = + "Once complete, you will not be able to resubmit this package. CMS will be notified and will use this content to review your request. If CMS needs any additional information, they will follow up by email."; export const WithdrawPackage = ({ item, schema, @@ -55,16 +57,11 @@ export const WithdrawPackage = ({ item={item} formController={form} submitHandler={handleSubmit} - intro={ - -

- Complete this form to withdraw a package. Once complete, you will - not be able to resubmit this package. CMS will be notified and will - use this content to review your request. If CMS needs any additional - information, they will follow up by email. -

-
+ title={`Withdraw ${item._source.planType} Package`} + description={ +

Complete this form to withdraw a package. {preSubmitMessage}

} + preSubmitMessage={preSubmitMessage} attachments={attachments} attachmentFaqLink={"/faq"} attachmentInstructions={ diff --git a/src/services/ui/src/pages/actions/WithdrawRai.tsx b/src/services/ui/src/pages/actions/WithdrawRai.tsx index 5ed292b91b..4d6cd4ee83 100644 --- a/src/services/ui/src/pages/actions/WithdrawRai.tsx +++ b/src/services/ui/src/pages/actions/WithdrawRai.tsx @@ -1,13 +1,13 @@ -import * as I from "@/components/Inputs"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { opensearch, PlanType } from "shared-types"; import { ActionFormTemplate } from "@/pages/actions/template"; import { useActionSubmitHandler } from "@/hooks/useActionFormController"; -import { ActionFormIntro } from "@/pages/actions/common"; import { FormSetup } from "@/pages/actions/setups"; +const preSubmitMessage = + "Once complete, you and CMS will receive an email confirmation."; export const WithdrawRai = ({ item, schema, @@ -27,15 +27,14 @@ export const WithdrawRai = ({ item={item} formController={form} submitHandler={handleSubmit} - intro={ - - Indicates a required field -

- Complete this form to withdraw the Formal RAI response. Once - complete, you and CMS will receive an email confirmation. -

-
+ title={"Withdraw Formal RAI Response Details"} + description={ +

+ Complete this form to withdraw the Formal RAI response.{" "} + {preSubmitMessage} +

} + preSubmitMessage={preSubmitMessage} attachments={attachments} attachmentFaqLink={"/faq/#medicaid-spa-rai-attachments"} requireAddlInfo diff --git a/src/services/ui/src/pages/actions/template.tsx b/src/services/ui/src/pages/actions/template.tsx index 509620df46..2dcec43785 100644 --- a/src/services/ui/src/pages/actions/template.tsx +++ b/src/services/ui/src/pages/actions/template.tsx @@ -1,9 +1,6 @@ import { Alert, LoadingSpinner } from "@/components"; -import { PackageInfo } from "@/pages/actions/common"; -import { - AttachmentsSizeTypesDesc, - PreSubmissionMessage, -} from "@/pages/form/content"; +import { ActionFormIntro, PackageInfo } from "@/pages/actions/common"; +import { AttachmentsSizeTypesDesc } from "@/pages/form/content"; import { SlotAdditionalInfo, SlotAttachments, @@ -15,7 +12,7 @@ import { FormMessage, RequiredIndicator, } from "@/components/Inputs"; -import { ReactElement } from "react"; +import { ReactElement, ReactNode } from "react"; import { opensearch } from "shared-types"; import { isStateUser } from "shared-utils"; import { @@ -27,12 +24,15 @@ import { import { AttachmentRecipe } from "@/lib"; import { useModalContext } from "@/pages/form/modals"; import { useGetUser } from "@/api/useGetUser"; +import { Info } from "lucide-react"; export const ActionFormTemplate = ({ item, formController, submitHandler, - intro, + title, + description, + preSubmitMessage, attachments, attachmentFaqLink, attachmentInstructions, @@ -42,7 +42,9 @@ export const ActionFormTemplate = ({ item: opensearch.main.ItemResult; formController: UseFormReturn; submitHandler: SubmitHandler; - intro: ReactElement; + title: string; + description: ReactNode; + preSubmitMessage?: string; attachments: AttachmentRecipe[]; attachmentFaqLink: string; attachmentInstructions?: ReactElement; @@ -50,12 +52,14 @@ export const ActionFormTemplate = ({ addlInfoInstructions?: ReactElement; }) => { const { setCancelModalOpen } = useModalContext(); - const { data: user } = useGetUser(); return (
{formController.formState.isSubmitting && } - {intro} + + Indicates a required field + {description} +

Attachments

{attachmentInstructions} @@ -102,7 +106,12 @@ export const ActionFormTemplate = ({ )} - {isStateUser(user!.user) && } + {preSubmitMessage && ( + + +

{preSubmitMessage}

+
+ )}