diff --git a/cypress/e2e/EnrollmentEditEventPage/EnrollmentEditEventPageForm/EnrollmentEditEventPageForm.feature b/cypress/e2e/EnrollmentEditEventPage/EnrollmentEditEventPageForm/EnrollmentEditEventPageForm.feature
index 72271b0594..594b821007 100644
--- a/cypress/e2e/EnrollmentEditEventPage/EnrollmentEditEventPageForm/EnrollmentEditEventPageForm.feature
+++ b/cypress/e2e/EnrollmentEditEventPage/EnrollmentEditEventPageForm/EnrollmentEditEventPageForm.feature
@@ -101,6 +101,12 @@ Scenario: User can see disabled scheduled date for active event
Then the user see the following text: Enrollment: Edit Event
Then the user see the schedule date field with tooltip: Scheduled date cannot be changed for Active events
+@user:trackerAutoTestRestricted
+Scenario: The user cannot enter edit mode for completed events
+ Given you land on the enrollment event page with selected Person by having typed /#/enrollmentEventEdit?eventId=nUVwTLuQ6FT&orgUnitId=DiszpKrYNg8
+ And the user see the following text: Enrollment: View Event
+ Then the edit button should be disabled
+
Scenario: User can edit the event and complete the enrollment
Given you land on the enrollment event page with selected Malaria Entity by having typed #/enrollmentEventEdit?eventId=MHR4Zj6KLz0&orgUnitId=DiszpKrYNg8
And the enrollment status is active
diff --git a/cypress/e2e/EnrollmentEditEventPage/EnrollmentEditEventPageForm/EnrollmentEditEventPageForm.js b/cypress/e2e/EnrollmentEditEventPage/EnrollmentEditEventPageForm/EnrollmentEditEventPageForm.js
index bd82268d44..bd8c7855fc 100644
--- a/cypress/e2e/EnrollmentEditEventPage/EnrollmentEditEventPageForm/EnrollmentEditEventPageForm.js
+++ b/cypress/e2e/EnrollmentEditEventPage/EnrollmentEditEventPageForm/EnrollmentEditEventPageForm.js
@@ -204,3 +204,9 @@ And('you open the Birth stage event', () => {
});
});
+Then('the edit button should be disabled', () => {
+ cy.get('[data-test="widget-enrollment-event"]')
+ .find('[data-test="dhis2-uicore-button"]')
+ .eq(1)
+ .should('be.disabled');
+});
diff --git a/i18n/en.pot b/i18n/en.pot
index 7e93f8ab6a..5612718d04 100644
--- a/i18n/en.pot
+++ b/i18n/en.pot
@@ -1341,6 +1341,9 @@ msgstr "Scheduled date cannot be changed for {{ eventStatus }} events"
msgid "Event completed"
msgstr "Event completed"
+msgid "The event cannot be edited after it has been completed"
+msgstr "The event cannot be edited after it has been completed"
+
msgid "Back to all stages and events"
msgstr "Back to all stages and events"
diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/WidgetEventEdit.container.js b/src/core_modules/capture-core/components/WidgetEventEdit/WidgetEventEdit.container.js
index 147934a992..f953852223 100644
--- a/src/core_modules/capture-core/components/WidgetEventEdit/WidgetEventEdit.container.js
+++ b/src/core_modules/capture-core/components/WidgetEventEdit/WidgetEventEdit.container.js
@@ -31,6 +31,8 @@ import { OverflowButton } from '../Buttons';
import { EventChangelogWrapper } from './EventChangelogWrapper';
import { FEATURES, useFeature } from '../../../capture-core-utils';
import { inMemoryFileStore } from '../DataEntry/file/inMemoryFileStore';
+import { eventStatuses } from './constants/status.const';
+import { useAuthorities } from './hooks';
const styles = {
header: {
@@ -99,6 +101,14 @@ export const WidgetEventEditPlain = ({
const loadedValues = useSelector(({ viewEventPage }) => viewEventPage.loadedValues);
const eventAccess = getProgramEventAccess(programId, stageId);
+ const { canEditCompletedEvent } = useAuthorities();
+ const blockEntryForm = stage.blockEntryForm && !canEditCompletedEvent && eventStatus === eventStatuses.COMPLETED;
+ const disableEdit = !eventAccess?.write || blockEntryForm;
+
+ const tooltipContent = blockEntryForm ?
+ i18n.t('The event cannot be edited after it has been completed') :
+ i18n.t('You don\'t have access to edit this event');
+
const availableProgramStages = useAvailableProgramStages(stage, teiId, enrollmentId, programId);
const { programCategory } = useCategoryCombinations(programId);
if (error) {
@@ -117,14 +127,14 @@ export const WidgetEventEditPlain = ({
{currentPageMode === dataEntryKeys.VIEW && (