diff --git a/services/app-api/src/domain-models/contractAndRates/contractTypes.ts b/services/app-api/src/domain-models/contractAndRates/contractTypes.ts index 3407bca7d6..e732224d69 100644 --- a/services/app-api/src/domain-models/contractAndRates/contractTypes.ts +++ b/services/app-api/src/domain-models/contractAndRates/contractTypes.ts @@ -1,17 +1,13 @@ import { z } from 'zod' import { contractRevisionWithRatesSchema } from './revisionTypes' +import { statusSchema } from './statusType' // Contract represents the contract specific information in a submission package // All that data is contained in revisions, each revision represents the data in a single submission // submissions are kept intact here across time const contractSchema = z.object({ id: z.string().uuid(), - status: z.union([ - z.literal('SUBMITTED'), - z.literal('DRAFT'), - z.literal('UNLOCKED'), - z.literal('RESUBMITTED'), - ]), + status: statusSchema, stateCode: z.string(), mccrsID: z.string().optional(), stateNumber: z.number().min(1), diff --git a/services/app-api/src/domain-models/contractAndRates/formDataTypes.ts b/services/app-api/src/domain-models/contractAndRates/formDataTypes.ts index d2e51c0bb0..630aa73b28 100644 --- a/services/app-api/src/domain-models/contractAndRates/formDataTypes.ts +++ b/services/app-api/src/domain-models/contractAndRates/formDataTypes.ts @@ -8,10 +8,10 @@ import { populationCoveredSchema, rateCapitationTypeSchema, rateTypeSchema, - sharedRateCertDisplay, stateContactSchema, submissionTypeSchema, } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto/zodSchemas' +import { statusSchema } from './statusType' const documentSchema = z.object({ name: z.string(), @@ -26,6 +26,12 @@ const managedCareEntitiesSchema = z.union([ z.literal('PCCM'), ]) +const packagesWithSharedRateCerts = z.object({ + packageName: z.string(), + packageId: z.string(), + packageStatus: statusSchema.optional(), +}) + const contractFormDataSchema = z.object({ programIDs: z.array(z.string()), populationCovered: populationCoveredSchema.optional(), @@ -77,7 +83,9 @@ const rateFormDataSchema = z.object({ certifyingActuaryContacts: z.array(actuaryContactSchema).optional(), addtlActuaryContacts: z.array(actuaryContactSchema).optional(), actuaryCommunicationPreference: actuaryCommunicationTypeSchema.optional(), - packagesWithSharedRateCerts: z.array(sharedRateCertDisplay).optional(), + packagesWithSharedRateCerts: z + .array(packagesWithSharedRateCerts) + .optional(), }) type ContractFormDataType = z.infer diff --git a/services/app-api/src/domain-models/contractAndRates/index.ts b/services/app-api/src/domain-models/contractAndRates/index.ts index e6930f608b..6c2a8baad1 100644 --- a/services/app-api/src/domain-models/contractAndRates/index.ts +++ b/services/app-api/src/domain-models/contractAndRates/index.ts @@ -11,6 +11,8 @@ export { rateRevisionSchema, } from './revisionTypes' +export { statusSchema } from './statusType' + export { convertContractWithRatesRevtoHPPRev, convertContractWithRatesToUnlockedHPP, diff --git a/services/app-api/src/domain-models/contractAndRates/rateTypes.ts b/services/app-api/src/domain-models/contractAndRates/rateTypes.ts index 3aa65cf7ba..3662666247 100644 --- a/services/app-api/src/domain-models/contractAndRates/rateTypes.ts +++ b/services/app-api/src/domain-models/contractAndRates/rateTypes.ts @@ -3,17 +3,13 @@ import { rateRevisionWithContractsSchema, rateRevisionSchema, } from './revisionTypes' +import { statusSchema } from './statusType' const rateSchema = z.object({ id: z.string().uuid(), createdAt: z.date(), updatedAt: z.date(), - status: z.union([ - z.literal('SUBMITTED'), - z.literal('DRAFT'), - z.literal('UNLOCKED'), - z.literal('RESUBMITTED'), - ]), + status: statusSchema, stateCode: z.string(), stateNumber: z.number().min(1), // If this rate is in a DRAFT or UNLOCKED status, there will be a draftRevision diff --git a/services/app-api/src/domain-models/contractAndRates/revisionTypes.ts b/services/app-api/src/domain-models/contractAndRates/revisionTypes.ts index e1ade74957..168fba1bd8 100644 --- a/services/app-api/src/domain-models/contractAndRates/revisionTypes.ts +++ b/services/app-api/src/domain-models/contractAndRates/revisionTypes.ts @@ -4,7 +4,11 @@ import { contractFormDataSchema, rateFormDataSchema } from './formDataTypes' const contractRevisionSchema = z.object({ id: z.string().uuid(), - contractID: z.string(), + contract: z.object({ + id: z.string().uuid(), + stateCode: z.string(), + stateNumber: z.number().min(1), + }), submitInfo: updateInfoSchema.optional(), unlockInfo: updateInfoSchema.optional(), createdAt: z.date(), diff --git a/services/app-api/src/domain-models/contractAndRates/statusType.ts b/services/app-api/src/domain-models/contractAndRates/statusType.ts new file mode 100644 index 0000000000..1d84c89825 --- /dev/null +++ b/services/app-api/src/domain-models/contractAndRates/statusType.ts @@ -0,0 +1,10 @@ +import { z } from 'zod' + +const statusSchema = z.union([ + z.literal('SUBMITTED'), + z.literal('DRAFT'), + z.literal('UNLOCKED'), + z.literal('RESUBMITTED'), +]) + +export { statusSchema } diff --git a/services/app-api/src/postgres/contractAndRates/parseContractAndRates.test.ts b/services/app-api/src/postgres/contractAndRates/parseContractAndRates.test.ts index fef82ff8a8..7383e0b979 100644 --- a/services/app-api/src/postgres/contractAndRates/parseContractAndRates.test.ts +++ b/services/app-api/src/postgres/contractAndRates/parseContractAndRates.test.ts @@ -9,9 +9,9 @@ import type { ContractTableFullPayload } from './prismaSubmittedContractHelpers' describe('parseDomainData', () => { describe('parseDraftContract', () => { + const draftContract = createDraftContractData() it('can parse valid draft domain data with no errors', () => { - const draftData = createDraftContractData() - const validatedDraft = parseContractWithHistory(draftData) + const validatedDraft = parseContractWithHistory(draftContract) expect(validatedDraft).not.toBeInstanceOf(Error) }) @@ -37,7 +37,7 @@ describe('parseDomainData', () => { contract: createDraftContractData({ stateCode: undefined, revisions: [ - createContractRevision({ + createContractRevision(draftContract, { submitInfo: { id: uuidv4(), updatedAt: new Date(), @@ -69,11 +69,10 @@ describe('parseDomainData', () => { ) }) describe('parseDraftContractRevision', () => { + const contract = createContractData() + it('cant parse valid contract revision with no errors', () => { - const contractRevision = createContractData() - expect( - parseContractWithHistory(contractRevision) - ).not.toBeInstanceOf(Error) + expect(parseContractWithHistory(contract)).not.toBeInstanceOf(Error) }) const draftContractRevisionsWithInvalidData: { contract: ContractTableFullPayload @@ -82,7 +81,7 @@ describe('parseDomainData', () => { { contract: createContractData({ revisions: [ - createContractRevision({ + createContractRevision(contract, { submissionType: undefined, }), ], @@ -92,7 +91,7 @@ describe('parseDomainData', () => { { contract: createContractData({ revisions: [ - createContractRevision({ + createContractRevision(contract, { submissionDescription: undefined, }), ], @@ -102,7 +101,7 @@ describe('parseDomainData', () => { { contract: createContractData({ revisions: [ - createContractRevision({ + createContractRevision(contract, { contractType: undefined, }), ], @@ -112,7 +111,7 @@ describe('parseDomainData', () => { { contract: createContractData({ revisions: [ - createContractRevision({ + createContractRevision(contract, { managedCareEntities: undefined, }), ], @@ -128,9 +127,9 @@ describe('parseDomainData', () => { ) }) describe('parseContractWithHistory', () => { + const contract = createContractData() it('can parse valid contract domain data with no errors', () => { - const contractData = createContractData() - const validatedContract = parseContractWithHistory(contractData) + const validatedContract = parseContractWithHistory(contract) expect(validatedContract).not.toBeInstanceOf(Error) }) @@ -153,7 +152,7 @@ describe('parseDomainData', () => { { contract: createContractData({ revisions: [ - createContractRevision({ + createContractRevision(contract, { rateRevisions: [ { rateRevisionID: uuidv4(), diff --git a/services/app-api/src/postgres/contractAndRates/parseContractWithHistory.ts b/services/app-api/src/postgres/contractAndRates/parseContractWithHistory.ts index 9e5727a043..21b7d6fcdf 100644 --- a/services/app-api/src/postgres/contractAndRates/parseContractWithHistory.ts +++ b/services/app-api/src/postgres/contractAndRates/parseContractWithHistory.ts @@ -83,7 +83,7 @@ function contractRevisionToDomainModel( ): ContractRevisionType { return { id: revision.id, - contractID: revision.contractID, + contract: revision.contract, createdAt: revision.createdAt, updatedAt: revision.updatedAt, submitInfo: convertUpdateInfoToDomainModel(revision.submitInfo), diff --git a/services/app-api/src/postgres/contractAndRates/prismaDraftContractHelpers.ts b/services/app-api/src/postgres/contractAndRates/prismaDraftContractHelpers.ts index 113a271d92..e32cba91ea 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaDraftContractHelpers.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaDraftContractHelpers.ts @@ -6,47 +6,14 @@ import type { import { contractFormDataToDomainModel, convertUpdateInfoToDomainModel, - includeUpdateInfo, + includeRateFormData, rateRevisionToDomainModel, } from './prismaSharedContractRateHelpers' import type { ContractRevisionTableWithRates } from './prismaSubmittedContractHelpers' const includeDraftRates = { revisions: { - include: { - rateDocuments: { - orderBy: { - position: 'asc', - }, - }, - supportingDocuments: { - orderBy: { - position: 'asc', - }, - }, - certifyingActuaryContacts: { - orderBy: { - position: 'asc', - }, - }, - addtlActuaryContacts: { - orderBy: { - position: 'asc', - }, - }, - submitInfo: includeUpdateInfo, - unlockInfo: includeUpdateInfo, - contractsWithSharedRateRevision: { - include: { - revisions: { - take: 1, - orderBy: { - createdAt: 'desc', - }, - }, - }, - }, - }, + include: includeRateFormData, take: 1, orderBy: { createdAt: 'desc', @@ -89,7 +56,7 @@ function draftContractRevToDomainModel( return { id: revision.id, - contractID: revision.contractID, + contract: revision.contract, createdAt: revision.createdAt, updatedAt: revision.updatedAt, unlockInfo: convertUpdateInfoToDomainModel(revision.unlockInfo), diff --git a/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts b/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts index 8840dcca6a..9b04f67d67 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts @@ -23,6 +23,28 @@ type UpdateInfoTableWithUpdater = Prisma.UpdateInfoTableGetPayload<{ include: typeof subincludeUpdateInfo }> +const includeContractFormData = { + unlockInfo: includeUpdateInfo, + submitInfo: includeUpdateInfo, + contract: true, + + stateContacts: { + orderBy: { + position: 'asc', + }, + }, + contractDocuments: { + orderBy: { + position: 'asc', + }, + }, + supportingDocuments: { + orderBy: { + position: 'asc', + }, + }, +} satisfies Prisma.ContractRevisionTableInclude + function convertUpdateInfoToDomainModel( info?: UpdateInfoTableWithUpdater | null ): UpdateInfoType | undefined { @@ -91,7 +113,7 @@ const includeRateFormData = { contractsWithSharedRateRevision: { include: { revisions: { - take: 1, + include: includeContractFormData, orderBy: { createdAt: 'desc', }, @@ -131,6 +153,7 @@ function rateFormDataToDomainModel( contractPrograms, statePrograms ), + packageStatus: getContractRateStatus(contract.revisions), }) } @@ -233,27 +256,6 @@ function ratesRevisionsToDomainModel( // ------ -const includeContractFormData = { - unlockInfo: includeUpdateInfo, - submitInfo: includeUpdateInfo, - - stateContacts: { - orderBy: { - position: 'asc', - }, - }, - contractDocuments: { - orderBy: { - position: 'asc', - }, - }, - supportingDocuments: { - orderBy: { - position: 'asc', - }, - }, -} satisfies Prisma.ContractRevisionTableInclude - type ContractRevisionTableWithFormData = Prisma.ContractRevisionTableGetPayload<{ include: typeof includeContractFormData diff --git a/services/app-api/src/testHelpers/contractAndRates/contractHelpers.ts b/services/app-api/src/testHelpers/contractAndRates/contractHelpers.ts index ea467866fd..36ef3b3401 100644 --- a/services/app-api/src/testHelpers/contractAndRates/contractHelpers.ts +++ b/services/app-api/src/testHelpers/contractAndRates/contractHelpers.ts @@ -9,6 +9,15 @@ import type { ContractFormDataType } from '../../domain-models/contractAndRates' import { findStatePrograms } from '../../postgres' import { must } from '../errorHelpers' +const defaultContractData = () => ({ + id: '24fb2a5f-6d0d-4e26-9906-4de28927c882', + createdAt: new Date(), + updatedAt: new Date(), + mccrsID: null, + stateCode: 'MN', + stateNumber: 111, +}) + const createInsertContractData = ({ stateCode = 'MN', ...formData @@ -40,6 +49,7 @@ const createDraftContractData = ( stateNumber: 111, revisions: contract?.revisions ?? [ createContractRevision( + contract, { rateRevisions: undefined, submitInfo: null, @@ -61,6 +71,7 @@ const createContractData = ( stateNumber: 111, revisions: contract?.revisions ?? [ createContractRevision( + contract, { draftRates: undefined, }, @@ -71,6 +82,7 @@ const createContractData = ( }) const createContractRevision = ( + contract?: Partial, revision?: Partial, stateCode: StateCodeType = 'MN' ): ContractRevisionTableWithRates => { @@ -78,6 +90,10 @@ const createContractRevision = ( return { id: uuidv4(), + contract: { + ...defaultContractData(), + ...contract, + }, createdAt: new Date(), updatedAt: new Date(), submitInfo: { diff --git a/services/app-graphql/src/queries/fetchRate.graphql b/services/app-graphql/src/queries/fetchRate.graphql index 7c7ea1461e..7da1b9b208 100644 --- a/services/app-graphql/src/queries/fetchRate.graphql +++ b/services/app-graphql/src/queries/fetchRate.graphql @@ -1,3 +1,125 @@ +fragment rateRevisionFragment on RateRevision { + id + createdAt + updatedAt + unlockInfo { + updatedAt + updatedBy + updatedReason + } + submitInfo { + updatedAt + updatedBy + updatedReason + } + formData { + rateType, + rateCapitationType, + rateDocuments { + name + s3URL + sha256 + }, + supportingDocuments { + name + s3URL + sha256 + }, + rateDateStart, + rateDateEnd, + rateDateCertified, + amendmentEffectiveDateStart, + amendmentEffectiveDateEnd, + rateProgramIDs, + rateCertificationName, + certifyingActuaryContacts { + name + titleRole + email + actuarialFirm + actuarialFirmOther + }, + addtlActuaryContacts { + name + titleRole + email + actuarialFirm + actuarialFirmOther + }, + actuaryCommunicationPreference + packagesWithSharedRateCerts { + packageName + packageId + packageStatus + } + } + contractRevisions { + id + contract { + id + stateCode + stateNumber + } + createdAt + updatedAt + submitInfo { + updatedAt + updatedBy + updatedReason + } + unlockInfo { + updatedAt + updatedBy + updatedReason + } + formData { + programIDs + populationCovered + submissionType + riskBasedContract + submissionDescription + stateContacts { + name, + title + email + } + supportingDocuments { + name + s3URL + sha256 + } + contractType + contractExecutionStatus + contractDocuments { + name + s3URL + sha256 + } + contractDateStart + contractDateEnd + managedCareEntities + federalAuthorities + inLieuServicesAndSettings + modifiedBenefitsProvided + modifiedGeoAreaServed + modifiedMedicaidBeneficiaries + modifiedRiskSharingStrategy + modifiedIncentiveArrangements + modifiedWitholdAgreements + modifiedStateDirectedPayments + modifiedPassThroughPayments + modifiedPaymentsForMentalDiseaseInstitutions + modifiedMedicalLossRatioStandards + modifiedOtherFinancialPaymentIncentive + modifiedEnrollmentProcess + modifiedGrevienceAndAppeal + modifiedNetworkAdequacyStandards + modifiedLengthOfContract + modifiedNonRiskPaymentArrangements + } + } +} + query fetchRate($input: FetchRateInput!) { fetchRate(input: $input) { rate { @@ -19,147 +141,11 @@ query fetchRate($input: FetchRateInput!) { initiallySubmittedAt draftRevision { - id - createdAt - updatedAt - unlockInfo { - updatedAt - updatedBy - updatedReason - } - submitInfo { - updatedAt - updatedBy - updatedReason - } - formData { - rateType, - rateCapitationType, - rateDocuments { - name - s3URL - sha256 - }, - supportingDocuments { - name - s3URL - sha256 - }, - rateDateStart, - rateDateEnd, - rateDateCertified, - amendmentEffectiveDateStart, - amendmentEffectiveDateEnd, - rateProgramIDs, - rateCertificationName, - certifyingActuaryContacts { - name - titleRole - email - actuarialFirm - actuarialFirmOther - }, - addtlActuaryContacts { - name - titleRole - email - actuarialFirm - actuarialFirmOther - }, - actuaryCommunicationPreference - packagesWithSharedRateCerts { - packageName - packageId - } - } - contractRevisions { - id - contractID - createdAt - updatedAt - submitInfo { - updatedAt - updatedBy - updatedReason - } - unlockInfo { - updatedAt - updatedBy - updatedReason - } - } + ...rateRevisionFragment } revisions { - id - createdAt - updatedAt - unlockInfo { - updatedAt - updatedBy - updatedReason - } - submitInfo { - updatedAt - updatedBy - updatedReason - } - formData { - rateType, - rateCapitationType, - rateDocuments { - name - s3URL - sha256 - }, - supportingDocuments { - name - s3URL - sha256 - }, - rateDateStart, - rateDateEnd, - rateDateCertified, - amendmentEffectiveDateStart, - amendmentEffectiveDateEnd, - rateProgramIDs, - rateCertificationName, - certifyingActuaryContacts { - name - titleRole - email - actuarialFirm - actuarialFirmOther - }, - addtlActuaryContacts { - name - titleRole - email - actuarialFirm - actuarialFirmOther - }, - actuaryCommunicationPreference - packagesWithSharedRateCerts { - packageName - packageId - } - } - contractRevisions { - id - contractID - createdAt - updatedAt - submitInfo { - updatedAt - updatedBy - updatedReason - } - unlockInfo { - updatedAt - updatedBy - updatedReason - } - } + ...rateRevisionFragment } } } diff --git a/services/app-graphql/src/queries/indexRates.graphql b/services/app-graphql/src/queries/indexRates.graphql index af81ab30ce..a708d93831 100644 --- a/services/app-graphql/src/queries/indexRates.graphql +++ b/services/app-graphql/src/queries/indexRates.graphql @@ -72,6 +72,7 @@ query indexRates { packagesWithSharedRateCerts { packageName packageId + packageStatus } } } @@ -128,11 +129,16 @@ query indexRates { packagesWithSharedRateCerts { packageName packageId + packageStatus } } contractRevisions { id - contractID + contract { + id + stateCode + stateNumber + } createdAt updatedAt submitInfo { @@ -145,6 +151,51 @@ query indexRates { updatedBy updatedReason } + formData { + programIDs + populationCovered + submissionType + riskBasedContract + submissionDescription + stateContacts { + name, + title + email + } + supportingDocuments { + name + s3URL + sha256 + } + contractType + contractExecutionStatus + contractDocuments { + name + s3URL + sha256 + } + contractDateStart + contractDateEnd + managedCareEntities + federalAuthorities + inLieuServicesAndSettings + modifiedBenefitsProvided + modifiedGeoAreaServed + modifiedMedicaidBeneficiaries + modifiedRiskSharingStrategy + modifiedIncentiveArrangements + modifiedWitholdAgreements + modifiedStateDirectedPayments + modifiedPassThroughPayments + modifiedPaymentsForMentalDiseaseInstitutions + modifiedMedicalLossRatioStandards + modifiedOtherFinancialPaymentIncentive + modifiedEnrollmentProcess + modifiedGrevienceAndAppeal + modifiedNetworkAdequacyStandards + modifiedLengthOfContract + modifiedNonRiskPaymentArrangements + } } } } diff --git a/services/app-graphql/src/schema.graphql b/services/app-graphql/src/schema.graphql index 8de6bd8b00..0b82dae8d1 100644 --- a/services/app-graphql/src/schema.graphql +++ b/services/app-graphql/src/schema.graphql @@ -730,6 +730,84 @@ type GenericDocument { Rates are rate certifications and their associated actuary contacts and documents State users may create, update, and submit several rates at a time """ + +enum PopulationCovered { + MEDICAID + CHIP + MEDICAID_AND_CHIP +} + +enum SubmissionType { + CONTRACT_ONLY + CONTRACT_AND_RATES +} + +enum ContractType { + BASE + AMENDMENT +} + +enum ContractExecutionStatus { + EXECUTED + UNEXECUTED +} + +enum ManagedCareEntity { + MCO + PIHP + PAHP + PCCM +} + +enum FederalAuthority { + STATE_PLAN + WAIVER_1915B + WAIVER_1115 + VOLUNTARY + BENCHMARK + TITLE_XXI +} + +type StateContact { + name: String + title: String + email: String +} + +type ContractFormData { + programIDs: [String!]! + populationCovered: PopulationCovered + submissionType: SubmissionType! + riskBasedContract: Boolean + submissionDescription: String! + stateContacts: [StateContact!]! + supportingDocuments: [GenericDocument!]! + contractType: ContractType + contractExecutionStatus: ContractExecutionStatus + contractDocuments: [GenericDocument!]! + contractDateStart: Date + contractDateEnd: Date + managedCareEntities: [ManagedCareEntity!]! + federalAuthorities: [FederalAuthority!]! + inLieuServicesAndSettings: Boolean, + modifiedBenefitsProvided: Boolean, + modifiedGeoAreaServed: Boolean, + modifiedMedicaidBeneficiaries: Boolean, + modifiedRiskSharingStrategy: Boolean, + modifiedIncentiveArrangements: Boolean, + modifiedWitholdAgreements: Boolean, + modifiedStateDirectedPayments: Boolean, + modifiedPassThroughPayments: Boolean, + modifiedPaymentsForMentalDiseaseInstitutions: Boolean, + modifiedMedicalLossRatioStandards: Boolean, + modifiedOtherFinancialPaymentIncentive: Boolean, + modifiedEnrollmentProcess: Boolean, + modifiedGrevienceAndAppeal: Boolean, + modifiedNetworkAdequacyStandards: Boolean, + modifiedLengthOfContract: Boolean, + modifiedNonRiskPaymentArrangements: Boolean, +} + enum RateType { NEW AMENDMENT @@ -767,9 +845,9 @@ type ActuaryContact { type PackageWithSameRate { packageName: String! packageId: String! + packageStatus: String } - type RateFormData { rateType: RateType rateCapitationType: RateCapitationType @@ -788,13 +866,21 @@ type RateFormData { packagesWithSharedRateCerts: [PackageWithSameRate!]! } +type ContractOnRevisionType { + id: String! + stateCode: String! + mccrsID: String + stateNumber: Int! +} + type RelatedContractRevisions { id: String! - contractID: String! + contract: ContractOnRevisionType! submitInfo: UpdateInformation unlockInfo: UpdateInformation createdAt: DateTime! updatedAt: DateTime! + formData: ContractFormData! } type RateRevision { diff --git a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx index de46c114a5..1ab6ddcdd0 100644 --- a/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection.tsx @@ -12,6 +12,7 @@ import { Rate, RateFormData, RateRevision, + RelatedContractRevisions, } from '../../../gen/gqlClient' import { UploadedDocumentsTable } from '../UploadedDocumentsTable' import type { DocumentDateLookupTableType } from '../../../documentHelpers/makeDocumentDateLookupTable' @@ -21,6 +22,10 @@ import { DocumentWarningBanner } from '../../Banner' import { useS3 } from '../../../contexts/S3Context' import useDeepCompareEffect from 'use-deep-compare-effect' import { recordJSException } from '../../../otelHelpers' +import { Link } from '@trussworks/react-uswds' +import { NavLink } from 'react-router-dom' +import { packageName } from '../../../common-code/healthPlanFormDataType' +import { UploadedDocumentsTableProps } from '../UploadedDocumentsTable/UploadedDocumentsTable' // This rate summary pages assumes we are using contract and rates API. // Eventually RateDetailsSummarySection should share code with this code @@ -82,6 +87,30 @@ const rateCertificationType = (formData: RateFormData) => { } } +const relatedSubmissions = ( + contractRevisions: RelatedContractRevisions[], + statePrograms: Program[] +): React.ReactElement => { + return ( + <> + {contractRevisions.map((contractRev) => ( + + {packageName( + contractRev.contract.stateCode, + contractRev.contract.stateNumber, + contractRev.formData.programIDs, + statePrograms + )} + + ))} + + ) +} + export const SingleRateSummarySection = ({ rate, isSubmitted, @@ -91,10 +120,8 @@ export const SingleRateSummarySection = ({ isSubmitted: boolean statePrograms: Program[] }): React.ReactElement | null => { - const formData: RateFormData = - rate?.status === 'UNLOCKED' - ? rate?.revisions[1].formData - : rate?.revisions[0].formData + const rateRevision = rate.revisions[0] + const formData: RateFormData = rateRevision?.formData const documentDateLookupTable = makeRateDocumentDateTable(rate.revisions) const isRateAmendment = formData.rateType === 'AMENDMENT' @@ -106,6 +133,15 @@ export const SingleRateSummarySection = ({ string | undefined | Error >(undefined) + const appendDraftToSharedPackages: UploadedDocumentsTableProps['packagesWithSharedRateCerts'] = + rateRevision?.formData.packagesWithSharedRateCerts.map((pkg) => ({ + packageId: pkg.packageId, + packageName: + pkg.packageStatus === 'DRAFT' + ? pkg.packageName.concat(' (Draft)') + : pkg.packageName, + })) + useDeepCompareEffect(() => { // get all the keys for the documents we want to zip async function fetchZipUrl() { @@ -238,6 +274,15 @@ export const SingleRateSummarySection = ({ explainMissingData={!isSubmitted} children={rateCapitationType(formData)} /> + @@ -247,12 +292,14 @@ export const SingleRateSummarySection = ({