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

Release to val #376

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/packages/shared-types/attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export const attachmentTitleMap: Record<string, string> = {
bCapCostSpreadsheets:
"1915(b) Comprehensive (Capitated) Waiver Cost Effectiveness Spreadsheets",
bCapIndependentAssessment:
"1915(b) Comprehensive (Capitated) Waiver Independent Assessment",
"1915(b) Comprehensive (Capitated) Waiver Independent Assessment (first two renewals only)",
b4WaiverApplication:
"1915(b)(4) FFS Selective Contracting (Streamlined) Waiver Application Pre-print",
b4IndependentAssessment:
"1915(b)(4) FFS Selective Contracting (Streamlined) Independent Assessment",
"1915(b)(4) FFS Selective Contracting (Streamlined) Independent Assessment (first two renewals only)",
};
export type AttachmentKey = keyof typeof attachmentTitleMap;
export type AttachmentTitle = typeof attachmentTitleMap[AttachmentKey];
Expand Down
2 changes: 1 addition & 1 deletion src/services/ui/src/components/Routing/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const B_WAIVER_SUBMISSION_OPTIONS = "/new-submission/waiver/b";
export const B4_WAIVER_OPTIONS = "/new-submission/waiver/b/b4";
export const BCAP_WAIVER_OPTIONS = "/new-submission/waiver/b/capitated";
export const WAIVER_1915_B_AMEND_CAP =
"/new-submission/waiver/b/capitated/amend/create";
"/new-submission/waiver/b/capitated/amendment/create";
export const WAIVER_1915_B_RENEWAL_CAP =
"/new-submission/waiver/b/capitated/renewal/create";
export const WAIVER_1915_B_INITIAL_CAP =
Expand Down
29 changes: 25 additions & 4 deletions src/services/ui/src/components/Webform/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { LoadingSpinner } from "@/components";
import { Footer } from "./footer";
import { Link, useParams } from "../Routing";
import { useReadOnlyUser } from "./useReadOnlyUser";
import { useState } from "react";

export const Webforms = () => {
return (
Expand Down Expand Up @@ -72,16 +73,25 @@ function WebformBody({
const form = useForm({
defaultValues: values,
});
const [subData, setSubData] = useState("");

const onSave = () => {
const values = form.getValues();
localStorage.setItem(`${id}v${version}`, JSON.stringify(values));
alert("Saved");
};

const reset = () => {
setSubData("");
form.reset(documentInitializer(data));
localStorage.removeItem(`${id}v${version}`);
alert("Data Cleared");
};

const onSubmit = form.handleSubmit(
(draft) => {
console.log({ draft });
setSubData(JSON.stringify(draft, undefined, 2));
/**
* The validator is intended to be a replica of RHF validation.
* To be used in backend api handlers to validate incoming/outgoing form data against document when...
Expand All @@ -104,16 +114,27 @@ function WebformBody({
<fieldset disabled={readonly}>
<RHFDocument document={data} {...form} />
{!readonly && (
<div className="flex justify-between text-blue-700 underline">
<Button type="button" onClick={onSave} variant="ghost">
Save draft
</Button>
<div className="flex justify-between text-blue-700 underline my-2">
<div>
<Button type="button" onClick={onSave} variant="ghost">
Save draft
</Button>
<Button
type="button"
onClick={reset}
variant="outline"
className="mx-2"
>
Clear Data
</Button>
</div>
<Button type="submit">Submit</Button>
</div>
)}
</fieldset>
</form>
</Form>
{subData && <pre className="my-2 text-sm">{subData}</pre>}
<Footer />
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/services/ui/src/pages/create/options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ export const BCAP_WAIVER_OPTIONS: OptionData[] = [
{
title: "1915(b) Comprehensive (Capitated) Waiver Amendment ",
description: "Amend an existing 1915(b) Comprehensive (Capitated) Waiver",
linkTo: "/new-submission/waiver/b/capitated/amend/create",
linkTo: "/new-submission/waiver/b/capitated/amendment/create",
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const Capitated1915BWaiverAmendment = () => {
className="my-6 space-y-8 mx-auto justify-center flex flex-col"
>
<h1 className="text-2xl font-semibold mt-4 mb-2">
Amend a 1915(b) Waiver
1915(b) Comprehensive (Capitated) Waiver Amendment
</h1>
<SectionCard title="1915(b) Waiver Amendment Request Details">
<Content.FormIntroText />
Expand All @@ -106,7 +106,7 @@ export const Capitated1915BWaiverAmendment = () => {
Waiver Authority
</Inputs.FormLabel>
<span className="text-lg font-thin">
All other 1915(b) Waivers
1915(b)
</span>
</div>
<Inputs.FormField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const Capitated1915BWaiverInitial = () => {
className="my-6 space-y-8 mx-auto justify-center flex flex-col"
>
<h1 className="text-2xl font-semibold mt-4 mb-2">
1915(b) Initial Waiver Submission
1915(b) Comprehensive (Capitated) Initial Waiver
</h1>
<SectionCard title="Initial Waiver Details">
<Content.FormIntroText />
Expand All @@ -107,7 +107,7 @@ export const Capitated1915BWaiverInitial = () => {
Waiver Authority
</Inputs.FormLabel>
<span className="text-lg font-thin">
All other 1915(b) Waivers
1915(b)
</span>
</div>
<Inputs.FormField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,18 @@ export const Capitated1915BWaiverRenewal = () => {
className="my-6 space-y-8 mx-auto justify-center flex flex-col"
>
<h1 className="text-2xl font-semibold mt-4 mb-2">
Renew a 1915(b) Waiver
1915(b) Comprehensive (Capitated) Renewal Waiver
</h1>
<SectionCard title="1915(b) Waiver Renewal Details">
<Content.FormIntroText />
<div className="flex flex-col">
<Inputs.FormLabel className="font-semibold">
Waiver Authority
</Inputs.FormLabel>
<span className="text-lg font-thin">
1915(b)
</span>
</div>
<Inputs.FormField
control={form.control}
name="waiverNumber"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const Contracting1915BWaiverAmendment = () => {
className="my-6 space-y-8 mx-auto justify-center flex flex-col"
>
<h1 className="text-2xl font-semibold mt-4 mb-2">
Amend a 1915(b) Waiver
1915(b)(4) FFS Selective Contracting Waiver Amendment
</h1>
<SectionCard title="1915(b) Waiver Amendment Request Details">
<Content.FormIntroText />
Expand All @@ -103,7 +103,7 @@ export const Contracting1915BWaiverAmendment = () => {
Waiver Authority
</Inputs.FormLabel>
<span className="text-lg font-thin">
1915(b)(4) FFS Selective Contracting waviers
1915(b)
</span>
</div>
<Inputs.FormField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const Contracting1915BWaiverInitial = () => {
Waiver Authority
</Inputs.FormLabel>
<span className="text-lg font-thin">
1915(b)(4) FFS Selective Contracting waviers
1915(b)
</span>
</div>
<Inputs.FormField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const Contracting1915BWaiverRenewal = () => {
className="my-6 space-y-8 mx-auto justify-center flex flex-col"
>
<h1 className="text-2xl font-semibold mt-4 mb-2">
Renew a 1915(b) Waiver
1915(b)(4) FFS Selective Contracting Renewal Waiver
</h1>
<SectionCard title="1915(b) Waiver Renewal Details">
<Content.FormIntroText />
Expand All @@ -127,7 +127,7 @@ export const Contracting1915BWaiverRenewal = () => {
Waiver Authority
</Inputs.FormLabel>
<span className="text-lg font-thin">
1915(b)(4) FFS Selective Contracting waviers
1915(b)
</span>
</div>
<Inputs.FormField
Expand Down
8 changes: 4 additions & 4 deletions src/services/ui/src/pages/form/zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export const zInitialWaiverNumberSchema = z
export const zRenewalWaiverNumberSchema = z
.string()
.regex(
/^[A-Z]{2}-\d{4,5}\.R\d{2}\.00$/,
"Renewal Number must be in the format of SS-####.R##.00 or SS-#####.R##.00 For renewals, the “R##” starts with ‘01’ and ascends."
/^[A-Z]{2}-\d{4,5}\.R(?!00)\d{2}\.\d{2}$/,
"Renewal Number must be in the format of SS-####.R##.00 or SS-#####.R##.00 For renewals, the “R##” starts with '01' and ascends."
)
.refine((value) => isAuthorizedState(value), {
message:
Expand All @@ -73,7 +73,7 @@ export const zAmendmentWaiverNumberSchema = z
.string()
.regex(
/^[A-Z]{2}-\d{4,5}\.R\d{2}\.(?!00)\d{2}$/,
"The 1915(b) Waiver Amendment Number must be in the format of SS-####.R##.## or SS-#####.R##.##. For amendments, the last two digits start with ‘01’ and ascends."
"The 1915(b) Waiver Amendment Number must be in the format of SS-####.R##.## or SS-#####.R##.##. For amendments, the last two digits start with '01' and ascends."
)
.refine((value) => isAuthorizedState(value), {
message:
Expand All @@ -88,7 +88,7 @@ export const zAmendmentOriginalWaiverNumberSchema = z
.string()
.regex(
/^[A-Z]{2}-\d{4,5}\.R\d{2}\.\d{2}$/,
"The 1915(b) Waiver Amendment Number must be in the format of SS-####.R##.## or SS-#####.R##.##. For amendments, the last two digits start with ‘01’ and ascends."
"The 1915(b) Waiver Amendment Number must be in the format of SS-####.R##.## or SS-#####.R##.##. For amendments, the last two digits start with '01' and ascends."
)
.refine((value) => isAuthorizedState(value), {
message:
Expand Down
2 changes: 1 addition & 1 deletion src/services/ui/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const router = createBrowserRouter([
element: <P.CHIPEligibilityLandingPage />,
},
{
path: "/new-submission/waiver/b/capitated/amend/create",
path: "/new-submission/waiver/b/capitated/amendment/create",
element: <P.Capitated1915BWaiverAmendmentPage />,
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/services/ui/src/utils/labelMappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export const mapSubmissionCrumb = (path: Route) => {
case "/new-submission/spa/chip/create":
return "Submit new CHIP SPA";
case "/new-submission/waiver/b/capitated/initial/create":
return "1915(b) Comprehensive (Capitated) New Initial Waiver";
return "1915(b) Comprehensive (Capitated) Initial Waiver";
case "/new-submission/waiver/b/capitated/renewal/create":
return "1915(b) Comprehensive (Capitated) Renewal Waiver";
case "/new-submission/waiver/b/capitated/amend/create":
case "/new-submission/waiver/b/capitated/amendment/create":
return "1915(b) Comprehensive (Capitated) Waiver Amendment";
case "/new-submission/waiver/b/b4/initial/create":
return "1915(b)(4) FFS Selective Contracting Initial Waiver";
Expand Down
Loading