Skip to content

Commit

Permalink
CMDCT-4116: NAAAR Dashboard Fields (#11949)
Browse files Browse the repository at this point in the history
  • Loading branch information
karla-vm authored Dec 2, 2024
1 parent 9523f64 commit 6da73bd
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
7 changes: 5 additions & 2 deletions services/ui-src/src/components/modals/AddEditReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ export const AddEditReportModal = ({
formData["reportingPeriodEndDate"]
);
const planTypeIncludedInProgram = formData["planTypeIncludedInProgram"];
const planTypeOtherText =
planTypeIncludedInProgram[0].value === "Other, specify"
? formData["planTypeIncludedInProgram-otherText"]
: null;

return {
metadata: {
Expand All @@ -158,8 +162,7 @@ export const AddEditReportModal = ({
lastAlteredBy: full_name,
copyFieldDataSourceId: copyFieldDataSourceId?.value,
planTypeIncludedInProgram,
"planTypeIncludedInProgram-otherText":
formData["planTypeIncludedInProgram-otherText"],
"planTypeIncludedInProgram-otherText": planTypeOtherText,
locked: false,
submissionCount: 0,
previousRevisions: [],
Expand Down
19 changes: 17 additions & 2 deletions services/ui-src/src/components/pages/Dashboard/DashboardTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import { Button, Image, Td, Tr, Spinner } from "@chakra-ui/react";
import { Table } from "components";
// utils
import { AnyObject, ReportMetadataShape, TableContentShape } from "types";
import {
AnyObject,
ReportMetadataShape,
ReportType,
TableContentShape,
} from "types";
import { convertDateUtcToEt } from "utils";
// assets
import editIcon from "assets/icons/icon_edit_square_gray.png";
Expand Down Expand Up @@ -40,6 +45,14 @@ export const DashboardTable = ({
<Td sx={sxOverride.programNameText}>
{report.programName ?? report.submissionName}
</Td>
{/* Plan type (NAAAR only) */}
{report.reportType === ReportType.NAAAR && (
<Td>
{report["planTypeIncludedInProgram"]?.[0].value === "Other, specify"
? report["planTypeIncludedInProgram-otherText"]
: report.planTypeIncludedInProgram?.[0].value}
</Td>
)}
{/* Date Fields */}
<DateFields report={report} reportType={reportType} />
{/* Last Altered By */}
Expand Down Expand Up @@ -162,7 +175,9 @@ interface EditReportProps {
const DateFields = ({ report, reportType }: DateFieldProps) => {
return (
<>
{reportType === "MCPAR" && <Td>{convertDateUtcToEt(report.dueDate)}</Td>}
{reportType !== ReportType.MLR && (
<Td>{convertDateUtcToEt(report.dueDate)}</Td>
)}
<Td>{convertDateUtcToEt(report.lastAltered)}</Td>
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// components
import { Box, Button, Flex, Image, Text, Spinner } from "@chakra-ui/react";
// utils
import { AnyObject, ReportMetadataShape } from "types";
import { AnyObject, ReportMetadataShape, ReportType } from "types";
import { convertDateUtcToEt } from "utils";
// assets
import editIcon from "assets/icons/icon_edit_square_gray.png";
Expand All @@ -27,7 +27,7 @@ export const MobileDashboardTable = ({
<Box data-testid="mobile-row" sx={sx.mobileTable} key={report.id}>
<Box sx={sx.labelGroup}>
<Text sx={sx.label}>
{reportType === "MCPAR" ? "Program name" : "Submission name"}
{reportType === ReportType.MLR ? "Submission name" : "Program name"}
</Text>
<Flex alignContent="flex-start">
{isStateLevelUser && !report?.locked && (
Expand All @@ -44,6 +44,17 @@ export const MobileDashboardTable = ({
<Text sx={sxOverride.programNameText}>{report.programName}</Text>
</Flex>
</Box>
{reportType === ReportType.NAAAR && (
<Box sx={sx.labelGroup}>
<Text sx={sx.label}>Plan type</Text>
<Text>
{report["planTypeIncludedInProgram-otherText"]
? report["planTypeIncludedInProgram-otherText"]
: report.planTypeIncludedInProgram?.[0].value}
</Text>
</Box>
)}

<Box sx={sx.labelGroup}>
<Flex alignContent="flex-start">
<DateFields report={report} reportType={reportType} />
Expand Down Expand Up @@ -125,7 +136,7 @@ interface MobileDashboardTableProps {
const DateFields = ({ report, reportType }: DateFieldProps) => {
return (
<>
{reportType === "MCPAR" && (
{reportType !== ReportType.MLR && (
<Box sx={sx.editDate}>
<Text sx={sx.label}>Due date</Text>
<Text>{convertDateUtcToEt(report.dueDate)}</Text>
Expand Down

0 comments on commit 6da73bd

Please sign in to comment.