diff --git a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.feature b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.feature index 1bb67f571c..f7707228cd 100644 --- a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.feature +++ b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.feature @@ -79,7 +79,7 @@ Feature: User interacts with the Enrollment New Event Workspace Given you land on the enrollment new event page by having typed /#/enrollmentEventNew?enrollmentId=qcFFRp7DpcX&orgUnitId=DiszpKrYNg8&programId=WSGAb5XwJ3Y&stageId=edqlbukwRfQ&teiId=erqa3phUfpI And you see the following Enrollment: New Event And you select the schedule tab - When you add a comment to the event + When you add a note to the event And the events saves successfully Scenario: User can add a new event and complete the enrollment diff --git a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.js b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.js index 11a1c94a15..aa9d7b88ad 100644 --- a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.js +++ b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.js @@ -61,12 +61,12 @@ Given('you select the schedule tab', () => { .click(); }); -When('you add a comment to the event', () => { - cy.get('[data-test="comment-textfield"]') - .type('This is a comment') +When('you add a note to the event', () => { + cy.get('[data-test="note-textfield"]') + .type('This is a note') .blur(); - cy.get('[data-test="add-comment-btn"]') + cy.get('[data-test="add-note-btn"]') .click(); }); diff --git a/cypress/e2e/NewPage/NewPage.js b/cypress/e2e/NewPage/NewPage.js index dabb30559c..d6d23d64bf 100644 --- a/cypress/e2e/NewPage/NewPage.js +++ b/cypress/e2e/NewPage/NewPage.js @@ -118,10 +118,10 @@ And('you see the registration form for the Malaria case registration', () => { .contains('Complete event') .should('exist'); cy.get('[data-test="registration-page-content"]') - .contains('Comments') + .contains('Notes') .should('exist'); cy.get('[data-test="registration-page-content"]') - .contains('Write comment') + .contains('Write note') .should('exist'); cy.get('[data-test="registration-page-content"]') .contains('Relationships') @@ -291,10 +291,10 @@ And('you see the registration form for the specific category', () => { .contains('Complete event') .should('exist'); cy.get('[data-test="registration-page-content"]') - .contains('Comments') + .contains('Notes') .should('exist'); cy.get('[data-test="registration-page-content"]') - .contains('Write comment') + .contains('Write note') .should('exist'); cy.get('[data-test="dhis2-uicore-splitbutton"]') diff --git a/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollmentComment/index.js b/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollmentComment/index.js deleted file mode 100644 index 1e97d61e19..0000000000 --- a/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollmentComment/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import { When, Then } from '@badeball/cypress-cucumber-preprocessor'; - -Then('the stages and events should be loaded', () => { - cy.contains('Stages and Events').should('exist'); -}); - -When(/^you fill in the comment: (.*)$/, (comment) => { - cy.get('[data-test="enrollment-comment-widget"]').within(() => { - cy.get('[data-test="comment-textfield"]').type(comment); - cy.wait(100); - - cy.get('[data-test="add-comment-btn"]').should('exist'); - cy.get('[data-test="add-comment-btn"]').click(); - }); -}); - -Then(/^list should contain the new comment: (.*)$/, (comment) => { - cy.get('[data-test="enrollment-comment-widget"]').within(() => { - cy.get('[data-test="comment-item"]').contains(comment).should('exist'); - }); -}); diff --git a/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollmentNote/index.js b/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollmentNote/index.js new file mode 100644 index 0000000000..47996bf13f --- /dev/null +++ b/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollmentNote/index.js @@ -0,0 +1,21 @@ +import { When, Then } from '@badeball/cypress-cucumber-preprocessor'; + +Then('the stages and events should be loaded', () => { + cy.contains('Stages and Events').should('exist'); +}); + +When(/^you fill in the note: (.*)$/, (note) => { + cy.get('[data-test="enrollment-note-widget"]').within(() => { + cy.get('[data-test="note-textfield"]').type(note); + cy.wait(100); + + cy.get('[data-test="add-note-btn"]').should('exist'); + cy.get('[data-test="add-note-btn"]').click(); + }); +}); + +Then(/^list should contain the new note: (.*)$/, (note) => { + cy.get('[data-test="enrollment-note-widget"]').within(() => { + cy.get('[data-test="note-item"]').contains(note).should('exist'); + }); +}); diff --git a/cypress/e2e/WidgetsForEnrollmentPages/WidgetEventComment/index.js b/cypress/e2e/WidgetsForEnrollmentPages/WidgetEventComment/index.js deleted file mode 100644 index 83fbe2c68d..0000000000 --- a/cypress/e2e/WidgetsForEnrollmentPages/WidgetEventComment/index.js +++ /dev/null @@ -1,27 +0,0 @@ -import { When, Then } from '@badeball/cypress-cucumber-preprocessor'; - -Then('the enrollment widget should be loaded', () => { - cy.contains('The enrollment event data could not be found').should('not.exist'); -}); - -When('you click edit mode', () => { - cy.contains('[data-test="dhis2-uicore-button"]', 'Edit event') - .click(); - cy.contains('Enrollment: Edit Event').should('exist'); -}); - -When(/^you fill in the comment: (.*)$/, (comment) => { - cy.get('[data-test="event-comment-widget"]').within(() => { - cy.get('[data-test="comment-textfield"]').type(comment); - cy.wait(100); - - cy.get('[data-test="add-comment-btn"]').should('exist'); - cy.get('[data-test="add-comment-btn"]').click(); - }); -}); - -Then(/^list should contain the new comment: (.*)$/, (comment) => { - cy.get('[data-test="event-comment-widget"]').within(() => { - cy.get('[data-test="comment-item"]').contains(comment).should('exist'); - }); -}); diff --git a/cypress/e2e/WidgetsForEnrollmentPages/WidgetEventNote/index.js b/cypress/e2e/WidgetsForEnrollmentPages/WidgetEventNote/index.js new file mode 100644 index 0000000000..2a1c5200ef --- /dev/null +++ b/cypress/e2e/WidgetsForEnrollmentPages/WidgetEventNote/index.js @@ -0,0 +1,27 @@ +import { When, Then } from '@badeball/cypress-cucumber-preprocessor'; + +Then('the enrollment widget should be loaded', () => { + cy.contains('The enrollment event data could not be found').should('not.exist'); +}); + +When('you click edit mode', () => { + cy.contains('[data-test="dhis2-uicore-button"]', 'Edit event') + .click(); + cy.contains('Enrollment: Edit Event').should('exist'); +}); + +When(/^you fill in the note: (.*)$/, (note) => { + cy.get('[data-test="event-note-widget"]').within(() => { + cy.get('[data-test="note-textfield"]').type(note); + cy.wait(100); + + cy.get('[data-test="add-note-btn"]').should('exist'); + cy.get('[data-test="add-note-btn"]').click(); + }); +}); + +Then(/^list should contain the new note: (.*)$/, (note) => { + cy.get('[data-test="event-note-widget"]').within(() => { + cy.get('[data-test="note-item"]').contains(note).should('exist'); + }); +}); diff --git a/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentDashboard/WidgetsForEnrollmentDashboard.feature b/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentDashboard/WidgetsForEnrollmentDashboard.feature index 0b5349e95e..724567d75d 100644 --- a/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentDashboard/WidgetsForEnrollmentDashboard.feature +++ b/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentDashboard/WidgetsForEnrollmentDashboard.feature @@ -118,8 +118,8 @@ Feature: The user interacts with the widgets on the enrollment dashboard Scenario: User can add note on enrollment dashboard page Given you land on the enrollment dashboard page by having typed #/enrollment?enrollmentId=wBU0RAsYjKE Then the stages and events should be loaded - When you fill in the comment: new test enrollment comment - Then list should contain the new comment: new test enrollment comment + When you fill in the note: new test enrollment note + Then list should contain the new note: new test enrollment note Scenario: The program rules are triggered and the effects are displayed in the sidebar widgets Given you land on the enrollment dashboard page by having typed #/enrollment?enrollmentId=wBU0RAsYjKE diff --git a/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentDashboard/WidgetsForEnrollmentDashboard.js b/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentDashboard/WidgetsForEnrollmentDashboard.js index 27f0a0d365..81034e2507 100644 --- a/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentDashboard/WidgetsForEnrollmentDashboard.js +++ b/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentDashboard/WidgetsForEnrollmentDashboard.js @@ -3,7 +3,7 @@ import moment from 'moment'; import '../sharedSteps'; import '../WidgetEnrollment'; import '../WidgetProfile'; -import '../WidgetEnrollmentComment'; +import '../WidgetEnrollmentNote'; When('the user sets the birthday date to the current date', () => { cy.get('[data-test="modal-edit-profile"]').find('[data-test="capture-ui-input"]').eq(8).clear() diff --git a/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentEditEvent/WidgetsForEnrollmentEditEvent.feature b/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentEditEvent/WidgetsForEnrollmentEditEvent.feature index 2cee07f71b..39bd30c304 100644 --- a/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentEditEvent/WidgetsForEnrollmentEditEvent.feature +++ b/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentEditEvent/WidgetsForEnrollmentEditEvent.feature @@ -57,8 +57,8 @@ Feature: The user interacts with the widgets on the enrollment edit event Scenario: User can add note on edit event page view mode Given you land on the enrollment edit event page by having typed /#/enrollmentEventEdit?eventId=XGLkLlOXgmE&orgUnitId=DiszpKrYNg8 Then the enrollment widget should be loaded - When you fill in the comment: new test comment - Then list should contain the new comment: new test comment + When you fill in the note: new test note + Then list should contain the new note: new test note # DHIS2-17635 @v<=41 @@ -66,7 +66,7 @@ Feature: The user interacts with the widgets on the enrollment edit event Given you land on the enrollment edit event page by having typed /#/enrollmentEventEdit?eventId=XGLkLlOXgmE&orgUnitId=DiszpKrYNg8 Then the enrollment widget should be loaded When you click edit mode - Then list should contain the new comment: new test comment + Then list should contain the new note: new test note Scenario: You can assign a user to a event Given you land on the enrollment edit event page by having typed /#/enrollmentEventEdit?eventId=veuwiLC2x0e&orgUnitId=g8upMTyEZGZ diff --git a/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentEditEvent/WidgetsForEnrollmentEditEvent.js b/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentEditEvent/WidgetsForEnrollmentEditEvent.js index a87c088484..a3c493e5cd 100644 --- a/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentEditEvent/WidgetsForEnrollmentEditEvent.js +++ b/cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentEditEvent/WidgetsForEnrollmentEditEvent.js @@ -1,7 +1,7 @@ import '../sharedSteps'; import '../WidgetEnrollment'; import '../WidgetProfile'; -import '../WidgetEventComment'; +import '../WidgetEventNote'; import '../WidgetAssignee'; import '../WidgetChangelog'; diff --git a/docs/user/resources/images/enrollment-widget-comment.png b/docs/user/resources/images/enrollment-widget-comment.png deleted file mode 100644 index 330cb9aa7f..0000000000 Binary files a/docs/user/resources/images/enrollment-widget-comment.png and /dev/null differ diff --git a/docs/user/resources/images/enrollment-widget-note.png b/docs/user/resources/images/enrollment-widget-note.png new file mode 100644 index 0000000000..8760d86450 Binary files /dev/null and b/docs/user/resources/images/enrollment-widget-note.png differ diff --git a/docs/user/resources/images/schedule_event_02.png b/docs/user/resources/images/schedule_event_02.png index 9e678683a5..ea704ecb59 100644 Binary files a/docs/user/resources/images/schedule_event_02.png and b/docs/user/resources/images/schedule_event_02.png differ diff --git a/docs/user/resources/images/schedule_event_04.png b/docs/user/resources/images/schedule_event_04.png index bb8330fa09..03f119eeb7 100644 Binary files a/docs/user/resources/images/schedule_event_04.png and b/docs/user/resources/images/schedule_event_04.png differ diff --git a/docs/user/using-the-capture-app.md b/docs/user/using-the-capture-app.md index 70ad02108f..1d64b1a4e2 100644 --- a/docs/user/using-the-capture-app.md +++ b/docs/user/using-the-capture-app.md @@ -31,7 +31,7 @@ In the Capture app you register events that occurred at a particular time and pl the field. This will open a map where you can search for a location and capture a polygon (button in the upper right corner of the map). -7. If desired you can add a comment by clicking the **Write comment** button at the bottom of the form. Note that Event comments are attributed to a user and cannot be deleted. +7. If desired, you can add a note by clicking the **Write note** button at the bottom of the form. Be aware that Event notes are attributed to a user and cannot be deleted. 8. If desired you can add a relationship by clicking the **Add relationship** button at the bottom of the form. See the section about **Adding a relationship** for more information. @@ -120,7 +120,7 @@ The second option, is to register a tracked entity instance with program and enr 3. Select a tracker program of your choice. -4. Click **Create new person**. Please note that the label of this button corresponds to the tracked entity type of the program, which could vary, such as "Building," "Person," etc. +4. Click **Create new person**. Note that the label of this button corresponds to the tracked entity type of the program, which could vary, such as "Building," "Person," etc. ![create new event](resources/images/register-and-enroll-program-selection.png) @@ -233,7 +233,7 @@ When the "Scheduled days from start" does not contain a number or contains 0 the ### Possible duplicates detection In both cases of registering a tracked entity instance, (with enrollment or without enrollment) the system will start looking for possible duplicates. -Note that, programs need to be correctly configured through the maintenance app for the system to start detecting duplicates when enrolling a new person in a program. +Note that programs need to be correctly configured through the maintenance app for the system to start detecting duplicates when enrolling a new person in a program. To configure a program through the maintenance app you will have to: @@ -280,8 +280,8 @@ Click **Save person**. The system will start looking for possible duplicates tha ### Program rules execution -In both cases of registering a tracked entity instance, (with enrollment or without enrollment) the system will run program rules you have configured. -Note that, rules can be configured in the maintenance app. +In both cases of registering a tracked entity instance (with enrollment or without enrollment), the system will run program rules you have configured. +Note that rules can be configured in the maintenance app. To see a rule being executed while enrolling a tracked entity instance you will have to take the following steps. @@ -1002,13 +1002,14 @@ You can complete the enrollment by clicking the complete button. When there are ![](resources/images/enrollment-dash-enrollment-widget-4.png) -### Enrollment comment widget +### Enrollment note widget -![](resources/images/enrollment-widget-comment.png) +The enrollment note widget displays notes and allows addition of notes, associated with the current enrollment. -The enrollment comment widget displays comments and allows addition of comments, associated with the current enrollment. +![](resources/images/enrollment-widget-note.png) + +By clicking in the text field, you will be able to enter new text and see action buttons **Save note** and **Cancel**. Be aware that Enrollment notes are attributed to a user and cannot be deleted. -By clicking in the text field, you will be able to enter new text and see action buttons **Save comment** and **Cancel**. Note that Enrollment comments are attributed to a user and cannot be deleted. ### Relationship widget @@ -1268,7 +1269,7 @@ If a program stage has a default next scheduled date configured, the suggested d User can also find more information about how many events that scheduled on the same selected date or the interval of selected date and the suggested date from the information box. -Below the schedule date entry, user can choose to add a comment to the scheduled event. +Below the schedule date entry, user can choose to add a note to the scheduled event. After clicking **Schedule** button, user will be navigated back to enrollment overview page. diff --git a/i18n/en.pot b/i18n/en.pot index 18b3dadbab..4184b241b2 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-06-04T12:49:55.581Z\n" -"PO-Revision-Date: 2024-06-04T12:49:55.581Z\n" +"POT-Creation-Date: 2024-06-28T11:23:02.970Z\n" +"PO-Revision-Date: 2024-06-28T11:23:02.970Z\n" msgid "Choose one or more dates..." msgstr "Choose one or more dates..." @@ -188,15 +188,15 @@ msgstr "Assigned user" msgid "Search for user" msgstr "Search for user" +msgid "Notes" +msgstr "Notes" + msgid "Basic info" msgstr "Basic info" msgid "Status" msgstr "Status" -msgid "Comments" -msgstr "Comments" - msgid "Relationships" msgstr "Relationships" @@ -229,8 +229,8 @@ msgstr "Active" msgid "Completed" msgstr "Completed" -msgid "Please add or cancel comment before saving the event" -msgstr "Please add or cancel comment before saving the event" +msgid "Please add or cancel note before saving the event" +msgstr "Please add or cancel note before saving the event" msgid "Save and add another" msgstr "Save and add another" @@ -619,14 +619,14 @@ msgstr "Offline" msgid "Syncing" msgstr "Syncing" -msgid "Add comment" -msgstr "Add comment" +msgid "Add note" +msgstr "Add note" -msgid "You don't have access to write comments" -msgstr "You don't have access to write comments" +msgid "You don't have access to write notes" +msgstr "You don't have access to write notes" -msgid "Write comment" -msgstr "Write comment" +msgid "Write note" +msgstr "Write note" msgid "was blanked out and hidden by your last action" msgstr "was blanked out and hidden by your last action" @@ -1165,9 +1165,6 @@ msgstr "" "You must provide a reason to check for enrollments in this protected " "program. All activity will be logged." -msgid "Save comment" -msgstr "Save comment" - msgid "Enrollment actions" msgstr "Enrollment actions" @@ -1295,14 +1292,8 @@ msgstr "Add coordinates" msgid "Add area" msgstr "Add area" -msgid "Comments about this enrollment" -msgstr "Comments about this enrollment" - -msgid "Write a comment about this enrollment" -msgstr "Write a comment about this enrollment" - -msgid "This enrollment doesn't have any comments" -msgstr "This enrollment doesn't have any comments" +msgid "Please add or cancel the note before saving the event" +msgstr "Please add or cancel the note before saving the event" msgid "organisation unit could not be retrieved. Please try again later." msgstr "organisation unit could not be retrieved. Please try again later." @@ -1313,21 +1304,21 @@ msgstr "Saving to {{stageName}} for {{programName}} in {{orgUnitName}}" msgid "program or stage is invalid" msgstr "program or stage is invalid" +msgid "Notes about this enrollment" +msgstr "Notes about this enrollment" + +msgid "Write a note about this enrollment" +msgstr "Write a note about this enrollment" + +msgid "This enrollment doesn't have any notes" +msgstr "This enrollment doesn't have any notes" + msgid "Error" msgstr "Error" msgid "Warning" msgstr "Warning" -msgid "Comments about this event" -msgstr "Comments about this event" - -msgid "Write a comment about this event" -msgstr "Write a comment about this event" - -msgid "This event doesn't have any comments" -msgstr "This event doesn't have any comments" - msgid "stage not found in rules execution" msgstr "stage not found in rules execution" @@ -1349,6 +1340,15 @@ msgstr "Event completed" msgid "Back to all stages and events" msgstr "Back to all stages and events" +msgid "Notes about this event" +msgstr "Notes about this event" + +msgid "Write a note about this event" +msgstr "Write a note about this event" + +msgid "This event doesn't have any notes" +msgstr "This event doesn't have any notes" + msgid "Schedule date info" msgstr "Schedule date info" @@ -1383,11 +1383,14 @@ msgstr "Schedule info" msgid "Schedule date / Due date" msgstr "Schedule date / Due date" -msgid "Event comments" -msgstr "Event comments" +msgid "Event notes" +msgstr "Event notes" + +msgid "Write a note about this scheduled event" +msgstr "Write a note about this scheduled event" -msgid "Write a comment about this scheduled event" -msgstr "Write a comment about this scheduled event" +msgid "Save note" +msgstr "Save note" msgid "" "Change information about this {{trackedEntityName}} here. To change " diff --git a/src/core_modules/capture-core/components/D2Form/D2CustomForm/D2CustomForm.component.js b/src/core_modules/capture-core/components/D2Form/D2CustomForm/D2CustomForm.component.js index 0bffc6c119..73e5d0a00b 100644 --- a/src/core_modules/capture-core/components/D2Form/D2CustomForm/D2CustomForm.component.js +++ b/src/core_modules/capture-core/components/D2Form/D2CustomForm/D2CustomForm.component.js @@ -124,8 +124,7 @@ export class D2CustomForm extends React.Component { 'data-custom-form-id': autoId, }, - /* $FlowFixMe[incompatible-type] automated - * comment */ + // $FlowFixMe[incompatible-type] automated comment // $FlowFixMe[prop-missing] automated comment ...path.walkChildren(), ); diff --git a/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/DataEntryWrapper/DataEntry/DataEntry.component.js b/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/DataEntryWrapper/DataEntry/DataEntry.component.js index 1e0c01069a..a9dd0b8f54 100644 --- a/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/DataEntryWrapper/DataEntry/DataEntry.component.js +++ b/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/DataEntryWrapper/DataEntry/DataEntry.component.js @@ -86,7 +86,7 @@ const getStyles = theme => ({ const dataEntrySectionNames = { BASICINFO: 'BASICINFO', STATUS: 'STATUS', - COMMENTS: 'COMMENTS', + NOTES: 'NOTES', RELATIONSHIPS: 'RELATIONSHIPS', ASSIGNEE: 'ASSIGNEE', }; @@ -242,8 +242,8 @@ const buildGeometrySettingsFn = () => ({ return createComponentProps(props, { width: props && props.formHorizontal ? 150 : 350, - label: 'Coordinate', - dialogLabel: 'Coordinate', + label: i18n.t('Coordinate'), + dialogLabel: i18n.t('Coordinate'), required: false, orientation: getOrientation(props.formHorizontal), shrinkDisabled: props.formHorizontal, @@ -359,16 +359,16 @@ const buildNotesSettingsFn = () => { const notesSettings = { getComponent: () => noteComponent, getComponentProps: (props: Object) => createComponentProps(props, { - label: 'Comments', + label: i18n.t('Notes'), onAddNote: props.onAddNote, - id: 'comments', + id: 'notes', dataEntryId: props.id, }), getPropName: () => 'note', getValidatorContainers: () => getNoteValidatorContainers(), getMeta: () => ({ placement: placements.BOTTOM, - section: dataEntrySectionNames.COMMENTS, + section: dataEntrySectionNames.NOTES, }), }; @@ -462,8 +462,8 @@ const AOCField = withAOCFieldBuilder({})( withDataEntryFields(buildCategoryOptionsFieldSettingsFn())(AssigneeField), ); const RelationshipField = withDataEntryFieldIfApplicable(buildRelationshipsSettingsFn())(AOCField); -const CommentField = withDataEntryField(buildNotesSettingsFn())(RelationshipField); -const GeometryField = withDataEntryFieldIfApplicable(buildGeometrySettingsFn())(CommentField); +const NoteField = withDataEntryField(buildNotesSettingsFn())(RelationshipField); +const GeometryField = withDataEntryFieldIfApplicable(buildGeometrySettingsFn())(NoteField); const ReportDateField = withDataEntryField(buildReportDateSettingsFn())(GeometryField); const FeedbackOutput = withFeedbackOutput()(ReportDateField); const IndicatorOutput = withIndicatorOutput()(FeedbackOutput); @@ -519,9 +519,9 @@ const dataEntrySectionDefinitions = { placement: placements.BOTTOM, name: i18n.t('Status'), }, - [dataEntrySectionNames.COMMENTS]: { + [dataEntrySectionNames.NOTES]: { placement: placements.BOTTOM, - name: i18n.t('Comments'), + name: i18n.t('Notes'), }, [dataEntrySectionNames.RELATIONSHIPS]: { placement: placements.BOTTOM, @@ -553,7 +553,7 @@ class NewEventDataEntry extends Component { componentDidMount() { if (this.relationshipsInstance && this.props.recentlyAddedRelationshipId) { this.relationshipsInstance.scrollIntoView(); - // $FlowFixMe[prop-missing] automated comment + // $FlowFixMe[prop-missing] automated note this.props.onScrollToRelationships(); } } @@ -625,7 +625,7 @@ class NewEventDataEntry extends Component { return (
- {/* $FlowFixMe[cannot-spread-inexact] automated comment */} + {/* $FlowFixMe[cannot-spread-inexact] automated note */} { const validatorContainers = [ { validator: validateNote, - message: i18n.t('Please add or cancel comment before saving the event'), + message: i18n.t('Please add or cancel note before saving the event'), }, ]; return validatorContainers; diff --git a/src/core_modules/capture-core/components/Notes/Notes.component.js b/src/core_modules/capture-core/components/Notes/Notes.component.js index 1a7626bfd7..ec25efb246 100644 --- a/src/core_modules/capture-core/components/Notes/Notes.component.js +++ b/src/core_modules/capture-core/components/Notes/Notes.component.js @@ -35,7 +35,7 @@ const styles = theme => ({ borderBoxContent: { margin: theme.typography.pxToRem(10), }, - newCommentButtonContainer: { + newNoteButtonsContainer: { marginTop: spacersNum.dp4, }, noteItemHeader: { @@ -52,10 +52,7 @@ const styles = theme => ({ notesList: { padding: 0, }, - newNoteButtonContainer: { - display: 'inline-block', - }, - addCommentContainer: { + addNoteContainer: { marginRight: 5, marginLeft: 2, }, @@ -72,7 +69,7 @@ type Props = { noteItem: string, inputContainer: string, borderBoxContent: string, - newCommentButtonContainer: string, + newNoteButtonsContainer: string, newNoteContainer: string, newNoteFormContainer: string, textEditorContainer: string, @@ -81,8 +78,7 @@ type Props = { noteItemUser: string, noteItemDate: string, notesList: string, - addCommentContainer: string, - newNoteButtonContainer: string, + addNoteContainer: string, }, }; @@ -150,17 +146,17 @@ class NotesPlain extends React.Component { onChange={this.handleChange} value={this.state.value} multiLine - data-test="comment-textfield" + data-test="note-textfield" /> -
+
@@ -202,22 +197,22 @@ class NotesPlain extends React.Component { const { notes, classes, entityAccess } = this.props; return (
- + {notes.map(n => (
-
+
{n.createdBy ? `${n.createdBy.firstName} ${n.createdBy.surname}` : `${n.storedBy}` }
-
+
{n.storedDate}
-
+
{n.value}
} @@ -225,7 +220,7 @@ class NotesPlain extends React.Component { ))}
{ -
+
{ this.state.addIsOpen ? this.renderInput() : this.renderButton(entityAccess.write) }
} diff --git a/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPageDefault/DefaultPageLayout/DefaultPageLayout.constants.js b/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPageDefault/DefaultPageLayout/DefaultPageLayout.constants.js index ea7fa191a7..306bf4b9d1 100644 --- a/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPageDefault/DefaultPageLayout/DefaultPageLayout.constants.js +++ b/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPageDefault/DefaultPageLayout/DefaultPageLayout.constants.js @@ -2,7 +2,7 @@ import { QuickActions, StagesAndEvents, - EnrollmentComment, + EnrollmentNote, DefaultWidgetsForEnrollmentOverview, WidgetTypes, } from '../../../common/EnrollmentOverviewDomain/EnrollmentPageLayout'; @@ -14,7 +14,7 @@ import type { export const WidgetsForEnrollmentPageDefault: $ReadOnly<{ [key: string]: WidgetConfig }> = Object.freeze({ QuickActions, StagesAndEvents, - EnrollmentComment, + EnrollmentNote, ...DefaultWidgetsForEnrollmentOverview, }); @@ -40,7 +40,7 @@ export const DefaultPageLayout: PageLayoutConfig = Object.freeze({ }, { type: WidgetTypes.COMPONENT, - name: 'EnrollmentComment', + name: 'EnrollmentNote', }, { type: WidgetTypes.COMPONENT, diff --git a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/PageLayout/DefaultPageLayout.constants.js b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/PageLayout/DefaultPageLayout.constants.js index 6a12ec64e7..09aaf1f2b9 100644 --- a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/PageLayout/DefaultPageLayout.constants.js +++ b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/PageLayout/DefaultPageLayout.constants.js @@ -6,14 +6,14 @@ import type { import { DefaultWidgetsForEnrollmentOverview, EditEventWorkspace, - EventComment, + EventNote, AssigneeWidget, WidgetTypes, } from '../../common/EnrollmentOverviewDomain/EnrollmentPageLayout'; export const WidgetsForEnrollmentEventEdit: $ReadOnly<{ [key: string]: WidgetConfig }> = Object.freeze({ EditEventWorkspace, - EventComment, + EventNote, AssigneeWidget, ...DefaultWidgetsForEnrollmentOverview, }); @@ -40,7 +40,7 @@ export const DefaultPageLayout: PageLayoutConfig = { }, { type: WidgetTypes.COMPONENT, - name: 'EventComment', + name: 'EventNote', }, { type: WidgetTypes.COMPONENT, diff --git a/src/core_modules/capture-core/components/Pages/ViewEvent/RightColumn/NotesSection/NotesSection.component.js b/src/core_modules/capture-core/components/Pages/ViewEvent/RightColumn/NotesSection/NotesSection.component.js index 11487a33d2..d0124c562b 100644 --- a/src/core_modules/capture-core/components/Pages/ViewEvent/RightColumn/NotesSection/NotesSection.component.js +++ b/src/core_modules/capture-core/components/Pages/ViewEvent/RightColumn/NotesSection/NotesSection.component.js @@ -28,7 +28,7 @@ const loadingIndicatorStyle = { width: 36, }; -const headerText = i18n.t('Comments'); +const headerText = i18n.t('Notes'); const getStyles = (theme: Theme) => ({ badge: { diff --git a/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.types.js b/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.types.js index 22642dce02..a123497504 100644 --- a/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.types.js +++ b/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.types.js @@ -8,8 +8,8 @@ type DefaultComponents = 'QuickActions' | 'AssigneeWidget' | 'NewEventWorkspace' | 'EditEventWorkspace' - | 'EnrollmentComment' - | 'EventComment' + | 'EnrollmentNote' + | 'EventNote' | 'TrackedEntityRelationship' | 'ErrorWidget' | 'WarningWidget' diff --git a/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/LayoutComponentConfig/LayoutComponentConfig.js b/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/LayoutComponentConfig/LayoutComponentConfig.js index 1ec4177636..3180e42d27 100644 --- a/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/LayoutComponentConfig/LayoutComponentConfig.js +++ b/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/LayoutComponentConfig/LayoutComponentConfig.js @@ -10,7 +10,7 @@ import { WidgetWarning } from '../../../../../WidgetErrorAndWarning/WidgetWarnin import type { Props as WidgetWarningProps } from '../../../../../WidgetErrorAndWarning/WidgetWarning/WidgetWarning.types'; import { WidgetFeedback } from '../../../../../WidgetFeedback'; import { WidgetIndicator } from '../../../../../WidgetIndicator'; -import { WidgetEnrollmentComment } from '../../../../../WidgetEnrollmentComment'; +import { WidgetEnrollmentNote } from '../../../../../WidgetEnrollmentNote'; import { WidgetProfile } from '../../../../../WidgetProfile'; import type { Props as WidgetProfileProps } from '../../../../../WidgetProfile/widgetProfile.types'; import { WidgetEnrollment } from '../../../../../WidgetEnrollment'; @@ -20,7 +20,7 @@ import type { Props as WidgetEventEditProps } from '../../../../../WidgetEventEd import type { WidgetConfig } from '../DefaultEnrollmentLayout.types'; import { NewEventWorkspaceWrapper } from '../../../NewEventWorkspaceWrapper'; import { WidgetEventEditWrapper } from '../../../WidgetEventEditWrapper'; -import { WidgetEventComment } from '../../../../../WidgetEventComment'; +import { WidgetEventNote } from '../../../../../WidgetEventNote'; import { WidgetAssignee } from '../../../../../WidgetAssignee'; import type { IndicatorProps, @@ -113,8 +113,8 @@ export const IndicatorWidget: WidgetConfig = { }), }; -export const EnrollmentComment: WidgetConfig = { - Component: WidgetEnrollmentComment, +export const EnrollmentNote: WidgetConfig = { + Component: WidgetEnrollmentNote, getProps: (): void => {}, }; @@ -261,8 +261,8 @@ export const AssigneeWidget: WidgetConfig = { }), }; -export const EventComment: WidgetConfig = { - Component: WidgetEventComment, +export const EventNote: WidgetConfig = { + Component: WidgetEventNote, getProps: ({ dataEntryKey, dataEntryId }) => ({ dataEntryKey, dataEntryId, diff --git a/src/core_modules/capture-core/components/WidgetComment/WidgetComment.types.js b/src/core_modules/capture-core/components/WidgetComment/WidgetComment.types.js deleted file mode 100644 index a7a36955b0..0000000000 --- a/src/core_modules/capture-core/components/WidgetComment/WidgetComment.types.js +++ /dev/null @@ -1,10 +0,0 @@ -// @flow - -export type Props = {| - title: string, - placeholder: string, - emptyCommentMessage: string, - comments: Array, - onAddComment: (comment: string) => void, - ...CssClasses -|}; diff --git a/src/core_modules/capture-core/components/WidgetComment/index.js b/src/core_modules/capture-core/components/WidgetComment/index.js deleted file mode 100644 index ea7e566b56..0000000000 --- a/src/core_modules/capture-core/components/WidgetComment/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { CommentSection } from './CommentSection/CommentSection'; -export { WidgetComment } from './WidgetComment.component'; diff --git a/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.container.js b/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.container.js index f6faa2669d..f46827f52b 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.container.js +++ b/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.container.js @@ -2,7 +2,7 @@ import React, { useMemo } from 'react'; import { errorCreator } from 'capture-core-utils'; import log from 'loglevel'; -import { WidgetEnrollment as WidgetEnrollmentComponent } from './WidgetEnrollment.component'; +import { WidgetEnrollment as WidgetEnrollmentNote } from './WidgetEnrollment.component'; import { useOrgUnitName } from '../../metadataRetrieval/orgUnitName'; import { useTrackedEntityInstances } from './hooks/useTrackedEntityInstances'; import { useEnrollment } from './hooks/useEnrollment'; @@ -82,7 +82,7 @@ export const WidgetEnrollment = ({ } return ( - { - const dispatch = useDispatch(); - const { enrollmentId } = useLocationQuery(); - const comments = useSelector(({ enrollmentDomain }) => enrollmentDomain?.enrollment?.notes ?? []); - - const onAddComment = (newCommentValue) => { - dispatch(requestAddNoteForEnrollment(enrollmentId, newCommentValue)); - }; - - return ( -
- -
- ); -}; diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentComment/index.js b/src/core_modules/capture-core/components/WidgetEnrollmentComment/index.js deleted file mode 100644 index 9cf0677908..0000000000 --- a/src/core_modules/capture-core/components/WidgetEnrollmentComment/index.js +++ /dev/null @@ -1 +0,0 @@ -export { WidgetEnrollmentComment } from './WidgetEnrollmentComment.component'; diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/DataEntry/DataEntry.component.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/DataEntry/DataEntry.component.js index d871330dfb..aa4520ca1c 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/DataEntry/DataEntry.component.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/DataEntry/DataEntry.component.js @@ -76,7 +76,7 @@ const getStyles = theme => ({ const dataEntrySectionNames = { BASICINFO: 'BASICINFO', STATUS: 'STATUS', - COMMENTS: 'COMMENTS', + NOTES: 'NOTES', RELATIONSHIPS: 'RELATIONSHIPS', ASSIGNEE: 'ASSIGNEE', }; @@ -229,8 +229,8 @@ const buildGeometrySettingsFn = () => ({ return createComponentProps(props, { width: props && props.formHorizontal ? 150 : 350, - label: 'Coordinate', - dialogLabel: 'Coordinate', + label: i18n.t('Coordinate'), + dialogLabel: i18n.t('Coordinate'), required: false, orientation: getOrientation(props.formHorizontal), shrinkDisabled: props.formHorizontal, @@ -263,16 +263,16 @@ const buildNotesSettingsFn = () => { const notesSettings = { getComponent: () => noteComponent, getComponentProps: (props: Object) => createComponentProps(props, { - label: 'Comments', + label: i18n.t('Notes'), onAddNote: props.onAddNote, - id: 'comments', + id: 'notes', dataEntryId: props.id, }), getPropName: () => 'note', getValidatorContainers: () => getNoteValidatorContainers(), getMeta: () => ({ placement: placements.BOTTOM, - section: dataEntrySectionNames.COMMENTS, + section: dataEntrySectionNames.NOTES, }), }; @@ -403,9 +403,9 @@ const dataEntrySectionDefinitions = { placement: placements.BOTTOM, name: i18n.t('Status'), }, - [dataEntrySectionNames.COMMENTS]: { + [dataEntrySectionNames.NOTES]: { placement: placements.BOTTOM, - name: i18n.t('Comments'), + name: i18n.t('Notes'), }, [dataEntrySectionNames.RELATIONSHIPS]: { placement: placements.BOTTOM, diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/DataEntry/fieldValidators/note.validatorContainersGetter.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/DataEntry/fieldValidators/note.validatorContainersGetter.js index ff5a13c5c7..5688fc26d7 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/DataEntry/fieldValidators/note.validatorContainersGetter.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/DataEntry/fieldValidators/note.validatorContainersGetter.js @@ -7,7 +7,7 @@ export const getNoteValidatorContainers = () => { const validatorContainers = [ { validator: validateNote, - message: i18n.t('Please add or cancel comment before saving the event'), + message: i18n.t('Please add or cancel the note before saving the event'), }, ]; return validatorContainers; diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentComment/WidgetEnrollmentComment.actions.js b/src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.actions.js similarity index 100% rename from src/core_modules/capture-core/components/WidgetEnrollmentComment/WidgetEnrollmentComment.actions.js rename to src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.actions.js diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.component.js b/src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.component.js new file mode 100644 index 0000000000..e7e661e4e6 --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.component.js @@ -0,0 +1,29 @@ +// @flow +import React from 'react'; +import i18n from '@dhis2/d2-i18n'; +import { useDispatch, useSelector } from 'react-redux'; +import { requestAddNoteForEnrollment } from './WidgetEnrollmentNote.actions'; +import { WidgetNote } from '../WidgetNote'; +import { useLocationQuery } from '../../utils/routing'; + +export const WidgetEnrollmentNote = () => { + const dispatch = useDispatch(); + const { enrollmentId } = useLocationQuery(); + const notes = useSelector(({ enrollmentDomain }) => enrollmentDomain?.enrollment?.notes ?? []); + + const onAddNote = (newNoteValue) => { + dispatch(requestAddNoteForEnrollment(enrollmentId, newNoteValue)); + }; + + return ( +
+ +
+ ); +}; diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentComment/WidgetEnrollmentComment.epics.js b/src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.epics.js similarity index 97% rename from src/core_modules/capture-core/components/WidgetEnrollmentComment/WidgetEnrollmentComment.epics.js rename to src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.epics.js index f4812b8dcb..ef60ee39b0 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentComment/WidgetEnrollmentComment.epics.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.epics.js @@ -5,7 +5,7 @@ import { switchMap } from 'rxjs/operators'; import uuid from 'd2-utilizr/lib/uuid'; import moment from 'moment'; import { actionTypes, batchActionTypes, startAddNoteForEnrollment, addEnrollmentNote } - from './WidgetEnrollmentComment.actions'; + from './WidgetEnrollmentNote.actions'; export const addNoteForEnrollmentEpic = (action$: InputObservable, store: ReduxStore, { querySingleResource }: ApiUtils) => action$.pipe( diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentComment/WidgetEnrollmentComment.types.js b/src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.types.js similarity index 100% rename from src/core_modules/capture-core/components/WidgetEnrollmentComment/WidgetEnrollmentComment.types.js rename to src/core_modules/capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.types.js diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentNote/index.js b/src/core_modules/capture-core/components/WidgetEnrollmentNote/index.js new file mode 100644 index 0000000000..2076d9af43 --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetEnrollmentNote/index.js @@ -0,0 +1 @@ +export { WidgetEnrollmentNote } from './WidgetEnrollmentNote.component'; diff --git a/src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.component.js b/src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.component.js deleted file mode 100644 index 3b6981aa0d..0000000000 --- a/src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.component.js +++ /dev/null @@ -1,28 +0,0 @@ -// @flow -import React from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import i18n from '@dhis2/d2-i18n'; -import type { Props } from './WidgetEventComment.types'; -import { requestAddNoteForEvent } from './WidgetEventComment.actions'; -import { WidgetComment } from '../WidgetComment'; - -export const WidgetEventComment = ({ dataEntryKey, dataEntryId }: Props) => { - const dispatch = useDispatch(); - const comments = useSelector(({ dataEntriesNotes }) => dataEntriesNotes[`${dataEntryId}-${dataEntryKey}`] ?? []); - - const onAddComment = (newCommentValue) => { - dispatch(requestAddNoteForEvent(dataEntryKey, dataEntryId, newCommentValue)); - }; - - return ( -
- -
- ); -}; diff --git a/src/core_modules/capture-core/components/WidgetEventComment/index.js b/src/core_modules/capture-core/components/WidgetEventComment/index.js deleted file mode 100644 index 15556e283d..0000000000 --- a/src/core_modules/capture-core/components/WidgetEventComment/index.js +++ /dev/null @@ -1 +0,0 @@ -export { WidgetEventComment } from './WidgetEventComment.component'; diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/note.validatorContainersGetter.js b/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/note.validatorContainersGetter.js index ff5a13c5c7..5688fc26d7 100644 --- a/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/note.validatorContainersGetter.js +++ b/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/note.validatorContainersGetter.js @@ -7,7 +7,7 @@ export const getNoteValidatorContainers = () => { const validatorContainers = [ { validator: validateNote, - message: i18n.t('Please add or cancel comment before saving the event'), + message: i18n.t('Please add or cancel the note before saving the event'), }, ]; return validatorContainers; diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js index 37ceccc12a..550f589dc4 100644 --- a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js +++ b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js @@ -71,7 +71,7 @@ const getStyles = (theme: Theme) => ({ const dataEntrySectionNames = { BASICINFO: 'BASICINFO', STATUS: 'STATUS', - COMMENTS: 'COMMENTS', + NOTES: 'NOTES', }; const baseComponentStyles = { @@ -278,9 +278,9 @@ const dataEntrySectionDefinitions = { placement: placements.BOTTOM, name: i18n.t('Status'), }, - [dataEntrySectionNames.COMMENTS]: { + [dataEntrySectionNames.NOTES]: { placement: placements.BOTTOM, - name: i18n.t('Comments'), + name: i18n.t('Notes'), }, [AOCsectionKey]: { placement: placements.TOP, diff --git a/src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.actions.js b/src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.actions.js similarity index 100% rename from src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.actions.js rename to src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.actions.js diff --git a/src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.component.js b/src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.component.js new file mode 100644 index 0000000000..55c4190e12 --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.component.js @@ -0,0 +1,28 @@ +// @flow +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import i18n from '@dhis2/d2-i18n'; +import type { Props } from './WidgetEventNote.types'; +import { requestAddNoteForEvent } from './WidgetEventNote.actions'; +import { WidgetNote } from '../WidgetNote'; + +export const WidgetEventNote = ({ dataEntryKey, dataEntryId }: Props) => { + const dispatch = useDispatch(); + const notes = useSelector(({ dataEntriesNotes }) => dataEntriesNotes[`${dataEntryId}-${dataEntryKey}`] ?? []); + + const onAddNote = (newNoteValue) => { + dispatch(requestAddNoteForEvent(dataEntryKey, dataEntryId, newNoteValue)); + }; + + return ( +
+ +
+ ); +}; diff --git a/src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.epics.js b/src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.epics.js similarity index 98% rename from src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.epics.js rename to src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.epics.js index eb33cbd46d..1bcd33222e 100644 --- a/src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.epics.js +++ b/src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.epics.js @@ -6,7 +6,7 @@ import uuid from 'd2-utilizr/lib/uuid'; import moment from 'moment'; import { convertValue as convertListValue } from '../../converters/clientToList'; import { dataElementTypes } from '../../metaData'; -import { actionTypes, batchActionTypes, startAddNoteForEvent } from './WidgetEventComment.actions'; +import { actionTypes, batchActionTypes, startAddNoteForEvent } from './WidgetEventNote.actions'; import { addEventNote, diff --git a/src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.types.js b/src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.types.js similarity index 100% rename from src/core_modules/capture-core/components/WidgetEventComment/WidgetEventComment.types.js rename to src/core_modules/capture-core/components/WidgetEventNote/WidgetEventNote.types.js diff --git a/src/core_modules/capture-core/components/WidgetEventNote/index.js b/src/core_modules/capture-core/components/WidgetEventNote/index.js new file mode 100644 index 0000000000..47ae18dfcd --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetEventNote/index.js @@ -0,0 +1 @@ +export { WidgetEventNote } from './WidgetEventNote.component'; diff --git a/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.actions.js b/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.actions.js index cf7b02e10d..16835afb2e 100644 --- a/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.actions.js +++ b/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.actions.js @@ -10,7 +10,7 @@ export const scheduleEventWidgetActionTypes = { export const requestScheduleEvent = ({ scheduleDate, - comments, + notes, programId, orgUnitId, stageId, @@ -24,7 +24,7 @@ export const requestScheduleEvent = ({ assignedUser, }: { scheduleDate: string, - comments: Array<{value: string}>, + notes: Array<{value: string}>, programId: string, orgUnitId: string, stageId: string, @@ -39,7 +39,7 @@ export const requestScheduleEvent = ({ }) => actionCreator(scheduleEventWidgetActionTypes.EVENT_SCHEDULE_REQUEST)({ scheduleDate, - comments, + notes, programId, orgUnitId, stageId, diff --git a/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.component.js b/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.component.js index ca2a1f7fbb..5a9a05bf2e 100644 --- a/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.component.js +++ b/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.component.js @@ -7,7 +7,7 @@ import { DataSection } from '../DataSection'; import { ScheduleButtons } from './ScheduleButtons'; import { ScheduleDate } from './ScheduleDate'; import { ScheduleText } from './ScheduleText'; -import { CommentSection } from '../WidgetComment'; +import { NoteSection } from '../WidgetNote'; import type { Props } from './widgetEventSchedule.types'; import { CategoryOptions } from './CategoryOptions/CategoryOptions.component'; import { Assignee } from './Assignee'; @@ -60,11 +60,11 @@ const WidgetEventSchedulePlain = ({ orgUnit, onCancel, onSchedule, - onAddComment, + onAddNote, classes, scheduleDate, suggestedScheduleDate, - comments, + notes, programCategory, enableUserAssignment, selectedCategories, @@ -113,13 +113,13 @@ const WidgetEventSchedulePlain = ({ /> } - {enableUserAssignment && ( diff --git a/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.container.js b/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.container.js index 27cf5bc8b2..24bfdc0016 100644 --- a/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.container.js +++ b/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.container.js @@ -13,7 +13,7 @@ import { useDetermineSuggestedScheduleDate, useEventsInOrgUnit, useScheduleConfigFromProgram, - useCommentDetails, + useNoteDetails, } from './hooks'; import { requestScheduleEvent } from './WidgetEventSchedule.actions'; import { NoAccess } from './AccessVerification'; @@ -43,9 +43,9 @@ export const WidgetEventSchedule = ({ const suggestedScheduleDate = useDetermineSuggestedScheduleDate({ programStageScheduleConfig, programConfig, initialScheduleDate, ...passOnProps, }); - const { currentUser, noteId } = useCommentDetails(); + const { currentUser, noteId } = useNoteDetails(); const [scheduleDate, setScheduleDate] = useState(''); - const [comments, setComments] = useState([]); + const [notes, setNotes] = useState([]); const [assignee, setAssignee] = useState(storedAssignee); const { events } = useEventsInOrgUnit(orgUnitId, scheduleDate); const { eventId } = useLocationQuery(); @@ -77,7 +77,7 @@ export const WidgetEventSchedule = ({ } dispatch(requestScheduleEvent({ scheduleDate, - comments, + notes, programId, orgUnitId, stageId, @@ -94,7 +94,7 @@ export const WidgetEventSchedule = ({ }, [ dispatch, scheduleDate, - comments, + notes, programId, orgUnitId, stageId, @@ -116,18 +116,18 @@ export const WidgetEventSchedule = ({ }, [scheduleDate, suggestedScheduleDate]); - const onAddComment = (comment) => { - const newComment = { + const onAddNote = (note) => { + const newNote = { storedBy: currentUser.userName, storedAt: moment().toISOString(), - value: comment, + value: note, createdBy: { firstName: currentUser.firstName, surname: currentUser.surname, }, note: noteId, }; - setComments([...comments, newComment]); + setNotes([...notes, newNote]); }; const onSetAssignee = useCallback(user => setAssignee(user), []); @@ -184,10 +184,10 @@ export const WidgetEventSchedule = ({ onCancel={onCancel} setScheduleDate={setScheduleDate} onSchedule={onHandleSchedule} - onAddComment={onAddComment} + onAddNote={onAddNote} eventCountInOrgUnit={eventCountInOrgUnit} orgUnit={orgUnit} - comments={comments} + notes={notes} selectedCategories={selectedCategories} categoryOptionsError={categoryOptionsError} onClickCategoryOption={onClickCategoryOption} diff --git a/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.epics.js b/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.epics.js index 188d107102..2f14686335 100644 --- a/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.epics.js +++ b/src/core_modules/capture-core/components/WidgetEventSchedule/WidgetEventSchedule.epics.js @@ -18,7 +18,7 @@ export const scheduleEnrollmentEventEpic = (action$: InputObservable, store: Red const uid = uuid(); const { scheduleDate, - comments, + notes, programId, orgUnitId, stageId, @@ -47,7 +47,7 @@ export const scheduleEnrollmentEventEpic = (action$: InputObservable, store: Red program: programId, programStage: stageId, status: 'SCHEDULE', - notes: comments ?? [], + notes: notes ?? [], assignedUser, }] }; diff --git a/src/core_modules/capture-core/components/WidgetEventSchedule/hooks/index.js b/src/core_modules/capture-core/components/WidgetEventSchedule/hooks/index.js index 4682262564..b41c3de724 100644 --- a/src/core_modules/capture-core/components/WidgetEventSchedule/hooks/index.js +++ b/src/core_modules/capture-core/components/WidgetEventSchedule/hooks/index.js @@ -2,12 +2,12 @@ import { useDetermineSuggestedScheduleDate } from './useDetermineSuggestedSchedu import { useEventsInOrgUnit } from './useEventsInOrgUnit'; import { useScheduleConfigFromProgram } from './useScheduleConfigFromProgram'; import { useScheduleConfigFromProgramStage } from './useScheduleConfigFromProgramStage'; -import { useCommentDetails } from './useCommentDetails'; +import { useNoteDetails } from './useNoteDetails'; export { useDetermineSuggestedScheduleDate, useEventsInOrgUnit, useScheduleConfigFromProgram, useScheduleConfigFromProgramStage, - useCommentDetails, + useNoteDetails, }; diff --git a/src/core_modules/capture-core/components/WidgetEventSchedule/hooks/useCommentDetails.js b/src/core_modules/capture-core/components/WidgetEventSchedule/hooks/useNoteDetails.js similarity index 92% rename from src/core_modules/capture-core/components/WidgetEventSchedule/hooks/useCommentDetails.js rename to src/core_modules/capture-core/components/WidgetEventSchedule/hooks/useNoteDetails.js index 4544faf9af..da2225e5bc 100644 --- a/src/core_modules/capture-core/components/WidgetEventSchedule/hooks/useCommentDetails.js +++ b/src/core_modules/capture-core/components/WidgetEventSchedule/hooks/useNoteDetails.js @@ -3,7 +3,7 @@ import { useMemo } from 'react'; import { useDataQuery } from '@dhis2/app-runtime'; import { generateUID } from '../../../utils/uid/generateUID'; -export const useCommentDetails = () => { +export const useNoteDetails = () => { const { data, error, loading } = useDataQuery(useMemo(() => ({ currentUser: { resource: 'me', diff --git a/src/core_modules/capture-core/components/WidgetEventSchedule/widgetEventSchedule.types.js b/src/core_modules/capture-core/components/WidgetEventSchedule/widgetEventSchedule.types.js index 39b5789226..b1fb963a88 100644 --- a/src/core_modules/capture-core/components/WidgetEventSchedule/widgetEventSchedule.types.js +++ b/src/core_modules/capture-core/components/WidgetEventSchedule/widgetEventSchedule.types.js @@ -36,7 +36,7 @@ export type Props = {| scheduleDate?: ?string, suggestedScheduleDate?: ?string, eventCountInOrgUnit: number, - comments: Array<{value: string}>, + notes: Array<{value: string}>, hideDueDate?: boolean, selectedCategories?: ?{ [categoryId: string]: CategoryOption }, programCategory?: ProgramCategory, @@ -47,7 +47,7 @@ export type Props = {| assignee?: UserFormField | null, onCancel: () => void, setScheduleDate: (date: string) => void, - onAddComment: (comment: string) => void, + onAddNote: (note: string) => void, onResetCategoryOption: (categoryId: string) => void, onClickCategoryOption: (optionId: string, categoryId: string) => void, ...CssClasses diff --git a/src/core_modules/capture-core/components/WidgetComment/CommentSection/CommentSection.js b/src/core_modules/capture-core/components/WidgetNote/NoteSection/NoteSection.js similarity index 68% rename from src/core_modules/capture-core/components/WidgetComment/CommentSection/CommentSection.js rename to src/core_modules/capture-core/components/WidgetNote/NoteSection/NoteSection.js index 1e7a26525d..2c182d0e74 100644 --- a/src/core_modules/capture-core/components/WidgetComment/CommentSection/CommentSection.js +++ b/src/core_modules/capture-core/components/WidgetNote/NoteSection/NoteSection.js @@ -12,10 +12,10 @@ import { TextField } from '../../FormFields/New'; const FocusTextField = withFocusSaver()(TextField); type Props = { - comments: Array, - handleAddComment: (text: string) => void, + notes: Array, + handleAddNote: (text: string) => void, placeholder: string, - emptyCommentMessage: string, + emptyNoteMessage: string, ...CssClasses } @@ -37,14 +37,14 @@ const styles = { padding: `0 ${spacersNum.dp16}px`, marginBottom: spacersNum.dp16, }, - commentsWrapper: { + notesWrapper: { maxHeight: 400, overflowY: 'auto', }, editor: { paddingTop: spacersNum.dp16, }, - emptyComments: { + emptyNotes: { fontSize: 14, color: colors.grey600, }, @@ -62,41 +62,41 @@ const styles = { margin: `${spacersNum.dp8}px 0 0 0`, }, }, - newCommentButtonContainer: { + newNoteButtonContainer: { paddingTop: spacersNum.dp4, display: 'flex', gap: '4px', }, }; -const CommentSectionPlain = ({ +const NoteSectionPlain = ({ placeholder, - emptyCommentMessage, - comments, - handleAddComment, + emptyNoteMessage, + notes, + handleAddNote, classes, }: Props) => { const [isEditing, setEditing] = useState(false); - const [newCommentValue, setNewCommentValue] = useState(''); + const [newNoteValue, setNewNoteValue] = useState(''); const handleChange = useCallback((value) => { setEditing(true); - setNewCommentValue(value); + setNewNoteValue(value); }, []); const onCancel = useCallback(() => { - setNewCommentValue(''); + setNewNoteValue(''); setEditing(false); }, []); - const onAddComment = useCallback(() => { - handleAddComment(newCommentValue); - setNewCommentValue(''); + const onAddNote = useCallback(() => { + handleAddNote(newNoteValue); + setNewNoteValue(''); setEditing(false); - }, [handleAddComment, newCommentValue]); + }, [handleAddNote, newNoteValue]); - const CommentItem = ({ value, storedAt, createdBy }) => ( -
+ const NoteItem = ({ value, storedAt, createdBy }) => ( +
{/* TODO: add avatar */}
@@ -117,14 +117,14 @@ const CommentSectionPlain = ({ return (
-
- {comments +
+ {notes .sort((a, b) => moment(a.storedAt).valueOf() - moment(b.storedAt).valueOf()) - .map(comment => ) + .map(note => ) } - {comments.length === 0 && -
- {emptyCommentMessage} + {notes.length === 0 && +
+ {emptyNoteMessage}
}
@@ -133,22 +133,22 @@ const CommentSectionPlain = ({
- {isEditing &&
+ {isEditing &&
); }; -export const CommentSection: ComponentType = withStyles(styles)(CommentSectionPlain); +export const NoteSection: ComponentType = withStyles(styles)(NoteSectionPlain); diff --git a/src/core_modules/capture-core/components/WidgetComment/WidgetComment.component.js b/src/core_modules/capture-core/components/WidgetNote/WidgetNote.component.js similarity index 59% rename from src/core_modules/capture-core/components/WidgetComment/WidgetComment.component.js rename to src/core_modules/capture-core/components/WidgetNote/WidgetNote.component.js index 9f6d154cb7..37300b12ad 100644 --- a/src/core_modules/capture-core/components/WidgetComment/WidgetComment.component.js +++ b/src/core_modules/capture-core/components/WidgetNote/WidgetNote.component.js @@ -2,27 +2,27 @@ import React, { useState, useCallback } from 'react'; import { Chip } from '@dhis2/ui'; import { Widget } from '../Widget'; -import type { Props } from './WidgetComment.types'; -import { CommentSection } from './CommentSection/CommentSection'; +import type { Props } from './WidgetNote.types'; +import { NoteSection } from './NoteSection/NoteSection'; -export const WidgetComment = ({ title, comments, onAddComment, ...passOnProps }: Props) => { +export const WidgetNote = ({ title, notes, onAddNote, ...passOnProps }: Props) => { const [open, setOpenStatus] = useState(true); return ( {title} - {comments.length ? - {comments.length} + {notes.length ? + {notes.length} : null}
} onOpen={useCallback(() => setOpenStatus(true), [setOpenStatus])} onClose={useCallback(() => setOpenStatus(false), [setOpenStatus])} open={open} > - diff --git a/src/core_modules/capture-core/components/WidgetNote/WidgetNote.types.js b/src/core_modules/capture-core/components/WidgetNote/WidgetNote.types.js new file mode 100644 index 0000000000..d005a1b4aa --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetNote/WidgetNote.types.js @@ -0,0 +1,10 @@ +// @flow + +export type Props = {| + title: string, + placeholder: string, + emptyNoteMessage: string, + notes: Array, + onAddNote: (note: string) => void, + ...CssClasses +|}; diff --git a/src/core_modules/capture-core/components/WidgetNote/index.js b/src/core_modules/capture-core/components/WidgetNote/index.js new file mode 100644 index 0000000000..439a9f9241 --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetNote/index.js @@ -0,0 +1,2 @@ +export { NoteSection } from './NoteSection/NoteSection'; +export { WidgetNote } from './WidgetNote.component'; diff --git a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/Comments.component.js b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/Notes.component.js similarity index 57% rename from src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/Comments.component.js rename to src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/Notes.component.js index 1a3df1963f..f1f8a7dc33 100644 --- a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/Comments.component.js +++ b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/Notes.component.js @@ -17,15 +17,15 @@ const styles = { paddingLeft: '2px', }, }; -export const CommentsPlain = ({ event, classes }: Props) => { - const commentsCount = event.notes?.length; +export const NotesPlain = ({ event, classes }: Props) => { + const notesCount = event.notes?.length; return ( - commentsCount ?
+ notesCount ?
- {commentsCount} + {notesCount}
: null ); }; -export const Comments: ComponentType<$Diff> = withStyles(styles)(CommentsPlain); +export const Notes: ComponentType<$Diff> = withStyles(styles)(NotesPlain); diff --git a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js index 183799e1df..d4f2d6b2a6 100644 --- a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js +++ b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js @@ -5,7 +5,7 @@ import { statusTypes, translatedStatusTypes } from 'capture-core/events/statusTy import { convertMomentToDateFormatString } from '../../../../../../utils/converters/date'; import { getSubValues } from '../../getEventDataWithSubValue'; import type { StageDataElement } from '../../../../types/common.types'; -import { Comments } from '../Comments.component'; +import { Notes } from '../Notes.component'; import type { QuerySingleResource } from '../../../../../../utils/api/api.types'; import { isEventOverdue } from '../../../../../../utils/isEventOverdue'; import { getCachedOrgUnitName } from '../../../../../../metadataRetrieval/orgUnitName'; @@ -60,7 +60,7 @@ const convertStatusForView = (event: ApiEnrollmentEvent) => { const convertOrgUnitForView = (event: ApiEnrollmentEvent) => getCachedOrgUnitName(event.orgUnit); -const convertCommentForView = (event: ApiEnrollmentEvent) => ; +const convertNoteForView = (event: ApiEnrollmentEvent) => ; const groupRecordsByType = async ( events: Array, @@ -96,7 +96,7 @@ export { getEventStatus, convertStatusForView, convertOrgUnitForView, - convertCommentForView, + convertNoteForView, getValueByKeyFromEvent, groupRecordsByType, }; diff --git a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/useEventList.js b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/useEventList.js index 95b2fe1093..2199216154 100644 --- a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/useEventList.js +++ b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/useEventList.js @@ -12,7 +12,7 @@ import { convertValue as convertServerToClient } from '../../../../../../convert import { convertStatusForView, convertOrgUnitForView, - convertCommentForView, + convertNoteForView, getValueByKeyFromEvent, groupRecordsByType, } from './helpers'; @@ -22,14 +22,14 @@ import { } from '../../../../../../metaDataMemoryStoreBuilders/common/helpers/dataElement/unsupportedMultiText'; import { useOrgUnitNames } from '../../../../../../metadataRetrieval/orgUnitName'; -const baseKeys = [{ id: 'status' }, { id: 'occurredAt' }, { id: 'assignedUser' }, { id: 'orgUnitName' }, { id: 'scheduledAt' }, { id: 'comments' }]; +const baseKeys = [{ id: 'status' }, { id: 'occurredAt' }, { id: 'assignedUser' }, { id: 'orgUnitName' }, { id: 'scheduledAt' }, { id: 'notes' }]; const basedFieldTypes = [ { type: dataElementTypes.STATUS, resolveValue: convertStatusForView }, { type: dataElementTypes.DATE }, { type: 'ASSIGNEE' }, { type: dataElementTypes.TEXT, resolveValue: convertOrgUnitForView }, { type: dataElementTypes.DATE }, - { type: dataElementTypes.UNKNOWN, resolveValue: convertCommentForView }, + { type: dataElementTypes.UNKNOWN, resolveValue: convertNoteForView }, ]; const getBaseColumnHeaders = props => [ { header: i18n.t('Status'), sortDirection: SORT_DIRECTION.DEFAULT, isPredefined: true }, diff --git a/src/core_modules/capture-core/components/WidgetsRelationship/WidgetTrackedEntityRelationship/NewTrackedEntityRelationship/Breadcrumbs/Breadcrumbs.component.js b/src/core_modules/capture-core/components/WidgetsRelationship/WidgetTrackedEntityRelationship/NewTrackedEntityRelationship/Breadcrumbs/Breadcrumbs.component.js index 5d1a015b11..2306255a57 100644 --- a/src/core_modules/capture-core/components/WidgetsRelationship/WidgetTrackedEntityRelationship/NewTrackedEntityRelationship/Breadcrumbs/Breadcrumbs.component.js +++ b/src/core_modules/capture-core/components/WidgetsRelationship/WidgetTrackedEntityRelationship/NewTrackedEntityRelationship/Breadcrumbs/Breadcrumbs.component.js @@ -17,7 +17,7 @@ const Slash = withStyles({ slash: { padding: 5 } })(({ classes }) => { const initialText = i18n.t('New {{trackedEntityTypeName}} relationship', { - trackedEntityTypeName: trackedEntityTypeName?.toLowerCase(), + trackedEntityTypeName: trackedEntityTypeName && trackedEntityTypeName.toLowerCase(), }); return (currentStep.value > NEW_TRACKED_ENTITY_RELATIONSHIP_WIZARD_STEPS.SELECT_LINKED_ENTITY_METADATA.value ? {initialText} : diff --git a/src/core_modules/capture-core/reducers/descriptions/enrollmentDomain.reducerDescription.js b/src/core_modules/capture-core/reducers/descriptions/enrollmentDomain.reducerDescription.js index 97964a6457..2eecc8429a 100644 --- a/src/core_modules/capture-core/reducers/descriptions/enrollmentDomain.reducerDescription.js +++ b/src/core_modules/capture-core/reducers/descriptions/enrollmentDomain.reducerDescription.js @@ -2,7 +2,7 @@ import { createReducerDescription } from '../../trackerRedux'; import { enrollmentSiteActionTypes } from '../../components/Pages/common/EnrollmentOverviewDomain'; import { actionTypes as enrollmentNoteActionTypes } - from '../../components/WidgetEnrollmentComment/WidgetEnrollmentComment.actions'; + from '../../components/WidgetEnrollmentNote/WidgetEnrollmentNote.actions'; import { actionTypes as editEventActionTypes } from '../../components/WidgetEventEdit/EditEventDataEntry/editEventDataEntry.actions'; import { newEventWidgetActionTypes } from '../../components/WidgetEnrollmentEventNew/Validated/validated.actions'; import { enrollmentEditEventActionTypes } from '../../components/Pages/EnrollmentEditEvent'; diff --git a/src/epics/trackerCapture.epics.js b/src/epics/trackerCapture.epics.js index 497d54d936..f0bdf3bc7e 100644 --- a/src/epics/trackerCapture.epics.js +++ b/src/epics/trackerCapture.epics.js @@ -72,7 +72,7 @@ import { import { addNoteForEventEpic, removeNoteForEventEpic, -} from 'capture-core/components/WidgetEventComment/WidgetEventComment.epics'; +} from 'capture-core/components/WidgetEventNote/WidgetEventNote.epics'; import { goingOnlineEpic, } from 'capture-core/components/Connectivity/connectivity.epics'; @@ -134,7 +134,7 @@ import { saveNoteForViewEventFailedEpic, } from 'capture-core/components/Pages/ViewEvent/Notes/viewEventNotes.epics'; -import { addNoteForEnrollmentEpic } from 'capture-core/components/WidgetEnrollmentComment/WidgetEnrollmentComment.epics'; +import { addNoteForEnrollmentEpic } from 'capture-core/components/WidgetEnrollmentNote/WidgetEnrollmentNote.epics'; import { openNewRelationshipRegisterTeiEpic, loadSearchGroupDuplicatesForReviewEpic,