diff --git a/cypress/integration/EnrollmentPage/HiddenProgramStage.feature b/cypress/integration/EnrollmentPage/HiddenProgramStage.feature index 4e6e427e3e..e13095474a 100644 --- a/cypress/integration/EnrollmentPage/HiddenProgramStage.feature +++ b/cypress/integration/EnrollmentPage/HiddenProgramStage.feature @@ -3,5 +3,4 @@ Feature: Hidden program stage Scenario: The user cannot add an event in a hidden program stage Given you add an enrollment event that will result in a rule effect to hide a program stage Then the New Postpartum care visit event button is disabled in the stages and events widget - And and an error is show in the Postpartum care visit stage And the Postpartum care visit button is disabled in the enrollmentEventNew page diff --git a/cypress/integration/EnrollmentPage/HiddenProgramStage/index.js b/cypress/integration/EnrollmentPage/HiddenProgramStage/index.js index edf6b833bd..f9e5cf69c2 100644 --- a/cypress/integration/EnrollmentPage/HiddenProgramStage/index.js +++ b/cypress/integration/EnrollmentPage/HiddenProgramStage/index.js @@ -45,18 +45,6 @@ Then('the New Postpartum care visit event button is disabled in the stages and e .should('be.disabled'); }); -Then('and an error is show in the Postpartum care visit stage', () => { - cy.visit( - '/#/enrollmentEventNew?enrollmentId=fmhIsWXVDmS&orgUnitId=s7SLtx8wmRA&programId=WSGAb5XwJ3Y&teiId=uW8Y7AIcRKA&stageId=bbKtnxRZKEP', - ); - cy.contains('[data-test="dhis2-uicore-button"]', 'Complete') - .should('be.disabled'); - cy.contains('[data-test="dhis2-uicore-button"]', 'Save without completing') - .should('be.disabled'); - cy.contains('[data-test="dhis2-uicore-noticebox-content"]', 'You can\'t add any more Postpartum care visit events') - .should('exist'); -}); - Then('the Postpartum care visit button is disabled in the enrollmentEventNew page', () => { cy.visit( '/#/enrollmentEventNew?enrollmentId=fmhIsWXVDmS&orgUnitId=s7SLtx8wmRA&programId=WSGAb5XwJ3Y&teiId=uW8Y7AIcRKA', diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/ErrorText/ErrorText.component.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/ErrorText/ErrorText.component.js deleted file mode 100644 index a885a48a6d..0000000000 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/ErrorText/ErrorText.component.js +++ /dev/null @@ -1,20 +0,0 @@ -// @flow -import React from 'react'; -import i18n from '@dhis2/d2-i18n'; -import { NoticeBox } from '@dhis2/ui'; -import type { Props } from './ErrorText.types'; - -export const ErrorText = ({ stageName }: Props) => ( - <> -
- - - {i18n.t("You can't add any more {{ programStageName }} events", { - programStageName: stageName, - interpolation: { escapeValue: false }, - })} - - -
- -); diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/ErrorText/ErrorText.types.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/ErrorText/ErrorText.types.js deleted file mode 100644 index 07785c7e1a..0000000000 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/ErrorText/ErrorText.types.js +++ /dev/null @@ -1,5 +0,0 @@ -// @flow - -export type Props = {| - stageName: string, -|}; diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/ErrorText/index.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/ErrorText/index.js deleted file mode 100644 index 2b26086840..0000000000 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/ErrorText/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// @flow -export { ErrorText } from './ErrorText.component'; diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/FinishButtons/FinishButtons.component.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/FinishButtons/FinishButtons.component.js index 1c0a36c1c8..465f807ace 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/FinishButtons/FinishButtons.component.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/FinishButtons/FinishButtons.component.js @@ -3,7 +3,6 @@ import React, { type ComponentType } from 'react'; import i18n from '@dhis2/d2-i18n'; import { withStyles } from '@material-ui/core'; import { Button, spacersNum } from '@dhis2/ui'; -import { ConditionalTooltip } from 'capture-core/components/ConditionalTooltip'; import { withCancelButton } from '../../DataEntry/withCancelButton'; import { addEventSaveTypes } from '../DataEntry/addEventSaveTypes'; import type { InputProps, Props } from './finishButtons.types'; @@ -18,40 +17,17 @@ const styles = { }, }; -const FinishButtonsPlain = ({ onSave, cancelButton, hiddenProgramStage, stageName, classes }: Props) => ( +const FinishButtonsPlain = ({ onSave, cancelButton, classes }: Props) => (
- - - +
- - - +
{cancelButton}
diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/FinishButtons/finishButtons.types.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/FinishButtons/finishButtons.types.js index 079708e30a..dd3acb8e32 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/FinishButtons/finishButtons.types.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/FinishButtons/finishButtons.types.js @@ -6,14 +6,10 @@ export type InputProps = {| onSave: (saveType: $Keys) => void, onCancel: () => void, id: string, - hiddenProgramStage: boolean, - stageName: string, |}; export type Props = {| onSave: (saveType: $Keys) => void, cancelButton: Element, - hiddenProgramStage: boolean, - stageName: string, ...CssClasses, |}; diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/Validated.component.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/Validated.component.js index 4f784d2b9a..4e3f2f96ef 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/Validated.component.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/Validated.component.js @@ -6,7 +6,6 @@ import { Widget } from '../../Widget'; import { DataEntry } from '../DataEntry'; import { FinishButtons } from '../FinishButtons'; import { SavingText } from '../SavingText'; -import { ErrorText } from '../ErrorText'; import type { Props } from './validated.types'; const styles = () => ({ @@ -24,7 +23,6 @@ const ValidatedPlain = ({ onSave, onCancel, orgUnit, - hiddenProgramStage, id, ...passOnProps }: Props) => ( @@ -48,14 +46,8 @@ const ValidatedPlain = ({ onSave={onSave} onCancel={onCancel} id={id} - hiddenProgramStage={hiddenProgramStage} - stageName={stage.name} /> - {hiddenProgramStage ? ( - - ) : ( - - )} + )} diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/Validated.container.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/Validated.container.js index c0245b477f..3d85e67cbf 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/Validated.container.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/Validated.container.js @@ -1,6 +1,6 @@ // @flow import React, { useCallback } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; +import { useDispatch } from 'react-redux'; import { withAskToCreateNew, withSaveHandler } from '../../DataEntry'; import { useLifecycle } from './useLifecycle'; import { useClientFormattedRulesExecutionDependencies } from './useClientFormattedRulesExecutionDependencies'; @@ -29,11 +29,6 @@ export const Validated = ({ }: ContainerProps) => { const dataEntryId = 'enrollmentEvent'; const itemId = 'newEvent'; - const rulesEffectsHiddenProgram = useSelector( - ({ rulesEffectsHiddenProgramStageDesc }) => - rulesEffectsHiddenProgramStageDesc && rulesEffectsHiddenProgramStageDesc[`${dataEntryId}-${itemId}`], - ); - const hiddenProgramStage = rulesEffectsHiddenProgram && rulesEffectsHiddenProgram[stage.id]; const rulesExecutionDependenciesClientFormatted = useClientFormattedRulesExecutionDependencies(rulesExecutionDependencies, program); @@ -132,7 +127,6 @@ export const Validated = ({ programName={program.name} orgUnit={orgUnit} rulesExecutionDependenciesClientFormatted={rulesExecutionDependenciesClientFormatted} - hiddenProgramStage={hiddenProgramStage} /> ); }; diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/validated.types.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/validated.types.js index 932e61a6d8..a5194d88af 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/validated.types.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/validated.types.js @@ -25,6 +25,5 @@ export type Props = {| formRef: (formInstance: any) => void, dataEntryFieldRef: (instance: any, id: string) => void, rulesExecutionDependenciesClientFormatted: RulesExecutionDependenciesClientFormatted, - hiddenProgramStage: boolean, ...CssClasses, |};