From 225f84ec7bd3cf3928c7d508630f1caaa2ba6cce Mon Sep 17 00:00:00 2001 From: eirikhaugstulen Date: Sat, 4 Nov 2023 16:34:50 +0100 Subject: [PATCH] feat: do not link --- i18n/en.pot | 11 ++++++-- .../getConvertedReferralEvent.js | 7 ++++- .../ReferralActions.component.js | 28 +++++++++++++++---- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/i18n/en.pot b/i18n/en.pot index d1ec09475c..74ecde71da 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2023-11-04T14:23:15.511Z\n" -"PO-Revision-Date: 2023-11-04T14:23:15.511Z\n" +"POT-Creation-Date: 2023-11-04T15:34:51.698Z\n" +"PO-Revision-Date: 2023-11-04T15:34:51.698Z\n" msgid "Choose one or more dates..." msgstr "Choose one or more dates..." @@ -1348,6 +1348,13 @@ msgstr "" "Enter {{referralProgramStageLabel}} details in the next step after " "completing this {{currentStageLabel}}." +msgid "" +"This {{currentStageLabel}} will be created without a link to " +"{{referralProgramStageLabel}}" +msgstr "" +"This {{currentStageLabel}} will be created without a link to " +"{{referralProgramStageLabel}}" + msgid "Schedule in {{displayName}}" msgstr "Schedule in {{displayName}}" diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/getConvertedReferralEvent/getConvertedReferralEvent.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/getConvertedReferralEvent/getConvertedReferralEvent.js index 83db6c2a0d..bfda035097 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/getConvertedReferralEvent/getConvertedReferralEvent.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/getConvertedReferralEvent/getConvertedReferralEvent.js @@ -53,6 +53,11 @@ const getEventDetailsByReferralMode = ({ referralEvent: null, linkedEventId, }; + } else if (referralMode === ReferralModes.DO_NOT_LINK_RESPONSE) { + return { + referralEvent: null, + linkedEventId: null, + }; } log.error(errorCreator(`Referral mode ${referralMode} is not supported`)()); @@ -85,7 +90,7 @@ export const getConvertedReferralEvent = ({ clientRequestEvent, }); - const relationship = { + const relationship = linkedEventId && { relationshipType: referralType.id, from: { event: { diff --git a/src/core_modules/capture-core/components/WidgetReferral/ReferralActions/ReferralActions.component.js b/src/core_modules/capture-core/components/WidgetReferral/ReferralActions/ReferralActions.component.js index 0082f54326..5f5e08b4e9 100644 --- a/src/core_modules/capture-core/components/WidgetReferral/ReferralActions/ReferralActions.component.js +++ b/src/core_modules/capture-core/components/WidgetReferral/ReferralActions/ReferralActions.component.js @@ -1,7 +1,7 @@ // @flow import React, { type ComponentType, useMemo } from 'react'; import i18n from '@dhis2/d2-i18n'; -import { Radio, colors, spacers, spacersNum, IconInfo16 } from '@dhis2/ui'; +import { Radio, colors, spacers, spacersNum, IconInfo16, IconWarning16 } from '@dhis2/ui'; import { withStyles } from '@material-ui/core'; import { actions as ReferralActionTypes, mainOptionTranslatedTexts, referralStatus } from '../constants'; import { DataSection } from '../../DataSection'; @@ -106,10 +106,13 @@ export const ReferralActionsPlain = ({ className={classes.infoBox} > - {i18n.t('Enter {{referralProgramStageLabel}} details in the next step after completing this {{currentStageLabel}}.', { - referralProgramStageLabel: programStage.stageForm.name, - currentStageLabel, - })} + {i18n.t( + 'Enter {{referralProgramStageLabel}} details in the next step after completing this {{currentStageLabel}}.', + { + referralProgramStageLabel: programStage.stageForm.name, + currentStageLabel, + }, + )} )} @@ -122,6 +125,21 @@ export const ReferralActionsPlain = ({ {...passOnProps} /> )} + + {selectedAction === ReferralActionTypes.DO_NOT_LINK_RESPONSE && ( +
+ + {i18n.t( + 'This {{currentStageLabel}} will be created without a link to {{referralProgramStageLabel}}', + { + referralProgramStageLabel: programStage.stageForm.name, + currentStageLabel, + }, + )} +
+ )} ); };