diff --git a/i18n/en.pot b/i18n/en.pot
index f5f3c016f4..7a83dc3b8a 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: 2024-11-21T13:57:21.323Z\n"
-"PO-Revision-Date: 2024-11-21T13:57:21.323Z\n"
+"POT-Creation-Date: 2024-12-05T10:53:07.214Z\n"
+"PO-Revision-Date: 2024-12-05T10:53:07.214Z\n"
msgid "Choose one or more dates..."
msgstr "Choose one or more dates..."
@@ -1534,6 +1534,16 @@ msgstr "You do not have access to remove the link and delete the linked event"
msgid "An error occurred while loading the widget."
msgstr "An error occurred while loading the widget."
+msgid "Linked event"
+msgstr "Linked event"
+
+msgid ""
+"This {{stageName}} event is linked to a {{linkedStageName}} event. Review "
+"the linked event details before entering data below"
+msgstr ""
+"This {{stageName}} event is linked to a {{linkedStageName}} event. Review "
+"the linked event details before entering data below"
+
msgid "Scheduled"
msgstr "Scheduled"
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetHeader/WidgetHeader.container.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetHeader/WidgetHeader.container.js
new file mode 100644
index 0000000000..cc52138727
--- /dev/null
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetHeader/WidgetHeader.container.js
@@ -0,0 +1,62 @@
+// @flow
+import React, { type ComponentType } from 'react';
+import { spacersNum } from '@dhis2/ui';
+import { withStyles } from '@material-ui/core/';
+import { EnrollmentPageKeys }
+ from '../../Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.constants';
+import { NonBundledDhis2Icon } from '../../NonBundledDhis2Icon';
+import type { PlainProps, Props } from './WidgetHeader.types';
+import { OverflowMenuComponent } from '../OverflowMenu';
+
+const styles = {
+ menu: {
+ marginLeft: 'auto',
+ },
+ icon: {
+ marginRight: spacersNum.dp8,
+ },
+};
+
+const WidgetHeaderPlain = ({
+ linkedStage,
+ linkedEvent,
+ orgUnitId,
+ currentPage,
+ relationship,
+ relationshipType,
+ stage,
+ eventId,
+ classes,
+}: Props) => {
+ const { icon } = linkedStage;
+ return (
+ <>
+ {icon && (
+
+
+
+ )}
+ {linkedStage.name}
+ {currentPage === EnrollmentPageKeys.VIEW_EVENT && (
+
+
+
+ )}
+ >
+ );
+};
+
+export const WidgetHeader: ComponentType = withStyles(styles)(WidgetHeaderPlain);
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetHeader/WidgetHeader.types.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetHeader/WidgetHeader.types.js
new file mode 100644
index 0000000000..383251fdbb
--- /dev/null
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetHeader/WidgetHeader.types.js
@@ -0,0 +1,20 @@
+// @flow
+import { EnrollmentPageKeys }
+ from '../../Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.constants';
+import type { ProgramStage } from '../../../metaData';
+
+export type PlainProps = {|
+ orgUnitId: string,
+ linkedEvent: { event: string },
+ linkedStage: ProgramStage,
+ currentPage: $Values | string,
+ relationship: string,
+ relationshipType: string,
+ stage: ProgramStage,
+ eventId: string,
+|};
+
+export type Props = {|
+ ...PlainProps,
+ ...CssClasses,
+|};
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetHeader/index.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetHeader/index.js
new file mode 100644
index 0000000000..efff17d3ce
--- /dev/null
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetHeader/index.js
@@ -0,0 +1,2 @@
+// @flow
+export { WidgetHeader } from './WidgetHeader.container';
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspace.container.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspace.container.js
index 37be7a7963..1851fb8d7b 100644
--- a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspace.container.js
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspace.container.js
@@ -1,54 +1,27 @@
// @flow
import React from 'react';
-import { colors, spacersNum } from '@dhis2/ui';
import i18n from '@dhis2/d2-i18n';
-import { withStyles } from '@material-ui/core/';
import type { Props } from './WidgetTwoEventWorkspace.types';
import { useMetadataForProgramStage } from '../DataEntries/common/ProgramStage/useMetadataForProgramStage';
import { Widget } from '../Widget';
-import { useLinkedEventByOriginId, useClientDataValues } from './hooks';
+import { useLinkedEventByOriginId } from './hooks/useLinkedEventByOriginId';
import { WidgetTwoEventWorkspaceComponent } from './WidgetTwoEventWorkspace.component';
-import { OverflowMenuComponent } from './OverflowMenu';
-import {
- EnrollmentPageKeys,
-} from '../Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.constants';
-import { NonBundledDhis2Icon } from '../NonBundledDhis2Icon';
+import { useClientDataValues } from './hooks/useClientDataValues';
+import { WidgetWrapper } from './WidgetWrapper';
+import { WidgetHeader } from './WidgetHeader';
-const styles = {
- menu: {
- display: 'flex',
- alignItems: 'center',
- padding: spacersNum.dp8,
- justifyContent: 'end',
- background: colors.white,
- borderTopLeftRadius: 3,
- borderTopRightRadius: 3,
- borderStyle: 'solid',
- borderColor: colors.grey400,
- borderWidth: 1,
- borderBottomWidth: 0,
- },
- header: {
- display: 'flex',
- alignItems: 'center',
- padding: spacersNum.dp8,
- },
- icon: {
- marginRight: spacersNum.dp8,
- },
-};
-
-const WidgetTwoEventWorkspacePlain = ({
+export const WidgetTwoEventWorkspace = ({
eventId,
programId,
orgUnitId,
currentPage,
- classes,
+ stage,
+ type,
}: Props) => {
const {
linkedEvent,
- relationship,
dataValues,
+ relationship,
relationshipType,
isError: isLinkedEventError,
isLoading: isLinkedEventLoading,
@@ -56,7 +29,7 @@ const WidgetTwoEventWorkspacePlain = ({
const {
formFoundation,
- stage,
+ stage: linkedStage,
isLoading: isLoadingMetadata,
isError: isMetadataError,
} = useMetadataForProgramStage({
@@ -86,54 +59,38 @@ const WidgetTwoEventWorkspacePlain = ({
);
}
- if (!linkedEvent || !formFoundation || !stage) {
+ if (!linkedEvent || !formFoundation || !linkedStage) {
return null;
}
return (
-
- {currentPage === EnrollmentPageKeys.VIEW_EVENT && (
-
-
+ }
+ noncollapsible
+ >
+
-
- )}
-
-
- {stage.icon && (
-
-
-
- )}
- {stage.name}
-
- }
- noncollapsible
- >
-
-
-
+
+ }
+ />
);
};
-
-export const WidgetTwoEventWorkspace = withStyles(
- styles,
-)(WidgetTwoEventWorkspacePlain);
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspace.types.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspace.types.js
index 52aff39ded..71bc0471fa 100644
--- a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspace.types.js
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspace.types.js
@@ -2,13 +2,17 @@
import {
EnrollmentPageKeys,
} from '../Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.constants';
+import { WidgetTwoEventWorkspaceWrapperTypes } from './index';
+import type { ProgramStage } from '../../metaData';
-type PlainProps = {|
+export type Props = {|
programId: string,
eventId: string,
orgUnitId: string,
stageId: string,
- currentPage: $Values,
+ currentPage: $Values | string,
+ stage?: ProgramStage,
+ type?: $Values,
|}
export type LinkedEvent = {|
@@ -17,8 +21,3 @@ export type LinkedEvent = {|
occurredAt: string,
orgUnit: string,
|}
-
-export type Props = {|
- ...PlainProps,
- ...CssClasses,
-|}
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspaceWrapper.const.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspaceWrapper.const.js
new file mode 100644
index 0000000000..421d827ca5
--- /dev/null
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetTwoEventWorkspaceWrapper.const.js
@@ -0,0 +1,5 @@
+// @flow
+
+export const WidgetTwoEventWorkspaceWrapperTypes = {
+ EDIT_EVENT: 'editEvent',
+};
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetWrapper/WidgetWrapper.container.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetWrapper/WidgetWrapper.container.js
new file mode 100644
index 0000000000..dcc0defdc9
--- /dev/null
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetWrapper/WidgetWrapper.container.js
@@ -0,0 +1,74 @@
+// @flow
+import React from 'react';
+import { colors, spacersNum, IconLink16 } from '@dhis2/ui';
+import i18n from '@dhis2/d2-i18n';
+import { withStyles } from '@material-ui/core/';
+import type { Props } from './WidgetWrapper.types';
+import { WidgetTwoEventWorkspaceWrapperTypes } from '../index';
+
+const styles = {
+ container: {
+ width: 'fit-content',
+ marginBottom: '16px',
+ margin: '16px',
+ },
+ header: {
+ display: 'flex',
+ alignItems: 'center',
+ paddingBottom: spacersNum.dp16,
+ fontWeight: 500,
+ fontSize: 16,
+ color: colors.grey800,
+ },
+ referalResponse: {
+ padding: spacersNum.dp16,
+ backgroundColor: colors.blue100,
+ borderRadius: '3px',
+ },
+ linkedEvent: {
+ color: colors.blue900,
+ verticalAlign: 'middle',
+ display: 'flex',
+ fontSize: '16px',
+ fontWeight: '500',
+ },
+ icon: {
+ marginRight: spacersNum.dp8,
+ },
+ decription: {
+ margin: `${spacersNum.dp8}px 0`,
+ },
+};
+
+const WidgetWrapperPlain = ({ widget, type, stage, linkedStage, classes }: Props) => {
+ if (type === WidgetTwoEventWorkspaceWrapperTypes.EDIT_EVENT) {
+ return (
+
+
{stage?.name}
+
+
+
+
+
+
{i18n.t('Linked event')}
+
+
+ {i18n.t(
+ 'This {{stageName}} event is linked to a {{linkedStageName}} event. Review the linked event details before entering data below',
+ {
+ linkedStageName: linkedStage?.name,
+ stageName: stage?.name,
+ interpolation: { escapeValue: false },
+ },
+ )}
+
+ {widget}
+
+
+ );
+ }
+
+ return <>{widget}>;
+};
+
+export const WidgetWrapper = withStyles(styles)(WidgetWrapperPlain);
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetWrapper/WidgetWrapper.types.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetWrapper/WidgetWrapper.types.js
new file mode 100644
index 0000000000..ae72f04aa3
--- /dev/null
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetWrapper/WidgetWrapper.types.js
@@ -0,0 +1,15 @@
+// @flow
+import { WidgetTwoEventWorkspaceWrapperTypes } from '../index';
+import type { ProgramStage } from '../../../metaData';
+
+type PlainProps = {|
+ widget: any,
+ linkedStage: ProgramStage,
+ stage?: ProgramStage,
+ type?: $Values,
+|};
+
+export type Props = {|
+ ...PlainProps,
+ ...CssClasses,
+|};
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetWrapper/index.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetWrapper/index.js
new file mode 100644
index 0000000000..adb87f9498
--- /dev/null
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/WidgetWrapper/index.js
@@ -0,0 +1,2 @@
+// @flow
+export { WidgetWrapper } from './WidgetWrapper.container';
diff --git a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/index.js b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/index.js
index 27320f9e8c..b057d60b99 100644
--- a/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/index.js
+++ b/src/core_modules/capture-core/components/WidgetTwoEventWorkspace/index.js
@@ -1,3 +1,4 @@
// @flow
export { WidgetTwoEventWorkspace } from './WidgetTwoEventWorkspace.container';
+export { WidgetTwoEventWorkspaceWrapperTypes } from './WidgetTwoEventWorkspaceWrapper.const';