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

MDCT-2759 + 2760: Transition Benchmarks w/ Drawer #65

Merged
merged 11 commits into from
Aug 31, 2023
87 changes: 79 additions & 8 deletions services/app-api/forms/wp.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"basePath": "/wp",
"version": "WP_2023-08-21",
"entities": {
"": { "required": true }
"targetPopulation": { "required": true }
},
"routes": [
{
Expand All @@ -23,20 +23,91 @@
{
"name": "Transition Benchmarks",
"path": "/wp/transition-benchmarks",
"pageType": "standard",
"pageType": "modalDrawer",
"entityType": "targetPopulation",
"verbiage": {
"intro": {
"exportSectionHeader": "",
"section": "",
"subsection": "",
"subsection": "Transition Benchmark Projections",
"info": [
{
"type": "html",
"content": ""
"type": "span",
"content": "Provide the projected number of transitions for target populations during each quarter. This number includes institutional residents who are discharged from an institution to a qualified residence during the reporting period, enroll in MFP, and being using Medicaid home and community-based services (HCBS)."
}
]
},
"exportSectionHeader": ""
"dashboardTitle": "Report projected number of transitions for each target population",
"addEntityButtonText": "Add other target population",
"editEntityButtonText": "Edit name",
"addEditModalAddTitle": "Add other target population",
"addEditModalEditTitle": "Edit other target population",
"deleteEntityButtonAltText": "Delete other target population",
"deleteModalTitle": "Are you sure you want to delete this target population?",
"deleteModalConfirmButtonText": "Yes, delete population",
"deleteModalWarning": "Are you sure you want to proceed? You will lose all information entered for this population in the Work Plan. The population will remain in previously submitted Semi-Annual Reports if applicable.",
"entityUnfinishedMessage": "Complete the remaining indicators for this access measure by entering details.",
"enterEntityDetailsButtonText": "Edit",
"reviewPdfHint": "To view Transition Benchmark Totals by target population and by quarter, click <i>Review PDF</i> and it will open a summary in a new tab.",
"drawerTitle": "Report transition benchmarks for ",
"drawerInfo": [
{
"type": "span",
"content": "Please provide the projected number of transitions for <i>[entity_name]</i> during each quarter. This number includes institutional residents who are discharged from an institution to a qualified residence during the reporting period, enroll in MFP, and begin using Medicaid HCBS."
},
{
"type": "p",
"content": "Complete all fields and select the Save & close button to save this section."
}
]
},
"modalForm": {
"id": "tb-modal",
"fields": [
{
"id": "transitionBenchmarks_targetPopulationName",
"type": "text",
"validation": "text",
"props": {
"label": "Target population name",
"hint": "Specify an \"other\" target population applicable to your MFP demonstration project. Individuals reported under this population must align throughout MFP. (e.g., HIV/AIDS, brain injury)"
}
}
]
},
"drawerForm": {
"id": "tb-drawer",
"fields": [
{
"id": "transitionBenchmarks_applicableToMfpDemonstration",
"type": "radio",
"validation": "radio",
"props": {
"label": "Is this target population applicable to your MFP demonstration?",
"hint": "Enter 0 for quarters with no projected transitions. Enter N/A for quarters you do not expect to report.",
"choices": [
{
"id": "2UObIwERkSKEGVUU1g8E1v",
"label": "No"
},
{
"id": "2UObIuHjl15upf6tLcgcWd",
"label": "Yes",
"children": [
{
"id": "quarterlyProjections_1",
"type": "number",
"nested": true,
"parentFieldName": "transitionBenchmarks_applicableToMfpDemonstration",
"parentOptionId": "2UObIuHjl15upf6tLcgcWd",
"props": {
"label": "2023 Q4"
}
}
]
}
]
}
}
]
}
},
{
Expand Down
Binary file added services/ui-src/src/assets/icons/icon_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion services/ui-src/src/components/app/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
// utils
import { ScrollToTopComponent, useUserStore } from "utils";
// types
import { ReportType, ReportRoute } from "types";
import { ReportRoute, ReportType } from "types";

export const AppRoutes = () => {
const { userIsAdmin } = useUserStore().user ?? {};
Expand Down Expand Up @@ -51,6 +51,7 @@ export const AppRoutes = () => {
pageType: "standard",
},
];

// LaunchDarkly
const wpReport = useFlags()?.wpReport;
const sarReport = useFlags().sarReport;
Expand Down
16 changes: 12 additions & 4 deletions services/ui-src/src/components/drawers/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import { makeMediaQueryClasses, parseCustomHtml } from "utils";
export const Drawer = ({
verbiage,
drawerDisclosure,
selectedEntity,
children,
...props
}: Props) => {
const mqClasses = makeMediaQueryClasses();
const { isOpen, onClose } = drawerDisclosure;

return (
<ChakraDrawer
isOpen={isOpen}
Expand All @@ -39,7 +41,9 @@ export const Drawer = ({
{verbiage.drawerEyebrowTitle}
</Text>
)}
<Text sx={sx.drawerHeaderText}>{verbiage.drawerTitle}</Text>
<Text sx={sx.drawerHeaderText}>
{verbiage.drawerTitle + selectedEntity}
</Text>
{verbiage.drawerInfo && (
<Box sx={sx.infoTextBox}>
{parseCustomHtml(verbiage.drawerInfo)}
Expand Down Expand Up @@ -71,6 +75,7 @@ interface Props {
isOpen: boolean;
onClose: Function;
};
selectedEntity?: string;
[key: string]: any;
}

Expand Down Expand Up @@ -127,9 +132,12 @@ const sx = {
},
infoTextBox: {
marginTop: "2rem",
"p, span": {
color: "palette.gray",
fontSize: "16px",
fontSize: "md",
fontWeight: "light",
color: "palette.gray",
paddingBottom: "0",
p: {
marginTop: "1rem",
},
a: {
color: "palette.primary",
Expand Down
1 change: 1 addition & 0 deletions services/ui-src/src/components/drawers/ReportDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const ReportDrawer = ({
verbiage={verbiage}
drawerDisclosure={drawerDisclosure}
entityType={entityType}
selectedEntity={selectedEntity?.name}
{...props}
>
{formFieldsExist ? (
Expand Down
3 changes: 2 additions & 1 deletion services/ui-src/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ export { ReportPageWrapper } from "./reports/ReportPageWrapper";
export { ReportContext } from "./reports/ReportProvider";
export { DrawerReportPage } from "./reports/DrawerReportPage";
export { ModalDrawerReportPage } from "./reports/ModalDrawerReportPage";

// statusing
export { StatusTable } from "./statusing/StatusTable";
// tables
export { EntityRow } from "./tables/EntityRow";
export { EntityStatusIcon } from "./tables/EntityStatusIcon";
export { Table } from "./tables/Table";
// widgets
export { SpreadsheetWidget } from "./widgets/SpreadsheetWidget";
Expand Down
9 changes: 9 additions & 0 deletions services/ui-src/src/components/menus/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ export const Sidebar = ({ isHidden }: SidebarProps) => {
section={{ name: "placeholder", path: "/standard" }}
level={1}
/>
{/* Temporary Page Navigation */}
<NavSection
keeysnc marked this conversation as resolved.
Show resolved Hide resolved
key={"tb-section"}
section={{
name: "Transition Benchmarks",
path: "/wp/transition-benchmarks",
}}
level={1}
/>
</Box>
</Box>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {
addEntityButtonText,
editEntityButtonText,
enterEntityDetailsButtonText,
deleteModalConfirmButtonText,
// deleteModalConfirmButtonText,
} = mockModalDrawerReportPageJson.verbiage;

const modalDrawerReportPageComponentWithEntities = (
Expand All @@ -50,28 +50,18 @@ describe("Test ModalDrawerReportPage with entities", () => {
await userEvent.click(addEntityButton);
expect(screen.getByRole("dialog")).toBeVisible();

const editButton = screen.getByText(editEntityButtonText);
const editButton = screen.getAllByText(editEntityButtonText)[0];
await userEvent.click(editButton);
const closeButton = screen.getByText("Close");
await userEvent.click(closeButton);
});

test("ModalDrawerReportPage opens the delete modal on remove click", async () => {
const addEntityButton = screen.getByText(addEntityButtonText);
const removeButton = screen.getByTestId("delete-entity-button");
await userEvent.click(removeButton);
// click delete in modal
const deleteButton = screen.getByText(deleteModalConfirmButtonText);
await userEvent.click(deleteButton);

// verify that the field is removed
const inputBoxLabelAfterRemove = screen.queryAllByTestId("test-label");
expect(inputBoxLabelAfterRemove).toHaveLength(0);
expect(addEntityButton).toBeVisible();
});
// TODO: test delete modal + functionality

test("ModalDrawerReportPage opens the drawer on enter-details click", async () => {
const enterDetailsButton = screen.getByText(enterEntityDetailsButtonText);
const enterDetailsButton = screen.getAllByText(
enterEntityDetailsButtonText
)[0];
await userEvent.click(enterDetailsButton);
expect(screen.getByRole("dialog")).toBeVisible();
});
Expand Down
Loading
Loading