Skip to content

Commit

Permalink
add UI for historic submissions that have shared rates
Browse files Browse the repository at this point in the history
  • Loading branch information
pearl-truss committed Mar 15, 2024
1 parent bd86e84 commit 5bfff55
Showing 1 changed file with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
Program,
RateRevision,
RateFormData,
HealthPlanPackageStatus,
} from '../../../../../gen/gqlClient'

export type RateDetailsSummarySectionV2Props = {
Expand All @@ -34,6 +35,18 @@ export type RateDetailsSummarySectionV2Props = {
onDocumentError?: (error: true) => void
}

type SharedRateCertDisplay = {
packageId?: string
packageName?: string
}
type PackageNameType = string
type PackageNamesLookupType = {
[id: string]: {
packageName: PackageNameType
status: HealthPlanPackageStatus
}
}

export function renderDownloadButton(
zippedFilesURL: string | undefined | Error
) {
Expand All @@ -57,6 +70,7 @@ export const RateDetailsSummarySectionV2 = ({
submissionName,
statePrograms,
onDocumentError,
isCMSUser,
}: RateDetailsSummarySectionV2Props): React.ReactElement => {
const isSubmitted = contract.status === 'SUBMITTED'
const isEditing = !isSubmitted && editNavigateTo !== undefined
Expand All @@ -70,6 +84,29 @@ export const RateDetailsSummarySectionV2 = ({
const [zippedFilesURL, setZippedFilesURL] = useState<
string | undefined | Error
>(undefined)
const [packageNamesLookup] = React.useState<PackageNamesLookupType | null>(
null
)

const refreshPackagesWithSharedRateCert = (
rateFormData: RateFormData
): SharedRateCertDisplay[] | undefined => {
return rateFormData.packagesWithSharedRateCerts?.map(
({ packageId, packageName }) => {
const refreshedName =
packageId &&
packageNamesLookup &&
packageNamesLookup[packageId]?.packageName
const isDraftText =
isCMSUser && !refreshedName ? ' (Draft)' : ''
return {
packageId,
packageName:
refreshedName ?? `${packageName}${isDraftText}`,
}
}
)
}

const rateCapitationType = (rate: Rate | RateRevision) => {
const rateFormData = getRateFormData(rate)
Expand Down Expand Up @@ -291,6 +328,9 @@ export const RateDetailsSummarySectionV2 = ({
documentDateLookupTable={
documentDateLookupTable
}
packagesWithSharedRateCerts={refreshPackagesWithSharedRateCert(
rateFormData
)}
multipleDocumentsAllowed={false}
caption="Rate certification"
documentCategory="Rate certification"
Expand All @@ -304,6 +344,9 @@ export const RateDetailsSummarySectionV2 = ({
documentDateLookupTable={
documentDateLookupTable
}
packagesWithSharedRateCerts={refreshPackagesWithSharedRateCert(
rateFormData
)}
caption="Rate supporting documents"
isSupportingDocuments
documentCategory="Rate-supporting"
Expand Down

0 comments on commit 5bfff55

Please sign in to comment.