Skip to content

Commit

Permalink
Merge pull request #247 from djnunez-aot/update-modal-text
Browse files Browse the repository at this point in the history
Setup custom modal text
  • Loading branch information
djnunez-aot authored Jan 21, 2025
2 parents 9a19c3e + f0d6a9a commit 7fed5bd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
17 changes: 13 additions & 4 deletions submit-web/src/components/Submission/DocumentRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Link as MuiLink, TableRow, Typography } from "@mui/material";
import { Submission } from "@/models/Submission";
import {
SUBMISSION_ITEM_METHOD,
SUBMISSION_ITEM_MODAL_CONTENT,
SUBMISSION_ITEM_TYPE,
SubmissionItem,
} from "@/models/SubmissionItem";
Expand Down Expand Up @@ -63,6 +64,14 @@ export default function DocumentRow({
}, [updatingSubmission, setIsLoading]);

const openConfirmationModal = () => {
const { title, description, confirmText } = SUBMISSION_ITEM_MODAL_CONTENT[
submissionItem.type.name
] || {
title: `Start ${subItemName} Review`,
description: `Would you like to start the ${subItemName} review now? This will begin the review counter.`,
confirmText: `Start ${subItemName} Review`,
};

setOpenModal(
<ConfirmationModal
onConfirm={() => {
Expand All @@ -75,11 +84,11 @@ export default function DocumentRow({
},
});
}}
title={`Start ${subItemName} Review`}
description={`Would you like to start the ${subItemName} review now? This will start the counter for the Review.`}
confirmText={`Start ${subItemName} Review`}
title={title}
description={description}
confirmText={confirmText}
cancelText="Start Later"
/>,
/>
);
};

Expand Down
17 changes: 17 additions & 0 deletions submit-web/src/models/SubmissionItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ export const SUBMISSION_ITEM_TYPE: Record<string, SubmissionItemTypeName> =
CONSULTATION_RECORD: "Consultation Record(s)",
});

export const SUBMISSION_ITEM_MODAL_CONTENT: Record<
string,
{ title: string; description: string; confirmText: string }
> = {
[SUBMISSION_ITEM_TYPE.MANAGEMENT_PLAN]: {
title: "Start Management Plan Review",
description:
"Would you like to start the Management Plan review now? This will start the counter for the MP Review.",
confirmText: "Start MP Review",
},
[SUBMISSION_ITEM_TYPE.CONSULTATION_RECORD]: {
title: "Start Consultation Check",
description: "Would you like to start the Consultation Check now?",
confirmText: "Start Consultation Check",
},
};

export interface SubmissionItem {
id: number;
package_id: number;
Expand Down

0 comments on commit 7fed5bd

Please sign in to comment.