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

Remove incomplete warnings on submission summary page #2387

Merged
merged 14 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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 @@ -71,16 +71,17 @@ const relatedSubmissions = (
{contractRevisions.map((contractRev) => (
<li key={contractRev.contract.id}>
<Link
asCustom={NavLink}
to={`/submissions/${contractRev.contract.id}`}
>
{packageName(
contractRev.contract.stateCode,
contractRev.contract.stateNumber,
contractRev.formData.programIDs,
statePrograms
)}
</Link></li>
asCustom={NavLink}
to={`/submissions/${contractRev.contract.id}`}
>
{packageName(
contractRev.contract.stateCode,
contractRev.contract.stateNumber,
contractRev.formData.programIDs,
statePrograms
)}
</Link>
</li>
))}
</ul>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@
li:after {
content: ', ';
}
li:last-of-type::after{
li:last-of-type::after {
display: none;
}
}
}


// align state contacts
dl div[class^='grid-container'] {
padding: 0;
Expand Down Expand Up @@ -127,4 +126,3 @@
padding: 0;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export type UploadedDocumentsTableProps = {
multipleDocumentsAllowed?: boolean // used to determined if we display validations based on doc list length
documentCategory?: string // used to determine if we display document category column
isEditing?: boolean // default false, used to determine if we display validations for state users (or else extra context for CMS reviewers)
isSubmitted?: boolean // default false, used to determine if we display validations for CMS users
}

export const UploadedDocumentsTable = ({
Expand All @@ -49,6 +50,7 @@ export const UploadedDocumentsTable = ({
isSupportingDocuments = false,
multipleDocumentsAllowed = true,
isEditing = false,
isSubmitted = false,
}: UploadedDocumentsTableProps): React.ReactElement => {
const initialDocState = documents.map((doc) => ({
...doc,
Expand Down Expand Up @@ -94,6 +96,7 @@ export const UploadedDocumentsTable = ({
? styles.withMarginTop
: ''

const hasMultipleDocs = !multipleDocumentsAllowed && documents.length > 1
const tableCaptionJSX = (
<>
<span>{caption}</span>
Expand Down Expand Up @@ -149,16 +152,14 @@ export const UploadedDocumentsTable = ({
<div className={styles.captionContainer}>
{tableCaptionJSX}
</div>
{!multipleDocumentsAllowed &&
documents.length > 1 &&
!isEditing && (
<DataDetailMissingField
classname={styles.missingInfo}
requiredText="Only one document is allowed for a rate
{!isSubmitted && hasMultipleDocs && !isEditing && (
<DataDetailMissingField
classname={styles.missingInfo}
requiredText="Only one document is allowed for a rate
certification. You must remove documents before
continuing."
/>
)}
/>
)}
</caption>
<thead>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export const RateDetailsSummarySectionV2 = ({
isCMSUser,
}: RateDetailsSummarySectionV2Props): React.ReactElement => {
const { loggedInUser } = useAuth()
const isSubmittedOrCMSUser = contract.status === 'SUBMITTED' || loggedInUser?.role === 'CMS_USER'
const isSubmittedOrCMSUser =
contract.status === 'SUBMITTED' || loggedInUser?.role === 'CMS_USER'
const isEditing = !isSubmittedOrCMSUser && editNavigateTo !== undefined
const isPreviousSubmission = usePreviousSubmission()
const contractFormData = isEditing
Expand Down Expand Up @@ -108,8 +109,7 @@ export const RateDetailsSummarySectionV2 = ({

return {
packageId,
packageName:
refreshedName ?? `${packageName}`,
packageName: refreshedName ?? `${packageName}`,
}
}
)
Expand Down Expand Up @@ -260,14 +260,18 @@ export const RateDetailsSummarySectionV2 = ({
<DataDetail
id="ratePrograms"
label="Programs this rate certification covers"
explainMissingData={!isSubmittedOrCMSUser}
explainMissingData={
!isSubmittedOrCMSUser
}
children={ratePrograms(rate)}
/>
)}
<DataDetail
id="rateType"
label="Rate certification type"
explainMissingData={!isSubmittedOrCMSUser}
explainMissingData={
!isSubmittedOrCMSUser
}
children={rateCertificationType(rate)}
/>
<DataDetail
Expand All @@ -278,7 +282,9 @@ export const RateDetailsSummarySectionV2 = ({
? 'Rating period of original rate certification'
: 'Rating period'
}
explainMissingData={!isSubmittedOrCMSUser}
explainMissingData={
!isSubmittedOrCMSUser
}
children={
rateFormData.rateDateStart &&
rateFormData.rateDateEnd ? (
Expand All @@ -299,7 +305,9 @@ export const RateDetailsSummarySectionV2 = ({
? 'Date certified for rate amendment'
: 'Date certified'
}
explainMissingData={!isSubmittedOrCMSUser}
explainMissingData={
!isSubmittedOrCMSUser
}
children={formatCalendarDate(
rateFormData.rateDateCertified
)}
Expand All @@ -308,7 +316,9 @@ export const RateDetailsSummarySectionV2 = ({
<DataDetail
id="effectiveRatingPeriod"
label="Rate amendment effective dates"
explainMissingData={!isSubmittedOrCMSUser}
explainMissingData={
!isSubmittedOrCMSUser
}
children={`${formatCalendarDate(
rateFormData.amendmentEffectiveDateStart
)} to ${formatCalendarDate(
Expand All @@ -321,7 +331,9 @@ export const RateDetailsSummarySectionV2 = ({
<DataDetail
id="certifyingActuary"
label="Certifying actuary"
explainMissingData={!isSubmittedOrCMSUser}
explainMissingData={
!isSubmittedOrCMSUser
}
children={
<DataDetailContactField
contact={
Expand All @@ -335,7 +347,9 @@ export const RateDetailsSummarySectionV2 = ({
<DataDetail
id="rateCapitationType"
label="Does the actuary certify capitation rates specific to each rate cell or a rate range?"
explainMissingData={!isSubmittedOrCMSUser}
explainMissingData={
!isSubmittedOrCMSUser
}
children={rateCapitationType(rate)}
/>
</DoubleColumnGrid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ describe('SubmissionTypeSummarySection', () => {
})

it('renders expected fields for submitted package on submission summary', () => {
const stateSubmission = mockContractPackageSubmitted()
renderWithProviders(
<SubmissionTypeSummarySection
contract={{ ...stateSubmission, status: 'SUBMITTED' }}
Expand Down Expand Up @@ -216,4 +217,31 @@ describe('SubmissionTypeSummarySection', () => {
screen.queryByRole('button', { name: 'Test button' })
).toBeInTheDocument()
})

it('does not render fields with missing fields for submitted package on submission summary', () => {
const stateSubmission = mockContractPackageSubmitted()
const submittedPackage = stateSubmission.packageSubmissions[0]
submittedPackage.contractRevision.formData = {
...submittedPackage.contractRevision.formData,
submissionDescription: '',
programIDs: [],
}
stateSubmission.packageSubmissions[0] = submittedPackage

renderWithProviders(
<SubmissionTypeSummarySection
contract={{ ...stateSubmission, status: 'SUBMITTED' }}
statePrograms={statePrograms}
editNavigateTo="submission-type"
submissionName="MN-MSHO-0003"
isStateUser={true}
/>
)
expect(
screen.queryByRole('definition', { name: 'Program(s)' })
).not.toBeInTheDocument()
expect(
screen.queryByRole('definition', { name: 'Submission description' })
).not.toBeInTheDocument()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import { GenericErrorPage } from '../../../../Errors/GenericErrorPage'
import { getVisibleLatestContractFormData } from '../../../../../gqlHelpers/contractsAndRates'
import { Program, Contract } from '../../../../../gen/gqlClient'
import { usePreviousSubmission } from '../../../../../hooks/usePreviousSubmission'
import { booleanAsYesNoUserValue } from '../../../../../components/Form/FieldYesNo/FieldYesNo'
import { SectionCard } from '../../../../../components/SectionCard'
import styles from '../../../../../components/SubmissionSummarySection/SubmissionSummarySection.module.scss'
Expand All @@ -37,8 +36,10 @@ export const SubmissionTypeSummarySectionV2 = ({
submissionName,
isStateUser,
}: SubmissionTypeSummarySectionV2Props): React.ReactElement => {
const isPreviousSubmission = usePreviousSubmission()
const contractFormData = getVisibleLatestContractFormData(contract, isStateUser)
const contractFormData = getVisibleLatestContractFormData(
contract,
isStateUser
)
if (!contractFormData) return <GenericErrorPage />

const programNames = statePrograms
Expand All @@ -60,7 +61,7 @@ export const SubmissionTypeSummarySectionV2 = ({
{headerChildComponent && headerChildComponent}
</SectionHeader>
<dl>
{isSubmitted && !isPreviousSubmission && (
{isSubmitted && (
<DoubleColumnGrid>
<DataDetail
id="submitted"
Expand All @@ -76,13 +77,15 @@ export const SubmissionTypeSummarySectionV2 = ({
</DoubleColumnGrid>
)}
<DoubleColumnGrid>
<DataDetail
id="program"
label="Program(s)"
explainMissingData={!isSubmitted}
children={programNames}
/>
{contractFormData && (
{(programNames?.length > 0 || !isSubmitted) && (
<DataDetail
id="program"
label="Program(s)"
explainMissingData={!isSubmitted}
children={programNames}
/>
)}
{(contractFormData.submissionType || !isSubmitted) && (
<DataDetail
id="submissionType"
label="Submission type"
Expand All @@ -94,7 +97,7 @@ export const SubmissionTypeSummarySectionV2 = ({
}
/>
)}
{
{(contractFormData.contractType || !isSubmitted) && (
<DataDetail
id="contractType"
label="Contract action type"
Expand All @@ -107,19 +110,20 @@ export const SubmissionTypeSummarySectionV2 = ({
: ''
}
/>
}
{contractFormData &&
contractFormData.riskBasedContract !== null && (
<DataDetail
id="riskBasedContract"
label="Is this a risk based contract"
explainMissingData={!isSubmitted}
children={booleanAsYesNoUserValue(
contractFormData.riskBasedContract
)}
/>
)}
{contractFormData && (
)}
{(contractFormData.riskBasedContract !== null ||
(!isSubmitted &&
contractFormData.riskBasedContract !== null)) && (
<DataDetail
id="riskBasedContract"
label="Is this a risk based contract"
explainMissingData={!isSubmitted}
children={booleanAsYesNoUserValue(
contractFormData.riskBasedContract
)}
/>
)}
{(contractFormData.populationCovered || !isSubmitted) && (
<DataDetail
id="populationCoverage"
label="Which populations does this contract action cover?"
Expand All @@ -136,7 +140,8 @@ export const SubmissionTypeSummarySectionV2 = ({

<Grid row gap className={styles.reviewDataRow}>
<Grid col={12}>
{contractFormData && (
{(contractFormData.submissionDescription ||
!isSubmitted) && (
<DataDetail
id="submissionDescription"
label="Submission description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,14 @@ export const SubmissionSummaryV2 = (): React.ReactElement => {
const submissionStatus = contract.status
const statePrograms = contract.state.programs

const contractFormData = getVisibleLatestContractFormData(contract, isStateUser)
const contractFormData = getVisibleLatestContractFormData(
contract,
isStateUser
)
if (!contractFormData || !contract || !statePrograms) {
console.error('missing fundamental contract data inside submission summary')
console.error(
'missing fundamental contract data inside submission summary'
)
return <GenericErrorPage />
}

Expand All @@ -157,9 +162,6 @@ export const SubmissionSummaryV2 = (): React.ReactElement => {

return (
<div className={styles.background}>
<div style={{ textAlign: 'center' }}>
This is the V2 page of the SubmissionSummary
</div>
<GridContainer
data-testid="submission-summary"
className={styles.container}
Expand Down Expand Up @@ -255,24 +257,24 @@ export const SubmissionSummaryV2 = (): React.ReactElement => {
/>
}

{(
{
<ContractDetailsSummarySectionV2
contract={contract}
isCMSUser={isCMSUser}
submissionName={name}
onDocumentError={handleDocumentDownloadError}
/>
)}
}

{isContractActionAndRateCertification && (
<RateDetailsSummarySectionV2
contract={contract}
submissionName={name}
isCMSUser={isCMSUser}
statePrograms={statePrograms}
onDocumentError={handleDocumentDownloadError}
/>
)}
<RateDetailsSummarySectionV2
contract={contract}
submissionName={name}
isCMSUser={isCMSUser}
statePrograms={statePrograms}
onDocumentError={handleDocumentDownloadError}
/>
)}

{<ContactsSummarySection contract={contract} />}

Expand Down
Loading