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

CMDCT-4116: NAAAR Dashboard Fields #11949

Merged
merged 2 commits into from
Dec 2, 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
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
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
Loading