From b3c714758d42791b4b284826e0614d251103305c Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Tue, 17 Oct 2023 10:52:32 -0400 Subject: [PATCH 01/28] routing for mccrsid field established, bare bones form --- services/app-web/src/constants/routes.ts | 7 +- services/app-web/src/constants/tealium.ts | 2 +- services/app-web/src/pages/App/AppRoutes.tsx | 11 +- .../src/pages/MccrsId/MccrsId.module.scss | 151 ++++++++++++++++++ .../app-web/src/pages/MccrsId/MccrsId.tsx | 120 ++++++++++++++ .../SubmissionSummary/SubmissionSummary.tsx | 11 +- 6 files changed, 287 insertions(+), 15 deletions(-) create mode 100644 services/app-web/src/pages/MccrsId/MccrsId.module.scss create mode 100644 services/app-web/src/pages/MccrsId/MccrsId.tsx diff --git a/services/app-web/src/constants/routes.ts b/services/app-web/src/constants/routes.ts index 78581264a9..98f9beab4f 100644 --- a/services/app-web/src/constants/routes.ts +++ b/services/app-web/src/constants/routes.ts @@ -12,7 +12,6 @@ const ROUTES = [ 'HELP', 'REPORTS', 'SETTINGS', - 'RATES_SUMMARY', 'SUBMISSIONS', 'SUBMISSIONS_NEW', 'SUBMISSIONS_TYPE', @@ -24,6 +23,7 @@ const ROUTES = [ 'SUBMISSIONS_REVIEW_SUBMIT', 'SUBMISSIONS_REVISION', 'SUBMISSIONS_SUMMARY', + 'SUBMISSIONS_MCCRSID', 'SUBMISSIONS_QUESTIONS_AND_ANSWERS', 'SUBMISSIONS_UPLOAD_QUESTION', 'SUBMISSIONS_UPLOAD_RESPONSE', @@ -47,7 +47,6 @@ const RoutesRecord: Record = { HELP: '/help', REPORTS: '/reports', SETTINGS: '/settings', - RATES_SUMMARY: 'rates/:id', SUBMISSIONS: '/submissions', SUBMISSIONS_NEW: '/submissions/new', SUBMISSIONS_EDIT_TOP_LEVEL: '/submissions/:id/edit/*', @@ -58,6 +57,7 @@ const RoutesRecord: Record = { SUBMISSIONS_DOCUMENTS: '/submissions/:id/edit/documents', SUBMISSIONS_REVIEW_SUBMIT: '/submissions/:id/edit/review-and-submit', SUBMISSIONS_SUMMARY: '/submissions/:id', + SUBMISSIONS_MCCRSID: '/submissions/:id/MCCRS-record-number', SUBMISSIONS_REVISION: '/submissions/:id/revisions/:revisionVersion', SUBMISSIONS_QUESTIONS_AND_ANSWERS: '/submissions/:id/question-and-answers', SUBMISSIONS_UPLOAD_QUESTION: @@ -102,7 +102,6 @@ const QUESTION_RESPONSE_SHOW_SIDEBAR_ROUTES: RouteTWithUnknown[] = [ const PageHeadingsRecord: Partial> = { ROOT: 'Dashboard', DASHBOARD_SUBMISSIONS: 'Dashboard', - DASHBOARD_RATES: 'Dashboard', SUBMISSIONS_NEW: 'New submission', UNKNOWN_ROUTE: '404', } @@ -122,7 +121,6 @@ const PageTitlesRecord: Record = { DASHBOARD: 'Dashboard', DASHBOARD_RATES: 'Rate Review Dashboard', DASHBOARD_SUBMISSIONS: 'Dashboard', - RATES_SUMMARY: 'Rate summary', SUBMISSIONS: 'Submissions', SUBMISSIONS_NEW: 'New submission', SUBMISSIONS_EDIT_TOP_LEVEL: 'Submissions', @@ -134,6 +132,7 @@ const PageTitlesRecord: Record = { SUBMISSIONS_REVIEW_SUBMIT: 'Review and submit', SUBMISSIONS_REVISION: 'Submission revision', SUBMISSIONS_SUMMARY: 'Submission summary', + SUBMISSIONS_MCCRSID: 'Add MC-CRS record number', SUBMISSIONS_QUESTIONS_AND_ANSWERS: 'Q&A', SUBMISSIONS_UPLOAD_QUESTION: 'Add questions', SUBMISSIONS_UPLOAD_RESPONSE: 'Add response', diff --git a/services/app-web/src/constants/tealium.ts b/services/app-web/src/constants/tealium.ts index 8e60ba373a..59c75b89f8 100644 --- a/services/app-web/src/constants/tealium.ts +++ b/services/app-web/src/constants/tealium.ts @@ -38,7 +38,6 @@ const CONTENT_TYPE_BY_ROUTE: Record = { GRAPHQL_EXPLORER: 'dev', REPORTS: 'table', SETTINGS: 'table', - RATES_SUMMARY: 'summary', SUBMISSIONS: 'form', SUBMISSIONS_NEW: 'form', SUBMISSIONS_EDIT_TOP_LEVEL: 'form', @@ -51,6 +50,7 @@ const CONTENT_TYPE_BY_ROUTE: Record = { SUBMISSIONS_SUMMARY: 'summary', SUBMISSIONS_REVISION: 'summary', SUBMISSIONS_QUESTIONS_AND_ANSWERS: 'summary', + SUBMISSIONS_MCCRSID: 'form', SUBMISSIONS_UPLOAD_QUESTION: 'form', SUBMISSIONS_UPLOAD_RESPONSE: 'form', UNKNOWN_ROUTE: '404', diff --git a/services/app-web/src/pages/App/AppRoutes.tsx b/services/app-web/src/pages/App/AppRoutes.tsx index 7b29b9c5f5..2cf9bc02ec 100644 --- a/services/app-web/src/pages/App/AppRoutes.tsx +++ b/services/app-web/src/pages/App/AppRoutes.tsx @@ -22,6 +22,7 @@ import { AuthenticatedRouteWrapper } from '../Wrapper/AuthenticatedRouteWrapper' import { Error404 } from '../Errors/Error404Page' import { Help } from '../Help/Help' import { Landing } from '../Landing/Landing' +import { MccrsId } from '../MccrsId/MccrsId' import { NewStateSubmissionForm, StateSubmissionForm } from '../StateSubmission' import { SubmissionSummary } from '../SubmissionSummary' import { SubmissionRevisionSummary } from '../SubmissionRevisionSummary' @@ -37,7 +38,6 @@ import { UploadQuestions, } from '../QuestionResponse' import { GraphQLExplorer } from '../GraphQLExplorer/GraphQLExplorer' -import { RateSummary } from '../SubmissionSummary/RateSummary' function componentForAuthMode( authMode: AuthModeType @@ -185,6 +185,10 @@ const CMSUserRoutes = ({ /> )} + } + /> }> {showQuestionResponse && ( @@ -207,11 +211,6 @@ const CMSUserRoutes = ({ /> - } - /> - } diff --git a/services/app-web/src/pages/MccrsId/MccrsId.module.scss b/services/app-web/src/pages/MccrsId/MccrsId.module.scss new file mode 100644 index 0000000000..dcccc1dd74 --- /dev/null +++ b/services/app-web/src/pages/MccrsId/MccrsId.module.scss @@ -0,0 +1,151 @@ +@import '../../styles/uswdsImports.scss'; +@import '../../styles/custom.scss'; + +.formPage { + width: 100%; +} + +.formContainer.tableContainer { + + &[class^='usa-form'] { + max-width: 100%; + width: 75rem; + } +} + +.stepIndicator { + @include grid-container; + width: 100%; + + > [class^='usa-step-indicator'] { + width: 100%; + } +} + +.formHeader { + text-align: center; + width: 100%; + padding: units(4) 0; +} + +.formContainer { + > [class^='usa-fieldset'] { + padding: units(4); + margin-bottom: units(2); + margin-top: units(2); + background: $cms-color-white; + border: 1px solid $theme-color-base-lighter; + @include u-radius('md'); + } + + h2 { + margin-top: 0; + } + + > div[class^='usa-form-group']:not(:first-of-type) { + margin-top: 2.5rem; + } + + &[class^='usa-form'] { + + min-width: 100%; + max-width: 100%; + + @include at-media(tablet){ + min-width: 40rem; + max-width: 20rem; + margin: 0 auto; + } + } +} + +[class^='usa-legend'] { + margin-top: 0; +} + +.buttonGroup { + justify-content: flex-end; + margin-right: 0; + margin-left: 0; + margin-bottom: units(3); +} + +.dateRangePicker { + [class^='usa-label'] { + font-weight: normal; + } + [class^='usa-form-group'] { + margin-top: 0.75rem; + } +} + +.nestedOptions { + padding-left: units(4); + margin: units(2) 0; + border-left: 4px solid $theme-color-primary; + + legend, + label { + font-weight: normal; + } +} + +.nestedOptionsError { + padding-left: units(4); + margin: units(2) 0; + border-left: 4px solid $theme-color-error-darker; +} + +.stateContact, +.actuaryContact { + margin-bottom: units(5); + + .removeContactBtn { + margin-top: 0.5rem; + @include u-text('secondary'); + } +} + +.rateCertContainer + .rateCertContainer { + margin-top: units(6); +} + +.stateContacts, +.actuaryContacts { + .addContactBtn { + margin-top: 0.5rem; + } + + .removeContactBtn { + margin-top: units(4); + } +} + +.capitationLegend { + p { + margin-top: 0; + } +} + +.legendSubHeader { + font-weight: normal; + &.requiredOptionalText { + margin-bottom: units(2); + } +} + +.guidanceTextBlock{ + padding-top: 0; + display: flex; + flex-direction: column; +} + +.requiredOptionalText { + display: block; + color: $theme-color-hint; +} + +.guidanceTextBlockNoPadding{ + display: flex; + flex-direction: column; +} \ No newline at end of file diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx new file mode 100644 index 0000000000..f9211fafe3 --- /dev/null +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -0,0 +1,120 @@ +import React from 'react' +import { Form as UswdsForm, ButtonGroup } from '@trussworks/react-uswds' +import { Formik } from 'formik' +import { FieldTextInput } from '../../components/Form' +import { ActionButton } from '../../components/ActionButton' + +import styles from './MccrsId.module.scss' + +export interface MccrsIdFormValues { + recordNumber: number | undefined +} +// type FormError = +// FormikErrors[keyof FormikErrors] + +export const MccrsId = (): React.ReactElement => { + const mccrsIDInitialValues: MccrsIdFormValues = { + recordNumber: undefined, + } + return ( + console.info('submitted')} + // onSubmit={(values, { setSubmitting }) => { + // return handleFormSubmit(values, setSubmitting, { + // shouldValidateDocuments: true, + // redirectPath: + // draftSubmission.submissionType === 'CONTRACT_ONLY' + // ? `../contacts` + // : `../rate-details`, + // }) + // }} + // validationSchema={() => ContractDetailsFormSchema(draftSubmission)} + > + {({ + values, + errors, + handleSubmit, + setSubmitting, + isSubmitting, + setFieldValue, + }) => ( + <> + 'submitted'} + // onSubmit={(e) => { + // setShouldValidate(true) + // setFocusErrorSummaryHeading(true) + // handleSubmit(e) + // }} + > +
+ + Add MC-CRS record number + + + {/* {shouldValidate && ( + + )} */} + + Required + + +
+ + console.info('click')} + // onClick={actionInProgress ? undefined : backOnClick} + > + Delete + + + console.info('click')} + animationTimeout={1000} + // loading={actionInProgress && !disableContinue} + > + Save MC-CRS number + {/* {!isLastPage ? 'Continue' : 'Submit'} */} + + +
+ + )} +
+ ) +} diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index afdaf632d3..53b7ab8e3d 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -165,10 +165,13 @@ export const SubmissionSummary = (): React.ReactElement => { submissionName={name} headerChildComponent={ isCMSUser ? ( - + <> + Add MC-CRS record number + + ) : undefined } statePrograms={statePrograms} From 519fe511c35839138a4261ceb93b678411b7dda8 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Tue, 17 Oct 2023 20:39:01 -0400 Subject: [PATCH 02/28] Add validation schema --- services/app-web/src/pages/App/AppRoutes.tsx | 2 +- .../app-web/src/pages/MccrsId/MccrsId.tsx | 74 ++++++++++++++----- .../src/pages/MccrsId/MccrsIdSchema.ts | 13 ++++ 3 files changed, 69 insertions(+), 20 deletions(-) create mode 100644 services/app-web/src/pages/MccrsId/MccrsIdSchema.ts diff --git a/services/app-web/src/pages/App/AppRoutes.tsx b/services/app-web/src/pages/App/AppRoutes.tsx index 2cf9bc02ec..af97fee4e0 100644 --- a/services/app-web/src/pages/App/AppRoutes.tsx +++ b/services/app-web/src/pages/App/AppRoutes.tsx @@ -187,7 +187,7 @@ const CMSUserRoutes = ({
} + element={} /> }> diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index f9211fafe3..e11e7ed7c0 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -1,25 +1,62 @@ import React from 'react' import { Form as UswdsForm, ButtonGroup } from '@trussworks/react-uswds' -import { Formik } from 'formik' +import { Formik, FormikErrors, FormikHelpers } from 'formik' import { FieldTextInput } from '../../components/Form' import { ActionButton } from '../../components/ActionButton' +import { MccrsIdFormSchema } from './MccrsIdSchema' import styles from './MccrsId.module.scss' export interface MccrsIdFormValues { - recordNumber: number | undefined + mccrsId: number | undefined } -// type FormError = -// FormikErrors[keyof FormikErrors] +type FormError = + FormikErrors[keyof FormikErrors] + +export const MccrsId = ({ + mccrsId, + showValidations = false, +}: {mccrsId: string, showValidations: boolean}): React.ReactElement => { + const [shouldValidate, setShouldValidate] = React.useState(showValidations) -export const MccrsId = (): React.ReactElement => { const mccrsIDInitialValues: MccrsIdFormValues = { - recordNumber: undefined, + mccrsId: 1232, } + + const showFieldErrors = (error?: FormError) => + shouldValidate && Boolean(error) + + const handleFormSubmit = async ( + values: MccrsIdFormValues, + formikHelpers: FormikHelpers + ) => { + + try { + formikHelpers.setSubmitting(false) + + // const updatedSubmission = await updateDraft(draftSubmission) + // if (updatedSubmission instanceof Error) { + // formikHelpers.setSubmitting(false) + // redirectToDashboard.current = false + // console.info( + // 'Error updating draft submission: ', + // updatedSubmission + // ) + // } else if (updatedSubmission) { + // if (redirectToDashboard.current) { + // navigate(RoutesRecord.DASHBOARD_SUBMISSIONS) + // } else { + // navigate(`../documents`) + // } + // } + } catch (serverError) { + formikHelpers.setSubmitting(false) + } + } return ( console.info('submitted')} + onSubmit={handleFormSubmit} // onSubmit={(values, { setSubmitting }) => { // return handleFormSubmit(values, setSubmitting, { // shouldValidateDocuments: true, @@ -29,7 +66,7 @@ export const MccrsId = (): React.ReactElement => { // : `../rate-details`, // }) // }} - // validationSchema={() => ContractDetailsFormSchema(draftSubmission)} + validationSchema={() => MccrsIdFormSchema()} > {({ values, @@ -53,6 +90,7 @@ export const MccrsId = (): React.ReactElement => { // }} >
+

MC-CRS record number

Add MC-CRS record number @@ -71,32 +109,31 @@ export const MccrsId = (): React.ReactElement => { headingRef={errorSummaryHeadingRef} /> )} */} - - Required -
console.info('click')} // onClick={actionInProgress ? undefined : backOnClick} > - Delete + Delete Number { // loading={actionInProgress && !disableContinue} > Save MC-CRS number - {/* {!isLastPage ? 'Continue' : 'Submit'} */} diff --git a/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts b/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts new file mode 100644 index 0000000000..d7960146a1 --- /dev/null +++ b/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts @@ -0,0 +1,13 @@ +import * as Yup from 'yup' + +export const MccrsIdFormSchema = () => { + + return Yup.object().shape({ + mccrsId: Yup.number().required( + 'You must enter a record number or delete this field.' + ) + .typeError('You must enter a number') + .test('len', 'You must enter no more than [4] characters', val => val?.toString().length === 4) + , + }) +} From 59237d0594b22d0f470a280291c998ae5582ccbd Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 18 Oct 2023 11:18:37 -0400 Subject: [PATCH 03/28] wip calling updateContract api onsubmit --- .../src/resolvers/contract/updateContract.ts | 9 +- .../app-web/src/pages/MccrsId/MccrsId.tsx | 109 ++++++++++-------- 2 files changed, 66 insertions(+), 52 deletions(-) diff --git a/services/app-api/src/resolvers/contract/updateContract.ts b/services/app-api/src/resolvers/contract/updateContract.ts index 91ccc3838f..6422eb6d7e 100644 --- a/services/app-api/src/resolvers/contract/updateContract.ts +++ b/services/app-api/src/resolvers/contract/updateContract.ts @@ -21,10 +21,11 @@ export function updateContract( return async (_parent, { input }, context) => { const { user, span } = context setResolverDetailsOnActiveSpan('updateContract', user, span) - const ratesDatabaseRefactor = await launchDarkly.getFeatureFlag( - context, - 'rates-db-refactor' - ) + // const ratesDatabaseRefactor = await launchDarkly.getFeatureFlag( + // context, + // 'rates-db-refactor' + // ) + const ratesDatabaseRefactor = true if (ratesDatabaseRefactor) { // This resolver is only callable by CMS users diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index e11e7ed7c0..7b5ae58262 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -1,10 +1,18 @@ -import React from 'react' -import { Form as UswdsForm, ButtonGroup } from '@trussworks/react-uswds' +import React, { useState } from 'react' +import { Form as UswdsForm, ButtonGroup, Button } from '@trussworks/react-uswds' import { Formik, FormikErrors, FormikHelpers } from 'formik' import { FieldTextInput } from '../../components/Form' import { ActionButton } from '../../components/ActionButton' import { MccrsIdFormSchema } from './MccrsIdSchema' +import { recordJSException } from '../../otelHelpers/tracingHelper' +import { + User, + HealthPlanPackage, + UpdateInformation, + useUpdateContractMutation, + UpdateContractInput +} from '../../gen/gqlClient' import styles from './MccrsId.module.scss' export interface MccrsIdFormValues { @@ -25,47 +33,53 @@ export const MccrsId = ({ const showFieldErrors = (error?: FormError) => shouldValidate && Boolean(error) + const [showPageErrorMessage, setShowPageErrorMessage] = useState< + boolean | string + >(false) // string is a custom error message, defaults to generic of true - const handleFormSubmit = async ( - values: MccrsIdFormValues, - formikHelpers: FormikHelpers - ) => { - - try { - formikHelpers.setSubmitting(false) - - // const updatedSubmission = await updateDraft(draftSubmission) - // if (updatedSubmission instanceof Error) { - // formikHelpers.setSubmitting(false) - // redirectToDashboard.current = false - // console.info( - // 'Error updating draft submission: ', - // updatedSubmission - // ) - // } else if (updatedSubmission) { - // if (redirectToDashboard.current) { - // navigate(RoutesRecord.DASHBOARD_SUBMISSIONS) - // } else { - // navigate(`../documents`) - // } - // } - } catch (serverError) { - formikHelpers.setSubmitting(false) + const [updateFormData] = useUpdateContractMutation() + const handleFormSubmit = async (values: MccrsIdFormValues): Promise => { + // const base64Draft = domainToBase64(input) + console.log('clicked!') + setShowPageErrorMessage(false) + try { + const updateResult = await updateFormData({ + variables: { + input: { + mccrsID: '1245', + id: 'b102352b-09c2-4d7c-b52c-a7166b1fa6ca' + }, + }, + }) + const updatedSubmission: HealthPlanPackage | undefined = + updateResult?.data?.updateContract.pkg + console.log(updatedSubmission) + if (!updatedSubmission) { + setShowPageErrorMessage(true) + console.info('Failed to update form data', updateResult) + recordJSException( + `StateSubmissionForm: Apollo error reported. Error message: Failed to update form data ${updateResult}` + ) + return new Error('Failed to update form data') } + console.log(updatedSubmission) + return updatedSubmission + } catch (serverError) { + setShowPageErrorMessage(true) + recordJSException( + `StateSubmissionForm: Apollo error reported. Error message: ${serverError.message}` + ) + console.log(serverError) + return new Error(serverError) } + } + return ( { - // return handleFormSubmit(values, setSubmitting, { - // shouldValidateDocuments: true, - // redirectPath: - // draftSubmission.submissionType === 'CONTRACT_ONLY' - // ? `../contacts` - // : `../rate-details`, - // }) - // }} + onSubmit={(values) => { + return handleFormSubmit(values) + }} validationSchema={() => MccrsIdFormSchema()} > {({ @@ -82,12 +96,11 @@ export const MccrsId = ({ id="ContractDetailsForm" aria-label="Contract Details Form" aria-describedby="form-guidance" - onSubmit={() => 'submitted'} - // onSubmit={(e) => { - // setShouldValidate(true) - // setFocusErrorSummaryHeading(true) - // handleSubmit(e) - // }} + onSubmit={(e) => { + setShouldValidate(true) + // setFocusErrorSummaryHeading(true) + handleSubmit(e) + }} >

MC-CRS record number

@@ -136,17 +149,17 @@ export const MccrsId = ({ Delete Number - console.info('click')} - animationTimeout={1000} + onSubmit={() => handleFormSubmit(values)} + // animationTimeout={1000} // loading={actionInProgress && !disableContinue} > Save MC-CRS number - + From 028664ac189fca661a1a588834aa5d582071b1dc Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 18 Oct 2023 20:51:31 -0400 Subject: [PATCH 04/28] update styling on add mccrs id page --- .../src/pages/MccrsId/MccrsId.module.scss | 116 +++++------------- .../app-web/src/pages/MccrsId/MccrsId.tsx | 24 ++-- .../SubmissionSummary/SubmissionSummary.tsx | 2 +- 3 files changed, 43 insertions(+), 99 deletions(-) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.module.scss b/services/app-web/src/pages/MccrsId/MccrsId.module.scss index dcccc1dd74..c3e806a974 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.module.scss +++ b/services/app-web/src/pages/MccrsId/MccrsId.module.scss @@ -13,15 +13,6 @@ } } -.stepIndicator { - @include grid-container; - width: 100%; - - > [class^='usa-step-indicator'] { - width: 100%; - } -} - .formHeader { text-align: center; width: 100%; @@ -38,8 +29,8 @@ @include u-radius('md'); } - h2 { - margin-top: 0; + h3 { + font-size: 22px; } > div[class^='usa-form-group']:not(:first-of-type) { @@ -63,89 +54,38 @@ margin-top: 0; } -.buttonGroup { - justify-content: flex-end; - margin-right: 0; - margin-left: 0; - margin-bottom: units(3); -} - -.dateRangePicker { - [class^='usa-label'] { - font-weight: normal; - } - [class^='usa-form-group'] { - margin-top: 0.75rem; - } -} - -.nestedOptions { - padding-left: units(4); - margin: units(2) 0; - border-left: 4px solid $theme-color-primary; - - legend, - label { - font-weight: normal; - } -} - -.nestedOptionsError { - padding-left: units(4); - margin: units(2) 0; - border-left: 4px solid $theme-color-error-darker; -} - -.stateContact, -.actuaryContact { - margin-bottom: units(5); - - .removeContactBtn { - margin-top: 0.5rem; - @include u-text('secondary'); +div[class^='usa-form-group'] { + margin-top: 24px; + label[class^='usa-label'] { + font-size: 16px; + max-width: 100%; } } -.rateCertContainer + .rateCertContainer { - margin-top: units(6); -} - -.stateContacts, -.actuaryContacts { - .addContactBtn { - margin-top: 0.5rem; +div[class^='usa-hint'] span { + span { + display: inline; + font-weight: bold; } +} - .removeContactBtn { - margin-top: units(4); - } -} - -.capitationLegend { - p { +ul[class^='usa-button-group'] { + justify-content: space-between; + li[class^='usa-button-group__item'] { margin-top: 0; + button { + margin-top: 16px; + margin-bottom: 44px; + } + &:first-of-type { + button[class^='usa-button'] { + color: $theme-color-error-darker; + box-shadow: inset 0 0 0 2px $theme-color-error-darker; + } + } + &:last-of-type { + margin-right: .25rem; + } } } -.legendSubHeader { - font-weight: normal; - &.requiredOptionalText { - margin-bottom: units(2); - } -} - -.guidanceTextBlock{ - padding-top: 0; - display: flex; - flex-direction: column; -} - -.requiredOptionalText { - display: block; - color: $theme-color-hint; -} - -.guidanceTextBlockNoPadding{ - display: flex; - flex-direction: column; -} \ No newline at end of file diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index 7b5ae58262..c529f8ff2d 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -5,6 +5,7 @@ import { FieldTextInput } from '../../components/Form' import { ActionButton } from '../../components/ActionButton' import { MccrsIdFormSchema } from './MccrsIdSchema' import { recordJSException } from '../../otelHelpers/tracingHelper' +import { useNavigate, useOutletContext, useParams } from 'react-router-dom' import { User, @@ -21,14 +22,18 @@ export interface MccrsIdFormValues { type FormError = FormikErrors[keyof FormikErrors] +type RouteParams = { + submissionId: string +} export const MccrsId = ({ mccrsId, showValidations = false, }: {mccrsId: string, showValidations: boolean}): React.ReactElement => { const [shouldValidate, setShouldValidate] = React.useState(showValidations) + const { submissionId } = useParams() const mccrsIDInitialValues: MccrsIdFormValues = { - mccrsId: 1232, + mccrsId: Number(mccrsId), } const showFieldErrors = (error?: FormError) => @@ -39,15 +44,14 @@ export const MccrsId = ({ const [updateFormData] = useUpdateContractMutation() const handleFormSubmit = async (values: MccrsIdFormValues): Promise => { - // const base64Draft = domainToBase64(input) - console.log('clicked!') setShowPageErrorMessage(false) try { const updateResult = await updateFormData({ variables: { input: { - mccrsID: '1245', - id: 'b102352b-09c2-4d7c-b52c-a7166b1fa6ca' + mccrsID: values?.mccrsId?.toString(), + // id: submissionId + id: '217f8e1e-1b09-4d4a-92b9-189d2dbb1c63' }, }, }) @@ -58,7 +62,7 @@ export const MccrsId = ({ setShowPageErrorMessage(true) console.info('Failed to update form data', updateResult) recordJSException( - `StateSubmissionForm: Apollo error reported. Error message: Failed to update form data ${updateResult}` + `MCCRSIDForm: Apollo error reported. Error message: Failed to update form data ${updateResult}` ) return new Error('Failed to update form data') } @@ -67,7 +71,7 @@ export const MccrsId = ({ } catch (serverError) { setShowPageErrorMessage(true) recordJSException( - `StateSubmissionForm: Apollo error reported. Error message: ${serverError.message}` + `MCCRSIDForm: Apollo error reported. Error message: ${serverError.message}` ) console.log(serverError) return new Error(serverError) @@ -133,7 +137,7 @@ export const MccrsId = ({ type="text" variant="SUBHEAD" aria-required - hint="(i.e 4375)" + hint={((i.e 4375))} />
@@ -149,7 +153,7 @@ export const MccrsId = ({ Delete Number - + diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index 53b7ab8e3d..57fce4c85c 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -166,7 +166,7 @@ export const SubmissionSummary = (): React.ReactElement => { headerChildComponent={ isCMSUser ? ( <> - Add MC-CRS record number + Add MC-CRS record number Date: Wed, 18 Oct 2023 21:19:31 -0400 Subject: [PATCH 05/28] finalize styling on the summary page --- .../SectionHeader/SectionHeader.module.scss | 9 +++++++++ .../src/components/SectionHeader/SectionHeader.tsx | 13 +++++++++++-- .../SubmissionTypeSummarySection.tsx | 6 ++++++ .../pages/SubmissionSummary/SubmissionSummary.tsx | 3 ++- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/services/app-web/src/components/SectionHeader/SectionHeader.module.scss b/services/app-web/src/components/SectionHeader/SectionHeader.module.scss index ae49b82e93..04d2ed570c 100644 --- a/services/app-web/src/components/SectionHeader/SectionHeader.module.scss +++ b/services/app-web/src/components/SectionHeader/SectionHeader.module.scss @@ -54,6 +54,15 @@ justify-content: space-between; align-items: center; padding-bottom: units(2); + + &.alignTop { + align-items: start; + } + + a { + display: block; + margin-top: 17.5px; + } } .summarySectionHeaderBorder { diff --git a/services/app-web/src/components/SectionHeader/SectionHeader.tsx b/services/app-web/src/components/SectionHeader/SectionHeader.tsx index dfe9a47edd..f6457aa9ce 100644 --- a/services/app-web/src/components/SectionHeader/SectionHeader.tsx +++ b/services/app-web/src/components/SectionHeader/SectionHeader.tsx @@ -4,6 +4,8 @@ import styles from './SectionHeader.module.scss' export type SectionHeaderProps = { header: string + headerLinkURL?: string + headerLinkLabel?: string navigateTo?: string children?: React.ReactNode sectionId?: string @@ -13,6 +15,8 @@ export type SectionHeaderProps = { export const SectionHeader = ({ header, + headerLinkURL, + headerLinkLabel, navigateTo, children, sectionId, @@ -23,10 +27,15 @@ export const SectionHeader = ({
-

{header}

+
+

{header}

+ {headerLinkURL && ( + {headerLinkLabel} + )} +
{navigateTo && ( diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index 57fce4c85c..45f47f0262 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -161,12 +161,13 @@ export const SubmissionSummary = (): React.ReactElement => { )} - Add MC-CRS record number Date: Thu, 19 Oct 2023 20:31:16 -0400 Subject: [PATCH 06/28] add unit test for mccrsID form and submission summary pages --- services/app-web/src/pages/App/AppRoutes.tsx | 8 +- .../src/pages/MccrsId/MccrsId.test.tsx | 165 ++++++++++++++ .../app-web/src/pages/MccrsId/MccrsId.tsx | 211 +++++++++--------- .../SubmissionSummary.test.tsx | 73 +++++- .../SubmissionSummary/SubmissionSummary.tsx | 9 +- 5 files changed, 348 insertions(+), 118 deletions(-) create mode 100644 services/app-web/src/pages/MccrsId/MccrsId.test.tsx diff --git a/services/app-web/src/pages/App/AppRoutes.tsx b/services/app-web/src/pages/App/AppRoutes.tsx index 299677ea3c..7fb031922b 100644 --- a/services/app-web/src/pages/App/AppRoutes.tsx +++ b/services/app-web/src/pages/App/AppRoutes.tsx @@ -185,10 +185,6 @@ const CMSUserRoutes = ({ /> )} - } - /> }> {showQuestionResponse && ( @@ -205,6 +201,10 @@ const CMSUserRoutes = ({ /> )} + } + /> } diff --git a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx new file mode 100644 index 0000000000..a1379a688b --- /dev/null +++ b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx @@ -0,0 +1,165 @@ +import { screen, waitFor } from '@testing-library/react' +import userEvent from '@testing-library/user-event' + +import { + ldUseClientSpy, + renderWithProviders, +} from '../../testHelpers/jestHelpers' +import { MccrsId } from './MccrsId' + +describe('MCCRSID', () => { + beforeEach(() => { + ldUseClientSpy({ 'cms-questions': false }) + }) + afterEach(() => { + jest.resetAllMocks() + }) + + it('renders without errors', async () => { + renderWithProviders(, { + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + }) + + expect( + await screen.findByRole('heading', { name: 'MC-CRS record number' }) + ).toBeInTheDocument() + expect( + screen.getByRole('button', { name: 'Save MC-CRS number' }) + ).not.toHaveAttribute('aria-disabled') + }) + + it('displays the text field for mccrs id', async () => { + renderWithProviders(, { + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + }) + + expect(screen.getByTestId('textInput')).toBeInTheDocument() + }) + + it('cannot continue without providing a MCCRS ID', async () => { + renderWithProviders(, { + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + }) + const continueButton = screen.getByRole('button', { + name: 'Save MC-CRS number', + }) + continueButton.click() + await waitFor(() => { + expect( + screen.getAllByText( + 'You must enter a record number or delete this field.' + ) + ).toHaveLength(1) + expect(continueButton).toHaveAttribute('aria-disabled', 'true') + }) + }) + + it('cannot continue with MCCRS ID less than 4 digits', async () => { + renderWithProviders(, { + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + }) + + screen + .getByLabelText( + 'Enter the Managed Care Contract and Rate Review System (MC-CRS) record number.' + ) + .focus() + await userEvent.paste('123') + const continueButton = screen.getByRole('button', { + name: 'Save MC-CRS number', + }) + continueButton.click() + await waitFor(() => { + expect( + screen.getAllByText( + 'You must enter no more than [4] characters' + ) + ).toHaveLength(1) + expect(continueButton).toHaveAttribute('aria-disabled', 'true') + }) + }) + + it('cannot continue with MCCRS ID more than 4 digits', async () => { + renderWithProviders(, { + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + }) + + screen + .getByLabelText( + 'Enter the Managed Care Contract and Rate Review System (MC-CRS) record number.' + ) + .focus() + await userEvent.paste('12345') + const continueButton = screen.getByRole('button', { + name: 'Save MC-CRS number', + }) + continueButton.click() + await waitFor(() => { + expect( + screen.getAllByText( + 'You must enter no more than [4] characters' + ) + ).toHaveLength(1) + expect(continueButton).toHaveAttribute('aria-disabled', 'true') + }) + }) + + it('cannot continue with MCCRS ID with non number input', async () => { + renderWithProviders(, { + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + }) + + screen + .getByLabelText( + 'Enter the Managed Care Contract and Rate Review System (MC-CRS) record number.' + ) + .focus() + await userEvent.paste('123a') + const continueButton = screen.getByRole('button', { + name: 'Save MC-CRS number', + }) + continueButton.click() + await waitFor(() => { + expect(screen.getAllByText('You must enter a number')).toHaveLength( + 1 + ) + expect(continueButton).toHaveAttribute('aria-disabled', 'true') + }) + }) + + it('successfully adds the MCCRS ID', async () => { + renderWithProviders(, { + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + }) + + screen + .getByLabelText( + 'Enter the Managed Care Contract and Rate Review System (MC-CRS) record number.' + ) + .focus() + await userEvent.paste('1234') + const continueButton = screen.getByRole('button', { + name: 'Save MC-CRS number', + }) + continueButton.click() + await waitFor(() => { + expect( + screen.getByText('Add MC-CRS record number') + ).toBeInTheDocument() + }) + }) +}) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index c529f8ff2d..ea78554ae9 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -1,18 +1,15 @@ import React, { useState } from 'react' -import { Form as UswdsForm, ButtonGroup, Button } from '@trussworks/react-uswds' -import { Formik, FormikErrors, FormikHelpers } from 'formik' +import { Form as UswdsForm, ButtonGroup } from '@trussworks/react-uswds' +import { Formik, FormikErrors } from 'formik' import { FieldTextInput } from '../../components/Form' -import { ActionButton } from '../../components/ActionButton' import { MccrsIdFormSchema } from './MccrsIdSchema' import { recordJSException } from '../../otelHelpers/tracingHelper' -import { useNavigate, useOutletContext, useParams } from 'react-router-dom' - +import { useNavigate, useParams } from 'react-router-dom' +import { GenericApiErrorBanner } from '../../components/Banner/GenericApiErrorBanner/GenericApiErrorBanner' +import { ActionButton } from '../../components/ActionButton' import { - User, HealthPlanPackage, - UpdateInformation, useUpdateContractMutation, - UpdateContractInput } from '../../gen/gqlClient' import styles from './MccrsId.module.scss' @@ -23,151 +20,145 @@ type FormError = FormikErrors[keyof FormikErrors] type RouteParams = { - submissionId: string + id: string } + export const MccrsId = ({ - mccrsId, showValidations = false, -}: {mccrsId: string, showValidations: boolean}): React.ReactElement => { +}: { + showValidations: boolean +}): React.ReactElement => { const [shouldValidate, setShouldValidate] = React.useState(showValidations) - const { submissionId } = useParams() + const { id } = useParams() + const navigate = useNavigate() const mccrsIDInitialValues: MccrsIdFormValues = { - mccrsId: Number(mccrsId), + mccrsId: undefined, } const showFieldErrors = (error?: FormError) => shouldValidate && Boolean(error) const [showPageErrorMessage, setShowPageErrorMessage] = useState< - boolean | string + boolean | string >(false) // string is a custom error message, defaults to generic of true const [updateFormData] = useUpdateContractMutation() - const handleFormSubmit = async (values: MccrsIdFormValues): Promise => { + const handleFormSubmit = async ( + values: MccrsIdFormValues + ): Promise => { setShowPageErrorMessage(false) try { const updateResult = await updateFormData({ variables: { input: { mccrsID: values?.mccrsId?.toString(), - // id: submissionId - id: '217f8e1e-1b09-4d4a-92b9-189d2dbb1c63' + id: id || '', }, }, }) + const updatedSubmission: HealthPlanPackage | undefined = updateResult?.data?.updateContract.pkg - console.log(updatedSubmission) + if (!updatedSubmission) { setShowPageErrorMessage(true) + console.info('Failed to update form data', updateResult) recordJSException( `MCCRSIDForm: Apollo error reported. Error message: Failed to update form data ${updateResult}` ) return new Error('Failed to update form data') + } else if (updatedSubmission) { + navigate(`/submissions/${updatedSubmission.id}`) + return updatedSubmission } - console.log(updatedSubmission) return updatedSubmission } catch (serverError) { setShowPageErrorMessage(true) recordJSException( `MCCRSIDForm: Apollo error reported. Error message: ${serverError.message}` ) - console.log(serverError) return new Error(serverError) } } - - return ( - { - return handleFormSubmit(values) - }} - validationSchema={() => MccrsIdFormSchema()} - > - {({ - values, - errors, - handleSubmit, - setSubmitting, - isSubmitting, - setFieldValue, - }) => ( - <> - { - setShouldValidate(true) - // setFocusErrorSummaryHeading(true) - handleSubmit(e) - }} - > -
-

MC-CRS record number

- - Add MC-CRS record number - - {/* {shouldValidate && ( - - )} */} - (i.e 4375))} - /> -
- - console.info('click')} - // onClick={actionInProgress ? undefined : backOnClick} - > - Delete Number - + return ( + <> + {showPageErrorMessage && } + { + return handleFormSubmit(values) + }} + validationSchema={() => MccrsIdFormSchema()} + > + {({ values, errors, handleSubmit, isSubmitting }) => ( + <> + { + setShouldValidate(true) + handleSubmit(e) + }} + > +
+

MC-CRS record number

+ + Add MC-CRS record number + + + (i.e 4375) + + } + /> +
+ + console.info('delete')} + > + Delete Number + - handleFormSubmit(values)} - // animationTimeout={1000} - // loading={actionInProgress && !disableContinue} - > - Save MC-CRS number - - -
- - )} -
+ handleFormSubmit(values)} + animationTimeout={1000} + loading={ + isSubmitting && + shouldValidate && + !errors.mccrsId + } + > + Save MC-CRS number + +
+
+ + )} +
+ ) } diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx index 25d888500c..ffc0d84e57 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx @@ -22,7 +22,6 @@ import { } from '../../testHelpers/jestHelpers' import { SubmissionSummary } from './SubmissionSummary' import { SubmissionSideNav } from '../SubmissionSideNav' -import React from 'react' import { testS3Client } from '../../testHelpers/s3Helpers' describe('SubmissionSummary', () => { @@ -161,6 +160,78 @@ describe('SubmissionSummary', () => { }) }) + it('renders add mccrs-id link for CMS user', async () => { + const submissionsWithRevisions = mockUnlockedHealthPlanPackage() + renderWithProviders( + + }> + } + /> + + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + user: mockValidCMSUser(), + statusCode: 200, + }), + fetchStateHealthPlanPackageWithQuestionsMockSuccess({ + stateSubmission: submissionsWithRevisions, + id: '15', + }), + ], + }, + routerProvider: { + route: '/submissions/15', + }, + } + ) + await waitFor(() => { + expect( + screen.getByText('Add MC-CRS record number') + ).toBeInTheDocument() + }) + }) + + it('does not render an add mccrs-id link for state user', async () => { + const submissionsWithRevisions = mockUnlockedHealthPlanPackage() + renderWithProviders( + + }> + } + /> + + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + user: mockValidUser(), + statusCode: 200, + }), + fetchStateHealthPlanPackageWithQuestionsMockSuccess({ + stateSubmission: submissionsWithRevisions, + id: '15', + }), + ], + }, + routerProvider: { + route: '/submissions/15', + }, + } + ) + await waitFor(() => { + expect( + screen.queryByText('Add MC-CRS record number') + ).not.toBeInTheDocument() + }) + }) + it('renders submission unlocked banner for State user', async () => { const submissionsWithRevisions = mockUnlockedHealthPlanPackage() renderWithProviders( diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index 45f47f0262..7c8f1a3c2c 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -70,7 +70,6 @@ export const SubmissionSummary = (): React.ReactElement => { const { pkg, currentRevision, packageData, user, documentDates } = useOutletContext() - const isCMSUser = user?.role === 'CMS_USER' const submissionStatus = pkg.status const statePrograms = pkg.state.programs @@ -161,8 +160,12 @@ export const SubmissionSummary = (): React.ReactElement => { )} Date: Fri, 20 Oct 2023 11:20:48 -0400 Subject: [PATCH 07/28] additional styling --- .../SectionHeader/SectionHeader.tsx | 12 +++---- .../SubmissionTypeSummarySection.tsx | 7 ++-- services/app-web/src/pages/App/AppRoutes.tsx | 9 ++--- .../src/pages/MccrsId/MccrsId.test.tsx | 36 ++++--------------- .../app-web/src/pages/MccrsId/MccrsId.tsx | 8 ++--- .../SubmissionSummary.module.scss | 15 ++++++++ .../SubmissionSummary/SubmissionSummary.tsx | 30 +++++++++++++--- 7 files changed, 60 insertions(+), 57 deletions(-) diff --git a/services/app-web/src/components/SectionHeader/SectionHeader.tsx b/services/app-web/src/components/SectionHeader/SectionHeader.tsx index f6457aa9ce..69786214e0 100644 --- a/services/app-web/src/components/SectionHeader/SectionHeader.tsx +++ b/services/app-web/src/components/SectionHeader/SectionHeader.tsx @@ -4,10 +4,9 @@ import styles from './SectionHeader.module.scss' export type SectionHeaderProps = { header: string - headerLinkURL?: string - headerLinkLabel?: string navigateTo?: string children?: React.ReactNode + subHeaderComponent?: React.ReactNode sectionId?: string headerId?: string hideBorder?: boolean @@ -15,8 +14,7 @@ export type SectionHeaderProps = { export const SectionHeader = ({ header, - headerLinkURL, - headerLinkLabel, + subHeaderComponent, navigateTo, children, sectionId, @@ -27,14 +25,12 @@ export const SectionHeader = ({

{header}

- {headerLinkURL && ( - {headerLinkLabel} - )} + {subHeaderComponent}
{navigateTo && ( diff --git a/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.tsx b/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.tsx index 54ff30de2f..92047758d7 100644 --- a/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.tsx @@ -21,6 +21,7 @@ export type SubmissionTypeSummarySectionProps = { headerLinkURL?: string headerLinkLabel?: string headerChildComponent?: React.ReactElement + subHeaderComponent?: React.ReactElement initiallySubmittedAt?: Date submissionName: string } @@ -29,8 +30,7 @@ export const SubmissionTypeSummarySection = ({ submission, statePrograms, navigateTo, - headerLinkURL, - headerLinkLabel, + subHeaderComponent, headerChildComponent, initiallySubmittedAt, submissionName, @@ -45,8 +45,7 @@ export const SubmissionTypeSummarySection = ({
diff --git a/services/app-web/src/pages/App/AppRoutes.tsx b/services/app-web/src/pages/App/AppRoutes.tsx index 7fb031922b..4e51b93124 100644 --- a/services/app-web/src/pages/App/AppRoutes.tsx +++ b/services/app-web/src/pages/App/AppRoutes.tsx @@ -201,16 +201,17 @@ const CMSUserRoutes = ({ /> )} - } - /> } /> + } + /> + } diff --git a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx index a1379a688b..76cd843114 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx @@ -16,7 +16,7 @@ describe('MCCRSID', () => { }) it('renders without errors', async () => { - renderWithProviders(, { + renderWithProviders(, { routerProvider: { route: '/submissions/15/MCCRS-record-number', }, @@ -31,7 +31,7 @@ describe('MCCRSID', () => { }) it('displays the text field for mccrs id', async () => { - renderWithProviders(, { + renderWithProviders(, { routerProvider: { route: '/submissions/15/MCCRS-record-number', }, @@ -41,7 +41,7 @@ describe('MCCRSID', () => { }) it('cannot continue without providing a MCCRS ID', async () => { - renderWithProviders(, { + renderWithProviders(, { routerProvider: { route: '/submissions/15/MCCRS-record-number', }, @@ -61,7 +61,7 @@ describe('MCCRSID', () => { }) it('cannot continue with MCCRS ID less than 4 digits', async () => { - renderWithProviders(, { + renderWithProviders(, { routerProvider: { route: '/submissions/15/MCCRS-record-number', }, @@ -88,7 +88,7 @@ describe('MCCRSID', () => { }) it('cannot continue with MCCRS ID more than 4 digits', async () => { - renderWithProviders(, { + renderWithProviders(, { routerProvider: { route: '/submissions/15/MCCRS-record-number', }, @@ -115,7 +115,7 @@ describe('MCCRSID', () => { }) it('cannot continue with MCCRS ID with non number input', async () => { - renderWithProviders(, { + renderWithProviders(, { routerProvider: { route: '/submissions/15/MCCRS-record-number', }, @@ -138,28 +138,4 @@ describe('MCCRSID', () => { expect(continueButton).toHaveAttribute('aria-disabled', 'true') }) }) - - it('successfully adds the MCCRS ID', async () => { - renderWithProviders(, { - routerProvider: { - route: '/submissions/15/MCCRS-record-number', - }, - }) - - screen - .getByLabelText( - 'Enter the Managed Care Contract and Rate Review System (MC-CRS) record number.' - ) - .focus() - await userEvent.paste('1234') - const continueButton = screen.getByRole('button', { - name: 'Save MC-CRS number', - }) - continueButton.click() - await waitFor(() => { - expect( - screen.getByText('Add MC-CRS record number') - ).toBeInTheDocument() - }) - }) }) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index ea78554ae9..4550060339 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -23,12 +23,8 @@ type RouteParams = { id: string } -export const MccrsId = ({ - showValidations = false, -}: { - showValidations: boolean -}): React.ReactElement => { - const [shouldValidate, setShouldValidate] = React.useState(showValidations) +export const MccrsId = (): React.ReactElement => { + const [shouldValidate, setShouldValidate] = React.useState(true) const { id } = useParams() const navigate = useNavigate() diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.module.scss b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.module.scss index 9d453edb2f..801a4048c1 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.module.scss +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.module.scss @@ -17,6 +17,21 @@ padding: 2rem 0; } +.subHeader { + margin-top: 17.5px; + span { + font-weight: bold; + a { + display: inline; + margin-left: 5px; + } + + } + .editLink { + margin-top: 0; + } +} + .banner { margin: units(2) auto; } diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index 7c8f1a3c2c..2735d298c5 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -160,12 +160,32 @@ export const SubmissionSummary = (): React.ReactElement => { )} + {pkg.mccrsID && ( + + MC-CRS record number: + + {pkg.mccrsID} + + + )} + + {pkg.mccrsID + ? 'Edit MC-CRS number' + : 'Add MC-CRS record number'} + +
+ ) : undefined } - headerLinkLabel="Add MC-CRS record number" submission={packageData} submissionName={name} headerChildComponent={ From 52d699d1c85601a6deb893425386357d1c948822 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Fri, 20 Oct 2023 11:50:23 -0400 Subject: [PATCH 08/28] code cleanup --- .../app-api/src/resolvers/contract/updateContract.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/services/app-api/src/resolvers/contract/updateContract.ts b/services/app-api/src/resolvers/contract/updateContract.ts index 6422eb6d7e..91ccc3838f 100644 --- a/services/app-api/src/resolvers/contract/updateContract.ts +++ b/services/app-api/src/resolvers/contract/updateContract.ts @@ -21,11 +21,10 @@ export function updateContract( return async (_parent, { input }, context) => { const { user, span } = context setResolverDetailsOnActiveSpan('updateContract', user, span) - // const ratesDatabaseRefactor = await launchDarkly.getFeatureFlag( - // context, - // 'rates-db-refactor' - // ) - const ratesDatabaseRefactor = true + const ratesDatabaseRefactor = await launchDarkly.getFeatureFlag( + context, + 'rates-db-refactor' + ) if (ratesDatabaseRefactor) { // This resolver is only callable by CMS users From 5718bcf7e078d16bf469f7ff3f51aadb4228cf03 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Fri, 20 Oct 2023 11:56:11 -0400 Subject: [PATCH 09/28] resolving bad merge --- services/app-web/src/constants/routes.ts | 6 +++++- services/app-web/src/constants/tealium.ts | 1 + services/app-web/src/pages/App/AppRoutes.tsx | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/services/app-web/src/constants/routes.ts b/services/app-web/src/constants/routes.ts index 98f9beab4f..c839478c4b 100644 --- a/services/app-web/src/constants/routes.ts +++ b/services/app-web/src/constants/routes.ts @@ -12,6 +12,7 @@ const ROUTES = [ 'HELP', 'REPORTS', 'SETTINGS', + 'RATES_SUMMARY', 'SUBMISSIONS', 'SUBMISSIONS_NEW', 'SUBMISSIONS_TYPE', @@ -47,6 +48,7 @@ const RoutesRecord: Record = { HELP: '/help', REPORTS: '/reports', SETTINGS: '/settings', + RATES_SUMMARY: 'rates/:id', SUBMISSIONS: '/submissions', SUBMISSIONS_NEW: '/submissions/new', SUBMISSIONS_EDIT_TOP_LEVEL: '/submissions/:id/edit/*', @@ -102,6 +104,7 @@ const QUESTION_RESPONSE_SHOW_SIDEBAR_ROUTES: RouteTWithUnknown[] = [ const PageHeadingsRecord: Partial> = { ROOT: 'Dashboard', DASHBOARD_SUBMISSIONS: 'Dashboard', + DASHBOARD_RATES: 'Dashboard', SUBMISSIONS_NEW: 'New submission', UNKNOWN_ROUTE: '404', } @@ -121,6 +124,7 @@ const PageTitlesRecord: Record = { DASHBOARD: 'Dashboard', DASHBOARD_RATES: 'Rate Review Dashboard', DASHBOARD_SUBMISSIONS: 'Dashboard', + RATES_SUMMARY: 'Rate summary', SUBMISSIONS: 'Submissions', SUBMISSIONS_NEW: 'New submission', SUBMISSIONS_EDIT_TOP_LEVEL: 'Submissions', @@ -129,10 +133,10 @@ const PageTitlesRecord: Record = { SUBMISSIONS_RATE_DETAILS: 'Rate details', SUBMISSIONS_CONTACTS: 'Contacts', SUBMISSIONS_DOCUMENTS: 'Supporting documents', + SUBMISSIONS_MCCRSID: 'Add MC-CRS record number', SUBMISSIONS_REVIEW_SUBMIT: 'Review and submit', SUBMISSIONS_REVISION: 'Submission revision', SUBMISSIONS_SUMMARY: 'Submission summary', - SUBMISSIONS_MCCRSID: 'Add MC-CRS record number', SUBMISSIONS_QUESTIONS_AND_ANSWERS: 'Q&A', SUBMISSIONS_UPLOAD_QUESTION: 'Add questions', SUBMISSIONS_UPLOAD_RESPONSE: 'Add response', diff --git a/services/app-web/src/constants/tealium.ts b/services/app-web/src/constants/tealium.ts index 59c75b89f8..d3453dd754 100644 --- a/services/app-web/src/constants/tealium.ts +++ b/services/app-web/src/constants/tealium.ts @@ -38,6 +38,7 @@ const CONTENT_TYPE_BY_ROUTE: Record = { GRAPHQL_EXPLORER: 'dev', REPORTS: 'table', SETTINGS: 'table', + RATES_SUMMARY: 'summary', SUBMISSIONS: 'form', SUBMISSIONS_NEW: 'form', SUBMISSIONS_EDIT_TOP_LEVEL: 'form', diff --git a/services/app-web/src/pages/App/AppRoutes.tsx b/services/app-web/src/pages/App/AppRoutes.tsx index 4e51b93124..82e87bf5ed 100644 --- a/services/app-web/src/pages/App/AppRoutes.tsx +++ b/services/app-web/src/pages/App/AppRoutes.tsx @@ -38,6 +38,7 @@ import { UploadQuestions, } from '../QuestionResponse' import { GraphQLExplorer } from '../GraphQLExplorer/GraphQLExplorer' +import { RateSummary } from '../SubmissionSummary/RateSummary' function componentForAuthMode( authMode: AuthModeType @@ -207,6 +208,11 @@ const CMSUserRoutes = ({ /> + } + /> + } From 320c017e4c25c61b69c5e032dac21ea57e504041 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Fri, 20 Oct 2023 11:59:30 -0400 Subject: [PATCH 10/28] remove unneeded code in submission summary --- .../SubmissionTypeSummarySection.tsx | 2 -- .../src/pages/SubmissionSummary/SubmissionSummary.tsx | 11 +++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.tsx b/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.tsx index 92047758d7..383b6d3235 100644 --- a/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.tsx +++ b/services/app-web/src/components/SubmissionSummarySection/SubmissionTypeSummarySection/SubmissionTypeSummarySection.tsx @@ -18,8 +18,6 @@ export type SubmissionTypeSummarySectionProps = { submission: HealthPlanFormDataType statePrograms: Program[] navigateTo?: string - headerLinkURL?: string - headerLinkLabel?: string headerChildComponent?: React.ReactElement subHeaderComponent?: React.ReactElement initiallySubmittedAt?: Date diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index 2735d298c5..10ed9287c6 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -70,6 +70,7 @@ export const SubmissionSummary = (): React.ReactElement => { const { pkg, currentRevision, packageData, user, documentDates } = useOutletContext() + const isCMSUser = user?.role === 'CMS_USER' const submissionStatus = pkg.status const statePrograms = pkg.state.programs @@ -190,12 +191,10 @@ export const SubmissionSummary = (): React.ReactElement => { submissionName={name} headerChildComponent={ isCMSUser ? ( - <> - - + ) : undefined } statePrograms={statePrograms} From cd98ba4af14d1f6985f03bf2c8e5f93deb305f67 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Mon, 23 Oct 2023 12:41:13 -0400 Subject: [PATCH 11/28] update the custom heading for mccrs page and update validation message for inccorect character count --- .../Header/PageHeadingRow/PageHeadingRow.tsx | 6 +-- services/app-web/src/constants/tealium.ts | 4 +- services/app-web/src/contexts/PageContext.tsx | 8 ++-- services/app-web/src/pages/App/AppRoutes.tsx | 9 ++-- .../src/pages/MccrsId/MccrsId.module.scss | 9 ++++ .../src/pages/MccrsId/MccrsId.test.tsx | 4 +- .../app-web/src/pages/MccrsId/MccrsId.tsx | 41 +++++++++++++++---- .../src/pages/MccrsId/MccrsIdSchema.ts | 2 +- 8 files changed, 58 insertions(+), 25 deletions(-) diff --git a/services/app-web/src/components/Header/PageHeadingRow/PageHeadingRow.tsx b/services/app-web/src/components/Header/PageHeadingRow/PageHeadingRow.tsx index 54b9736700..3e831c5c23 100644 --- a/services/app-web/src/components/Header/PageHeadingRow/PageHeadingRow.tsx +++ b/services/app-web/src/components/Header/PageHeadingRow/PageHeadingRow.tsx @@ -18,7 +18,7 @@ const CMSUserRow = ({ heading, }: { user: CmsUser | AdminUser | HelpdeskUser | BusinessOwnerUser - heading?: string + heading?: string | React.ReactElement }) => { return (
@@ -46,7 +46,7 @@ const StateUserRow = ({ heading, }: { user: StateUser - heading?: string + heading?: string | React.ReactElement }) => { return (
@@ -99,7 +99,7 @@ const LandingRow = ({ isLoading }: { isLoading: boolean }) => { type PageHeadingProps = { isLoading?: boolean loggedInUser?: User - heading?: string + heading?: string | React.ReactElement route?: string } diff --git a/services/app-web/src/constants/tealium.ts b/services/app-web/src/constants/tealium.ts index d3453dd754..ce0cb008a6 100644 --- a/services/app-web/src/constants/tealium.ts +++ b/services/app-web/src/constants/tealium.ts @@ -84,7 +84,7 @@ const getTealiumPageName = ({ user, }: { route: RouteT | 'UNKNOWN_ROUTE' - heading: string | undefined + heading: string | React.ReactElement | undefined user: User | undefined }) => { const addSubmissionNameHeading = @@ -96,7 +96,7 @@ const getTealiumPageName = ({ title, }: { title: string - heading?: string + heading?: string | React.ReactElement }) => { const headingPrefix = heading && addSubmissionNameHeading ? `${heading}: ` : '' diff --git a/services/app-web/src/contexts/PageContext.tsx b/services/app-web/src/contexts/PageContext.tsx index 470304e9b3..a64ab2daa4 100644 --- a/services/app-web/src/contexts/PageContext.tsx +++ b/services/app-web/src/contexts/PageContext.tsx @@ -7,8 +7,8 @@ import { useCurrentRoute } from '../hooks/useCurrentRoute' Intended for page specific context that must be shared across the application, not for data that can be fetched from the api. */ type PageContextType = { - heading?: string - updateHeading: ({ customHeading }: { customHeading?: string }) => void + heading?: string | React.ReactElement + updateHeading: ({ customHeading }: { customHeading?: string | React.ReactElement }) => void } const PageContext = React.createContext(null as unknown as PageContextType) @@ -21,14 +21,14 @@ const PageProvider: React.FC< React.PropsWithChildren> > > = ({ children }) => { - const [heading, setHeading] = React.useState(undefined) + const [heading, setHeading] = React.useState(undefined) const { currentRoute: routeName } = useCurrentRoute() /* Set headings in priority order 1. If there a custom heading, use that (relevant for heading related to the api loaded resource, such as the submission name) 2. Otherwise, use default static headings for the current location when defined. */ - const updateHeading = ({ customHeading }: { customHeading?: string }) => { + const updateHeading = ({ customHeading }: { customHeading?: string | React.ReactElement }) => { const defaultHeading = PageHeadingsRecord[routeName] ? PageHeadingsRecord[routeName] : undefined diff --git a/services/app-web/src/pages/App/AppRoutes.tsx b/services/app-web/src/pages/App/AppRoutes.tsx index 82e87bf5ed..d40c96433e 100644 --- a/services/app-web/src/pages/App/AppRoutes.tsx +++ b/services/app-web/src/pages/App/AppRoutes.tsx @@ -206,6 +206,10 @@ const CMSUserRoutes = ({ path={RoutesRecord.SUBMISSIONS_SUMMARY} element={} /> + } + /> } /> - } - /> - } diff --git a/services/app-web/src/pages/MccrsId/MccrsId.module.scss b/services/app-web/src/pages/MccrsId/MccrsId.module.scss index c3e806a974..28873fa105 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.module.scss +++ b/services/app-web/src/pages/MccrsId/MccrsId.module.scss @@ -62,6 +62,15 @@ div[class^='usa-form-group'] { } } +.customHeading { + font-weight: 700; + + span { + font-weight: normal; + margin-left: 16px; + } +} + div[class^='usa-hint'] span { span { display: inline; diff --git a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx index 76cd843114..d3c62384f2 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx @@ -80,7 +80,7 @@ describe('MCCRSID', () => { await waitFor(() => { expect( screen.getAllByText( - 'You must enter no more than [4] characters' + 'You must enter no more than 4 characters' ) ).toHaveLength(1) expect(continueButton).toHaveAttribute('aria-disabled', 'true') @@ -107,7 +107,7 @@ describe('MCCRSID', () => { await waitFor(() => { expect( screen.getAllByText( - 'You must enter no more than [4] characters' + 'You must enter no more than 4 characters' ) ).toHaveLength(1) expect(continueButton).toHaveAttribute('aria-disabled', 'true') diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index 4550060339..c4a1a0bfe1 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -1,12 +1,15 @@ -import React, { useState } from 'react' +import React, { useState, useEffect } from 'react' import { Form as UswdsForm, ButtonGroup } from '@trussworks/react-uswds' import { Formik, FormikErrors } from 'formik' import { FieldTextInput } from '../../components/Form' import { MccrsIdFormSchema } from './MccrsIdSchema' import { recordJSException } from '../../otelHelpers/tracingHelper' -import { useNavigate, useParams } from 'react-router-dom' +import { useNavigate, useParams, useOutletContext } from 'react-router-dom' import { GenericApiErrorBanner } from '../../components/Banner/GenericApiErrorBanner/GenericApiErrorBanner' import { ActionButton } from '../../components/ActionButton' +import { usePage } from '../../contexts/PageContext' +import { SideNavOutletContextType } from '../SubmissionSideNav/SubmissionSideNav' + import { HealthPlanPackage, useUpdateContractMutation, @@ -26,19 +29,41 @@ type RouteParams = { export const MccrsId = (): React.ReactElement => { const [shouldValidate, setShouldValidate] = React.useState(true) const { id } = useParams() + if (!id) { + throw new Error( + 'PROGRAMMING ERROR: id param not set in state submission form.' + ) + } const navigate = useNavigate() + const { packageName } = + useOutletContext() + // page context + const { updateHeading } = usePage() + + const customHeading = ( + { + packageName} + MC-CRS record number + + ) + useEffect(() => { + updateHeading({ customHeading }) + }, [customHeading, updateHeading]) + + const [showPageErrorMessage, setShowPageErrorMessage] = useState< + boolean | string + >(false) // string is a custom error message, defaults to generic of true + + const [updateFormData] = useUpdateContractMutation() + const mccrsIDInitialValues: MccrsIdFormValues = { mccrsId: undefined, } const showFieldErrors = (error?: FormError) => shouldValidate && Boolean(error) - const [showPageErrorMessage, setShowPageErrorMessage] = useState< - boolean | string - >(false) // string is a custom error message, defaults to generic of true - - const [updateFormData] = useUpdateContractMutation() + const handleFormSubmit = async ( values: MccrsIdFormValues ): Promise => { @@ -48,7 +73,7 @@ export const MccrsId = (): React.ReactElement => { variables: { input: { mccrsID: values?.mccrsId?.toString(), - id: id || '', + id: id, }, }, }) diff --git a/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts b/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts index d7960146a1..b40077f33a 100644 --- a/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts +++ b/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts @@ -7,7 +7,7 @@ export const MccrsIdFormSchema = () => { 'You must enter a record number or delete this field.' ) .typeError('You must enter a number') - .test('len', 'You must enter no more than [4] characters', val => val?.toString().length === 4) + .test('len', 'You must enter no more than 4 characters', val => val?.toString().length === 4) , }) } From 43e4c36162cc85245f90347c9c7eecff16e6e5e8 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Mon, 23 Oct 2023 14:33:02 -0400 Subject: [PATCH 12/28] update useEffect code for setting the header --- .../app-web/src/pages/MccrsId/MccrsId.tsx | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index c4a1a0bfe1..3a32abede9 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -35,35 +35,34 @@ export const MccrsId = (): React.ReactElement => { ) } const navigate = useNavigate() - const { packageName } = - useOutletContext() + const { packageName } = useOutletContext() // page context const { updateHeading } = usePage() - const customHeading = ( - { - packageName} - MC-CRS record number - - ) useEffect(() => { + const customHeading = ( + + {packageName} + MC-CRS record number + + ) updateHeading({ customHeading }) - }, [customHeading, updateHeading]) + }, [packageName, updateHeading]) const [showPageErrorMessage, setShowPageErrorMessage] = useState< - boolean | string + boolean | string >(false) // string is a custom error message, defaults to generic of true const [updateFormData] = useUpdateContractMutation() - + const mccrsIDInitialValues: MccrsIdFormValues = { mccrsId: undefined, } const showFieldErrors = (error?: FormError) => shouldValidate && Boolean(error) - + const handleFormSubmit = async ( values: MccrsIdFormValues ): Promise => { From a5087ca5a9c84b6c746a4619eed772c35c67b602 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Mon, 23 Oct 2023 15:49:35 -0400 Subject: [PATCH 13/28] fix existing unit test --- .../src/pages/MccrsId/MccrsId.test.tsx | 231 ++++++++++++++---- .../app-web/src/pages/MccrsId/MccrsId.tsx | 10 +- 2 files changed, 183 insertions(+), 58 deletions(-) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx index d3c62384f2..2c1659bd88 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx @@ -1,6 +1,13 @@ import { screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' - +import { Route, Routes } from 'react-router' +import { SubmissionSideNav } from '../SubmissionSideNav' +import { RoutesRecord } from '../../constants/routes' +import { + fetchCurrentUserMock, + fetchStateHealthPlanPackageWithQuestionsMockSuccess, + mockValidCMSUser, +} from '../../testHelpers/apolloMocks' import { ldUseClientSpy, renderWithProviders, @@ -16,11 +23,32 @@ describe('MCCRSID', () => { }) it('renders without errors', async () => { - renderWithProviders(, { - routerProvider: { - route: '/submissions/15/MCCRS-record-number', - }, - }) + renderWithProviders( + + }> + } + /> + + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + user: mockValidCMSUser(), + statusCode: 200, + }), + fetchStateHealthPlanPackageWithQuestionsMockSuccess({ + id: '15', + }), + ], + }, + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + } + ) expect( await screen.findByRole('heading', { name: 'MC-CRS record number' }) @@ -31,22 +59,64 @@ describe('MCCRSID', () => { }) it('displays the text field for mccrs id', async () => { - renderWithProviders(, { - routerProvider: { - route: '/submissions/15/MCCRS-record-number', - }, - }) + renderWithProviders( + + }> + } + /> + + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + user: mockValidCMSUser(), + statusCode: 200, + }), + fetchStateHealthPlanPackageWithQuestionsMockSuccess({ + id: '15', + }), + ], + }, + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + } + ) - expect(screen.getByTestId('textInput')).toBeInTheDocument() + expect(await screen.findByTestId('textInput')).toBeInTheDocument() }) it('cannot continue without providing a MCCRS ID', async () => { - renderWithProviders(, { - routerProvider: { - route: '/submissions/15/MCCRS-record-number', - }, - }) - const continueButton = screen.getByRole('button', { + renderWithProviders( + + }> + } + /> + + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + user: mockValidCMSUser(), + statusCode: 200, + }), + fetchStateHealthPlanPackageWithQuestionsMockSuccess({ + id: '15', + }), + ], + }, + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + } + ) + const continueButton = await screen.findByRole('button', { name: 'Save MC-CRS number', }) continueButton.click() @@ -61,17 +131,36 @@ describe('MCCRSID', () => { }) it('cannot continue with MCCRS ID less than 4 digits', async () => { - renderWithProviders(, { - routerProvider: { - route: '/submissions/15/MCCRS-record-number', - }, - }) + renderWithProviders( + + }> + } + /> + + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + user: mockValidCMSUser(), + statusCode: 200, + }), + fetchStateHealthPlanPackageWithQuestionsMockSuccess({ + id: '15', + }), + ], + }, + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + } + ) + + const input = await screen.findByTestId('textInput') + input.focus() - screen - .getByLabelText( - 'Enter the Managed Care Contract and Rate Review System (MC-CRS) record number.' - ) - .focus() await userEvent.paste('123') const continueButton = screen.getByRole('button', { name: 'Save MC-CRS number', @@ -79,26 +168,43 @@ describe('MCCRSID', () => { continueButton.click() await waitFor(() => { expect( - screen.getAllByText( - 'You must enter no more than 4 characters' - ) + screen.getAllByText('You must enter no more than 4 characters') ).toHaveLength(1) expect(continueButton).toHaveAttribute('aria-disabled', 'true') }) }) it('cannot continue with MCCRS ID more than 4 digits', async () => { - renderWithProviders(, { - routerProvider: { - route: '/submissions/15/MCCRS-record-number', - }, - }) + renderWithProviders( + + }> + } + /> + + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + user: mockValidCMSUser(), + statusCode: 200, + }), + fetchStateHealthPlanPackageWithQuestionsMockSuccess({ + id: '15', + }), + ], + }, + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + } + ) + + const input = await screen.findByTestId('textInput') + input.focus() - screen - .getByLabelText( - 'Enter the Managed Care Contract and Rate Review System (MC-CRS) record number.' - ) - .focus() await userEvent.paste('12345') const continueButton = screen.getByRole('button', { name: 'Save MC-CRS number', @@ -106,26 +212,43 @@ describe('MCCRSID', () => { continueButton.click() await waitFor(() => { expect( - screen.getAllByText( - 'You must enter no more than 4 characters' - ) + screen.getAllByText('You must enter no more than 4 characters') ).toHaveLength(1) expect(continueButton).toHaveAttribute('aria-disabled', 'true') }) }) it('cannot continue with MCCRS ID with non number input', async () => { - renderWithProviders(, { - routerProvider: { - route: '/submissions/15/MCCRS-record-number', - }, - }) + renderWithProviders( + + }> + } + /> + + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + user: mockValidCMSUser(), + statusCode: 200, + }), + fetchStateHealthPlanPackageWithQuestionsMockSuccess({ + id: '15', + }), + ], + }, + routerProvider: { + route: '/submissions/15/MCCRS-record-number', + }, + } + ) + + const input = await screen.findByTestId('textInput') + input.focus() - screen - .getByLabelText( - 'Enter the Managed Care Contract and Rate Review System (MC-CRS) record number.' - ) - .focus() await userEvent.paste('123a') const continueButton = screen.getByRole('button', { name: 'Save MC-CRS number', diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index 3a32abede9..728dcf5a8d 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect, useMemo } from 'react' import { Form as UswdsForm, ButtonGroup } from '@trussworks/react-uswds' import { Formik, FormikErrors } from 'formik' import { FieldTextInput } from '../../components/Form' @@ -40,15 +40,17 @@ export const MccrsId = (): React.ReactElement => { // page context const { updateHeading } = usePage() - useEffect(() => { - const customHeading = ( + const customHeading = useMemo(() => { + return ( {packageName} MC-CRS record number ) + }, [packageName]) + useEffect(() => { updateHeading({ customHeading }) - }, [packageName, updateHeading]) + }, [customHeading, updateHeading]) const [showPageErrorMessage, setShowPageErrorMessage] = useState< boolean | string From 1cb5d8d2228b3eb8e60611f3a87f62e0928800ef Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Mon, 23 Oct 2023 15:57:02 -0400 Subject: [PATCH 14/28] PR fixes --- services/app-web/src/constants/routes.ts | 2 +- services/app-web/src/pages/MccrsId/MccrsId.test.tsx | 12 ++++++------ services/app-web/src/pages/MccrsId/MccrsId.tsx | 9 ++------- .../pages/SubmissionSummary/SubmissionSummary.tsx | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/services/app-web/src/constants/routes.ts b/services/app-web/src/constants/routes.ts index c839478c4b..b92105e250 100644 --- a/services/app-web/src/constants/routes.ts +++ b/services/app-web/src/constants/routes.ts @@ -59,7 +59,7 @@ const RoutesRecord: Record = { SUBMISSIONS_DOCUMENTS: '/submissions/:id/edit/documents', SUBMISSIONS_REVIEW_SUBMIT: '/submissions/:id/edit/review-and-submit', SUBMISSIONS_SUMMARY: '/submissions/:id', - SUBMISSIONS_MCCRSID: '/submissions/:id/MCCRS-record-number', + SUBMISSIONS_MCCRSID: '/submissions/:id/mccrs-record-number', SUBMISSIONS_REVISION: '/submissions/:id/revisions/:revisionVersion', SUBMISSIONS_QUESTIONS_AND_ANSWERS: '/submissions/:id/question-and-answers', SUBMISSIONS_UPLOAD_QUESTION: diff --git a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx index 2c1659bd88..2bcbc44943 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx @@ -45,7 +45,7 @@ describe('MCCRSID', () => { ], }, routerProvider: { - route: '/submissions/15/MCCRS-record-number', + route: '/submissions/15/mccrs-record-number', }, } ) @@ -81,7 +81,7 @@ describe('MCCRSID', () => { ], }, routerProvider: { - route: '/submissions/15/MCCRS-record-number', + route: '/submissions/15/mccrs-record-number', }, } ) @@ -112,7 +112,7 @@ describe('MCCRSID', () => { ], }, routerProvider: { - route: '/submissions/15/MCCRS-record-number', + route: '/submissions/15/mccrs-record-number', }, } ) @@ -153,7 +153,7 @@ describe('MCCRSID', () => { ], }, routerProvider: { - route: '/submissions/15/MCCRS-record-number', + route: '/submissions/15/mccrs-record-number', }, } ) @@ -197,7 +197,7 @@ describe('MCCRSID', () => { ], }, routerProvider: { - route: '/submissions/15/MCCRS-record-number', + route: '/submissions/15/mccrs-record-number', }, } ) @@ -241,7 +241,7 @@ describe('MCCRSID', () => { ], }, routerProvider: { - route: '/submissions/15/MCCRS-record-number', + route: '/submissions/15/mccrs-record-number', }, } ) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index 728dcf5a8d..9a334d9895 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -65,9 +65,7 @@ export const MccrsId = (): React.ReactElement => { const showFieldErrors = (error?: FormError) => shouldValidate && Boolean(error) - const handleFormSubmit = async ( - values: MccrsIdFormValues - ): Promise => { + const handleFormSubmit = async (values: MccrsIdFormValues) => { setShowPageErrorMessage(false) try { const updateResult = await updateFormData({ @@ -90,11 +88,8 @@ export const MccrsId = (): React.ReactElement => { `MCCRSIDForm: Apollo error reported. Error message: Failed to update form data ${updateResult}` ) return new Error('Failed to update form data') - } else if (updatedSubmission) { - navigate(`/submissions/${updatedSubmission.id}`) - return updatedSubmission } - return updatedSubmission + navigate(`/submissions/${updatedSubmission.id}`) } catch (serverError) { setShowPageErrorMessage(true) recordJSException( diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index 10ed9287c6..8f3142b773 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -168,7 +168,7 @@ export const SubmissionSummary = (): React.ReactElement => { MC-CRS record number: {pkg.mccrsID} From 612194208091e27ee77417e2ed44aa7d94eaec2b Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Mon, 23 Oct 2023 15:59:38 -0400 Subject: [PATCH 15/28] add link change for mccrs website --- .../app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index 8f3142b773..1074925c84 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -175,7 +175,7 @@ export const SubmissionSummary = (): React.ReactElement => { )} Date: Mon, 23 Oct 2023 16:21:18 -0400 Subject: [PATCH 16/28] add feature flag --- .../src/common-code/featureFlags/flags.ts | 7 +++++++ services/app-web/src/pages/App/AppRoutes.tsx | 16 ++++++++++++---- .../app-web/src/pages/MccrsId/MccrsId.test.tsx | 2 +- .../SubmissionSummary/SubmissionSummary.test.tsx | 1 + .../SubmissionSummary/SubmissionSummary.tsx | 7 ++++++- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/services/app-web/src/common-code/featureFlags/flags.ts b/services/app-web/src/common-code/featureFlags/flags.ts index b25c088eda..c1cf4c2269 100644 --- a/services/app-web/src/common-code/featureFlags/flags.ts +++ b/services/app-web/src/common-code/featureFlags/flags.ts @@ -41,6 +41,13 @@ const featureFlags = { flag: 'cms-questions', defaultValue: false, }, + /** + * Enables CMS to add, view, edit and delete MC-CRS record numbers + */ + MCCRS_RECORD_NUMBER: { + flag: 'mccrs-record-number', + defaultValue: false, + }, /** * Enables packages with shared rates dropdown on rate details page. This was an early version of rates across subs functionality. */ diff --git a/services/app-web/src/pages/App/AppRoutes.tsx b/services/app-web/src/pages/App/AppRoutes.tsx index d40c96433e..11d96f5ed0 100644 --- a/services/app-web/src/pages/App/AppRoutes.tsx +++ b/services/app-web/src/pages/App/AppRoutes.tsx @@ -159,6 +159,12 @@ const CMSUserRoutes = ({ featureFlags.RATE_REVIEWS_DASHBOARD.flag, featureFlags.RATE_REVIEWS_DASHBOARD.defaultValue ) + + const showMCCRSRecordNumber = ldClient?.variation( + featureFlags.MCCRS_RECORD_NUMBER.flag, + featureFlags.MCCRS_RECORD_NUMBER.defaultValue + ) + return ( @@ -206,10 +212,12 @@ const CMSUserRoutes = ({ path={RoutesRecord.SUBMISSIONS_SUMMARY} element={} /> - } - /> + {showMCCRSRecordNumber && ( + } + /> + )} { beforeEach(() => { - ldUseClientSpy({ 'cms-questions': false }) + ldUseClientSpy({ 'mccrs-record-number': true }) }) afterEach(() => { jest.resetAllMocks() diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx index ffc0d84e57..b4aea29d6a 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx @@ -27,6 +27,7 @@ import { testS3Client } from '../../testHelpers/s3Helpers' describe('SubmissionSummary', () => { beforeEach(() => { ldUseClientSpy({ 'cms-questions': false }) + ldUseClientSpy({ 'mccrs-record-number': true }) }) afterEach(() => { jest.resetAllMocks() diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index 1074925c84..e89c331079 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -68,6 +68,11 @@ export const SubmissionSummary = (): React.ReactElement => { featureFlags.CMS_QUESTIONS.defaultValue ) + const showMCCRSRecordNumber = ldClient?.variation( + featureFlags.MCCRS_RECORD_NUMBER.flag, + featureFlags.MCCRS_RECORD_NUMBER.defaultValue + ) + const { pkg, currentRevision, packageData, user, documentDates } = useOutletContext() @@ -162,7 +167,7 @@ export const SubmissionSummary = (): React.ReactElement => { {pkg.mccrsID && ( From 0f5fa3d103af329677a28dac774b4343a7cc6bef Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Tue, 24 Oct 2023 09:29:51 -0400 Subject: [PATCH 17/28] cypress re-run --- services/app-web/src/common-code/featureFlags/flags.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/app-web/src/common-code/featureFlags/flags.ts b/services/app-web/src/common-code/featureFlags/flags.ts index c1cf4c2269..2e3ac295e9 100644 --- a/services/app-web/src/common-code/featureFlags/flags.ts +++ b/services/app-web/src/common-code/featureFlags/flags.ts @@ -42,7 +42,7 @@ const featureFlags = { defaultValue: false, }, /** - * Enables CMS to add, view, edit and delete MC-CRS record numbers + * Enables CMS users to add, view, edit and delete MC-CRS record numbers */ MCCRS_RECORD_NUMBER: { flag: 'mccrs-record-number', From 5e563eb2dfd5beec160d960a58d824bc6f0d61c6 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Tue, 24 Oct 2023 11:01:03 -0400 Subject: [PATCH 18/28] cypress re-run From df44654103782d9529f4856885734ef293ee953b Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Tue, 24 Oct 2023 11:50:15 -0400 Subject: [PATCH 19/28] remove character limit on mcccrs id field --- .../src/pages/MccrsId/MccrsId.test.tsx | 88 ------------------- .../src/pages/MccrsId/MccrsIdSchema.ts | 10 +-- 2 files changed, 3 insertions(+), 95 deletions(-) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx index 5dd339d2c3..a072d6ba67 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.test.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.test.tsx @@ -130,94 +130,6 @@ describe('MCCRSID', () => { }) }) - it('cannot continue with MCCRS ID less than 4 digits', async () => { - renderWithProviders( - - }> - } - /> - - , - { - apolloProvider: { - mocks: [ - fetchCurrentUserMock({ - user: mockValidCMSUser(), - statusCode: 200, - }), - fetchStateHealthPlanPackageWithQuestionsMockSuccess({ - id: '15', - }), - ], - }, - routerProvider: { - route: '/submissions/15/mccrs-record-number', - }, - } - ) - - const input = await screen.findByTestId('textInput') - input.focus() - - await userEvent.paste('123') - const continueButton = screen.getByRole('button', { - name: 'Save MC-CRS number', - }) - continueButton.click() - await waitFor(() => { - expect( - screen.getAllByText('You must enter no more than 4 characters') - ).toHaveLength(1) - expect(continueButton).toHaveAttribute('aria-disabled', 'true') - }) - }) - - it('cannot continue with MCCRS ID more than 4 digits', async () => { - renderWithProviders( - - }> - } - /> - - , - { - apolloProvider: { - mocks: [ - fetchCurrentUserMock({ - user: mockValidCMSUser(), - statusCode: 200, - }), - fetchStateHealthPlanPackageWithQuestionsMockSuccess({ - id: '15', - }), - ], - }, - routerProvider: { - route: '/submissions/15/mccrs-record-number', - }, - } - ) - - const input = await screen.findByTestId('textInput') - input.focus() - - await userEvent.paste('12345') - const continueButton = screen.getByRole('button', { - name: 'Save MC-CRS number', - }) - continueButton.click() - await waitFor(() => { - expect( - screen.getAllByText('You must enter no more than 4 characters') - ).toHaveLength(1) - expect(continueButton).toHaveAttribute('aria-disabled', 'true') - }) - }) - it('cannot continue with MCCRS ID with non number input', async () => { renderWithProviders( diff --git a/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts b/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts index b40077f33a..d757bb7bfa 100644 --- a/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts +++ b/services/app-web/src/pages/MccrsId/MccrsIdSchema.ts @@ -1,13 +1,9 @@ import * as Yup from 'yup' export const MccrsIdFormSchema = () => { - return Yup.object().shape({ - mccrsId: Yup.number().required( - 'You must enter a record number or delete this field.' - ) - .typeError('You must enter a number') - .test('len', 'You must enter no more than 4 characters', val => val?.toString().length === 4) - , + mccrsId: Yup.number() + .required('You must enter a record number or delete this field.') + .typeError('You must enter a number'), }) } From a44304fca30030656d3c96bbaa86ba3839953617 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Tue, 24 Oct 2023 13:03:59 -0400 Subject: [PATCH 20/28] cypress re-run From 31d7bff87df8cb0cb311a3f174256b3d05f4ff95 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Tue, 24 Oct 2023 20:11:51 -0400 Subject: [PATCH 21/28] trim possible whitespace --- .../src/pages/SubmissionSummary/SubmissionSummary.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index e89c331079..4400423fb1 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -173,7 +173,10 @@ export const SubmissionSummary = (): React.ReactElement => { MC-CRS record number: {pkg.mccrsID} From df1245a5d6db8a4e3d037964311e2e1a443eb4d1 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 25 Oct 2023 09:58:40 -0400 Subject: [PATCH 22/28] cypress re-run --- .../src/components/SectionHeader/SectionHeader.module.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/app-web/src/components/SectionHeader/SectionHeader.module.scss b/services/app-web/src/components/SectionHeader/SectionHeader.module.scss index ba53041d02..d566e49b51 100644 --- a/services/app-web/src/components/SectionHeader/SectionHeader.module.scss +++ b/services/app-web/src/components/SectionHeader/SectionHeader.module.scss @@ -21,7 +21,7 @@ display: block; margin-top: 17.5px; padding-bottom: units(1); - } + } } .summarySectionHeaderBorder { From a787975747f70b53b3ce7ce341ef48ab34c9c5a4 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 25 Oct 2023 10:37:23 -0400 Subject: [PATCH 23/28] cypress re-run From 6bace5ecf57839aa9d3ce0c2b57da50b23a9b538 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 25 Oct 2023 11:11:15 -0400 Subject: [PATCH 24/28] rerun all jobs From 099ef619a2775b3a0ae6e25cce49450f748356c2 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 25 Oct 2023 12:52:02 -0400 Subject: [PATCH 25/28] hide delete button --- services/app-web/src/pages/MccrsId/MccrsId.module.scss | 1 + services/app-web/src/pages/MccrsId/MccrsId.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.module.scss b/services/app-web/src/pages/MccrsId/MccrsId.module.scss index 28873fa105..6ded9a82f2 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.module.scss +++ b/services/app-web/src/pages/MccrsId/MccrsId.module.scss @@ -88,6 +88,7 @@ ul[class^='usa-button-group'] { } &:first-of-type { button[class^='usa-button'] { + display: none; color: $theme-color-error-darker; box-shadow: inset 0 0 0 2px $theme-color-error-darker; } diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index 9a334d9895..0637233ee2 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -35,7 +35,7 @@ export const MccrsId = (): React.ReactElement => { ) } const navigate = useNavigate() - const { packageName } = useOutletContext() + const { pkg, packageName } = useOutletContext() // page context const { updateHeading } = usePage() @@ -59,7 +59,7 @@ export const MccrsId = (): React.ReactElement => { const [updateFormData] = useUpdateContractMutation() const mccrsIDInitialValues: MccrsIdFormValues = { - mccrsId: undefined, + mccrsId: pkg.mccrsID ? Number(pkg.mccrsID) : undefined, } const showFieldErrors = (error?: FormError) => @@ -127,8 +127,8 @@ export const MccrsId = (): React.ReactElement => { Add MC-CRS record number Date: Wed, 25 Oct 2023 12:52:59 -0400 Subject: [PATCH 26/28] hide delete button --- services/app-web/src/pages/MccrsId/MccrsId.module.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.module.scss b/services/app-web/src/pages/MccrsId/MccrsId.module.scss index 6ded9a82f2..0bcd3974df 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.module.scss +++ b/services/app-web/src/pages/MccrsId/MccrsId.module.scss @@ -89,6 +89,7 @@ ul[class^='usa-button-group'] { &:first-of-type { button[class^='usa-button'] { display: none; + visibility: hidden; color: $theme-color-error-darker; box-shadow: inset 0 0 0 2px $theme-color-error-darker; } From 7130786c4f2285bef61c685debb598bee203bfb9 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 25 Oct 2023 13:33:44 -0400 Subject: [PATCH 27/28] remove mccrs-record-number flag, delete button and blank entry validation --- .../src/common-code/featureFlags/flags.ts | 7 --- services/app-web/src/pages/App/AppRoutes.tsx | 9 +--- .../src/pages/MccrsId/MccrsId.module.scss | 12 +---- .../src/pages/MccrsId/MccrsId.test.tsx | 49 +------------------ .../app-web/src/pages/MccrsId/MccrsId.tsx | 10 ---- .../src/pages/MccrsId/MccrsIdSchema.ts | 4 +- .../SubmissionSummary.test.tsx | 1 - .../SubmissionSummary/SubmissionSummary.tsx | 7 +-- 8 files changed, 6 insertions(+), 93 deletions(-) diff --git a/services/app-web/src/common-code/featureFlags/flags.ts b/services/app-web/src/common-code/featureFlags/flags.ts index 2e3ac295e9..b25c088eda 100644 --- a/services/app-web/src/common-code/featureFlags/flags.ts +++ b/services/app-web/src/common-code/featureFlags/flags.ts @@ -41,13 +41,6 @@ const featureFlags = { flag: 'cms-questions', defaultValue: false, }, - /** - * Enables CMS users to add, view, edit and delete MC-CRS record numbers - */ - MCCRS_RECORD_NUMBER: { - flag: 'mccrs-record-number', - defaultValue: false, - }, /** * Enables packages with shared rates dropdown on rate details page. This was an early version of rates across subs functionality. */ diff --git a/services/app-web/src/pages/App/AppRoutes.tsx b/services/app-web/src/pages/App/AppRoutes.tsx index 11d96f5ed0..9d9186ddb0 100644 --- a/services/app-web/src/pages/App/AppRoutes.tsx +++ b/services/app-web/src/pages/App/AppRoutes.tsx @@ -160,11 +160,6 @@ const CMSUserRoutes = ({ featureFlags.RATE_REVIEWS_DASHBOARD.defaultValue ) - const showMCCRSRecordNumber = ldClient?.variation( - featureFlags.MCCRS_RECORD_NUMBER.flag, - featureFlags.MCCRS_RECORD_NUMBER.defaultValue - ) - return ( @@ -212,12 +207,12 @@ const CMSUserRoutes = ({ path={RoutesRecord.SUBMISSIONS_SUMMARY} element={} /> - {showMCCRSRecordNumber && ( + { } /> - )} + } { - beforeEach(() => { - ldUseClientSpy({ 'mccrs-record-number': true }) - }) afterEach(() => { jest.resetAllMocks() }) @@ -89,47 +83,6 @@ describe('MCCRSID', () => { expect(await screen.findByTestId('textInput')).toBeInTheDocument() }) - it('cannot continue without providing a MCCRS ID', async () => { - renderWithProviders( - - }> - } - /> - - , - { - apolloProvider: { - mocks: [ - fetchCurrentUserMock({ - user: mockValidCMSUser(), - statusCode: 200, - }), - fetchStateHealthPlanPackageWithQuestionsMockSuccess({ - id: '15', - }), - ], - }, - routerProvider: { - route: '/submissions/15/mccrs-record-number', - }, - } - ) - const continueButton = await screen.findByRole('button', { - name: 'Save MC-CRS number', - }) - continueButton.click() - await waitFor(() => { - expect( - screen.getAllByText( - 'You must enter a record number or delete this field.' - ) - ).toHaveLength(1) - expect(continueButton).toHaveAttribute('aria-disabled', 'true') - }) - }) - it('cannot continue with MCCRS ID with non number input', async () => { renderWithProviders( diff --git a/services/app-web/src/pages/MccrsId/MccrsId.tsx b/services/app-web/src/pages/MccrsId/MccrsId.tsx index 0637233ee2..167ae92bfc 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.tsx +++ b/services/app-web/src/pages/MccrsId/MccrsId.tsx @@ -144,16 +144,6 @@ export const MccrsId = (): React.ReactElement => { /> - console.info('delete')} - > - Delete Number - - { return Yup.object().shape({ - mccrsId: Yup.number() - .required('You must enter a record number or delete this field.') - .typeError('You must enter a number'), + mccrsId: Yup.number().typeError('You must enter a number'), }) } diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx index b4aea29d6a..ffc0d84e57 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx @@ -27,7 +27,6 @@ import { testS3Client } from '../../testHelpers/s3Helpers' describe('SubmissionSummary', () => { beforeEach(() => { ldUseClientSpy({ 'cms-questions': false }) - ldUseClientSpy({ 'mccrs-record-number': true }) }) afterEach(() => { jest.resetAllMocks() diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx index 4400423fb1..21fed8f71c 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.tsx @@ -68,11 +68,6 @@ export const SubmissionSummary = (): React.ReactElement => { featureFlags.CMS_QUESTIONS.defaultValue ) - const showMCCRSRecordNumber = ldClient?.variation( - featureFlags.MCCRS_RECORD_NUMBER.flag, - featureFlags.MCCRS_RECORD_NUMBER.defaultValue - ) - const { pkg, currentRevision, packageData, user, documentDates } = useOutletContext() @@ -167,7 +162,7 @@ export const SubmissionSummary = (): React.ReactElement => { {pkg.mccrsID && ( From 40b30d6a78d84d02193d3ac1af7387a67a098e17 Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Wed, 25 Oct 2023 14:30:35 -0400 Subject: [PATCH 28/28] cypress re-run --- services/app-web/src/pages/MccrsId/MccrsId.module.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/app-web/src/pages/MccrsId/MccrsId.module.scss b/services/app-web/src/pages/MccrsId/MccrsId.module.scss index 2c0ba4ed02..ca8f126406 100644 --- a/services/app-web/src/pages/MccrsId/MccrsId.module.scss +++ b/services/app-web/src/pages/MccrsId/MccrsId.module.scss @@ -87,6 +87,6 @@ ul[class^='usa-button-group'] { margin-bottom: 44px; margin-right: .25rem; } - } + } }