All files / react-app/src/features/forms/post-submission/toggle-withdraw-rai index.tsx

66.66% Statements 4/6
100% Branches 0/0
50% Functions 2/4
66.66% Lines 4/6

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            72x 1x                                                       72x 1x                                                  
import { ActionForm } from "@/components/ActionForm";
import { formSchemas } from "@/formSchemas";
import { PackageSection } from "@/components/Form/content/PackageSection";
import { useParams } from "react-router";
import { isCmsUser } from "shared-utils";
 
export const EnableWithdrawRaiForm = () => {
  const { authority, id } = useParams();
 
  return (
    <ActionForm
      schema={formSchemas["toggle-withdraw-rai"]}
      additionalInformation={false}
      title="Enable Formal RAI Response Withdraw Details"
      fields={() => <PackageSection />}
      defaultValues={{ id, authority, raiWithdrawEnabled: true }}
      documentPollerArgs={{
        property: "id",
        documentChecker: (check) => check.recordExists,
      }}
      breadcrumbText="Enable Formal RAI Response Withdraw"
      formDescription="Once you submit this form, the most recent Formal RAI Response for this
    package will be able to be withdrawn by the state"
      showPreSubmissionMessage={false}
      areFieldsRequired={false}
      bannerPostSubmission={{
        header: "RAI response withdrawal enabled",
        body: `The state will be able to withdraw its RAI response. It may take up to a minute for this change to be applied.`,
        variant: "success",
      }}
      conditionsDeterminingUserAccess={[isCmsUser]}
    />
  );
};
 
export const DisableWithdrawRaiForm = () => {
  const { authority, id } = useParams();
  return (
    <ActionForm
      schema={formSchemas["toggle-withdraw-rai"]}
      additionalInformation={false}
      title="Disable Formal RAI Response Withdraw Details"
      fields={() => <PackageSection />}
      defaultValues={{ id, authority, raiWithdrawEnabled: false }}
      documentPollerArgs={{
        property: "id",
        documentChecker: (check) => check.recordExists,
      }}
      breadcrumbText="Disable Formal RAI Response Withdraw"
      formDescription="The state will not be able to withdraw its RAI response. It may take up to a minute for this change to be applied."
      showPreSubmissionMessage={false}
      areFieldsRequired={false}
      bannerPostSubmission={{
        header: "RAI response withdrawal disabled",
        body: `The state will not be able to withdraw its RAI response. It may take up to a minute for this change to be applied.`,
        variant: "success",
      }}
      conditionsDeterminingUserAccess={[isCmsUser]}
    />
  );
};