Skip to content

Commit

Permalink
YoY copy: show alert msg if reporting period is not available (#11466)
Browse files Browse the repository at this point in the history
Co-authored-by: Casie Siekman <[email protected]>
Co-authored-by: Brax Excell <[email protected]>
  • Loading branch information
3 people authored Sep 20, 2023
1 parent ce27594 commit bdf6ace
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 10 deletions.
1 change: 1 addition & 0 deletions services/app-api/forms/mcpar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2625,6 +2625,7 @@
"dashboardTitle": "Quality & performance measure total count:",
"countEntitiesInTitle": true,
"addEntityButtonText": "Add quality & performance measure",
"missingReportingPeriodMessage": "Add the Measure Reporting Period for this quality and performance measure by editing the measure.",
"editEntityButtonText": "Edit measure",
"addEditModalAddTitle": "Add a quality & performance measure",
"addEditModalEditTitle": "Edit quality & performance measure",
Expand Down
1 change: 1 addition & 0 deletions services/app-api/utils/testing/mocks/mockForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export const mockModalDrawerReportPageVerbiage = {
intro: mockVerbiageIntro,
dashboardTitle: "Mock dashboard title",
addEntityButtonText: "Mock add entity button text",
missingReportingPeriodMessage: "Mock measure unfinished message",
editEntityButtonText: "Mock edit entity button text",
addEditModalAddTitle: "Mock add/edit entity modal add title",
addEditModalEditTitle: "Mock add/edit entity modal edit title",
Expand Down
1 change: 1 addition & 0 deletions services/app-api/utils/types/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export interface DrawerReportPageVerbiage extends ReportPageVerbiage {
export interface ModalDrawerReportPageVerbiage
extends DrawerReportPageVerbiage {
addEntityButtonText: string;
missingReportingPeriodMessage: string;
editEntityButtonText: string;
addEditModalAddTitle: string;
addEditModalEditTitle: string;
Expand Down
31 changes: 22 additions & 9 deletions services/ui-src/src/components/cards/EntityCard/EntityCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,23 @@ export const EntityCard = ({
printVersion={!!printVersion}
/>
{openAddEditEntityModal && (
<Button
variant="outline"
size="sm"
sx={sx.editButton}
leftIcon={<Image src={editIcon} alt="edit icon" height="1rem" />}
onClick={() => openAddEditEntityModal(entity)}
>
{verbiage.editEntityButtonText}
</Button>
<>
{entityType == ModalDrawerEntityTypes.QUALITY_MEASURES &&
!formattedEntityData.reportingPeriod && (
<Text sx={sx.missingReportingPeriodMessage}>
{verbiage.missingReportingPeriodMessage}
</Text>
)}
<Button
variant="outline"
size="sm"
sx={sx.editButton}
leftIcon={<Image src={editIcon} alt="edit icon" height="1rem" />}
onClick={() => openAddEditEntityModal(entity)}
>
{verbiage.editEntityButtonText}
</Button>
</>
)}
{entityStarted || entityCompleted || printVersion ? (
<EntityCardBottomSection
Expand Down Expand Up @@ -239,6 +247,11 @@ const sx = {
filter: svgFilters.primary_darker,
},
},
missingReportingPeriodMessage: {
marginTop: "1rem",
fontSize: "xs",
color: "palette.error_dark",
},
unfinishedMessage: {
fontSize: "xs",
color: "palette.error_dark",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,18 @@ export const EntityCardTopSection = ({
? "D2.VII.7a Reporting Period and D2.VII.7b Reporting period: Date range"
: "Measure Reporting Period"}
</Text>
<Text sx={sx.subtext}>{formattedEntityData.reportingPeriod}</Text>
{formattedEntityData.reportingPeriod ? (
<Text sx={sx.subtext}>
{formattedEntityData.reportingPeriod}
</Text>
) : (
<Text
sx={sx.unfinishedMessage}
className={printVersion ? "pdf-color" : ""}
>
Not answered
</Text>
)}
</GridItem>
</Grid>
<Text sx={sx.subtitle}>
Expand Down Expand Up @@ -145,4 +156,11 @@ const sx = {
marginTop: "0.25rem",
fontSize: "sm",
},
unfinishedMessage: {
fontSize: "xs",
color: "palette.error_dark",
"&.pdf-color": {
color: "palette.error_darker",
},
},
};
1 change: 1 addition & 0 deletions services/ui-src/src/types/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export interface DrawerReportPageVerbiage extends ReportPageVerbiage {
export interface ModalDrawerReportPageVerbiage
extends DrawerReportPageVerbiage {
addEntityButtonText: string;
missingReportingPeriodMessage: string;
editEntityButtonText: string;
addEditModalAddTitle: string;
addEditModalEditTitle: string;
Expand Down
1 change: 1 addition & 0 deletions services/ui-src/src/utils/testing/mockForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export const mockNestedReportPageJson = {
export const mockModalDrawerReportPageVerbiage = {
intro: mockVerbiageIntro,
dashboardTitle: "Mock dashboard title",
missingReportingPeriodMessage: "Mock measure unfinished message",
addEntityButtonText: "Mock add entity button text",
editEntityButtonText: "Mock edit entity button text",
addEditModalAddTitle: "Mock add/edit entity modal add title",
Expand Down

0 comments on commit bdf6ace

Please sign in to comment.