-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
290bd57
commit 03170ab
Showing
38 changed files
with
460 additions
and
326 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
cypress/integration/WidgetsForEnrollmentPages/WidgetAssignee/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
When('you assign the user Geetha in the view mode', () => { | ||
cy.get('[data-test="widget-assignee"]').within(() => { | ||
cy.get('[data-test="widget-assignee-edit"]').click(); | ||
cy.get('[data-test="capture-ui-input"]').type('Geetha'); | ||
cy.contains('Geetha Alwan').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="capture-ui-input"]').type('Tracker demo'); | ||
cy.contains('Tracker demo User').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'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/core_modules/capture-core/components/FormFields/UserField/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
// @flow | ||
export { UserField } from './UserField.component'; | ||
export { UserSearch } from './UserSearch.component'; | ||
export type { User as UserFormField } from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/hooks/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
// @flow | ||
export { useEvent } from './useEvent'; | ||
export { useAssignee, useAssignedUserSaveContext } from './useAssignedUserSaveContext'; |
27 changes: 27 additions & 0 deletions
27
...les/capture-core/components/Pages/EnrollmentEditEvent/hooks/useAssignedUserSaveContext.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @flow | ||
import { useCallback, useMemo } from 'react'; | ||
import { convertServerToClient, convertClientToServer } from '../../../WidgetAssignee'; | ||
import type { EnrollmentData } from '../../common/EnrollmentOverviewDomain/useCommonEnrollmentDomainData'; | ||
import type { UserFormField } from '../../../FormFields/UserField'; | ||
|
||
export const useAssignee = (event?: ApiEnrollmentEvent) => | ||
useMemo(() => convertServerToClient(event?.assignedUser), [event?.assignedUser]); | ||
|
||
export const useAssignedUserSaveContext = ( | ||
enrollmentSite?: EnrollmentData, | ||
event?: ApiEnrollmentEvent, | ||
eventId: string, | ||
) => | ||
useCallback( | ||
(newAssignee: UserFormField) => ({ | ||
eventId, | ||
assignedUser: event?.assignedUser, | ||
events: enrollmentSite?.events | ||
// $FlowFixMe[missing-annot] | ||
? enrollmentSite.events.map(e => ( | ||
e.event === eventId ? { ...e, assignedUser: convertClientToServer(newAssignee) } : e | ||
)) | ||
: [], | ||
}), | ||
[enrollmentSite?.events, event?.assignedUser, eventId], | ||
); |
52 changes: 0 additions & 52 deletions
52
...-core/components/Pages/ViewEvent/RightColumn/AssigneeSection/AssigneeSection.component.js
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...-core/components/Pages/ViewEvent/RightColumn/AssigneeSection/AssigneeSection.container.js
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
...capture-core/components/Pages/ViewEvent/RightColumn/AssigneeSection/Contents.component.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.