-
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.
feat: [DHIS2-15483] assign an user when scheduling an enrollment event (
- Loading branch information
1 parent
9230e3a
commit 556884f
Showing
19 changed files
with
152 additions
and
8 deletions.
There are no files selected for viewing
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
12 changes: 12 additions & 0 deletions
12
cypress/e2e/WidgetsForEnrollmentPages/WidgetsForEnrollmentAddEventPage/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,4 +1,16 @@ | ||
import { Then } from '@badeball/cypress-cucumber-preprocessor'; | ||
import '../sharedSteps'; | ||
import '../WidgetEnrollment'; | ||
import '../WidgetProfile'; | ||
import '../WidgetTab'; | ||
|
||
Then('you can assign a user when scheduling the event', () => { | ||
cy.get('[data-test="assignee-section"]').within(() => { | ||
cy.get('[data-test="capture-ui-input"]').click(); | ||
cy.get('[data-test="capture-ui-input"]').type('Tracker demo'); | ||
cy.contains('Tracker demo User').click(); | ||
}); | ||
cy.get('[data-test="assignee-section"]').within(() => { | ||
cy.get('[data-test="dhis2-uicore-chip"]').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
1 change: 1 addition & 0 deletions
1
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,3 @@ | ||
// @flow | ||
export { UserField } from './UserField.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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ export type User = { | |
id: string, | ||
username: string, | ||
name: string, | ||
firstName: string, | ||
surname: string, | ||
}; |
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
38 changes: 38 additions & 0 deletions
38
src/core_modules/capture-core/components/WidgetEventSchedule/Assignee/Assignee.component.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,38 @@ | ||
// @flow | ||
import React from 'react'; | ||
import i18n from '@dhis2/d2-i18n'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import { UserField } from '../../FormFields/UserField/UserField.component'; | ||
import type { Props } from './Assignee.types'; | ||
|
||
const getStyles = () => ({ | ||
container: { | ||
display: 'flex', | ||
alignItems: 'baseline', | ||
padding: '8px 8px 8px 12px', | ||
}, | ||
label: { | ||
fontSize: 14, | ||
flexBasis: 200, | ||
color: '#212934', | ||
}, | ||
field: { | ||
flexBasis: 150, | ||
flexGrow: 1, | ||
}, | ||
}); | ||
|
||
const AssigneePlain = (props: Props) => { | ||
const { classes, assignee, ...passOnProps } = props; | ||
return ( | ||
<div className={classes.container}> | ||
<div className={classes.label}>{i18n.t('Assignee')}</div> | ||
<div className={classes.field}> | ||
{/* $FlowFixMe[cannot-spread-inexact] automated comment */} | ||
<UserField inputPlaceholderText={i18n.t('Search for user')} value={assignee} {...passOnProps} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export const Assignee = withStyles(getStyles)(AssigneePlain); |
7 changes: 7 additions & 0 deletions
7
src/core_modules/capture-core/components/WidgetEventSchedule/Assignee/Assignee.types.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,7 @@ | ||
// @flow | ||
import type { UserFormField } from '../../FormFields/UserField'; | ||
|
||
export type Props = { | ||
...CssClasses, | ||
assignee?: UserFormField, | ||
}; |
2 changes: 2 additions & 0 deletions
2
src/core_modules/capture-core/components/WidgetEventSchedule/Assignee/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,2 @@ | ||
// @flow | ||
export { Assignee } from './Assignee.component'; |
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
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
Oops, something went wrong.