Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [DHIS2-15480] widget assignee #3412

Merged
merged 29 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
03170ab
feat: widget assignee
simonadomnisoru Sep 13, 2023
fa263d7
Merge branch 'master' into DHIS2-15480
simonadomnisoru Sep 13, 2023
0282008
chore: improve displaymodel types
simonadomnisoru Oct 11, 2023
0170414
Merge branch 'master' into DHIS2-15480
simonadomnisoru Oct 11, 2023
4cf93f5
feat: remove redux and use app runtime hooks and callbacks
simonadomnisoru Nov 1, 2023
929c7e7
Merge branch 'master' into DHIS2-15480
simonadomnisoru Nov 1, 2023
e0d91ad
chore: split enrollment event page
simonadomnisoru Nov 1, 2023
fdf9f23
Merge branch 'master' into DHIS2-15480
simonadomnisoru Nov 1, 2023
af609d0
chore: improve converters
simonadomnisoru Nov 3, 2023
fac65a1
chore: simplify widget assignee props
simonadomnisoru Nov 14, 2023
fd3974e
chore: disable action buttons in the read-only mode
simonadomnisoru Nov 14, 2023
52ae166
feat: add delete assigned user functionality
simonadomnisoru Nov 15, 2023
f353687
Merge branch 'master' into DHIS2-15480
simonadomnisoru Nov 15, 2023
95453dd
chore: clean trackedEntityInstance
simonadomnisoru Dec 4, 2023
feb615a
Merge branch 'master' into DHIS2-15480
simonadomnisoru Dec 4, 2023
7a5ffe3
chore: clean trackedEntityInstance from payload
simonadomnisoru Dec 4, 2023
667b1cb
fix: hide assignee in form when rescheaduling an event
simonadomnisoru Dec 4, 2023
97588ac
Merge branch 'master' into DHIS2-15480
simonadomnisoru Jan 8, 2024
6ee56dd
Merge branch 'master' into DHIS2-15480
simonadomnisoru Jan 22, 2024
6aac3b8
chore: remove on prefix
simonadomnisoru Jan 22, 2024
2bcd8e3
feat: use UserAvatar component
simonadomnisoru Jan 22, 2024
3bd6cd0
chore: remove eventIdSelector
simonadomnisoru Jan 22, 2024
da212bc
feat: get the user avatar id with react query
simonadomnisoru Jan 23, 2024
c96bac8
fix: wait for the user avatar to load
simonadomnisoru Jan 23, 2024
27d4ce2
chore: apply mockup css properties
simonadomnisoru Jan 23, 2024
1290bfc
Merge branch 'master' into DHIS2-15480
simonadomnisoru Jan 23, 2024
8529d35
test: fix 2.38 cypress failures
simonadomnisoru Jan 23, 2024
c272d46
test: scenario for removing the assigned user
simonadomnisoru Jan 23, 2024
094b32e
fix: fallback to firstname and surname
simonadomnisoru Jan 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions cypress/e2e/WidgetsForEnrollmentPages/WidgetAssignee/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { When, Then } from '@badeball/cypress-cucumber-preprocessor';

When('you assign the user Geetha in the view mode', () => {
cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-assignee-assign"]').click();
cy.get('[data-test="capture-ui-input"]').type('Geetha');
cy.contains('Geetha Alwan').click();
cy.get('[data-test="widget-assignee-save"]').click();
});
});

When('you assign the user Tracker demo User in the edit mode', () => {
cy
.get('[data-test="widget-enrollment-event"]')
.find('[data-test="dhis2-uicore-button"]')
.eq(1)
.click();

cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-assignee-edit"]').click();
cy.get('[data-test="dhis2-uicore-chip-remove"]').click();
cy.get('[data-test="capture-ui-input"]').type('Tracker demo');
cy.contains('Tracker demo User').click();
cy.get('[data-test="widget-assignee-save"]').click();
});
});

When('you remove the assigned user', () => {
cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-assignee-edit"]').click();
cy.get('[data-test="dhis2-uicore-chip-remove"]').click();
cy.get('[data-test="widget-assignee-save"]').click();
});
});

Then('the event has the user Geetha Alwan assigned', () => {
cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-contents"]').contains('Geetha Alwan').should('exist');
});
});

Then('the event has the user Tracker demo User assigned', () => {
cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-contents"]').contains('Tracker demo User').should('exist');
});
});

Then('the event has no assignd user', () => {
cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-contents"]').contains('No one is assigned to this event').should('exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,13 @@ 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 comment: new test comment

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
When you assign the user Geetha in the view mode
Then the event has the user Geetha Alwan assigned
When you assign the user Tracker demo User in the edit mode
Then the event has the user Tracker demo User assigned
When you remove the assigned user
Then the event has no assignd user
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ import '../sharedSteps';
import '../WidgetEnrollment';
import '../WidgetProfile';
import '../WidgetEventComment';
import '../WidgetAssignee';

52 changes: 29 additions & 23 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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-01-05T14:09:35.742Z\n"
"PO-Revision-Date: 2024-01-05T14:09:35.742Z\n"
"POT-Creation-Date: 2024-01-22T13:52:51.172Z\n"
"PO-Revision-Date: 2024-01-22T13:52:51.172Z\n"

msgid "Choose one or more dates..."
msgstr "Choose one or more dates..."
Expand Down Expand Up @@ -802,18 +802,18 @@ msgstr "Program Stages could not be loaded"
msgid "Stage"
msgstr "Stage"

msgid "Enrollment{{escape}} View Event"
msgstr "Enrollment{{escape}} View Event"

msgid "Enrollment{{escape}} Edit Event"
msgstr "Enrollment{{escape}} Edit Event"

msgid "The enrollment event data could not be found"
msgstr "The enrollment event data could not be found"

msgid "There are no feedback for this event"
msgstr "There are no feedback for this event"

msgid "Enrollment{{escape}} View Event"
msgstr "Enrollment{{escape}} View Event"

msgid "Enrollment{{escape}} Edit Event"
msgstr "Enrollment{{escape}} Edit Event"

msgid "Registered events"
msgstr "Registered events"

Expand Down Expand Up @@ -926,15 +926,6 @@ msgstr ""
"Leaving this page will discard any selections you made for a new "
"relationship"

msgid "No one is assigned to this event"
msgstr "No one is assigned to this event"

msgid "Assign"
msgstr "Assign"

msgid "Event assigned to {{name}}"
msgstr "Event assigned to {{name}}"

msgid "Feedbacks"
msgstr "Feedbacks"

Expand Down Expand Up @@ -1107,6 +1098,24 @@ msgstr "To work with the selected program,"
msgid "open the Tracker Capture app"
msgstr "open the Tracker Capture app"

msgid "Assigned to"
msgstr "Assigned to"

msgid "You don't have access to edit this assignee"
msgstr "You don't have access to edit this assignee"

msgid "Edit"
msgstr "Edit"

msgid "No one is assigned to this event"
msgstr "No one is assigned to this event"

msgid "You don't have access to assign an assignee"
msgstr "You don't have access to assign an assignee"

msgid "Assign"
msgstr "Assign"

msgid "This program is protected"
msgstr "This program is protected"

Expand Down Expand Up @@ -1182,9 +1191,6 @@ msgstr "Latitude"
msgid "Longitude"
msgstr "Longitude"

msgid "Edit"
msgstr "Edit"

msgid "Set coordinates"
msgstr "Set coordinates"

Expand Down Expand Up @@ -1380,9 +1386,6 @@ msgstr "This stage can only have one event"
msgid "Events could not be retrieved. Please try again later."
msgstr "Events could not be retrieved. Please try again later."

msgid "Assigned to"
msgstr "Assigned to"

msgid "{{ totalEvents }} events"
msgstr "{{ totalEvents }} events"

Expand Down Expand Up @@ -1578,6 +1581,9 @@ msgstr "Error deleting the enrollment event"
msgid "Error editing the event, the changes made were not saved"
msgstr "Error editing the event, the changes made were not saved"

msgid "Error updating the Assignee"
msgstr "Error updating the Assignee"

msgid "Set coordinate"
msgstr "Set coordinate"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const getAddEventEnrollmentServerData = (state: ReduxState,
program: programId,
programStage: formFoundation.id,
orgUnit: orgUnitId,
trackedEntityInstance: teiId,
trackedEntity: teiId,
enrollment: enrollmentId,
...getApiCategoriesArgument(state.currentSelections.categories),
dataValues: Object
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
export { UserField } from './UserField.component';
export { UserSearch } from './UserSearch.component';
export type { User as UserFormField } from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const NewEventWorkspacePlain = ({
onSave={onSave}
onCancel={onCancel}
hideDueDate={stage?.hideDueDate}
enableUserAssignment
/>}
</div>
</Widget>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @flow

import { actionCreator } from '../../../actions/actions.utils';
import type { UserFormField } from '../../FormFields/UserField';

export const actionTypes = {
ASSIGNEE_SET: 'EnrollmentDomain.AssigneeSet',
ASSIGNEE_SAVE_FAILED: 'EnrollmentDomain.AssigneeSaveFailed',
};

export const setAssignee = (assignedUser?: ApiAssignedUser, assignee: UserFormField | null, eventId: string) =>
actionCreator(actionTypes.ASSIGNEE_SET)({ assignedUser, assignee, eventId });

export const rollbackAssignee = (assignedUser?: ApiAssignedUser, assignee: UserFormField | null, eventId: string) =>
actionCreator(actionTypes.ASSIGNEE_SAVE_FAILED)({ assignedUser, assignee, eventId });
Loading
Loading