diff --git a/services/app-web/src/components/SubmissionSummarySection/ContractDetailsSummarySection/ContractDetailsSummarySection.tsx b/services/app-web/src/components/SubmissionSummarySection/ContractDetailsSummarySection/ContractDetailsSummarySection.tsx index 9f25cdffa0..a789cc6771 100644 --- a/services/app-web/src/components/SubmissionSummarySection/ContractDetailsSummarySection/ContractDetailsSummarySection.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/ContractDetailsSummarySection/ContractDetailsSummarySection.tsx @@ -313,7 +313,7 @@ export const ContractDetailsSummarySection = ({ } caption="Contract" documentCategory="Contract" - isEditing={isEditing} + hideDynamicFeedback={!isEditing} /> ) diff --git a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/RateDetailsSummarySection.tsx b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/RateDetailsSummarySection.tsx index 27b89b9143..7500f14c0d 100644 --- a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/RateDetailsSummarySection.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/RateDetailsSummarySection.tsx @@ -356,7 +356,7 @@ export const RateDetailsSummarySection = ({ rateInfo.rateDocuments, documentDateLookupTable )} - packagesWithSharedRateCerts={refreshPackagesWithSharedRateCert( + packagesWithSharedRateCerts={isPreviousSubmission? []:refreshPackagesWithSharedRateCert( rateInfo )} previousSubmissionDate={ @@ -369,7 +369,7 @@ export const RateDetailsSummarySection = ({ multipleDocumentsAllowed={false} caption="Rate certification" documentCategory="Rate certification" - isEditing={isEditing} + hideDynamicFeedback={!isEditing} /> ) : ( 'LOADING...' @@ -380,7 +380,7 @@ export const RateDetailsSummarySection = ({ rateInfo.supportingDocuments, documentDateLookupTable )} - packagesWithSharedRateCerts={refreshPackagesWithSharedRateCert( + packagesWithSharedRateCerts={isPreviousSubmission? []: refreshPackagesWithSharedRateCert( rateInfo )} previousSubmissionDate={ @@ -391,9 +391,8 @@ export const RateDetailsSummarySection = ({ : null } caption="Rate supporting documents" - isSupportingDocuments documentCategory="Rate-supporting" - isEditing={isEditing} + hideDynamicFeedback={!isEditing} /> ) : ( 'LOADING...' diff --git a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.test.tsx b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.test.tsx index f72bdbb9a5..1c9923fbce 100644 --- a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.test.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.test.tsx @@ -100,7 +100,7 @@ describe('SingleRateSummarySection', () => { ).toBeInTheDocument() }) // can delete the next test when linked rates flag is permanently on - it('renders documents with linked submissions correctly (legacy feature)', async () => { + it('renders documents with linked submissions correctly for CMS users (legacy feature)', async () => { const rateData = rateDataMock() const parentContractRev = rateData.revisions[0].contractRevisions[0] const rateDoc = rateData.revisions[0].formData.rateDocuments[0] diff --git a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx index 3584b23bf1..80abf1bcff 100644 --- a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx @@ -71,16 +71,17 @@ const relatedSubmissions = ( {contractRevisions.map((contractRev) => (
  • - {packageName( - contractRev.contract.stateCode, - contractRev.contract.stateNumber, - contractRev.formData.programIDs, - statePrograms - )} -
  • + asCustom={NavLink} + to={`/submissions/${contractRev.contract.id}`} + > + {packageName( + contractRev.contract.stateCode, + contractRev.contract.stateNumber, + contractRev.formData.programIDs, + statePrograms + )} + + ))} ) @@ -105,6 +106,8 @@ export const SingleRateSummarySection = ({ const explainMissingData = !isSubmitted && loggedInUser?.role === 'STATE_USER' const isCMSUser = loggedInUser?.role === 'CMS_USER' + const isSubmittedOrCMSUser = + rate.status === 'SUBMITTED' || loggedInUser?.role === 'CMS_USER' // feature flags const ldClient = useLDClient() @@ -347,12 +350,14 @@ export const SingleRateSummarySection = ({ multipleDocumentsAllowed={false} previousSubmissionDate={lastSubmittedDate} caption="Rate certification" + hideDynamicFeedback={!isSubmittedOrCMSUser} /> diff --git a/services/app-web/src/components/SubmissionSummarySection/SubmissionSummarySection.module.scss b/services/app-web/src/components/SubmissionSummarySection/SubmissionSummarySection.module.scss index 5728b7b6f7..7d74e560ea 100644 --- a/services/app-web/src/components/SubmissionSummarySection/SubmissionSummarySection.module.scss +++ b/services/app-web/src/components/SubmissionSummarySection/SubmissionSummarySection.module.scss @@ -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; @@ -127,4 +126,3 @@ padding: 0; } } - diff --git a/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/DocumentTag.tsx b/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/DocumentTag.tsx index 61d6a094af..5bd562a42e 100644 --- a/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/DocumentTag.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/DocumentTag.tsx @@ -3,7 +3,7 @@ import { InfoTag } from '../../InfoTag/InfoTag' import styles from './UploadedDocumentsTable.module.scss' type DocumentTagProps = { - isShared?: boolean // can be delted after LINK_RATES + isShared?: boolean // can be deleted after legacy submissions addressed and LINK_RATES permanently on isNew?: boolean } export const DocumentTag = ({ diff --git a/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/UploadedDocumentsTable.test.tsx b/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/UploadedDocumentsTable.test.tsx index a071847f1d..c46ef00757 100644 --- a/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/UploadedDocumentsTable.test.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/UploadedDocumentsTable.test.tsx @@ -9,6 +9,10 @@ import { import type { GenericDocument } from '../../../gen/gqlClient' describe('UploadedDocumentsTable', () => { + + afterEach ( () => { + jest.clearAllMocks() + }) it('renders documents without errors', async () => { const testDocuments = [ { @@ -24,6 +28,7 @@ describe('UploadedDocumentsTable', () => { caption="Contract" documentCategory="Contract" previousSubmissionDate={new Date('01/01/01')} + hideDynamicFeedback={true} />, { apolloProvider: { @@ -72,6 +77,7 @@ describe('UploadedDocumentsTable', () => { caption="Contract supporting" documentCategory="Contract-supporting" isSupportingDocuments + hideDynamicFeedback={true} />, { apolloProvider: { @@ -121,6 +127,7 @@ describe('UploadedDocumentsTable', () => { documentCategory="Contract-supporting" isSupportingDocuments previousSubmissionDate={new Date('03/26/2022')} + hideDynamicFeedback={true} />, { apolloProvider: { @@ -171,6 +178,7 @@ describe('UploadedDocumentsTable', () => { caption="Contract supporting" documentCategory="Contract-supporting" isSupportingDocuments + hideDynamicFeedback={true} />, { apolloProvider: { @@ -222,6 +230,7 @@ describe('UploadedDocumentsTable', () => { caption="Contract supporting" documentCategory="Contract-supporting" isSupportingDocuments + hideDynamicFeedback={true} />, { apolloProvider: { @@ -251,7 +260,7 @@ describe('UploadedDocumentsTable', () => { }) }) }) - it('shows the NEW tag when a document is submitted after the last submission', async () => { + it('renders the NEW tag when a document is submitted after the last submission', async () => { const testDocuments: GenericDocument[] = [ { s3URL: 's3://foo/bar/test-1', @@ -279,6 +288,7 @@ describe('UploadedDocumentsTable', () => { caption="Contract supporting" documentCategory="Contract-supporting" isSupportingDocuments + hideDynamicFeedback={true} />, { apolloProvider: { @@ -319,6 +329,7 @@ describe('UploadedDocumentsTable', () => { caption="Contract" documentCategory="Contract" multipleDocumentsAllowed={false} + hideDynamicFeedback={false} />, { apolloProvider: { @@ -338,7 +349,7 @@ describe('UploadedDocumentsTable', () => { }) }) - it('does not show the NEW tag if the user is not a CMS user', async () => { + it('does not show the NEW tag to state user', async () => { const testDocuments = [ { s3URL: 's3://foo/bar/test-1', @@ -366,6 +377,7 @@ describe('UploadedDocumentsTable', () => { caption="Contract supporting" documentCategory="Contract-supporting" isSupportingDocuments + hideDynamicFeedback={true} />, { apolloProvider: { @@ -379,4 +391,249 @@ describe('UploadedDocumentsTable', () => { expect(screen.queryByTestId('tag')).not.toBeInTheDocument() }) }) + + it('renders SHARED tag to CMS users when packages across submissions present', async () => { + const packagesWithSharedRateCerts = [ + { + packageId: '333b4225-5b49-4e82-aa71-be0d33d7418d', + packageName: 'MCR-MN-0001-SNBC', + }, + { + packageId: '21467dba-6ae8-11ed-a1eb-0242ac120002', + packageName: 'MCR-MN-0002-PMAP', + }, + ] + const testDocuments = [ + { + s3URL: 's3://foo/bar/test-1', + name: 'supporting docs test 1', + sha256: 'fakesha', + dateAdded: new Date('01/01/00'), + }, + ] + renderWithProviders( + , + { + apolloProvider: { + mocks: [fetchCurrentUserMock({ user: mockValidCMSUser(), statusCode: 200 })], + }, + featureFlags: { + 'link-rates': false, + }, + } + ) + + expect(await screen.findByTestId('tag')).toHaveTextContent('SHARED') + }) + + it('renders SHARED tag to state users when packages across submissions present', async () => { + const packagesWithSharedRateCerts = [ + { + packageId: '333b4225-5b49-4e82-aa71-be0d33d7418d', + packageName: 'MCR-MN-0001-SNBC', + }, + { + packageId: '21467dba-6ae8-11ed-a1eb-0242ac120002', + packageName: 'MCR-MN-0002-PMAP', + }, + ] + const testDocuments = [ + { + s3URL: 's3://foo/bar/test-1', + name: 'supporting docs test 1', + sha256: 'fakesha', + dateAdded: new Date('01/01/00'), + }, + ] + renderWithProviders( + , + { + apolloProvider: { + mocks: [fetchCurrentUserMock({ statusCode: 200 })], + }, + featureFlags: { + 'link-rates': false, + }, + } + ) + + expect(await screen.findByTestId('tag')).toHaveTextContent('SHARED') + }) + + it('still renders SHARED tag to CMS user if linked rates flag on', async () => { + const packagesWithSharedRateCerts = [ + { + packageId: '333b4225-5b49-4e82-aa71-be0d33d7418d', + packageName: 'MCR-MN-0001-SNBC', + }, + { + packageId: '21467dba-6ae8-11ed-a1eb-0242ac120002', + packageName: 'MCR-MN-0002-PMAP', + }, + ] + const testDocuments = [ + { + s3URL: 's3://foo/bar/test-1', + name: 'supporting docs test 1', + sha256: 'fakesha', + dateAdded: new Date('01/01/00'), + }, + ] + renderWithProviders( + , + { + apolloProvider: { + mocks: [fetchCurrentUserMock({ user: mockValidCMSUser(), statusCode: 200 })], + }, + featureFlags: { + 'link-rates': true, + }, + } + ) + + expect(await screen.findByTestId('tag')).toHaveTextContent('SHARED') + }) + + it('still renders SHARED tag to state user when linked rates flag on', async () => { + const packagesWithSharedRateCerts = [ + { + packageId: '333b4225-5b49-4e82-aa71-be0d33d7418d', + packageName: 'MCR-MN-0001-SNBC', + }, + { + packageId: '21467dba-6ae8-11ed-a1eb-0242ac120002', + packageName: 'MCR-MN-0002-PMAP', + }, + ] + const testDocuments = [ + { + s3URL: 's3://foo/bar/test-1', + name: 'supporting docs test 1', + sha256: 'fakesha', + dateAdded: new Date('01/01/00'), + }, + ] + renderWithProviders( + , + { + apolloProvider: { + mocks: [fetchCurrentUserMock({ user: mockValidStateUser(), statusCode: 200 })], + }, + featureFlags: { + 'link-rates': true, + }, + } + ) + + expect(await screen.findByTestId('tag')).toBeInTheDocument() + }) + + it('does not validations when hideDynamicFeedback is set to true',async() =>{ + const testDocuments = [ + { + s3URL: 's3://foo/bar/test-1', + name: 'supporting docs test 1', + sha256: 'fakesha', + dateAdded: new Date('03/25/2022'), + }, + { + s3URL: 's3://foo/bar/test-2', + name: 'supporting docs test 2', + sha256: 'fakesha1', + dateAdded: new Date('03/25/2022'), + }, + { + s3URL: 's3://foo/bar/test-3', + name: 'supporting docs test 3', + sha256: 'fakesha2', + dateAdded: new Date('03/27/2022'), + }, + ] + renderWithProviders( + , + { + apolloProvider: { + mocks: [fetchCurrentUserMock({ statusCode: 200 })], + }, + } + ) + await waitFor(() => { + expect(screen.queryByText(/Only one document is allowed/)).not.toBeInTheDocument() + }) + }) + it('renders document validations if hideDynamicFeedback is false and too many documents uploaded',async() =>{ + const testDocuments = [ + { + s3URL: 's3://foo/bar/test-1', + name: 'supporting docs test 1', + sha256: 'fakesha', + dateAdded: new Date('03/25/2022'), + }, + { + s3URL: 's3://foo/bar/test-2', + name: 'supporting docs test 2', + sha256: 'fakesha1', + dateAdded: new Date('03/25/2022'), + }, + { + s3URL: 's3://foo/bar/test-3', + name: 'supporting docs test 3', + sha256: 'fakesha2', + dateAdded: new Date('03/27/2022'), + }, + ] + renderWithProviders( + , + { + apolloProvider: { + mocks: [fetchCurrentUserMock({ statusCode: 200 })], + }, + } + ) + await waitFor(() => { + expect(screen.queryByText(/Only one document is allowed/)).toBeInTheDocument() + }) + }) }) diff --git a/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/UploadedDocumentsTable.tsx b/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/UploadedDocumentsTable.tsx index 0cfeddfd70..e05bc77e68 100644 --- a/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/UploadedDocumentsTable.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/UploadedDocumentsTable/UploadedDocumentsTable.tsx @@ -33,11 +33,12 @@ export type UploadedDocumentsTableProps = { documents: GenericDocument[] caption: string | null previousSubmissionDate: Date | null // used to calculate NEW tag based on doc dateAdded + hideDynamicFeedback: boolean // used to determine if we display static data for submission summary experience or if we display dynamic feedback UI (validations, edit buttons) like on review submit experience packagesWithSharedRateCerts?: SharedRateCertDisplay[] // deprecated - could be deleted after we resolve all historical data linked rates isSupportingDocuments?: boolean // used to calculate empty state and styles around the secondary supporting docs tables - would be nice to remove this in favor of more domain agnostic prop such as 'emptyStateText' 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) + } export const UploadedDocumentsTable = ({ @@ -48,7 +49,7 @@ export const UploadedDocumentsTable = ({ previousSubmissionDate, isSupportingDocuments = false, multipleDocumentsAllowed = true, - isEditing = false, + hideDynamicFeedback = false, }: UploadedDocumentsTableProps): React.ReactElement => { const initialDocState = documents.map((doc) => ({ ...doc, @@ -60,7 +61,7 @@ export const UploadedDocumentsTable = ({ const { getDocumentsWithS3KeyAndUrl } = useDocument() const [refreshedDocs, setRefreshedDocs] = useState(initialDocState) - const shouldShowEditButton = isEditing && isSupportingDocuments // at this point only contract supporting documents need the inline EDIT button - this can be deleted when we move supporting docs to ContractDetails page + const shouldShowEditButton = !hideDynamicFeedback && isSupportingDocuments // at this point only contract supporting documents need the inline EDIT button - this can be deleted when we move supporting docs to ContractDetails page // canDisplayDateAddedForDocument - guards against passing in null or undefined to dayjs // don't display on new initial submission @@ -70,7 +71,7 @@ export const UploadedDocumentsTable = ({ const shouldHaveNewTag = (doc: DocumentWithS3Data) => { if (!isCMSUser) { - return false // design requirement, don't show new tag to state users on review submit + return false // design requirement, don't show new tag to state users on review submit } if (!doc || !doc.s3Key) { @@ -83,17 +84,16 @@ export const UploadedDocumentsTable = ({ return doc.dateAdded > previousSubmissionDate } - const hasSharedRateCert = - (packagesWithSharedRateCerts && - packagesWithSharedRateCerts.length > 0) || - false + // show legacy shared rates across submissions (this is feature replaced by linked rates) + // to cms users always when data available, to state users only when linked rates flag is off + const showLegacySharedRatesAcross = Boolean(packagesWithSharedRateCerts && packagesWithSharedRateCerts.length > 0) - const showSharedInfo = hasSharedRateCert && !isEditing const borderTopGradientStyles = `borderTopLinearGradient ${styles.uploadedDocumentsTable}` const supportingDocsTopMarginStyles = isSupportingDocuments ? styles.withMarginTop : '' + const hasMultipleDocs = !multipleDocumentsAllowed && documents.length > 1 const tableCaptionJSX = ( <> {caption} @@ -149,16 +149,14 @@ export const UploadedDocumentsTable = ({
    {tableCaptionJSX}
    - {!multipleDocumentsAllowed && - documents.length > 1 && - !isEditing && ( - - )} + /> + )} @@ -167,7 +165,7 @@ export const UploadedDocumentsTable = ({ {documentCategory && ( Document category )} - {showSharedInfo && ( + {showLegacySharedRatesAcross && ( Linked submissions )} @@ -179,7 +177,7 @@ export const UploadedDocumentsTable = ({ {doc.name} @@ -206,17 +205,15 @@ export const UploadedDocumentsTable = ({ )} {documentCategory && {documentCategory}} - {showSharedInfo - ? packagesWithSharedRateCerts && ( + {showLegacySharedRatesAcross && ( {linkedPackagesList({ unlinkDrafts: Boolean(isCMSUser), packages: - packagesWithSharedRateCerts, + packagesWithSharedRateCerts ?? [], })} - ) - : null} + )} ))} diff --git a/services/app-web/src/pages/StateSubmission/RateDetails/V2/LinkedRateSummary.tsx b/services/app-web/src/pages/StateSubmission/RateDetails/V2/LinkedRateSummary.tsx index bf507f8bc1..4bbd3399f0 100644 --- a/services/app-web/src/pages/StateSubmission/RateDetails/V2/LinkedRateSummary.tsx +++ b/services/app-web/src/pages/StateSubmission/RateDetails/V2/LinkedRateSummary.tsx @@ -63,7 +63,7 @@ export const LinkedRateSummary = ({ multipleDocumentsAllowed={false} caption="Rate certification" documentCategory="Rate certification" - isEditing={false} + hideDynamicFeedback={true} // linked rates always displayed without validations previousSubmissionDate={null} /> diff --git a/services/app-web/src/pages/StateSubmission/RateDetails/V2/RateDetailsV2.tsx b/services/app-web/src/pages/StateSubmission/RateDetails/V2/RateDetailsV2.tsx index a53c7b4978..9e65dda661 100644 --- a/services/app-web/src/pages/StateSubmission/RateDetails/V2/RateDetailsV2.tsx +++ b/services/app-web/src/pages/StateSubmission/RateDetails/V2/RateDetailsV2.tsx @@ -363,9 +363,7 @@ const RateDetailsV2 = ({ /> )} -
    - This is the V2 version of the Rate Details Page -
    + { diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ContractDetailsSummarySectionV2.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ContractDetailsSummarySectionV2.tsx index d9f93d0bc7..c92768445f 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ContractDetailsSummarySectionV2.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ContractDetailsSummarySectionV2.tsx @@ -13,6 +13,7 @@ import { DoubleColumnGrid } from '../../../../../components/DoubleColumnGrid' import { DownloadButton } from '../../../../../components/DownloadButton' import { usePreviousSubmission } from '../../../../../hooks/usePreviousSubmission' import styles from '../../../../../components/SubmissionSummarySection/SubmissionSummarySection.module.scss' +import { useAuth } from '../../../../../contexts/AuthContext' import { sortModifiedProvisions, @@ -24,7 +25,6 @@ import { isBaseContract, isCHIPOnly, isContractWithProvisions, - isSubmitted, } from '../../../../../common-code/ContractType' import { federalAuthorityKeysForCHIP, @@ -84,8 +84,10 @@ export const ContractDetailsSummarySectionV2 = ({ string | undefined | Error >(undefined) const ldClient = useLDClient() - const isEditing = !isSubmitted(contract) && editNavigateTo !== undefined - + const { loggedInUser } = useAuth() + const isSubmittedOrCMSUser = + contract.status === 'SUBMITTED' || loggedInUser?.role === 'CMS_USER' + const isEditing = !isSubmittedOrCMSUser && editNavigateTo !== undefined const contractFormData = getVisibleLatestContractFormData( contract, isEditing @@ -113,7 +115,7 @@ export const ContractDetailsSummarySectionV2 = ({ useDeepCompareEffect(() => { // skip getting urls of this if this is a previous contract or draft - if (!isSubmitted(contract) || isPreviousSubmission) return + if (!isSubmittedOrCMSUser || isPreviousSubmission) return // get all the keys for the documents we want to zip async function fetchZipUrl() { @@ -170,7 +172,7 @@ export const ContractDetailsSummarySectionV2 = ({ header="Contract details" editNavigateTo={editNavigateTo} > - {isSubmitted(contract) && + {isSubmittedOrCMSUser && !isPreviousSubmission && renderDownloadButton(zippedFilesURL)} @@ -189,7 +191,7 @@ export const ContractDetailsSummarySectionV2 = ({ StatutoryRegulatoryAttestationQuestion } explainMissingData={ - !isSubmitted(contract) + !isSubmittedOrCMSUser } children={ StatutoryRegulatoryAttestation[ @@ -207,7 +209,7 @@ export const ContractDetailsSummarySectionV2 = ({ {provisionsAreInvalid ? null : ( @@ -305,7 +307,7 @@ export const ContractDetailsSummarySectionV2 = ({ : 'This contract action does NOT include new or modified provisions related to the following' } explainMissingData={ - provisionsAreInvalid && !isSubmitted(contract) + provisionsAreInvalid && !isSubmittedOrCMSUser } > {provisionsAreInvalid ? null : ( @@ -325,7 +327,7 @@ export const ContractDetailsSummarySectionV2 = ({ previousSubmissionDate={lastSubmittedDate} caption="Contract" documentCategory="Contract" - isEditing={isEditing} + hideDynamicFeedback={isSubmittedOrCMSUser} /> )} {contractSupportingDocuments && ( @@ -335,7 +337,7 @@ export const ContractDetailsSummarySectionV2 = ({ caption="Contract supporting documents" documentCategory="Contract-supporting" isSupportingDocuments - isEditing={isEditing} + hideDynamicFeedback={isSubmittedOrCMSUser} /> )} diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx index bc2978da5f..85029ca0d7 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/RateDetailsSummarySectionV2.tsx @@ -73,10 +73,10 @@ export const RateDetailsSummarySectionV2 = ({ submissionName, statePrograms, onDocumentError, - 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 @@ -108,8 +108,7 @@ export const RateDetailsSummarySectionV2 = ({ return { packageId, - packageName: - refreshedName ?? `${packageName}`, + packageName: refreshedName ?? `${packageName}`, } } ) @@ -260,14 +259,18 @@ export const RateDetailsSummarySectionV2 = ({ )} @@ -354,7 +367,7 @@ export const RateDetailsSummarySectionV2 = ({ caption="Rate certification" documentCategory="Rate certification" previousSubmissionDate={lastSubmittedDate} - isEditing={isEditing} + hideDynamicFeedback={isSubmittedOrCMSUser} /> )} {rateFormData.supportingDocuments && ( @@ -369,9 +382,8 @@ export const RateDetailsSummarySectionV2 = ({ ) } caption="Rate supporting documents" - isSupportingDocuments documentCategory="Rate-supporting" - isEditing={isEditing} + hideDynamicFeedback={isSubmittedOrCMSUser} /> )} diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ReviewSubmitV2.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ReviewSubmitV2.tsx index 5e256c9d3d..2e43a2331a 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ReviewSubmitV2.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ReviewSubmitV2.tsx @@ -108,7 +108,6 @@ export const ReviewSubmitV2 = (): React.ReactElement => { /> -
    This is the V2 version of the Review Submit Page
    { }) it('renders expected fields for submitted package on submission summary', () => { + const stateSubmission = mockContractPackageSubmitted() renderWithProviders( { 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( + + ) + expect( + screen.queryByRole('definition', { name: 'Program(s)' }) + ).not.toBeInTheDocument() + expect( + screen.queryByRole('definition', { name: 'Submission description' }) + ).not.toBeInTheDocument() + }) }) diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/SubmissionTypeSummarySectionV2.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/SubmissionTypeSummarySectionV2.tsx index 83f7db7ba8..08bb3f9213 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/SubmissionTypeSummarySectionV2.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/SubmissionTypeSummarySectionV2.tsx @@ -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' @@ -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 const programNames = statePrograms @@ -60,7 +61,7 @@ export const SubmissionTypeSummarySectionV2 = ({ {headerChildComponent && headerChildComponent}
    - {isSubmitted && !isPreviousSubmission && ( + {isSubmitted && ( )} - - {contractFormData && ( + {(programNames?.length > 0 || !isSubmitted) && ( + + )} + {(contractFormData.submissionType || !isSubmitted) && ( )} - { + {(contractFormData.contractType || !isSubmitted) && ( - } - {contractFormData && - contractFormData.riskBasedContract !== null && ( - - )} - {contractFormData && ( + )} + {(contractFormData.riskBasedContract !== null || + (!isSubmitted && + contractFormData.riskBasedContract !== null)) && ( + + )} + {(contractFormData.populationCovered || !isSubmitted) && ( - {contractFormData && ( + {(contractFormData.submissionDescription || + !isSubmitted) && ( { 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 } @@ -157,9 +162,6 @@ export const SubmissionSummaryV2 = (): React.ReactElement => { return (
    -
    - This is the V2 page of the SubmissionSummary -
    { /> } - {( + { - )} + } {isContractActionAndRateCertification && ( - - )} + + )} {}